It's never too late to get a life

Object Oriented File Access in PHP

Test-driven driven development in PHP can become a pain when you’re dealing with the file system. The builtin functions like stat, getfilemtime, fopen and fgets assume the existence of actual files. Until now, I assumed you’d have to add a library like FileFetcher, Flysystem, Gaufrette or vfsSystem to your dependencies. While those libraries are nice, they are additional dependencies and some add additional capabilities like caching or providing a unified interface to cloud storage.

How to protect your privacy by changing your Git commit times

Your Git commit logs provide a good approximation of your habits and time zone: When you sleep, if you are working full time, which projects are private and and which are work-related (weekend vs workday commits), when you go to lunch, etc. By setting the environment variables GIT_AUTHOR_DATE and GIT_COMMITTER_DATE before committing, you can change the recorded time of a commit. But always setting those variables before committing becomes tedious, so I experimented with a shell function that sets the environment variables for me.

Impressions from SwanseaCon 2016

I attended the SwanseaCon 2016, a conference about Agile Development & Software Craftsmanship. I enjoyed most of the talks and took some notes for the most interesting stuff: My two favorite talks Immutable architecture “Your servers are not your pets” - don’t give them names, don’t tend to them with complex state-based configuration management software like Puppet and Chef, don’t get emotionally attached. Just build the environment you need using simple tools like Ansible, deploy the code to it, put it behind your load balancer and throw the old one away.

Blog reboot

I’ve migrated this blog from Drupal 6 to the static site generator Spress. As a developer I work best with version-controlled plain text files and in the sure knowledge that my “CMS” is not reachable from the internet. I’ve dropped three heavily outdated posts in the process. The URLs of the old blog never worked right (since I had mixed language content), so felt no need to keep them. The design is a stand-in until I have the time to do something better.

Using grep on files with no newlines

I had a big, automatically-generated HTML file without newlines and wanted to see all occurrences of a certain image name. Using the command grep my_image.png just outputs the whole file - not useful! While writing the question to the unix section of StackExchange, I found a way to do it with grep: grep -oE ".{30}my_image.{30}" This command yielded the desired result: Each occurrence on a separate line, with 30 characters before and after.

Zend_Form zweispaltig mit CSS formatieren

In der Standardeinstellung verpackt Zend_Form Eingabefelder und ihre Beschriftungen in einer HTML-Definitionsliste. Ob das nun semantisch ist oder nicht, darĂ¼ber kann man sich so trefflich streiten wie darĂ¼ber, was der bessere Editor oder das bessere Betriebssystem ist. Viel interessanter ist die Frage, wie man die DT und DD Elemente so mit CSS formatiert, dass dabei ein zweispaltiges Formular herauskommt. Der erste Versuch ist klassisch: das dt mit der Beschriftung bekommt eine Breite und ein float verpasst, das bekommt dd ‘zur Sicherheit’ noch einen Rand, der der Breite des dt entspricht.

jEdit Syntax highlighting for Asterisk AEL files

These days I’m doing some Asterisk work, creating AEL dial plan scripts for call center agents: Logging in and out, checking if the hotlines are staffed before allowing a pause, logging agent events to a separate logfile. For the scripts I’m using my favourite cross-platform editor jEdit. At the moment, jEdit has no syntax highlighting for AEL files, so I put one together myself. For a while, the file was hosted on snippets.

Visually debugging XSL-FO stylesheets

When developing XSL-FO stylesheets sooner or later you will see something that doesn’t look as intended: It has the wrong margin, padding, line height, floats in the wrong place, etc. If you have no visual debugging tool, the quickest way to check for errors is setting a border or background attribute on the element in question. <curmudgeon>Just like we debugged web layouts in 1999! We had nothing like that fancy Firebug plugin, just our trusty notepad and bare HTML!