22 April 2009

Three weeks ago I attended the eJug Days in Vienna. It was a little conference with some nice presentations. I hadn't been to a conference for some time and was highly motivated. At the end of one particularly cool talk, when the speaker showed his last slide containing the address of his personal web site, a thought hit me. "Man", I thought, "I should have some nice web page with all my stuff put together in one place." This should save my job from going to India ;-) This was the beginning of Code Cop dot org.

I am a senior developer and have been working with Java and internet related technologies since 1999. And I am a completionist. I like my code being in order, e.g. nicely formatted, readable, proper named, designed, tested etc. In fact I am fanatic about it, sometimes even forced to keep it neat. For example a colleague calls me to his place to discuss some problem and I spot some minor flaw in the code on the screen, e.g. he wrote static public instead of public static. I'm getting mad. I am unable to listen to him till the flaw is fixed. I can tell you it's a vice. (And rumours are that there are colleagues who write such crap on purpose, just to tease me.) I don't know if it's the impact of my Virgo ascendant or the beginning of some weird mental disorder. But I do know that studying Mathematics and doing research work did not help to be less freaky.

I started working on code quality in 2004. While staying with Herold Business Data I was responsible for the code quality of the Online Services, running the Daily Build with Apache Ant and loads of tools. There, after years of harassing my dear colleagues with code and daily build issues, I was officially appointed "Code Cop" in 2006 (and even called a "Code Nazi" once). Later I published some articles about being a Code Cop :-). Now I moved all my QA related stuff from different sources here and will add all things I have not published yet.

Like Why the Lucky Stiff I'm an "aspiring author with no true achievements under my belt". I am interested in code quality tools, code generation techniques and recently in dynamic languages like Ruby or Scala. I have a PhD in mathematical computer science (a mixture of Applied Mathematics and Computer Sciences) from the university of technology in Vienna. I live in Austria.

Credits
It's time to thank some people for their help: Christoph Kober (Polychrom) for the cool Code Cop logo you see above on the right. Back in grammar school he already made the fanciest drawings. Claudia Gillmeier (Aurian) for her help with the design and layout. Stefan Nestelbacher designed my first T-shirt back in 2006. Further thanks to Douglas Bowman (Minima Stretch template), Mike Samuel (Prettify), phydeaux3 (Tag Cloud) and all the folks at Flickr for releasing their images under the creative commons licence. I just love your images. Keep going! Last but not least I want to thank my significant other Kasia for proofreading and supporting me in setting up this site.

5 April 2009

Recently I wanted to pimp my Sony Ericsson mobile and add some nice themes (.thm files). There were plenty of them around and I just downloaded a collection of some hundred free ones. Unfortunately most came without a preview image and going through these on my mobile to find nice ones was painstaking and slow: I had to activate each of them, return to the standby mode, check out the main image, return to the theme manager, and start over again. What I needed was some kind of theme browser. I did not trust the Sony Ericsson Themes Creator application to provide browsing and did not bother installing it.

As being a hard core developer I had a look into the THM files. I STFW but could not find any resources explaining the file format. So I explored it a bit myself. Here is what I found together with some Ruby code.

Sony Ericsson Theme File (.THM) FormatThe file contains several files concatenated together with some kind of header before the data.

At 0x0000 a null-terminated string with the name of the original file. Remaining bytes are all null. This is read with name = data[ofs..ofs+0x63].strip.

At 0x0064 several null-or-blank-terminated strings containing octal numbers. The number fields may contain blanks which are treated as separators as well. Parse them with

Sometimes it's not called in this way, but any XML file will do. The Color looks like a regular HTML Colour Code. The Source is a reference to an image stored inside the theme file. The important image types are

Standby_image - main image.

Desktop_image - background in the menu.

Popup_image - background of popup.

There are a lot more, but often these three images are reused in smaller themes.

Knowing the standby image name, it is possible to extract it to the file-system (File.open(filename,'wb') {|io| io.write body}). Then browsing these preview images with some image utility and deleting unwanted ones is a piece of cake. The whole Ruby program is here. Have fun!