Ever seen duplicate lines in your log4j output? Maybe something like this: Well, the obvious cause is probably duplicate loggers your log4j configuration: As the properties are inherited from the root logger, this is telling log4j that all quartz-classes should send their log to the DefaultConsoleAppender (which the root logger is doing anyway). So we simply have to remove the… Read more »
Since Sun’s API search is a real pain in the arse and even DocWeb doesn’t allow you to quickly search the Java API, this firefox plugin is a substantial improvement: https://addons.mozilla.org/en-US/firefox/addon/60675/ It basically redirects the search query to Google’s “I’m Feeling Lucky” feature to search Java’s API for the class information. Together with Second Search querying the Java API is… Read more »
At first sight, implementing equals() doesn’t seem fairly hard. Unfortunately, it turns out that writing a correct equality method is surprisingly difficult: http://java.sun.com/javase/6/docs/api/java/lang/Object.html The equals method implements an equivalence relation on non-null object references: It is reflexive: for any non-null reference value x, x.equals(x) should return true. It is symmetric: for any non-null reference values x and y, x.equals(y) should… Read more »
Thread safety is a very hot topic for Java programmers right now. But I’ve seen quite a few folks using the rather complex collections from java.util.concurrent when they actually needed just a thread-safe implementation of a Set. Of course, the HashSet implementation is non-thread-safe: http://java.sun.com/javase/6/docs/api/java/util/HashSet.html Note that this implementation is not synchronized. If multiple threads access a hash set concurrently,… Read more »
For those of you, who want to understand what goes on inside google adsense’s show_ads.js, here is the complete source code: Found on http://www.koders.com.