Thursday, December 24, 2009

2 feet of Global Warming

Single-stage Simplicity snow thrower in use on...Image via Wikipedia

With the record snowfall of 2 feet here in the Washington D.C. area I have developed my plan to help fight global warming and stimulate the economy. I am going to buy a snow blower before that big snowstorm in the mid west gets here.

I came up with this plan as I was shoveling the 2 feet of snow of my driveway and thinking about Copenhagen conference and Climategate. As I was shoveling I watch one of my neighbors taking her dog out for a walk. It was obvious I could blame her, yes apparently dogs put out 2.5 time the amount of CO2 than my SUV.
"We should always be suspicious of computer models, for while they look impressive, they may very well be constructed on mathematical models that the programmer assumes, but which may not be the ones that nature uses."

Reblog this post [with Zemanta]

Sunday, December 6, 2009

Java Examples

Computer directory listingImage via Wikipedia

Ever Google to figure out how to do something in java. Its always fun.
Try Googling:
file recursion java
you will get:
Results 1 - 10 of about 886,000 for file recursion java

A typical java subject search gives you everything you already know but not the one thing you need. You will get snippets of code. And often you will get Q/A threads asking how to do the same thing you are searching for with no reply. And you will see, copy after copy of it.

For those that found this page looking for java file recursion:

package blogsamples;

import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
* File Recursioin example
*/
public class RecursiveFileListing {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
listAllFiles(new File(args[0]));
}
public static void listAllFiles(File dir) {
// if it is a directory get the contents.
if (dir.isDirectory()) {
String[] children = dir.list();
for (int i = 0; i < children.length; i++) {
// call itself
listAllFiles(new File(dir,children[i]));
}
} else {
// if it is a file print out the file.
try {
System.out.println(dir.getCanonicalPath());
} catch (IOException ex) {
Logger.getLogger(RecursiveFileListing.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}




Reblog this post [with Zemanta]