Create file type input using textbox and simple button

January 30, 2011 by Sandeep Bhardwaj | Tags:

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 more

Trim method in JavaScript

December 28, 2010 by Sandeep Bhardwaj | Tags:

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 more

Renaming files using command prompt on windows

December 09, 2010 by Sandeep Bhardwaj | Tags:

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 more

Main method in java

December 06, 2010 by Sandeep Bhardwaj | Tags:

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 more

How Class.forName() method works ?

December 06, 2010 by Sandeep Bhardwaj | Tags:

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