Monday, May 21, 2007
Java FX ... The X Factor !
Setting up for Java FX: Here. First time saw anything that can be done easily in Java(because I guess its not Java :) )
And my Cruel World Program,
import javafx.ui.*;
var window = new Frame();
window.title = "Title Bar";
window.width = 400;
window.height = 200;
var label = new Label();
label.text = "Cruel World";
window.content = label;
window.visible = true;
By the way where is the class. Sir this is the world of Scripting :). I guess a easier way to write code with more smoothness and less tension of inheritance, abstract funda.
So, trying for a code, in which I will take my photo and zoom it. So Nice :D. Will comeback with code in next blog.
Sunday, May 20, 2007
Searching Impl.
This is one bad implementation of the last blog. Need to change a lot of part to run in generic way, I am too lazy :)
import java.util.*;
public class SearchFile
{
public static void main(String args[])
{
try
{
String osName = System.getProperty("os.name" );
System.out.println(osName);
String[] cmd = new String[5];
if( osName.equals( "Windows Vista" ) )
{
cmd[0] = "cmd.exe" ;
cmd[1] = "/C" ;
cmd[2] = "dir *.java /s";
cmd[3] = ">";
cmd[4] = "Hello.txt";
}
/* else if( osName.equals( "Unix" ) )
{
find name filename
...
} */
Runtime rt = Runtime.getRuntime();
System.out.println("Executing " + cmd[0] + " " + cmd[1]
+ " " + cmd[2]+ " " + cmd[3]+ " " + cmd[4]);
Process proc = rt.exec(cmd);
int exitVal = proc.waitFor();
System.out.println("ExitValue: " + exitVal);
} catch (Throwable t)
{
t.printStackTrace();
}
}
}
Look at the search speed after first run. Its simple awesome. But it will create problem if user dont have permission to run a process.
Friday, May 11, 2007
How to get ?
On windows, dos gives me an option to search a file in a dir or sub-dir by command:
if ( OS == Windows) {get it by dir filename /s}
elseif (OS == Linux or Solaris or Unix){get it by find /directory_name filename}
else {God Knows only :)}