Archive for the ‘Technology’ Category

How to reuse test classes from other maven projects

Friday, August 22nd, 2008

Just when I needed it, I found these helpful instructions on how to reuse test classes from other maven enabled projects. Thanks for this easy to follow instructions, Cédric!

Automatically Fetching Local Backup Data from Collax Business Server

Wednesday, August 20th, 2008

Finally, I have a backup strategy for my Collax Business Server, which also hosts this blog and my gallery. The challenge was this:

  1. Setting up a automated backup on Collax is easy, but where to put the data?
  2. I don’t have another computer running 24/7 to share some harddisk space.
  3. I don’t know of an internet service that shares space via SMB or NFS.
  4. I don’t want to connect another harddrive to the box, since it’s running between our bedroom and Jonas’ Kinderzimmer. It’s a special silent pc from ichbinleise.de, and it’s really quiet. I don’t want to ruin that with a noisy harddrive.

The only solution I could come up with was to store backup the data on the server itself. But — in case of a hardware crash that doesn’t help me a lot. I need to get the data off of the server, including the email notification with crucial content how to restore the data (which is sent with every backup run to my local email account).

Saving the E-Mail

The first part was trivial: I just created a rule in Thunderbird to move any email starting with “Backup Information” to a local folder. All other emails can continue to live their happy live on the server, from where I can access them over IMAP.

Saving the backup

This was tricky (for me) - all you *nix gurus out there will possibly yawn at this. The solution I was after was that every time I logon to my ubuntu desktop, it will fetch/sync the backup data from the server to my local PC.

The outline solution was to allow root ssh access from my PC only and trigger a script on each logon which ssh’s into the server and get’s all the files. This sounds so easy in retrospect :) I’ll assume you have some basic knowledge about ssh, keys and how to automate logon. From here the steps were as follows:

  1. On the CBS I needed to allow root to login from remote, but restrict it to running a command that would copy the files over. In order to do that, I edited /etc/ssh/sshd_config and set the options PermitRootLogin to forced-commands-only and PermitUserEnvironment to yes:
    admin@scheff:/etc/ssh$ sdiff -s sshd_config sshd_config_orig
    PermitRootLogin forced-commands-only                   |    PermitRootLogin no
    PermitUserEnvironment yes                      |    #PermitUserEnvironment no
  2. I edited the /root/.ssh/authorized_keys to include the from and command option. The first restricts the login as root to distinct servers, in my case only to my local desktop machine called “andreas-desktop”. The second option includes the command to be executed, whenever a login as root is detected. Note that this is all in a single line:
    root@scheff:~/.ssh# cat authorized_keys
    from="andreas-desktop,andreas-desktop.intern.karroum.de",command="rsync -avz /var/lib/afbackup/ser
    vers/lokal/mount/ andreas@andreas-desktop:/home/andreas/Backup" ssh-rsa AAA............

    As you can see I am planning to use rsync to transfer the backup files from /var/lib/afbackup/servers/lokal/mount to a local directory /home/andreas/Backup

  3. Where’re close to the solution now :) Third step is to create a shell script which is executed on every logon. I included a little ping wait because first the WiFi network connection needs to be established with the network manager. The script is really tiny and just looks like this - with ’scheff’ being the name of my server. Don’t forget to add execution rights (chmod +x filename) to the script after saving it:
    #!/bin/sh
    ping -c 10 -w 120 scheff
    ssh root@scheff
  4. The last step is to tell Ubuntu/Gnome to start the script with the user session. Go to System -> Settings -> Sessions and add the script you just saved.

Done :)

Installing Certificates with Subject Alternative Name on Symbian Phones

Monday, August 18th, 2008

For quite some time now I was struggeling with my certificate, that I signed with my own CA for my Collax Business Server at home. There were two problems:

  1. I had no idea how to install the root certificate on my phone, from which I intend to access my emails as well as from my ubuntu desktop and anywhere else.
  2. Thunderbird (and other email clients) had some weird problem with the certificate: it complained that the used hostname didn’t match the one in the certificate, although the error dialog clearly showed the opposite. Unfortunatly also the otherwise always helpful support forum for the Collax Business Server was clueless.

A while after I created the issue with Thunderbird, somebody replied on it with the resolution. It’s actually not Thunderbird, which is wrong (except for providing a error dialog that is not very helpful in analysing the error condition), but the certificate. This is what I excpected, but I had no idea what to change in the certificate. It turned out that if you use alias names in your certificate, which I do because the server can be access under a variation of names (like blog.karroum.dyndns.org for our blogs and bilder.karroum.dyndns.org for the picture gallery), you need to repeat the CN of the certificate! Once I did that,Thunderbird was happy with only my own CA imported. Problem one resolved.

One problem remaining. How can I convince my phone that this is a trusted server for the encrypted connection? Up to recently, I had to confirm on every connection attempt to my own server that the certificate should be trusted. Importing the CA to symbian phone is not so easy as you might think it is.

The certificate has to be in binary DER format. Collax can export certificates only as PEM (which is Bas64 encoded), if you don’t want your private key to be included. Thus, I had to convert it first. In general Jacco de Leeuw’s article “Importing certificates on Symbian” was very helpful.

Converting the certificate to DER

It all boils down to download and install openssl and then issue the following command. In my case my exported PEM certificate was CA.crt, DER encoded certificate ended up in CA.cer:

openssl x509 -in CA.crt -out CA.cer -outform DER

Installing the certificate

After the certificate is in the right format for use with Symbian, you now have to install it in the phone. This sounds easier that it actually is. You have to transfer it to the phone, and then place it in the right … place. I mailed the certificate to myself, because I can access my emails from my mobile, but you could also use an internet service, where you can upload you certificate for you to access it with your mobile browser. By doing so you save the hassle of making sure your MIME types etc. are configured correctly for downloading certificates. How to install it in the phone after it’s on it, is also well described in above mentioned article from Jacco de Leeuw.

Conclusion

1) These days, nothing is simple.

2) Funny enough it works nice on my E90, but not on the N80i. The latter still asks me everytime, if my server can be trusted. No solution to that problem yet.

Avoid SOA Pitfalls

Sunday, June 29th, 2008

IT projects have generally a high risk of failure if not managed and executed properly. The risk is even higher, if the project is to define a replacement for the current IT architecture, to overcome agility, scalability, security, extensibility, management or performance impediments. The Service Oriented Architecture is hyped to deliver that, what CORBA and EJB failed to provide, to be the new blanket for hiding the architectural chaos underneath.

When a new technology (or better a methodology) like SOA is not only difficult to master on it’s own, but also hyped (means, proposed by people, who have never written a line of code in their life), it is not a surprise, that “there are instances, where projects are going well, but most are over budget and under delivering, ” says David Linthicum from Real World SOA. He even proposes a money-back guarantee to share the risk, if the consultants take the training on the job on the client’s dime. As this is clearly a little over-provocative, he has a point that it is easy to fail in your job to implement a SOA sucessfully.

Rik de Groot, Viktor Grgic, Vincent Partington, and Gero Vermaas from Xebia posted the top 10 SOA Pitfalls for you to avoid the most common mistakes. They categorized these into implementation, architectural, and most importand also organizational pitfalls. These are the most dangerous, since with SOA also has to come a shift in the organizational culture, which reacts ponderous, sluggish and unwieldy to any attempt to change it. Thanks for the excellent and insightful postings.

With the knowledge about these Top 10 SOA pitfalls, maybe you can give your clients a money-back guarantee!

News I Find Interesting

Friday, June 20th, 2008

I’m using Google Reader for quite a while now and am still happy with it. A nice feature is that I can easily share items that I find interesting and valuable to read with others. So if you would like to know what I liked best, either visit the webpage with my recommandations, or subscribe to the feed.

Robot - A Great Open Source Test Automation Framework

Friday, June 20th, 2008

I was just made aware, that Robot, the test automation framework that we used at Nokia Siemens Networks for huge projects, is now open source. Well done! It really has some very usefull features and because of it’s internal deployment scales up to huge projects where the whole test suite takes a good working day to execute and spans all layers of your enterprise application.

Testcases are described in HTML tables, as well as the test results:

Features include:

  • Enables easy-to-use tabular syntax for creating test cases in a uniform way.
  • Provides ability to create reusable higher-level keywords from the existing keywords.
  • Provides easy-to-read result reports and logs in HTML format.
  • Is platform and application independent.
  • Can natively use both Python and Java test code.
  • Provides a simple library API for creating customized test libraries.
  • Provides a command line interface and XML based outputs for integration into existing build infrastructure (continuous integration systems).
  • Provides support for Selenium for web testing, Java GUI testing, running processes, Telnet, SSH, and so on.
  • Supports creating data-driven tests.
  • Provides tagging to categorize and select test cases to be executed.

Now the only thing missing, to avoid that others have to go through the same pain as we had to, is the Robot Development Kit. That’s an Eclipse/EMF based editor for anything you need for Robot. It solves all the pains that you have with HTML editing, merging HTML in a version control system, etc. I hope that will be open sources at some point as well!

Burning Audio CDs from MP3s with K3b in Ubuntu Hardy

Tuesday, June 17th, 2008

I’m quite happy with Amarok and K3b. I even found a nice place to buy new music in MP3 format in Germany: Musicload.  What gave me a brief headache was that I was unable to burn an Audio CD from the brand new Coldplay Album with K3b due to an unsupported file format. It turned out, that just another package was missing: libk3b2-extracodecs. After that has been installed, creating an audio CD from MP3s was no problem anymore:

> sudo apt-get install libk3b2-extracodecs

Compiling FFmpeg for Collax Business Server

Sunday, June 15th, 2008

I’m hosting our pictures on our CBS server and also would like to upload some videos. In order for Gallery to create video-thumbnails, FFmpeg is needed. Since there’s no default package for CBS available, I have to compile FFmpeg from the sources:

  1. Download the full nightly snapshot of the FFmpeg sources and unpack it
    1. wget http://ffmpeg.mplayerhq.hu/ffmpeg-checkout-snapshot.tar.bz2
    2. bzip2 -d ffmpeg-checkout-snapshot.tar.bz2
    3. tar -xf ffmpeg-checkout-snapshot.tar
  2. I had gcc and make already installed, but before the configure and make script worked, I also had to install:
    1. apt-get install libc6-dev
    2. apt-get install kernel-headers-current
  3. Call ./configure. I went with the default options for now - with one exception. In order to let make know that the headers for CBS already contain a definition of socketlen_t, I had to add that to the cflags for gcc. More options are available with ‘./configure –help’
    1. ./configure –extra-cflags=-DHAVE_SOCKETLEN_T
  4. When first gcc was invoked by make, it failed to locate linux/limits.h, although it was installed with the kernel-headers-current package. I had to set a symbolic link from /usr/local/include to the place where the files were installed.
    1. rm -rf /usr/local/include
    2. ln -s /usr/src/linux/include /usr/local/include
  5. After these preparational steps, invocation of make worked fine.
  6. Call ‘make install’ as a last step, and you should be done. An ‘which ffmpeg’ results in ‘/usr/local/bin/ffmpeg’.

JavaOne 2008 Presentations Available For Free

Monday, June 2nd, 2008

While I’m still trying to catch up with all the information gathered while JavaOne was happening (still 1000+ unread blog posts according to Google Reader), now also all presentations for technical sessions and hand-on labs are available for free (except for registering for the Sun Developers Network). I’d love to see the BOFs available somewhere too, some of them are scattered in some blogs if people cared to upload their slides, but this could be more organized. Presentations include a PDF and for some (and later more) sessions also audio and transcriptions. Some JavaOne ago it was suggested that the community could provide localised transcriptions - has that ever happened? Additionally, when will be able to see the live demos that were given during the session?

Slow CD/DVD-Drive in Ubuntu Hardy

Monday, June 2nd, 2008

Sorry, this entry is only available in Deutsch - German.