Interesting article on references in PHP

Johannes Schlüters wrote a very interesting article on references in PHP. Already its title “Do not use PHP references” hints on its main conclusion:

References in PHP are bad. Do not use them. They hurt and will just mess with things and do not expect to be able to outsmart the engine with references!

Posted in PHP | Tagged | Leave a comment

Ubuntu: Diff tool with file browser integration

Having installed a new Ubuntu VM (for testing purposes) I was looking for visual diff tool with nice UI integration.
Windows users: think of WinMerge being launched by selecting two files in Explorer and compare them from the context menu.

This is what I came up with:
Install Meld – a visual diff tool:

sudo apt-get install meld

To be able to launch Meld from the file browsers context menu install “Nautilus Actions” (Nautilus is the name of the Ubuntu file browser). Nautilus Actions is an extension to add custom entries to the context menu.
To install it type:

sudo apt-get install nautilus-actions

Launch it from System -> Settings -> Nautilus Actions
and add a new action with these settings:

  1. Label: Compare
  2. Icon: /usr/share/pixmaps/meld.png
  3. Path: /usr/bin/meld
  4. Parameters: %M
  5. Conditions tab: Group “Appears if selection contains” select “Both”
  6. check “Appears if selection has multiple files or folders”

Restart the file browser:

nautilus -q

Then you can select two files, right click, and select “Compare” and Meld will show you the differences between the selected files.

Posted in Misc | Tagged , , | 3 Comments


Throughout the last weeks and month I made experiences by myself to that subject. Lately I found two very nice statements about this topic:

First an article title “The Number One Developer Productivity Tool” (via @weierohpinney) which refers to an article by Joel Spolsky.

And secondly David Heinemeier Hansson sums it up in my favorite-tweet-of-the-month:

How many people have you interrupted today by IM or phone or in-person where an email would have done just fine?

Posted in Misc, Quotes | Leave a comment

25 Jahre SWR1 Leute

Die SWR1- Sendung “Leute” feiert heute ihr 25. Jubiläum. Dazu herzlichen Glückwunsch !

Ich habe den Leute-Podcast seit 4.9.2006 (damals zu Gast: Prof. Dieter Jauch, Direktor der Wilhelma) abonniert und seither auch fast keine Folge verpasst. Über die Zeit kamen viele Podcast auf meinen iPod – aber Leute ist der Einzige, der sich gehalten hat.

An die Herren Siller, Heim & Kollegen: weiter so…

Posted in German | Tagged | Leave a comment

Using Minify in a Zend Framework project

Minify is a project to help you improve your website performance by grouping, compressing and caching CSS and/or JS files.

To use it in a Zend Framework project I suggest the following steps:

1. Download und unpack Minify

2. Split up Minify according to the Zend Framework project structure

Assuming you are using the standard directory structure suggested for Zend Framework projects, copy the contents of “min/lib” from the Minify project to “library/minify/lib” in your project. The files “config.php”, “groupsConfig.php” and “index.php” go to a new directory under “public” called “minify”.

This steps ensures that only the necessary files are located in the public area of the project.

3. Configure Minify

Next we need to configure Minify. I suggest using the group feature to summarize all Javascript files into single URL – same goes for CSS.

Here is an example configuration:

return array(
'js' => array('//javascripts/prototype.js', '//javascripts/application.js'),
'css' => array('//stylesheets/application.css')

Of course you can have as many files in the groups as you like. If you need more – or different combination of files in groups throughout your website create groups accordingly.
You can test your groups by accessing the group url directly. E.g. the javascript url from the above example can be accessed through:
This should display the grouped and minified javascript files.

4. Using the minified files

Now you can just use the above url to include the configured groups in your application, by using:

<script type="text/javascript" src="minify/?g=js"></script>

While this would work perfectly can could go even further. The above example will tell the browser to cache the contents for a given time (see config.php). This introduces a little conflict: If the timeout is small the cache will be refreshed more often than necessary. A higher value makes it difficult if you need to change something in your files, since not all browsers will get the changes when they appear.

Minifys solution to this is to add a second parameter which identifies any changes to the group. As long as this (numeric) identifier stays the same, there is no need to delivery the file again – caching is preferred. Once the identifier changes the files will be served to the browser again.

Sounds complicated  ? It’s not ! Minify brings some handy utilities making it easy.
Since we are using Zend Framework I would suggest to create a helper to encapsulate all this.

5. The minify helper

To let a helper do all the work with the caching identifier we change the SCRIPT-Tag to:

<script type="text/javascript" src="<?php echo $this->Minify('js') ?>"></script>

So it our soon-to-be-create Helpers job to construct the url to Minify group and take care about that caching stuff.

Here is the helper code:

class My_View_Helper_Minify {
  public function setView(Zend_View_Interface $view) {
    $this->view = $view;
  public function Minify($group) {
    require_once 'minify/lib/Minify/Build.php';
    static $builds = array();
    static $gc = false;
    if (false === $gc) {
      $gc = (require '../public/minify/groupsConfig.php');
    if (! isset($builds[$group])) {
      $builds[$group] = new Minify_Build($gc[$group]);
    return $builds[$group]->uri($this->view->baseUrl.'/minify/?g='.$group);

Note: Most if this code is taken from Minifys utils.php and packed into a ZF helper.

I implemented theses steps in 3 projects so far and the results are very good. I hope this helps to serve Javascript and CSS files more elegantly.

Posted in PHP | Tagged , , | 15 Comments

Strange effects with phing in Mac terminal app

When using phing from a Mac terminal command line you might notice that its output is not displayed correctly, unless you triple click the output area.

To fix this the phing scripts needs to be fixed.
Locate the script with:
which phing
edit the script to replace the line:
-logger phing.listener.AnsiColorLogger
-logger phing.listener.DefaultLogger

Posted in Misc | Tagged , | Leave a comment

Video: Scrum in under 10 minutes

Nice video about how to start with Scrum:

Posted in Misc | Tagged , | Leave a comment