Skip to content


if (i=1) throw null;

Nginx is an awesome highly customable and super fast (web)server, unfortunately configuring and setting him up is not that easy compared to Apache.

Modules could not be loaded later via a config file like Apache modules, instead they must be compiled into the Nginx binary. This often leads to the necessity to compile Nginx from source for a deployment.

Here how I compiled, installed and deployed Nginx on a Ubuntu 12.04 system:

continue reading…

Lately I discovered LESS and started loving and using it. In combination with Twitter’s Bootstrap it become very easy to generate CSS in a very comfortable way.

At one point I needed to generate roughly 30 css classes to leverage CSS sprites. I’ve been used do this all by hand back when CSS was written without any help, but having such awesome tools like LESS there must be a way to do this more comfortable. After searching for a while various sources (and also the LESS documentation) said that there are no loops in LESS, so I looked through the Bootstrap sources I found some stuff that looked similar to loops (grid.less and mixins.less).

After simplifying what I found here is the shortest version of doing a loop-like construct in LESS: continue reading…

It’s been a while since my last post, so here some relevant updates (shot version): I entirely switched to git for source control and I am quite happy about it. It is flexible, fast and simply amazing.

After using it for a while you sometime discover some shortcomings.
For example: Many of my client do not use git so I need to send them an archive with the current state of development. There are different way to get this done.

  • Do this in your file manager. Very annoying, because you need to sort out all files that should not be in the archive (.git folder, log, cache, etc.)
  • On your console:
    git archive --format zip --output name_of_branch

This is not easy as it should be. So why not create your own custom git command (or git extension)? Like git archive-file! continue reading…

I am currently working on a Flash project. Because it has a lot of GUI stuff and it is always a lot of code to make some nice GUI components in pure ActionScript 3 I decided to give Flex a change. Surprisingly I really like it. It’s nice and a little bit sick (for a framework a lot of magic happens during compilation). Like for ActionScript 3 Adobe again did a really good job on writing a nice documentation.

But not everything works flawless. Here is a thing struggled with:

Embedding an image is quite easy (the image will be compiled into the final swf file):

  1. <mx:Image source="@Embed(source=’image.jpg’)"/>

Using HTML to format text shouldn’t be a problem for anyone.

  1. <mx:Text width="100%">
  2.   <mx:htmlText>
  3.     <![CDATA[<p><img src=’url’/>some text</p>]]>
  4.   </mx:htmlText>
  5. </mx:Text>

This will show the image from the given URL and “some text”. The Image is going to be loaded when displayed, it is not embedded into the swf file.

How to use a embedded image in a HTML text element? continue reading…

Today I discovered that a while back on a PHP/HTML/MySQL project I made some serious mistakes on my database design. To explain it in short:

I have one a table, lets call it “table1″, and another table, lets call it “table2″. Table1 references a row from table2, but I didn’t used foreign keys in these days. (I don’t if I didn’t know that they are exist or if InnoDB wasn’t available.) The Website has an admin tool which edits all the tables through some HTML forms. My mistake was that it is possible to delete a row from table2 which leaves all the rows in table1 referencing this row in table2 somehow broken. Today someone discovered this mistake I needed to clean this up. My idea was to create a simple query which cleans table1 and the alter the PHP which deleting rows from table2 to also clean up table1.

I started which the following query:

  1. DELETE FROM table1 WHERE id IN (
  2.   SELECT
  3.   FROM table1 AS t1
  4.   LEFT JOIN table2 AS t2 ON t1.key = t2.key
  5.   WHERE t2.key IS NULL
  6. )

Which leads to the following error:

#1093 - You can't specify target table 'table1' for update in FROM clause

I was some kind of shocked because I had no idea whats wrong with this query. After searching the web for a while I found out that it is some kind of bug in MySQL but there is a weird looking workaround: continue reading…

I’m a big fan of the Linux operating system, but sometimes you really need a Windows to run software that isn’t available for Linux or where isn’t any related program.
Therefore you could try WINE (which emulates the Windows API within you Linux system), you could install a virtual windows using a virtual machine like Virtual Box (which emulates a whole PC within you Linux system) or you could install a native Windows operating system side by side to you Linux. If you need the whole performance you hardware could give you, you need to install Windows on your hard drive next to you Linux installation.
Since the Windows boot loader is very restrictive regarding to having multiple operating systems the easiest way is to first install Windows and then later install your Linux system, which brings GRUB (or something similar) as a boot loader.
I first installed Ubuntu on my PC and wanted to install Windows later, so I hard to do it the hardest way:
continue reading…

Sometimes you run a task from the console which takes a while. (E.g.: compiling some programs, downloading something from the internet or installing updates.) Often you do not wait until this task finishes and just toggle to the next window. Would it be nice if you would get some kind of notification, when the task has finished? I found the following solution, which uses the Ubuntu notification system:

  • Edit the .bashrc file from you home directory and append the following lines:
    1. alias alert_helper=‘history|tail -n1|sed -e "s/^\s*[0-9]\+\s*//" -e "s/;\s*alert$//"’
    2. alias alert=‘notify-send -i /usr/share/icons/gnome/32×32/apps/gnome-terminal.png "[$?] $(alert_helper)"’
  • Install the libnotify-bin package
    sudo apt-get install libnotify-bin
  • If you do not want to restart execute the next command in a console:
    source ~/.bashrc

Now you have a new command available on your console: alert
If you do something time consuming now add the additional alert after the last command and you will get a nice notification:


notification from the console

Back in the days where I used Windows having video and audio conversations with Skype was really easy. Just plug in all the devices and configure the volume of the microphone and you are done.

Today I tried the same with my Ubuntu 10.04 installation and I encountered a few problems. This is how I got my webcam working with Skype: continue reading…

A while ago I used VMware server to running a few virtual instances for testing purposes. Everything worked really flawless. Yesterday I wanted to have some virtual server on my home computer again and encountered many problem with the current version of VMware Server on my Ubuntu 10.04 LTS.
There where some problems with the installation, some to get the VMware console running and also a few the keyboard input on the console.

It took a while to get everything running and I pulled all the information I needed from many different sites. So pulled them all together in this blog entry: continue reading…

I am developing with JavaScript for a while and I am used to a lot of it quirks. But even after years of using this language you still find new curiosities. Today a struggled a while with this one.
Considering this piece of JavaScript code:

  1. var i = 10;
  2. function foo() {
  3.         i++; // i is now 11
  4.         console.log("foo1: "+i);
  5.         i = 0; // i is now 0
  6.         console.log("foo2: "+i);
  7. };
  8. console.log("global1: "+i); // should be 10
  9. foo();
  10. console.log("global2: "+i); // and now 0

Ok. That’s fine. Now we change the code a little bit to this one:

  1. var i = 10;
  2. function foo() {
  3.         i++; // is now 11
  4.         console.log("foo1: "+i);
  5.         var i = 0; //create a new variable with value 0
  6.         console.log("foo2: "+i);
  7. };
  8. console.log("global1: "+i); // expect: 10
  9. foo();
  10. console.log("global2: "+i); // expect: 11

What do you expect? I was quite surprised: continue reading…