Java Tips: Thread Safety Documentation

Joshua Bloch in his book, “Effective Java” summarized the levels of thread safety: immutable—Instances of this class appear constant. No external synchronization is necessary. Examples include String, Long, and BigInteger (Item 15). unconditionally thread-safe—Instances of this class are mutable, but the class has sufficient internal synchronization that its instances can be used concurrently without the […]

Java Tips: Memory Optimization for String

String is a unique object in Java. The Java Specification explains several unique properties of String in Java. We might already know some of them. First, String is unique because it can be created without new keyword, like example below. I have to mention that you can still create String object using new keyword, like […]

Spring Tips: Initializing bean using EasyMock for unit test

Unit test is a very good practice for creating robust application. Using Spring, we can avoid using ApplicationContext and instead arrange all dependencies programmatically. However, once in a while, we still need to test using the actual ApplicationContext. This can be problematic if our test using mock from EasyMock. So here is the example on […]

My top Eclipse keyboard shortcut

If you use Eclipse a lot you must have your favorite keyboard shortcut. Here are mine: Context Assist (CTRL+SPACE), I believe this is all favorite since they just have so many functionality. You want assistance about class name/method name/variable name. You get all. More than that, it also shows the template available for the context. […]

Fixing Samba symbolic links' problem from Leopard

Oh no… all symbolic links are not accessible from Leopard. It shows error message that the target links can’t be found. They are OK with Tiger, so I’m thinking that there is a bug in Leopard. For a while, I can live with copying the file from Linux to Mac and worked with the copy […]

“Force link that open new window to open in new tab” for Firefox 2

Firefox 2 removes option to “Force link that open new window to open in new tab”. I found this to be very disappointing, since I always activate this option. Working with tabs is one of the reason I use Firefox, if some sites force me to open new window, it is just as annoying as […]