Blog Archives

Set up JAVA_HOME to track Java Preferences.app on Mac OS X

Mac OS X’s Java Preferences.app has a pane for switching between versions of the JDK, but I just found out from a coworker (thanks, Mike!) that you can make your shell match that preference easily — just add this to

Tagged with: , , , , ,
Posted in Technical HOWTOs

Simple spring integration testing

Spring has had a really nice unit test framework available for a while now, but the documentation can be a bit daunting. Here’s a super-simple example of adding dependency injection to an integration test:

Tagged with: , ,
Posted in Software Development Mantras, Technical HOWTOs

How to serve a transparent 1×1 pixel GIF from a servlet

The first issue was how to build the smallest possible byte array that represents a 1×1 GIF. Using ImageMagick piped to base64 made it easy to embed into java code:

At servlet load time, un-base64 the gif back into

Tagged with: ,
Posted in Technical HOWTOs

How to increase maven heapspace in hudson builds

If your maven-built project fails in hudson (especially when you’re using the assembly plugin) and it isn’t a compile or test failure, check the console output. If it says “java.lang.OutOfMemoryError: Java heap space”, you need to configure your hudson job

Tagged with: , , ,
Posted in Technical HOWTOs

How to add a version number to your maven webapp

I couldn’t find a simple recipe to add a version number to a maven-built webapp. The maven-war-plugin talks about how to filter, but no simple example is given.

Tagged with: , ,
Posted in Technical HOWTOs

How to set up your Maven2 POM to support Java5

Seeing this?

You need to tell the maven-compiler-plugin to use java 1.5. Add this to your pom.xml:

Tagged with: ,
Posted in Technical HOWTOs

IDEA versus Eclipse

IDEA has been giving me grief lately. Fed up with mysterious pauses, bugs in svn moves, and crashes even after performing cache-deletion voodoo in IDE, I’m back to trying Eclipse. Keystroke differences and functionality differences have been the major stumbling

Tagged with: , , ,
Posted in Technical HOWTOs

Simple Log4J eclipse template

Do you use eclipse and log4j? Do you have a template to add a static Logger instance in classes? Do you have to manually add the import? HA! NO MORE! Under Preferences > Java > Editor > Templates, click New…

Tagged with: , ,
Posted in Technical HOWTOs

java rake db:migrate implementations

I was surprised that there were so many libraries that do the same thing — manage change in  your database schema. Here’s what I’ve found so far: Liquibase (migrations are specified in db-generic XML) migrate4j (migrations must be writted in

Tagged with:
Posted in Technical HOWTOs

New Toys

Make friendly URLs easy with stapler Make library management hell less hellish with ivy (2.0 was just released) ACEGI is now “Spring Security,” whose new version purports lighter configuration requirements than previously. iBATIS Pipe Viewer (pv) — gives you a

Tagged with:
Posted in Technical HOWTOs