I started my new job back in February.

It’s “bit” delayed, but back in February I started a new job.

I was employed with the Birkerød (north of Copenhagen) based company AdMad, as a backend developer and systems administrator.

During my time with AdMad I’ve had the pleasure of working on a many different systems as well as kept the Linux servers up and running.

Amongst the highlights I can mention:
I’ve written a distributed mail delivery system meant for promotional emails, which have been used for sending out millions of mails.
Before spotify and wimp came around, I had the pleasure of maintaining the systems for one of the first music streaming services in Denmark. It was called TouchDiva.
I’ve written a document parser for the e-magazine AdMagz, that converts PDF-files into SWF (Flash) and image-files for online viewing.
And I’ve enjoyed working on chanti’s site, where I played a key part in developing their new HTML-based site which replaced their old flash-based site.

The new job (which isn’t so new anymore) is as a Systems Developer at PeerCraft located near the center of Copenhagen.
I’m looking forward to spending a long time working with these wonderful people.

PS.: It’s good to be popular I’ve been on most popular images for about 6 months. 🙂

Varnish, Ispconfig and apache2’s access-log

My web server that hosts this site, is running on Debian GNU/Linux with Apache2, Varnish and the management software Ispconfig.

This combination means that the default access log, logged as the remote address (Varnish’s IP). This simple change to the file /etc/apache2/sites-available/ispconfig.conf


LogFormat "%v %h %l %u %t \"%r\" %>s %B \"%{Referer}i\" \"%{User-Agent}i\"" combined_ispconfig
CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m%d-access.log\" -d \"/etc/vlogger-dbi.conf\" /var/log/ispconfig/httpd" combined_ispconfig


SetEnvIf X-Forwarded-For "^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" is-forwarder

LogFormat "%v %{X-Forwarded-For}i %l %u %t \"%r\" %>s %B \"%{Referer}i\" \"%{User-Agent}i\"" combined_ispconfig_forwarded
LogFormat "%v %h %l %u %t \"%r\" %>s %B \"%{Referer}i\" \"%{User-Agent}i\"" combined_ispconfig

CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m%d-access.log\" -d \"/etc/vlogger-dbi.conf\" /var/log/ispconfig/httpd" combined_ispconfig env=!is-forwarder
CustomLog "| /usr/local/ispconfig/server/scripts/vlogger -s access.log -t \"%Y%m%d-access.log\" -d \"/etc/vlogger-dbi.conf\" /var/log/ispconfig/httpd" combined_ispconfig_forwarded env=is-forwarder

And add these lines to

sub vcl_fetch {
    ## Remove the X-Forwarded-For header if it exists.
    remove req.http.X-Forwarded-For;

    set    req.http.X-Forwarded-For = client.ip;

Politikere med ikke-svar svar

Jeg havde fornyligt en lille udveksling med vores kulturminister Uffe Elbæk, på hans facebook side1 omkring §75c i ophavsretsloven.
For dem der ikke ved det, så er §75c den paragraf der forbyder os, at bryde kopispærringen på bl.a. DVD-film. Det er en paragraf som jeg er stærkt utilfreds med, da jeg ser det som min ret at bruge mine lovlig købte film som det passer mig i mit eget hjem.

Jeg havde ærligtalt ikke forventet at han ville give et reelt svar på mit spørgsmål, men det ærgre mig alligevel at han svarer på et spørgsmål hvor han bliver bedt om at retfærdiggøre loven med at gentage hvad loven siger.
Jeg synes heller ikke særlig godt om at han henviser til RettighedsAlliancen, da de i mine øjne er partisk imod mine og andre borgeres rettigheder, så hvorfor skulle jeg have den fjerneste interesse i at spørge dem om noget som helst. Jeg vil heller ikke tigge RA om at få lov til noget som jeg mener er min ret, en ret som loven i øvrigt giver mig medmindre producenten har lagt en kopispærring på produktet og derved gør det ringere.

  1. Link til diskussionen []

The Coolest Merge EVER – My take

Linus Torvalds wrote about “The coolest merge EVER!” back in June 20051 now I needed to do something similar a while back.

I had two git repositories that I use for database backup, the two repositories contains backup from a different mysql server in a master-slave setup and therefor contains mostly the same data. This was a problem because they had grown to a size which is a pain to sync to other servers.
So I decided to join the two repositories into one with full history. Unfortunately simply doing what Torvalds had done wouldn’t work because the files in the two repositories are in the same path and with the same file names, so I had rewrite the commits so that the files were moved to an appropriate sub-directory.

For such a task git has a tool called filter-branch, which can rewrite the history according to rules I’ve made for it.
This is what I did:

      First clone the repositories

      git clone path-to-first-repository database_server1
      git clone path-to-second-repository database_server2
      Now that you have a clone of both repositories enter the first of them and rewrite it’s history so all the files are in a subdirectory. You should also alter some of the files with sed or other cli utils.

      cd database_server1
      git filter-branch -f --prune-empty --tree-filter 'mkdir -p <subdirname>; find -mindepth 1 -maxdepth 1 -type f -exec mv '{}' <subdirname>/ \;;'
      Rewriting can take a very long time and requires a lot of CPU and memory, after you’ve done it on the first repository move on to the other repository and repeat the process by moving the files

      to different directory.
      cd ../database_server2
      git filter-branch -f --prune-empty --tree-filter 'mkdir -p <subdirname>; find -mindepth 1 -maxdepth 1 -type f -exec mv '{}' <subdirname>/ \;;'
      Now that you have rewritten the history of both repositories make a clone of the first one, so you don’t have to start from scratch if something goes wrong.

      cd ..
      git clone database_server1 database_server1_merge
      cd database_server1_merge
      And now for “The Coolest Merge EVER”, I’ve taken the liberty to fix the commands so they work with a resent version of git.

      git fetch ../database_server1
      GIT_INDEX_FILE=.git/tmp-index git read-tree FETCH_HEAD
      GIT_INDEX_FILE=.git/tmp-index git checkout-index -a -u
      git update-index --add -- (GIT_INDEX_FILE=.git/tmp-index git ls-files)
      cp .git/FETCH_HEAD .git/MERGE_HEAD
      git commit
      git gc --prune=now # Clean out old objects if needed.

That’s it, now I have a single git repository with the full history of the two original repositories

  1. http://www.gelato.unsw.edu.au/archives/git/0506/5511.html []


Inspired by some patches I found on kde-apps, I’ve started working on the great KDE application KRegExpEditor, developed by Jesper K. Pedersen from blackie.dk.

I don’t have commit access to KDEs repositories and KRegExpEditor is still in the old SVN-repository, so I’ve created a temporary project on gitorious located here http://gitorious.org/kregexpeditor/kregexpeditor

The first thing I’ll do is fixing some of the bugs and crashes. I’ve applied the patches from http://kde-apps.org/content/show.php/KRegExpEditor+and+KDE4?content=144569 and I’ve fixed a crash, that was triggered when I switched to emacs syntax.