Regular expression multiline mode - what's a newline?

Posted on Wed 30 May 2012 in Coding • Tagged with newline, regular expressions, csharp, java

I stumbled upon an interesting little detail as I was using a regular expression in a unit test case in a C# application. I had a multiline string and was searching for a particular substring in multiline mode. The newlines in the string were Windows newlines, meaning CR followed by ...


Continue reading

Strongly typed properties in Java vs C#

Posted on Thu 19 January 2012 in Coding • Tagged with delegate, generics, method group, csharp, java

The background for this post was that I needed to implement strongly typed properties in a C# project. With strongly typed property, I specifically mean a strongly typed version of public object GetProperty(string propertyName), where the property name is a constant (or name) of some sort, and the return ...


Continue reading

Playing with Java annotation processing

Posted on Fri 06 January 2012 in Coding • Tagged with annotations, apt, Java, spi

I found Project Lombok via a Tweet, and was intrigued when I saw that a single annotation could trigger automatic code generation transparently during compilation of a source file. How do they do that?

Some digging lead me to discover Java’s annotation processing API, and how one can use ...


Continue reading

Debugging Java focus problems using the focus log

Posted on Wed 28 September 2011 in Coding • Tagged with Java

A while ago I set out to fix a couple of focus problems in a GUI at work. One of the problems was that after a certain user operation, all keyboard shortcuts stopped working (as you may know, keyboard events are dispatched up the focus chain until a component handles ...


Continue reading