Wednesday, February 25, 2009

Is brevity really the soul of wit?

Inspired by Indexed.

Tuesday, February 24, 2009

Poster: Software Engineering Quotes


I few months ago Max and I discovered a cool site on hilarious quotes from famous tech people. We've decided to compile a poster, which we wan't to share with you.
We hope you enjoy it, feel free to post further quotes. May be we can provide some updates from time to time.



Thursday, February 5, 2009

De-Mail

Yesterday a thing called "De-Mail" has hit the general public here in Germany, even the old bull of German news TV picked it up. (German only). For those of you who don't know what De-Mail is (as did I until recently): De-Mail is ought to be a service centrally controlled by the government to offer a legally valid and secure transfer of documents etc. The aim is to allow for official errands to be handled from home. The minimal prerequisite to accomplish that is to register at one of the official partners for an e-mail address.

After I learned about this governmental effort yesterday I read some articles about it and must say that I can't believe it will be a big success (or a success at all). After all you have to register at one of the providers (the usual suspects Deutsche Telekom, T-Systems and Deutsche Post come into play here) and furthermore the fact that the whole project was initially started and is backed by the German government (more precisely by the department of the interior) makes this whole thing not more but less trustworthy. Honestly: Who does actually trust government more than a dedicated company, which in the first instance has no interest in spying out its customers (which the government - proving it again and again - definitely has)?

Moreover: Why are the "thinkers" behind this project reinventing the wheel again as is also done again and again in other governmental projects? There are mail services already and the tools for secure communication also are out there. It would have been much more efficient, cheap and mass compatible if the whole project would have consisted of integrating existing services (everyone already has an e-mail address and many out there already have e.g. a PGP key).

My conclusion: De-Mail is doomed from the beginning.

Wednesday, February 4, 2009

Java RegExp - Filter unicode character subset

Task: Find a specific subset of unicode characters in a Java string. In the given case I was asked to prevent an upload of a malformed csv-file through a servlet. Before the file is written to the db the submitted file has to be checked for specified illegal characters like Chr(13) etc.

Solution: Usage of Java regular expressions.

Java offers a wide range of possibilities to search within a string. I've used the following code in my solution:

boolean containsInvalidCharacters(String s) { 
Pattern p = null;
Matcher m = null;
// Use a compiled pattern if you check serveral times for the same pattern
p = Pattern.compile("[\u0000-\u0020[\u0100-\uFFFF]]"); 
m = p.matcher(s); 
return m.find();
}
The pattern excludes all unicode characters between 0x0000 - 0x0020 and 0x100 - 0xFFFF. With the find function no .* or + is needed is addition to the pattern.

Nasty Traps: Be aware of the .matches() method with is provided by the Matcher and the String class. This method checks for an exact match  with a given string. If you just want to check for the occurence  of a substring use .find() method.


Helpful links: