Halbzeit in Schweden

Wow, das ging eigentlich ziemlich schnell. Nachdem ich gestern meine zweite Klausur für diese Periode geschrieben habe, beginnt am kommenden Montag offiziell die zweite Halbzeit des Wintersemesters. Da fahren die Schweden nämlich ihren etwas eigenen Bildungsweg und unterteilen das Semester kurzerhand nochmal in zwei Hälften (inklusive je einer Klausurphasen).

Nachdem das “kleine Semesterende” aber auch mit ein paar Tagen vorlesungsfreier Zeit verbunden ist, nutze ich diese um ein paar Bilder zu posten. Die Bilder sind in den vergangenen Wochen entstanden, stammen Aus Tallinn, Norrköping, Örebro und einigen anderen Orten und haben keine spezielle Ordnung – dafür aber Kommentare.

Am 21. Dezember geht es übrigens wieder zurück mit einem kleinen Zwischenstopp in Hamburg. Die Fähre ist schon gebucht, aber falls uns noch jemand eine Schlafgelegenheit für die Nacht anbieten könnte, immer gerne. Wir sind mit dem Auto unterwegs und dementsprechend lange aus Achse.

Beste Grüße,
Thomas Uhrig

Show next image by clicking images in NextGEN Gallery


Here‘s the same for NextGEN + Shutter!


NextGEN Gallery is a great plugin for WordPress to embed slideshows in your blog. I used it several times, you can probably find some examples below (and perhaps above if I didn’t stop using it…;).

But – NextGEN Gallery comes with a very user-unfriendly default behavior: if you click on an image, the slideshow will be closed. You have to use two small buttons at the bottom of each image to navigate through the slideshow. And if the images have different sizes, you have to move your mouse after each picture, because the position of the buttons is related to the size of images.

However, since Facebook everybody will expect something different: a click on an image should show the next image and a click somewhere outside the image should close the slideshow. This enables a very easy and fast navigation through the slideshow.

To do that in NextGEN Gallery is quite simple. First of all, we have to change the used slide-effect from Shutter (the default) to Tickbox. To do this, click on Gallery > Options > Effect and select Tickbox from the drop-down list. Now we have to modify the file thickbox.js. You can find it in ../wordpress/wp-includes/js/thickbox/thickbox.js. We have to do the following changes:

Around line 136 we have to replace the whole line starting like:

to this:

Also, we have to add a new line around line 161. Under the line:

we have to add:

After that changes, you can click right on an image to navigate to the next one. If it is the last picture of the slideshow, the slideshow will be closed.

Best regards,
Thomas Uhrig

Java 8 in Eclipse (Juno)


Note: Here is an up-to-date tutorial for the new Eclipse versions Kepler and Luna: http://tuhrig.de/java-8-in-eclipse-kepler-and-luna


Since last July the new Java 7 is generally available. However, even the newer Java 8 is already available as an Early Access Preview. It can be download as part of the OpenJDK including lambda-support. To use it with Eclipse, some additional steps are required. Here’s how it goes:

  1. Download the JDK from http://jdk8.java.net/lambda and install it.
  2. Create a new Java project in Eclipse.
  3. Change some project settings in Eclipse in order to use the new javac compiler of Java 8:
    1. Click right on your project and select Properties.
    2. Select Builders on the left side and uncheck the default Java Builder.
    3. Click on New and select Program as the type of the new builder.
    4. Open javac from the JDK 8 on your disk (it’s in the folder bin).
    5. Configure the new builder by providing some arguments:
    6. Select the tab Build Options and check the During auto builds box, to let the builder run automatically.
  4. Done! Now you can write and execute Java 8 code!

The main feature of Java 8 is the ability to write lambdas and use a functional-like programming style. This can be very useful, especially in GUI-programming. It can reduce the amount of code, because anonymous classes that only implements a listener-interface are avoided. Here’s a very simple example:

The code creates a common JFrame with two buttons. To each button an action-listener is added. But instead of implementing an anonymous class, a method reference is passed in the first case and a lambda in the second case. This reduces the amount of code compared with the old solution that looked like this:

However, the Java compiler will create exactly such a thing of the lambda expression or function reference. Therefore, the passed method must fulfill the interface described by ActionListener. Also, we can only use lambdas instead of interfaces that only describe one single method. Such interfaces are called functional interfaces.

Since Eclipse Juno is made for Java 7 it will not recognize the new lambda syntax. Hence, the editor will mark parts of the code as red errors. But it’s still possible to compile and to execute the code using the new javac compiler form Java 8.

Best regards,
Thomas Uhrig