Show me the bill!

I share a flat with two other students. When someone bought something we all (or two of us) will benefit of like food or household articles, we don’t split up the price immediately. Instead, we put it on a (paper-based) list. When this list is full, someone (me…) needs to do the math and figure out who needs to pay how much money to whom. This is where computer science comes in handy 😉 So I finally wrote a small program which takes such a list and prints something like “A needs to pay B 23.42 Euro”. Continue reading “Show me the bill!”

Writing iCal data to phone calendar using gammu

Normally, I use a paper-based calendar to write down dates of appointments. Since such a calendar isn’t able to notify me about upcoming events, I wanted to use the reminder feature which is built into the calendar of my mobile phone (Nokia 6030).

Because I really hate typing on the phone keyboard, the calendar data needs to be sent to the phone using my computer. I already configured gammu some time ago to connect to my phone. For calendar editing, I use Mozilla Lightning. So the only thing that was left was some shell script to automate the transfer process between computer and phone. Continue reading “Writing iCal data to phone calendar using gammu”

GNOME "Places" menu: Adding and deleting bookmarks

If you look in the “Places” menu of the GNOME panel or the “Places” view in open/close dialogs or in the file manager, you will see a list of folders. It often includes some local folders and – in addition – the remote locations you connected to via the “Connect to server” functionality.

These entries are saved in your home directory in the file .gtk-bookmarks. It is built using a simple scheme: Each line consists of a target URL and a label to display, separated by a blank. You can simply reduce or extend your list of bookmarks by editing this file.

An example, showing various protocols:

sftp://username@host.na.me/path/to/folder My folder on host.na.me (via SSH)
ftp://user@another.host/mypath Another bookmark, using FTP
file:///home/user2/music My local music folder

This will be displayed as

My folder on host.na.me (via SSH)
Another bookmark, using FTP
My local music folder

One computer – two workstations

If you run Linux, need multiple workstations but only have one computer with at least one graphics adapter, you could build a multi headed workstation. Don’t expect high speed graphics, because almost certainly there will be no graphics acceleration in your final “Hydra” system as it is called by some people.

What you need:

  • a graphics adapter with two outputs, able to work in the mode called “extended screen” (I used an Intel onboard video card, G33)
  • two monitors, two mouses and two keyboards, of course
  • recent versions of Xorg and Xephyr (I tried Ubuntu 8.04, including Xorg 7.3)

I used the great tutorial from Josean. In this article, I will present the additional fine tuning I needed to get a system that fulfills my expectations. Continue reading “One computer – two workstations”

Anonymous classes: references to parents

If you want to create an anonymous class (here: inherited frow OtherClass) and you need a reference to the containing class (here: MyClass), you should do it as follows:

class MyClass {
    void myProcedure() {
        OtherClass oc = new OtherClass() {
            void otherProcedure() {
                foo(MyClass.this);
            }
        };
    }
}

It is much easier to use “MyClass.this” than to introduce a line like “final MyClass selfref = this;” outside of the anonymous class and finally call “foo(selfref);”