Wednesday, October 24, 2007

Gimp 2.4 released!

To celebrate the release of GIMP 2.4 and to scratch and item off the Long Overdue list, the Gimp team have refreshed the web site and released Gimp 2.4. Grab it now!

GIMP is the GNU Image Manipulation Program. It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages. (more...)

Official GIMP web site. It contains information about downloading, installing, using, and enhancing it. This site also serves as a distribution point for the latest releases. We try to provide as much information about the GIMP community and related projects as possible. Hopefully you will find what you need here. Grab a properly chilled beverage and enjoy.

Collection of different levels of GIMP tutorials, which includes for Beginner, Intermediate, Expert, Photo Editing, Web and Script Authoring.

GIMP Tutorials found here!

Thursday, October 18, 2007

How to read what inside a directory in Java

Code Snippet on reading files and folders inside a directory in Java

Java Imports:
java.io.File

Code Snippet:
File directory = new File( "C:/" );
File[] fileList = directory.listFiles();

// Iterate through the fileList
for( int index = 0; index < fileList.length; index++ ) {
if( fileList[ index ].isFile() ) {
// prints the file names
System.out.println( "File Name " +fileList[ index ].getName() );
} else if( fileList[ index ].isDirectory() ) {
// prints the directory names
System.out.println( "Directory Name: " +fileList[ index ].getName() );
}
}

How to write a File in Java

Code snippet on how to write a File in Java

Note: myFile.txt - file to be written

Java Imports:
java.io.BufferedWriter,
java.io.FileWriter,
java.io.IOException

Code Snippet:
try {
// myFile.txt - file to write
FileWriter fileWriter = new FileWriter( "myFile.txt" );
BufferedWriter bufferedWriter = new BufferedWriter( fileWriter );
// write to a file line 0, line 1, line n
for( int index = 0; index < 10; index++ ) {
bufferedWriter.write( "line " +index+ "\n" );
}
// close writer
bufferedWriter.close();
} catch ( IOException ioe ) {
// handle exception
}

How to read a File in Java

Code snippet on how to read a file in Java

Note: myFile.txt - file that will be read

Java Imports:
java.io.BufferedReader,
java.io.File,
java.io.FileReader,
java.io.IOException


Code Snippet:
try {
// myFile.txt - text file to read
File file = new File( "myFile.txt" );
FileReader fileReader = new FileReader( file );
BufferedReader bufferedReader = new BufferedReader( fileReader );
String line;
// line - holder for the line of text
while( ( line = bufferedReader.readLine() ) != null ) {
System.out.println( line ); // prints the text per line on console
}
// don't forget to dispose after use
fileReader.close();
bufferedReader.close();
} catch ( IOException ioe ) {
// handle exception
}
Google