January 30, 2011 by Sandeep Bhardwaj | Tags: JavaScript
Some times we have requirement to create a file type input in HTML with using simple textbox and a simple button for browse functionality. I search a lot on Google to achieve this functionality but there is no option available in javascript or in jQuery to open file dialog using a simple button. ...
Read moreDecember 28, 2010 by Sandeep Bhardwaj | Tags: JavaScript
We can use String.replace method to trim a string in javascript. //method for trim a complete string like " Hello World " function trim(str) { return str.replace(/^\s+|\s+$/g,""); } //method for left trim a string like " Hello World" function leftTrim(str) { return str.replac...
Read moreDecember 09, 2010 by Sandeep Bhardwaj | Tags: Tips & Tricks
Suppose we have lots of lots file in a directory and we need to rename of modify the extension of all the file, then renaming one by one is pain and not a good idea as well. In that case we can use ren or rename command on windows. If we want to rename all the files in directory in one shot then...
Read moreDecember 06, 2010 by Sandeep Bhardwaj | Tags: Java
public static void main(String arg[]) In Java we write public static void main (String args[]) instead of just main because: public static void main(String arg[]) { } public The main method must be public because it is call from outside the class. It is called by jvm. sta...
Read moreDecember 06, 2010 by Sandeep Bhardwaj | Tags: Java
Class.forName() Class.forName(“XYZ”) method dynamically loads the class XYZ (at runtime). Class.forName(“XYZ”) initialized class named XYZ (i.e., JVM executes all its static block after class loading). Class.forName(“XYZ”) returns the Class object associated with the XYZ class. The returne...
Read more