Thursday, July 29, 2010
Friday, April 9, 2010
Thursday, March 11, 2010
List all directories under a path and Print current directory through JAVA code
Below is source code for the same:
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
public class direcotryName {
public static void main(String[] args){
File dir=new File("/Users/admin");
File[] subDirs = dir.listFiles(new FileFilter() {
public boolean accept(File pathname) {
return pathname.isDirectory();
}
});
for (File subDir : subDirs) {
System.out.println("path :"+subDir.getPath());
}
//print current working directory...
File f = new java.io.File(".");
try {
System.out.println(f.getCanonicalPath() );
} catch (IOException e) {
e.printStackTrace();
}
}
}
Wednesday, December 9, 2009
Namespace approach to call a javascript method
html snippet:
javascript snippet: index.js
myApp = new Object();
myApp.fun=function(method1){
alert('inside overidden method');
if(arguments.length == 1)
window[method1]();
else if(arguments.length == 2)
window[method1](arguments[1]);
else if(arguments.length == 3)
window[method1](arguments[1], arguments[2]);
else if(arguments.length == 4)
window[method1](arguments[1], arguments[2], arguments[3]);
else if(arguments.length == 5)
window[method1](arguments[1], arguments[2], arguments[3], arguments[4]);
};
function invokerMethod(method){
if(typeof myApp != "undefined"){
myApp.fun(method);
}
else{
alert('namespace is not created for this release');
fun(method);
}
}
Actual method: test.js
function one(){
alert('actual method....');
}
Subscribe to:
Posts (Atom)
