Wednesday, July 17, 2013

JavaScript - setTimeOut vs setInterval

With JavaScript, it is possible to execute some code at specified time-intervals. This is called timing events. It's very easy to time events in JavaScript. The two key methods that are used are: setInterval() - executes a function, over and over again, at specified time intervals setTimeout() - executes...

Tuesday, July 16, 2013

Java - Memory Analyzer

A. To generate HEAP DUMP in Memory Analyzer: Project>Run Configuration> Arguments -XX:+HeapDumpOnOutOfMemoryError Heap dump will be generated when the out of memory occurs B. Use MAT to open...

Tomcat - loading additional libraries

Create Sub Folder in Tomcat Lib Define those paths in shared.loader property of /conf/catalina.properties file. ################# shared.loader = ${catalina.home}/lib/novell/*.jar, ${catalina.home}/lib/mail/*.j...

Java Memory Analyser

VisualVM with Tomcat 1. adding these paramater into catalina.out set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote=true set JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.management.jmxremote.port=3333 set...

Java - loop to iterate over enum

public enum Direction {    NORTH,    NORTHEAST,    EAST,    SOUTHEAST,    SOUTH,    SOUTHWEST,    WEST,    NORTHWEST } for (Direction dir : Direction.values()) {   // do what you want } Reference: http://stackove...

Thursday, July 11, 2013

How do you test to see if a double is equal to NaN in Java?

Use the static Double.isNaN(double) method, or your Double's .isNaN() method. Simply doing: if (var == Double.NaN) { ... } Reference: http://stackoverflow.com/questions/1456566/how-do-you-test-to-see-if-a-double-is-equal-to-nan-in-j...

Java - Bytes to Image & vice versa

package org.configurator.pdfgenerator.utils; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import org.apache.xerces.impl.dv.util.Base64; public class...

Java - Generate Image from Google Maps

Beside this API, Google Maps also provides an URL based API for extracting static Google Maps directly into desktop application, without requiring JavaScript or access keys. This API is very well explained here: http://code.google.com/apis/maps/documentation/staticmaps/index.html. public class ImageUtils...

Tuesday, July 9, 2013

Monday, July 8, 2013

jQuery - serializeArray

serializeArray for uncheck checkboxes Trick: <input type='hidden' name='check' value='false'/> <input type='checkbox' name='check' value='true'/> jQuery.serializeArray(); serializeArray fieldset doesn't work in IE / Safari Use 'form' instead of 'fieldset' <form class="myFieldset">  ...

Friday, July 5, 2013

Flex - PHPEclipse Plugin

Step 1 :              Begin the installation from the Flex Builder Help menu item.        Step 2 :             ...