Fluent Interfaces

company.hires(“law firm”, “criminal law”) was Alef’s example of a fluent interface. If you found it interesting here’s the link to Martin Fowler’s website where he talks about it.


The good way to configure Java in Ubunto

After I wrote the previous post, I found out I should not have configured Java like that. So after following some tips from the comments and from “Installing Sun’s Java environment in Debian systems” here is a better way to do it:

  • Go Repositories/Ubuntu where you will find information on how to add the “Universe” repository.
  • Open your Synaptic Package Manager and search for java-package. Mark for install and apply.
  • After downloading the JDK bin file, go to a terminal and type
  1. make-jpkg jre-1_5_0_03-linux-i586.bin
  2. sudo dpkg -i sun-j2sdk1.5_1.5.0+update09_i386.deb
  3. sudo update-alternatives –config java (here choose the one that points to the JDK you installed)
  4. sudo update-alternatives –config javac

This is a better way since it will take care of the system variables for every user (you can verify that java and javac are working on the console) and it will be easier to manage updates.

If you’re using Eclipse you need to update the Installed JREs in Window->Preferences->Java and add a new one that points to /usr/lib/j2sdk1.5-sun/ e.g..

Configuring Java in Ubuntu

Here is a simple way to configure Java in Ubunu Linux. After following these steps, commands like java and javac will be available in the terminal window.

  • Download the JDK and unpack it somewhere on your system. Let’s use /home/user/bin as an example.
  • Set the file you download to executable. You can do this by right-clicking the file, choose Properties->Permissions.
  • Excecute the file by double-clicking it and choose “Run in terminal” . Say yes a few times and you’re done.

Now you need to make Java available in the path so you can use it from any terminal.

  • Edit the file .bashrc under your home directory and add the following lines

export JAVA_HOME=/home/user/bin/jdk1.5.0_09

export PATH=$JAVA_HOME/bin:$PATH

  • Open a new terminal window and type java -version to make sure you’re running the java version you expected. Type env and verify that PATH variable contains the path to the JDK that you exported before.

Ubuntu on Dell Latitude D610

I installed Ubuntu 6.0.6 in my laptop last week and was getting nuts by a high pitched noise it made when it was idle. To get rid of this noise I had to edit the file /boot/grug/menu.lst and add pci=bios idle=halt acpi_sleep=s3_bios to the kernel line. So in the end it will look something like this:

kernel /boot/vmlinuz-2.6.15-27-386 root=/dev/sda1 ro pci=bios idle=halt acpi_sleep=s3_bios quiet splash

I think that consequently the laptop will spend more battery but at least it won’t drive me crazy! đŸ˜›

Officially Java

Just to keep in the record (for myself :P), I officially moved from the C++ team to the Java team! The last two weeks have been great. I’ve had the opportunity to attend really great sessions given by Alef Arendsen from Interface21:

  • Introduction to Java EE
  • Introduction to Spring
  • Spring Core

Although the training was mostly about Spring, Alef also talked about Unit Testing, EasyMock and Eclipse shortcut keys (very usefull)!

Deeplinking on EarthPOI

If you’re tired of making drawings to tell your friends where a certain place is, then you can use a new feature of EarthPOI called deeplinking. Simple send the link of your POI to your friends by email, or post it on your blog or website. You can find the link url on your POI details.

And because I don’t want you to think that lately I don’t write anything about Java, here is a deeplink to a Java historical fact.