Posts

How to check Java version on compiled class

Recently working with Java and encountered some issue regarding java version when I run my java program. Its said that the version of my program is incompatible and it is expecting some version else. After some searching, here is one of my finding on how to check the java version for a compiled class. 1) First start your command prompt. 2) For those who don't have the javap class path matched, navigate into bin folder inside your Java folder. The command is as simple as below: javap -verbose MyClass (MyClass is my class file name) This might output a junk of coding which is not required in this case. The java class can be determined in the early stage. So output everything into a file,  javap -verbose MyClass > myclass.log And now open the the myclass.log and you can see the following at the start. public class MyClass extends java.lang.Object SourceFile: "MyClass.java" minor version: 0 major version: 50 Constant pool: const #1 = clas...

DevDens: Jquery Validation: Disable/Skip Jquery validation ...

DevDens: Jquery Validation: Disable/Skip Jquery validation ... : Skipping jquery validation at certain condition

Jquery Validation: Disable/Skip Jquery validation at certain condition

There is time when validation is not needed when certain submit button is clicked. Eg: when there are 'Clear' and 'Submit' buttons. Jquery validation has been initiated for the form which contain both of these submit buttons. However, when 'Clear' is clicked, and it is needed to submit the form for backend processing, jquery validation will assume this submit required checking as how 'Submit' button was. To handle this scenario, it is very easy. To prevent validation to take place when 'Clear' button is clicked, simply add class="cancel" for that submit button and it will skip the validation. Eg: <input class="cancel" name="clear" type="submit" value="Clear"> It is just as simple as this. Happy coding

Jquery Validation fix for date format dd/mm/yyyy in Chrome and Safari

After a long search, finally i found the solution for JQuery validation ( Can get the plugin from here:   http://docs.jquery.com/Plugins/Validation ) for date in Chrome and Safari. This is because Chrome and Safari do not handle the format properly. When developer set datepicker format from mm/dd/yyyy (default format) to dd/mm/yyyy , JQuery validation plugin tool does not able validate this format (only happen in Chrome and Browser. Other browser like IE, and Firefox is working fine). For example, if you initiate datepicker like this: $(':input.date').datepicker({dateFormat: 'dd/mm/yy'}); Then when you select date with day more than 12 like 13/11/2011 or 22/11/2011 and so on, and when you are using Jquery validation plugin to validate before submit, this will normally return with ' Please enter a valid date ' in Chrome and Safari. The solve this issue, it is needed to modify JQuery validation plugin. For my case it is jquery.validation.min.js. Lo...

Jquery Validation fix for date format dd/mm/yyyy in Chrome and Safari

After a long search, finally i found the solution for JQuery validation ( Can get the plugin from here:   http://docs.jquery.com/Plugins/Validation ) for date in Chrome and Safari. This is because Chrome and Safari do not handle the format properly. When developer set datepicker format from mm/dd/yyyy (default format) to dd/mm/yyyy , JQuery validation plugin tool does not able validate this format (only happen in Chrome and Browser. Other browser like IE, and Firefox is working fine). For example, if you initiate datepicker like this: $(':input.date').datepicker({dateFormat: 'dd/mm/yy'}); Then when you select date with day more than 12 like 13/11/2011 or 22/11/2011 and so on, and when you are using Jquery validation plugin to validate before submit, this will normally return with ' Please enter a valid date ' in Chrome and Safari. The solve this issue, it is needed to modify JQuery validation plugin. For my case it is jquery.validation.min.js. Lo...

Jquery Validation fix for date format dd/mm/yyyy in Chrome and Safari

After a long search, finally i found the solution for JQuery validation ( Can get the plugin from here:   http://docs.jquery.com/Plugins/Validation ) for date in Chrome and Safari. This is because Chrome and Safari do not handle the format properly. When developer set datepicker format from mm/dd/yyyy (default format) to dd/mm/yyyy , JQuery validation plugin tool does not able validate this format (only happen in Chrome and Browser. Other browser like IE, and Firefox is working fine). For example, if you initiate datepicker like this: $(':input.date').datepicker({dateFormat: 'dd/mm/yy'}); Then when you select date with day more than 12 like 13/11/2011 or 22/11/2011 and so on, and when you are using Jquery validation plugin to validate before submit, this will normally return with ' Please enter a valid date ' in Chrome and Safari. The solve this issue, it is needed to modify JQuery validation plugin. For my case it is jquery.validation.min.js. Lo...

Android Tutorial : Creating AlertDialog for Android Application

Image
I believe you guys reach here after searching on how to create an AlertDialog for Android. There are few types of Dialog (or also can consider as a Pop Up) is available in Android SDK. The easiest to work with is AlertDialog. This is the AlertDialog:  To do this is very simple. Below are the code snippet to create a simple AlertDialog for Android : (FYI: I'll skip all the import stuff as you can do it generally by Crtl + Shift + O / Organize Import - a function in eclipse to fill in all the import stuff for you ) // define a list of array final CharSequence[] shareItems = {"Facebook", "Twitter", "Email"}; // initiate a alert dialog builder AlertDialog.Builder builder = new AlertDialog.Builder(MediaNewsDetailActivity.this); builder.setTitle("Share this");   // set title for the AlertDialog builder.setItems(shareItems, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) {     // TODO A...