Sushi programming

Today i want to share a programming technique with you. My former fellow developer Felix and i tried it and had real good experiences while using it. (Damn, its a long time we didn’t worked together and i miss it!)

We named it sushi programming. I will explain later how we came to this name, the differences to Katas and Pair Programming and where we found pros and cons. Let’s keep things short and dive into the sushi bar!

How to do it?

We have two phases in sushi programming:

  1. the performance and
  2. the discussion

Let’s dive into the performance

The base philosophy behind “Sushi Programming” is to watch, and ONLY watch, note things, which will be discussed later. So we have one developer who is writing code with his normal IDE in the normal way he does this. Lets call him the author.

The other role is the audience, at minimum one other developer. The audience is only watching the author. It is important, that the audience in no circumstance (only a nuclear war or the lunch time should disturb us ;)) talks to each other or the author. No questions like “How did you get your IDE to automagically create this whole file?” or “Why don’t you use this fancy key combination to commit your code?”. The audience just writes remarkable things down. This phase should durate between 15 and 45 minutes. With shorter phases you won’t find enough new good or bad habits, with longer the amount of things will decrease.

In the second phase, called discussion, the audience and the author walk through the notes of the audience. Here all good habits swap around the team and the bad ones get out of the author. Rule of thumb is, that all points should be formulated respectfull and without a personal judgement. So only ask “How did you did that magic trick?” or “Do you know, that you could generate the getters/setters?”. I think it is important to write about this rule, cause it will keep the drama out of the discussion. The aim of this technique is to spread the given knowledge as much as possible in the team and increase everyones work quality and speed.

Differences to other techniques

Pair Programming

In pair programming you are allowed to talk all the time. This gives the software developers a better understanding of each other and the solution they build. With suhi programming we are aiming only at the habits of each other. Therefore the silence in the first phase is installed.

Peer Reviews

Peer reviews are either with one guy or with multiple guys. So whenever a piece of code, a software or UI design or an architecture is watched by a group of people, we can call it a peer review. The aim is slightly different from sushi programming: in peer reviews we want to improve the code at all. We should not mind who wrote the code, we just want to see, if it fits our quality standards and our understanding.

Code Katas

Code Katas are a great wy to learn things as a group. We sit together and work through a rigid plan of steps without thinking too deep while doing. The aim is to get a new habit into our muscle memory. For instance it is perfect to get into the Test Driven Development circle, if you never before used it. Or a new framework into your brain. This said, the aim is clearly close to sushi programming: train the new things.

Why the crazy name “Sushi Programming”?

I’m not sure where i got this information from and if it is true: i heard, if you want to become a sushi cook, you have to spend a certain time as a dish washer and as a waiter. This phase around your aimed work should give you the respect for the other activities and let you soak in the spirit of a sushi restaurant, like how to treat the food and the guests. This should beware you of doing the biggest mistakes in the everyday worklife over and over again. You’re filled with best practices before you even ram your first knive in the first fish. Soaking the spirit, for the learning developers, and spreading the spirit, for the master developers is a healthy habit in my eyes.

Pros and cons

  • the flow of the author isn’t broke by discussions – a big plus to get more knowledge moving from one to another individual
  • the author and the audience find more hidden treasures (a.k.a. IDE shortcuts or bad habits) in the everyday routines of the other than by Pair Programming
  • the team members get a deeper understanding of the used techniques
  • the team members get kwowing each other better, because they see each other finding solutions (hopefully they reflect their own too and thereby know themself better)
  • the team members train discussing techniques and routines without hurting personal feelings, which will be good for the team spirit
  • after a time only the knowledge of the team is spreaded, there is a “we don’t learn anthing new” if you do it too often, without developers from the outside of the team


For me it was a really useful habit to sometimes sushi program. Our team knowledge went up fast and it helped me and the others! So my recommendation is: try it yourself and have fun!

Did you liked the article or the idea? Do you feel the urge to propose a better name? Do you know, if it is part of becoming a suhsi cook to be dish washer and waiter first? Did you tried it yourself with some colleagues? What were your experiences? Than please leave a comment!

Thanks for reading and sharing!

Reading the GET parameters in JavaScript

Today i want to write about the situation, when you need a GET parameter in the JavaScript part, and only there, of your website. As sayed, you will never touch or even read the parameter in the PHP or Ruby part of your code, cause it is only there to get something done in the frontend. Exempli gratia you want to switch to the second jquery tab of the actual site. Lets say you want to do this by the GET parameter “tab”. You add the “?tab=0” (as an IT guy i start to count at zero ;)) to your URL. Now you only have to read this parameter and switch to the correct tab. Therefore a GET parameter reading function was my first idea. You call the function and get a nice key-value-object back, so that you can work with it further. Enough said, lets dive into the code:

function getGETParameters() {
    var parameterString ='?','');
    var parametersAsString = parameterString.split('&');

    var parameters = {};

    jQuery.each(parametersAsString, function (index, parameter) {
        var parts = parameter.split('=');

        parameters[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]);

    return parameters;

Do you like this post or the code? Let some kind words here 🙂

If not, let me know what could be improved!

You want me to coach you with your programming or software development skills? Write me a direct email to:

You want to hire me? Write a direct email too 🙂

Short guide to set up an apache virtual host on ubuntu 14.04

Knowing, that there are very good and detailed guides for virtual host creation, i decided to have a shortest possible how to on this topic here.
Assuming, that you have installed and running your apache in Ubuntu 14.04 Trusty Tahr, then these are the steps to create a new virtual host:

  • assure, that the directory, where your virtual host should to “live” in, exists (e.g. “/var/www/awesome.local”)
  • assure, that the permissions of your document root are set to 755
  • create an apache virtual host configuration file (copy the default config file)
    • sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/awesome.local
    • fill it with your configuration (with the editor of your choice)
  • <VirtualHost *:80>
        ServerAdmin admin@awesome.local
        ServerName awesome.local
        ServerAlias www.awesome.local
        DocumentRoot /var/www/awesome.local
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
  • enable the virtual host configuration:
    sudo a2ensite awesome.local
  • restart apache:
    sudo service apache2 restart
  • set up your local /etc/hosts:
    • open the file “etc/hosts”
    • add the line awesome.local www.awesome.local
  • open http://awesome.local and/or http://www.awesome.local in your browser and check, if everything went well (if you see an empty page, check, that there is something in your document root ;))

SVN export script

If you ever wanted to export some svn repository from and clean it from some things like the tests or other helper scripts, i have a nice little helper script.

Download it or copy paste it:


remove=( "/" )

rm -r --force $path_export
svn export . $path_export

for i in "${remove[@]}"
    echo $i
    rm -r --force $path_export$i

Add any files or directories you want to delete from the exported version to the fourth line like this:

remove=( "" "another_file.txt" "a_directory" )

Let me know, if you have any suggestions, improvements or if you just like it in the comments.

Little GREPpings

Sometimes it is great to have the little help of grep. I’m often asked for some hints, so here are my favorite tiny commands:

grep -lir 'PATTERN' *

where the l stands for “give me only the file names”, i for “case insensitive”, r for recursive and the asterisk for all files (use *.xml or other wildcards to only search in certain files).

grep -lir 'PATTERN' * | grep -v "svn"

to search all files, except the svn files (hopefully there is no other filename with svn in it 😉 ). The | is the pipe operator.

I hope that they are useful and help you to grep around!

Language Smells

Watching this video about the future of JavaScript, i liked one cite “The human compiler, at work.” from Paul Graham so much, that i googled it and stumbled upon Are Design Patterns Missing Language Features. To outline this great thoughts: if we wish to extract or already have extracted a design pattern, it is no longer a code smell, but a language smell. In other words not the programmer or developer cares not enough of the code design, but the language designer.

My first thoughts to this thesis: any language designer should carefully look at a statistic on how often each design pattern is used in the most famous open source projects (or even better proprietary one too) and think about getting them into the next language version. On the other hand some patterns have different realizations. For example the transition function of the state pattern could be implemented by entry-/exit-functions in each concrete state or as a function moveTo(oldState, newState) in the state machine. Both implementations have pros and cons, but if a language designer chooses one for the language, it would be a pain if a programmer/developer needs the other one. If both versions are implemented in the language, things get complexer. This would be contrary the design goal of simple languages.

Glad i found this inspiring thoughts! Whats your opinion?

SME Server – Dansguardian installation script

I wrote a script to install a Dansguardian filter on a SME Server 7.5:
here it is!

Download it by typing


to your server shell as root.

Then make it executable by

chmod +x

and run it by


… thats it ;)!

If you have any hints, critiques or improvements, let me know it and write a comment or an email!

Security script: ubuntu server automatic check of services

Looking at this post on about perl i got the idea to write my own script to check if all services are running.

Here it is:

There are only a few things you have to do:

  • change the path to the script in the script (necessary cause we use cron)
  • put it in your crontab:
    • “crontab -e” as root
    • set your local PATH variable (look it up in the shell with “echo $PATH”)
    • * * * * * /PATH_TO_YOUR_SCRIPT/
  • think about how you observe the logfile (maybe you want an email or a notification at login)

If you like the script, see any points i missed or have problems: let me know it and write a comment!

Tutorial: How to create a nailboard – part 2 (loading a picture)



This part of the tutorial series will work out how to load an image to the nailboard created in How to create a nailboard – part 1 (creating the nails) so that it looks like in my video keep on nailin’:
A nailboard example.

As expected no project tooks the way you thought it will go when you started it. When i began to create the nailboard i worked with blender 2.49b. Now blender 2.5 is out and i thought it will be quite easy to port the scripts to the new version. You already guess it – this was not the case 😀 !

In blender 2.5 runs a python interpreter of the version 3.x your python scripts. In blender 2.49b this was done by a python interpreter version 2.x. And here comes the point where things get tricky: there is no “Python Image Library”-package for python 3.x. One can compile the source by himself and use it with his own python 3.x, but cause blender has its own python interpreter the including of your own PIL-compilation gets harder. Cause i want to keep things as simple as possible, i don’t want you to create your own blender build or get in touch with the ctypes-module… so we will go a little detour and have an easier way (we will use the old python version outside blender for preparing the image data and load it in blender to apply it to the nails). At the end of this part of the tutorial i will give you the 2.5 and the 2.49b files for comparison. The tutorial will stay at the blender version 2.5.


The last part of this tutorial series has focused on the creation of our nails. There every nail got an unique name. In this part we will discuss the scripts which load an image to the nailboard.

In a previous post i wrote about another (and faster) way to come to a nailboard. I will discuss the differences short at the end of this post.

The idea

As mentioned before we have to go a little detour. So my former blender 2.49b script is divided into two parts: one script to read the input image and one script to apply the gained information to our nailboard. The second script not only applies the height values to the several nails, it also saves them to the graphs, which where in former blender versions the ipo-curves.

The scripts

As in the first tutorial part i will go from top to bottom through the scripts.

The script generator script

Let us begin with the main function “generateScript” of the generation script. Here it is:


# Script to generate the imageload

import os
import Image

size = (102,76)


def generateScript( in_file, base_file, out_file, frame ):
base = file2string( base_file )
s = prepareImage( in_file, frame )
string2file( out_file, base + s )

generateScript( 'beaker_full.png', '', '', 1 )

As you can see our main function has four parameters: the name of the image, the name of the file in which the header for our loading sequence is placed, the name of our generated image loading script and the frame number where the image should appear. The first command reads, like the function name says, the base file to the string “base”. The second command reads the image and prepares a string with commands to set the nails. We will see this soon. The last command finally writes the concatenated strings to the given file. I will omit the file handling here to keep things short.

Now we come back to the function “prepareImage”. Here it is:

def prepareImage( name, frame ):
img = name )
img.thumbnail( size )

s = ""
for x in range( 0, size[0] ):
for y in range( 0, size[1] ):
colour = getPixel( img, x, y )
s += prepareString( x, y, frame, colour )
return s

The first two commands open the image file and scale it down to the previous defined dimensions “size”. This is quite useful, so we don’t have to scale for ourselves. I have chosen this dimensions (for the nailboard and the “size” variable) cause now we can simply take an image with 1024×768 pixels. I haven’t try what happens if you take an image with other dimensions, but i guess it will work too ;).

The function “prepareString” returns a string with a python command which looks like this:

setNail( 5, 5, 1, 0.329411764706)

Where the first two integers are the coordinates on the nailboard (here (5,5)), the third value is the frame in which the height value will be displayed (in a domain from zero upto one, where zero means the bottom value for a nail and one means the top value for a nail).

Let us now take a look on the results of the “getPixel” function:

def getPixel( img, x, y ):
colour = 0
if ( img.mode == 'P' ):
colour = float( img.getpixel( ( x, y ) ) )
elif ( img.mode == 'L' ):
colour = img.getpixel( ( x, y ) ) / float( 255 )
elif ( img.mode == 'RGB' ):
rgb = img.getpixel( ( x, y ) )
colour = ( rgb[0] + rgb[1] + rgb[2] ) / float( 3*255 )
return colour

It is a case differentiation and scales the pixel values of the image to the domain between zero and one. The cases i implemented are the full colour, the greyscale and the black and white images. This is necessary if you want to use the script easily with arbitrary image types – here are three basic examples:

>>> im.mode
>>> im.getpixel((1,1))
(175, 73, 5)

>>> im.mode
>>> im.getpixel((1,1))

>>> im.mode
>>> im.getpixel((1,1))

Applying the script

The generated script is written to a file with name “”. To generate this script you need the base script, where the header with the functions for the generated script lies in. Open a shell and change to the directory where your image and your scripts are in. Then type


and hit enter. If you have not installed python 2.6, then install it by typing

sudo apt-get install python2.6

and run the script again. If all went well, you have now the file “”. Test it by typing


to your shell.

The generated script

The last pieces of code i want to look at are parts of the generated script. You already know the functions “unselectAll”, “floatRange” and “moveToLayer” from the last part of this tutorial series. We have only to look at

def getNail( x, y ):
str_name = 'nail' + '_' + str(x) + '_' + str(y)
return[ str_name ]

def setNail( x, y, frame, height ):

max = 3.5
nail = getNail( x, y )
nail.location.z = height * max
nail.keyframe_insert( data_path="location", frame=frame, index=2)

# after this line the generated part starts
# -----------------------------------------------------------------


The generated part of the script is a list of calls of the “setNail” function. It takes the nailboard coordinates x and y, the frame number and the new height of the nail. The function “getNail” helps us to get the pointer to the correct nail. The value max is the maximum height of your nails. If you want to use another domain than 0..3,5 correct it here (also the lower limit could be moved at the position where “height * max” stands)! To end up with a positioned nail we set it by the “nail.location.z” value. Last, but nearly equally important, we set a new keyframe at our frame to the location.

Running the generated script

Open your blend file with your nailboard from the last part of this tutorial series. Then open a Text Editor and the generated script in it:
add a plane

And finally run the script by hitting “Alt+P”. This will take a while…

Now you are able to load any image to your nailboard!


I assume this may be interesting points:

  • as usual there are multiple ways to come to a good result (this one and the displacement method),
  • both lead to displayed images,
  • displacement method is faster realized,
  • i have not compared running/rendering times,
  • if you set two frames (at least two frames away from each other), with this method, then the blender internal graphs care for our interpolation,
  • the latter point is important for more realistic movies,
  • the displacement method leaves you alone with this (i haven’t tried to reach smooth movements by interpolation between two images with a video program – if you only want transfer two images, this will not be hard, but if you want to have smooth nail movements in a movie sequence then this could get harsh).

What i learned

  • i will never start a tutorial before i’m shure everything works as expected ;),
  • a very little bit of the new blender 2.5 python API and the new console,
  • an important thing about blender: the python interpreter is hard coded into it,
  • next time i animate something like a nailboard, i choose at first the music and then go and make an animation storyboard and finally
  • sharing information is fun and makes you learn more about the systems you use!


Here you can download the two scripts:


I hope you had fun and learned something! If you liked this tutorial series or have any suggestions, hints and/or critiques, let me know it and write a comment and/or a mail!

Tutorial: How to create a nailboard – remark, an alternative solution

In this post i want to show you a fast alternative way how you could create a nailboard like i showed you in my former post. I got the idea from Wefyb at the BlenderArtists forum (thanks for this 😉 ). I will not discuss it too deep, because it is really easy to apply. You can get more information about the DupliVerts method in the blender documentation. I describe the solution in blender 2.5.

Let’s go:
When you have modeled your nail you add a plane:
add a plane

Then parent the plane to the nail by

  • selecting the nail,
  • select the plane too (holding shift) and
  • pressing Ctrl+P and select “Object”.

Now select the plane and go to the “Object Properties”. There is a submenu “Duplication”. Here you choose “Verts”. If all went well you have this situation:
add a plane

Now apply your imagesize by subdividing/extruding the plane in Editmode until it has the exact the same dimensions in vertices like your image has pixels. For this tutorial i only made two subdivisions, which leads to a 5×5 nailboard, you will have to scale your nails and your plane a bit, to adjust the whole thing:
add a plane

The next step is to add an displacement modifier to the plane, set the Midlevel to “0” and the direction to “Z”:
add a plane

Add a new texture:
add a plane

Go to the texture properties and set the type to “Image or Movie” and load an image:
add a plane

If all went well you have implemented your nailboard really fast. Only things to do are the modeling of the nailboard body and the scaling of the heights, which are controlled by the “Strength” value of the displacement modifier. At a later post i will discuss the difference between this kind of nailboard generation and “my way”.

I hope you liked this post. If so or if you have questions or hints, let me know it and write a comment.