Archive for January, 2012

Heap dump of a running JVM with jmap

Tags: ,

You don’t have to wait for your JVM to die with an OutOfMemoryError to get the heap dump you get when you use the -XX:+HeapDumpOnOutOfMemoryError flag. Setting that flag is a good thing though – you get a dump after the heap is big and bloated just before the JVM dies making it easier to [...]

Continue reading » 2 Comments

Java – The 4 inner/nested class types

Tags:

If you are trying to clear your thoughts around just how many different types of inner/nested classes there are in Java, this should be a quick refresher. All but the first kind are known as inner classes. Static member classes – These will not hold on to a reference to the enclosing class. You do [...]

Continue reading » No comments

Double braces initialization in Java

Tags:

This little trick is not very well known and can look like completely new syntax to the uninitiated. But it is actually a form of something you use quite frequently – anonymous inner classes. // Normal list initialization List<String> days1 = new ArrayList<String>(); days1.add("Sun"); days1.add("Mon"); days1.add("Tue"); // Double braces initialization. Compact! List<String> days2 = new [...]

Continue reading » No comments

Find duplicate files

Tags: ,

So you know you have a bunch of files all with similar content but different file names strewn all over a directory tree. How would you identify the repetitions so that you can work towards eliminating them? Here is some CLI magic that helps you do so (sourced from CommandLineFu). find -not -empty -type f [...]

Continue reading » No comments

Eclipse jsp jstl error – Cannot find the tag library descriptor for http://java.sun.com/jsp/jstl/core

Tags: , , ,

You get that error for the missing tld when standard.jar and jstl.jar are not found. If you are using maven, adding the following should fix it. <!– standard.jar –> <dependency> <groupId>taglibs</groupId> <artifactId>standard</artifactId> <version>1.1.2</version> </dependency> <!– JSTL –> <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.1.2</version> </dependency> Try restarting Eclipse if the error doesn’t go away after adding this. Do [...]

Continue reading » No comments

Vi – Disable wrapping

Tags: , ,

So your neatly formatted csv file looks all ugly in vi because your screen isn’t wide enough? [Esc]:set nowrap[Enter] There, that will disable wrapping and your file will make sense once again.

Continue reading » No comments

MySql on a RAM disk for super fast performance with the innodb storage engine

Tags: ,

In a development environment, having a super fast database can be immensely helpful. If you are not lucky enough to already have an SSD in your system, you need to make yourself a RAMDisk. I had a system with 6 gig of RAM. I allocated 500 meg for a RAM Disk. You can create one [...]

Continue reading » No comments

Maven dependency – Local jar file from an external third party to be installed into project repository

Tags: ,

Some time back, I was working on an application that involved payments processing. I worked with a payments company called DataCash. They made available a jar file with their API. Now the app I was working on used Maven for dependency management. Usually, if one needs an API to be included for use in the [...]

Continue reading » No comments