-
Why you should use 0.0.0.0 in your hosts file – redux
Some time ago I (wow, time files!) I suggested that using 0.0.0.0 for host-file based blocklists would be faster than using 127.0.0.1. Above you can see an other reason for using 0.0.0.0: some applications take up port 80 on the localhost and accessing it can (potentially) create havoc. In the example above TeamViewer (which is…
-
Augmenting Log4J stack traces with class versions
If you have multiple versions of your code in production, it is extremely useful for the log to include the version of the classes when producing a stacktrace, otherwise it is very hard to match the lines in the stacktrace with the lines of the source code (sidenote: there is an optimization in the Sun…
-
Remote debugging with Java
Sometimes you have the situation that an issue is only occurring on certain machines or only at a certain time of day. There are a couple of possible methods to investigate such an issue (like: adding extra logging), however I would like to add an other one: remote debugging trough TCP/IP. To do this, start…
-
Navigating (Searching) Collections
Update: this article has been crossposted to the Transylvania JUG blog. The Java collections framework includes the concept of NavigableSets / NavigableMaps. The principle behind these interfaces is that taking a SortedSet/SortedMap you can use a subset of it. Some examples: Given the following set: @Before public void setUp() { set = new TreeSet(); set.addAll(Arrays.asList(1,…
-
How to test for the implementation of toString()
Update: This entry has been crossposted to the transylvania-jug blog. Problem statement: you have some value objects for which you implemented toString() (for debugging purposes) and now you would like to test using a unit test that these implementations exist. Possible solutions: Use reflection to detect the existence of the method: boolean hasToStringViaReflection(Class clazz) {…
-
Non-buffered processor in Perl
Lets say that you have the following problem: you want to write a script which processes the output of a program and writes out the modified somewere, with as little buffering as possible. One concrete example (for which I needed the script) is log rotation: you want to save the output of a program (which…
-
Comparative book review
Below is a a short comparative review of tow books about Java concurrency which I’ve read in the last couple of months. Disclaier: the Amazon links are affiliate ones. Java Concurrency in Practice is an interesting book, which should be a must-read for anyone doing concurrent programming in Java (and in these days if you…
-
noevir review
noevir is a “direct marketing” company focusing on cosmetics and “* care” (skin, body, etc) type of products. After looking at their site I’m mostly neutral about them. I wouldn’t recommend anyone to join such (“direct marketing”) organizations, but that’s not specific to noevir. It also says “Ginza Tokyo” in the header, which is a…
-
scentsy review
scentsy has an interesting concept for providing different scents in the room: rather than burning different materials (like candles or sticks) it uses a lightbulb to heat the wax. This provides a “smoke-free” way to enjoy your fragrances. An other advantage of the concept is that it keeps the warm glow of the candle. If…
-
Processing clipboard data in Perl
The problem: lets say you have a program which generates data to the clipboard (or it is easier to get the data into the clipboard than into a file) and you want to process the data (create a summary for example). Perl to the rescue! Get the Clipboard module (if you use Linux, it is…