-
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…
-
Why Ubuntu 10.10 is better than Windows XP?
I want to preface this with the following: I don’t want to pull a fanboy move here. The only thing I assert is that a recent OS (ie. Ubuntu 10.10) can give a considerable performance improvement (without changing the hardware) compared to an almost 10 year old OS (Windows XP). Without further ado, compiling a…
-
Java has some surprising amount of dinamism in it
Not long ago I saw some java code from Simone Tripodi. It generates synchronization wrappers around arbitrary objects at runtime in a typesafe manner with a couple of easy to understand lines of code. The heavy lifting is done by the dynamic proxy mechanism available from Java 1.5 if I recall correctly. The downside is…
-
delicious/cdman83
performance tweaks and tools for linux