Sunday, 21 December 2008


I have some time off from work and decided it is time to
finally learn and use the colemak keyboard layout.
This is one of my new year resolutions, and I cannot
explain how exited I am about this. I'm actually typing
this post using it, but its still slow going.

I had some trouble getting it to work in ktouch, but I figured it out:

I also had some trouble convincing kubuntu to handle the capslock key
as a backspace key. The final solution for me was to make a little script,
and get it to run when kde starts up.

#setup capslock -> backspace (nice for colemak)
xmodmap -e "remove Lock = Caps_Lock"
xset r 66
run it automatically:
system settings -> advanced -> autostart

I practised for 30-45 minutes per day and I learn more keys every day.
Some of the nice things about Colemak for me are:
  1. You learn the common keys first, so you can actually start typing quite soon. (You can type a lot by just using the home row.)
  2. You are forced to touchtype, because looking at the keyboard doesn't help (assuming you didn't swap your keys, which I recommend.)
  3. Most of your short cut keys are in the same position.
I found these finger stretches quite handy:

Thursday, 11 December 2008

Symbolic link not allowed

I got the following nasty exception in my /var/log/apache2/error_log,
and it took me too long to figure out how to fix it:

Symbolic link not allowed or link target not accessible: /opt/gforge5/plugins/scmbzr

Where in my case /opt/gforge5/plugins/scmbzr is a symlink to somewhere else.
I checked and rechecked all my permissions, but nothing worked.

So eventually it turns out that for every directory in the path where you have symlinks, you need something like:

Options FollowSymLinks

(because I have a symlink in plugins called scmbzr)

Thanks a LOT to Ivan Van Laningham who mentioned this on some mailinglist:

Monday, 8 December 2008

A query which generates a sequence in Oracle

Sometimes for some reason, you may need a query in Oracle
which can generate a sequence of numbers or dates.
I found the following to be an elegant way of doing it:

--count from 1 to 10
SELECT rownum
FROM dual

--even numbers from from 2 to 20
SELECT rownum*2
FROM dual

--get the previous 100 days
SELECT trunc(sysdate) - rownum day
FROM dual

Thursday, 4 December 2008

Whoohoo, I'm a hero today!

In order to answer somebody's question today,
I figured out how to use bzr replay
this made me his hero for a day,
and this in turn has made *my* day!
Markus Korn confirmed that the question is solved:
Thanks a lot Marius, this initial commit did the trick,
you are my hero of the day ;)

Wednesday, 3 December 2008

oracle XE sessions and processes

I found that my locally installed Oracle XE runs out of available connections far too soon for a php app I'm running. This results in some weird gui behaviour: some frames just don't load. Fortunately I found a way to sort of makes it a little better:

sqlplus system@XE
show parameters sessions;
alter system set sessions=250
show parameters processes;
alter system set processes=200
sudo /etc/init.d/oracle-xe restart

Saturday, 22 November 2008

kubuntu intrepid automount external harddrive

The new intrepid kubuntu comes with a nice plasmoid where mountable partitions show up wehen you plug in USB flash disks and external hard drives.
The problem is, they don't get mounted automatically, which is what I want (to streamline my backup process). Fortunitely I found this thread which gave me a hint:

I first tried to download and build devicenotifier_automount from sources, but then after downloading a ton of -dev packages etc. and still not getting it to build, it dawned on me to look for a PPA. I found one:
I've installed it successfully but haven't restarted X & tested yet.
Edit: so it seems you don't need to restart X, just use the `New Device Notifier Automount` plasmoid. Works great so far (2 minutes of testing:)

bash echo on

I've searched previously for a way to echo all the commands in a bash script.
Today i found it on a asp page of all places:

set -o verbose #echo on
set +o verbose #echo off

If you want to do it once to debug a script you can also do:
bash -x

Thursday, 20 November 2008

some words of the day

I regularly send out a word of the day/week/month, so I decided to also publish them on my blog from now on. So without some further ado, here is the some of all:

and of course my favourite: somesuch!

There you have it: all the words starting with some except the ones starting with somer. Like me, I know you always wanted to know that.
This list was compiled using the linux command `look some`.
This post was inspired by my friend Sizwe Mabanga's saying: "Someway Somehow".

Tuesday, 18 November 2008


Have you ever downloaded a .deb file and wondered what the best way to install it is?
This little gem of an app, does the trick for me. It installs the file while resolving and installing all its dependencies!

gdebi is a simple tool to install deb files. It lets you install local deb packages resolving and installing its dependencies.

apt does the same, but only for remote (http, ftp)
located packages.

It has a graphical user interface but can be used in your terminal.

Wednesday, 12 November 2008


I recently went over to Kubuntu 8.10 (Intrepid), and I'm trying to get used to dolphin now. But it doesnt have the super cool "file size view" which I used to love in konqueror.
The soloution is to install kdirstat, which pretty much has the same functionality.
(Found it on Too many open files

We hit this again on sles today, so I thought I should leave a note here for posterity. /home/tcmas/tomcat/5.0.28/work/Catalina/localhost/balancer/SESSIONS.ser (Too many open files)

  1. It might be caused by the small amount of memory available! so increasing that, may fix it.
  2. It may also be the the number of open files limit on linux:
Increase file descriptor limit under Linux to prevent Too many open files

Get current limit:

ulimit -n

cat /proc/sys/fs/file-nr

The default limit is 1024.

Get current number of open file descriptors:

lsof [-p pid] | wc -l

Increase the limit:

Edit /etc/security/limits.conf:

username hard nofile 32768

Monday, 10 November 2008 114: [[: not found (Oracle XE problem on ubuntu)

I installed Oracle Express edition on Kubuntu again, and I got a familiar error again after running:
. /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/
/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/ 114: [[: not found

the solution is to change (as root or sudo) the first line in the "" from
#! /bin/sh
#! /bin/bash

Saturday, 8 November 2008

Figured out how to save my kde4 session

just run:

dbus-send --dest=org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.saveCurrentSession

For some reason my HP laptop crashes from time to time, and then my session disappears :'(

Friday, 7 November 2008


I found this gem of an app a while ago, for monitoring the current network usage.
After installing intrepid, I had to look for it again, so here's the link

Friday, 24 October 2008

How I got php with oci8 working

  1. Install Oracle instant client (the basic package and the SDK!). (You obviously need the 64bit version on a 64bit architecture). I tried doing this using my locally installed oracle express edition (XE) but that whas a whole lot of pain:
    OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory
    I ended up using oracle_instantclient_10_2 which worked!!
  2. sudo -i
  3. apt-get install apache2 php5 php5-dev php-pear libaio1
  4. Make sure your $ORACLE_HOME and $LD_LIBRARY_PATH is set. Since I have 2 different versions of 'oracle' I set these two variables in /usr/sbin/apache2ctl, at the top of the 'CONFIGURATION SETION':
    export ORACLE_HOME=/stuph/install/oracle_instantclient_10_2
  5. echo $ORACLE_HOME >> /etc/
  6. ldconfig
  7. Check if the symlinks named and exist in $ORACLE_HOME, which we will need later. In my case these symlinks were not created by ldconfig, so I created them manually:

    ln -s; ln -s

  8. pecl install oci8
  9. To enable the oci8 module, add "" to /etc/php5/apache2/php.ini and /etc/php5/cli/php.ini). (put this line after the examples starting with ; in the "Dynamic Extensions" section).

  10. ldconfig
  11. apache2ctl restart
    /etc/init.d/apache2 force-reload
    to make sure)
  12. You should see the oci8 module in the output of phpinfo(). (put info.php in ~www-data or ~apache with the following content and browse to it: "<? phpinfo() ?>")

(I'm sorry if this assumes you know how to do certain stuff, but this is a howto for myself, so that I can remember how to do this in a mounth's time)

Saturday, 11 October 2008

my bash setup

Here are some things I put in ~/.bashrc or /etc/bash.bashrc to make my life easier:

# When using bash, I use ctrl+r a lot to find commands I executed recently.
# I found that I remember my commands for much longer than bash does,
# so I increased my bash's memory:
export HISTFILESIZE=3000 # the bash history should save 3000 commands
export HISTCONTROL=ignoredups # don't put duplicate lines in the history.
export HISTCONTROL=ignoreboth # ignore same sucessive entries.
# (from

# I like to have a colour prompt with my user, the machine I'm on and the full
# path. Its a bit long so I put it on 2 lines.
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;33m\]\w\[\033[00m\]>\n\$ '

# enable bzr command auto completion
. /opt/bzr/bzr.current/contrib/bash/bzr.simple

# bzr aliasses
alias bt='./bzr --no-plugins selftest'
alias bd='bzr diff'
alias bl='bzr log'
alias bp='bzr pull -v |less'
alias bm='bzr missing |less'
alias bs='bzr status'

# bzr functions, which cant be done by alias or bzr's alias
#the $@ inserts all the parameters you pass in
bzr help "$@" |less

bzr cdiff "$@" | less -R

Sunday, 5 October 2008

Super cool startup script for linux

I recently had to get a startup script going which works on Ubuntu and Sles for loggerhead. I came up with these install instructions and following simple but super cool init script. Note that this should work for basically any linux daemon, you just need to rename the script (loggerheadd) and change the script a little.
  1. Copy loggerheadd to /etc/init.d
  2. Edit the file to configure it.
  3. Register the service:
    cd /etc/init.d
  • on upstart based systems like Ubuntu run:
    update-rc.d loggerheadd defaults
  • on Sysvinit based systems like Centos or SuSE run:
    chkconfig --add loggerheadd

Here follows the script (the indentation is a bit messed up by blogspot)

# Required-Start: $local_fs $remote_fs $network
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Loggerhead
# Description: Manage Loggerhead (a web viewer for projects in bazaar)

# Configure this please: #

# You can add additional options to serve-branches here:
START_CMD="$LOGGERHEAD_PATH/serve-branches --prefix=$PREFIX --log-folder=$LOG_FOLDER --port=$PORT /var/lib/gforge/bzrroot/"

# main part
case "$1" in
python $START_CMD > $LOG_FILE 2>&1 &
echo "Started loggerhead. (See $LOG_FOLDER for details.)"
pkill -f "$START_CMD"
proccess=`pgrep -fl "$START_CMD"`
echo "$proccess"
netstat -anp |grep -e ":$PORT"
if [ -z "$proccess" ]; then
echo "Loggerhead is not running."
echo "Loggerhead is running."

echo "Usage: loggerheadd { start | stop | status }"
exit 1

Wednesday, 1 October 2008

Maximum file sizes on differrent file systems

I was looking up the maximum file size on a file system for a friend, and I realised I didn't even know this stuff. Here is a couple:
FAT32: 4 GiB
NTFS: 16 EiB
ext2 and ext3: 16 GiB to 2 TiB (see this note about max range)
ext4: 1 EiB
ReiserFS: 8 TiB
HFS plus (used by Apple's Mac OS X): 8 EiB

Sunday, 14 September 2008

Set partition labels on linux.

My colleague Elardus complained that my flash drive didn't have volume labels set and I also wanted automounting to make a nice consistant mountpoint eg. /media/my_flash_drive.
I didn't think think it would be that hard, I really thought that a gui like gparted or qtparted would be able to do that, but was disappointed. So I had to do it from the commandline.

To set the label for ext2 or ext3 partitions:
sudo e2label /dev/sdb2 new_label

where /dev/sdb2 is the partition you want to label. (To get a list of mounted partitions you can do `df -ahT`)

For FAT partitions you first need to configure the drive:
you have to edit /etc/mtools.conf, make f: drive be /dev/sdb1
sudo mlabel f:new_label

Initially I got the following error.
Total number of sectors (256976) not a multiple of sectors per track (63)!
Add mtools_skip_check=1 to your .mtoolsrc file to skip this test
I just did what it asked and then it worked:
echo "mtools_skip_check=1" > ~/.mtoolsrc

I found my info on this page:

Friday, 12 September 2008

Laptop tip of the day.

If you easily get cold feet,
I want to tell you something neat.
Put your toes on a transformer
it'll make your feet warmer.
AC to DC gives off some heat!

ok I wrote it at 1:00 AM
(with my toes on the ... you guessed it)

Wednesday, 10 September 2008

European experience

My wife and I recently returned from a tour of Europe (2008-08-08..2008-08-24) and I just want to make you guys a little jealous.
We decided earlier this year that we should probably see a bit of the world before the kids arrived and I thought
Europe is a nice diverse, architecturally and historically rich place to go.
We had to organise it pretty quickly since my wife is sort of forced to be on leave in august (private school holidays),
which worked out to be a fairly quite time with regards to projects at work.

Without going into too much detail, we first flew to Dubai and after a 2 hour stop over,
we flew to London. There we stayed over one night and then embarked on our Trafalgar tour, which I must say
was extremely well organised, we had the best driver and tour director ever!
During our tour we slept over in Amsterdam (Netherlands), Ludwigshafen (Germany), Innsbruck (Austria),
Venice, Rome, Florence (Italy), Stans (Next to lake Luzern, Switserland), Paris (France :) .
We drove mostly by bus and had lots of interesting outings at the places we passed by.
After the tour we had two nights in London again, where we saw most tourist sights using the tourist buses.
Finally we had a night in Dubai where we also had a short Arabian Adventure, which was also extreamly well organised and very nice.

On this trip we did aeroplanes, big boats (ferries), medium boats, little boats (including gondolas), big buses, little buses, a train, a mono rail, a cog rail and cable cars (big and small),
we walked quite a lot too (I got some blisters even), but we didn't do any cars.
We saw lots of old and new buildings, a lot of country side and a lot of famous attractions.
The places we visited had way more water than what we are used to, a lot of towns have BIG rivers running through the middle.
We made great friends and met people from all over the word, where the most of the tour group was from Australia.

This was deffinitely a worthwhile and value for money experience, which I can highly reccomend (even though the pound and euro is so much stronger than the rand).

For some photos, checkout:

From European Experience

Wednesday, 6 August 2008

Headless VirtualBox in ubuntu server.

1) I tried to get a headless VirtualBox running in the virtualbox which I could apt-get from a standard Ubuntu Hardy repository. - turns out that that version of virtual box does not support headless mode.

2) Then I tried to install a version of virtualbox I downloaded previously from sun (virtualbox_1.6.2-31466_Ubuntu_hardy_i386.deb) but it failed to compile its kernel module, even after I installed the kernel source:
# /etc/init.d/vboxdrv setup
* Stopping VirtualBox kernel module
* done.
* Removing old VirtualBox kernel module
* done.
* Recompiling VirtualBox kernel module
* Look at /var/log/vbox-install.log to find out what went wrong
3) Then I downloaded the latest version from sun, installed it:
# gdebi virtualbox_1.6.4-33808_Ubuntu_hardy_i386.deb
and it worked beautifully!

Friday, 1 August 2008

maven repository manager

After struggling for a couple of days, I finally managed to set up a local maven repository behind a proxy.
  • I first tried nexus, but it's configuration is very buggy and despite the fact that it don't work for me, it keeps on forgetting my settings if I open on it again.
  • Then I tried artifactory, ant it too looked promising, but for some reason I could not get it to download stuff through a proxy either. To be fair after I figured out that my real problem as that my maven clean plugin was broken, I managed to get artifactory working through a proxy (but I think I like archiva the most at the moment).
  • Then I tried apache archiva, which looked even more promising since it actually had the concept of a network proxy on its configuration screen. After a lot of googling, I found out that its a known (and fixed but un-released) bug in archiva 1.1. ( So I installed version 1.0.2 and my downloads began to work!!
The only problem was that as part of testing if this works, I deleted the org directory in my maven repository (as described in the nexus section of the maven difinitve guide).
This caused my `mvn clean` to stop working:
"org.apache.maven.plugin.version.PluginVersionNotFoundException: The plugin 'org.apache.maven.plugins:maven-clean-plugin' does not exist or no valid version could be found"
After a bit of googling I found out that deleting my repository (~/.m2/repository) fixes this problem!

A last note is that the different repository mangers are surprisingly similar as to how they work and configured. It must be something to with where they all come from.

Monday, 28 July 2008


I've been trying to get a decent apt-proxy going which doesn't force me to alter my sources.list file.
I tried apt-cacher, which is supposed to work, but it didn't for me.
Then I tried apt-cacher-ng.

(At my office we connect to the internet through a proxy server which requires username/password authentication,
so obviously I needed to configure apt-cacher-ng to connect
through our normal web proxy to be able to access the internet)

But it gave met the following error when I tried to use it:
407 Proxy Authentication Required

after struggling for some time, I figured out on this Russian site how to fix my problem:

It turns out the sample config file (/etc/apt-cacher-ng/acng.conf) is making you configure the proxy wrongly.
So in stead of configuring like:
proxy: http://user:pass@srv:port
do it like:
proxy: user:pass@srv:port

Now that I could configure my apt-cacher-ng to connect through and authenticate to our internet proxy, I'm able to switch to using it by merely editing /etc/apt/apt.conf:
Acquire::http { Proxy "http://myaptcacherng:3142"; };
//Acquire::http { Proxy "http://networkproxy:3142"; };

(lines starting with // are considered comments)

To Import .deb files from the local apt cache:
# let apt-cacher-ng use the .deb files that are already in /var/cache/apt/archives/
sudo mkdir -p /var/cache/apt-cacher-ng/_import
sudo chown apt-cacher-ng /var/cache/apt-cacher-ng/_import
sudo cp -al /var/cache/apt/archives/* /var/cache/apt-cacher-ng/_import/
# browse to and click "Start Import"
(from )