Ingo Schommer

SilverStripe core dev, testing fanatic, and passionate DIYer. With his heart somewhere between Germany and New Zealand. Contactable as @chillu or via mail.

Behat Step Transformations for Relative Time

I’ve been playing around with “Specification By Example” style tests for a while now, but really kicked things off while mentoring a Behat+SilverStripe integration at Google Summer of Code 2013. The SilverStripe CMS UI is a complex beast, so it requires frequent additions to our Behat context. Today I’ve come across an interesting problem with relative dates: We want to test that a CMS report only shows recently edited pages, without hardcoding any dates. We came up with the following feature:

Scenario: I can search for a page by its newest last edited date
	Given a "page" "Recent Page"
	And a "page" "Old Page" was last edited "7 days ago"
	When I fill in "To" with "the date of 5 days ago"
	And I press the "Apply Filter" button
	Then I should not see "Recent Page" in the tree
	But I should see "Old Page" in the tree

There’s some specifics to the SilverStripe CMS integration with Behat (like creating a page), but we’re just interested in ’I fill in “To" with "the date of 5 days ago’. That’s actually a built-in step for Mink, Behat’s sidekick for web acceptance testing. It fills out a form field with a value, in our case “the date of 5 days ago”. But since we want the actual formatted date (e.g. “2013-12-31”, that argument is going through a Behat Transformation. This handy feature parses all step arguments (mostly quoted stuff in your steps). If any arguments match your transformation rule, it applies the transformation and the new, transformed value is passed into your step function.

use Behat\Behat\Context\BehatContext;

class MyFeatureContext extends BehatContext {
	protected $dateFormat = 'Y-m-d';

	 * Transforms relative date statements compatible with strtotime().
	 * Example: "date 2 days ago" might return "2013-10-10" if its currently 
	 * the 12th of October 2013. Customize through {@link setDateFormat()}.
	 * @Transform /^(?:(the|a)) date of (?.*)$/
	public function castRelativeToAbsoluteDate($prefix, $val) {
		$timestamp = strtotime($val);
		if(!$timestamp) {
			throw new \InvalidArgumentException(sprintf(
				"Can't resolve '%s' into a valid datetime value",
		return date($this->dateFormat, $timestamp);

	public function getDateFormat() {
		return $this->dateFormat;

	public function setDateFormat($format) {
		$this->dateFormat = $format;

PHP’s strtotime() is smart enough to handle most natural language relative dates, so we’ll leave the hard work to that. The $dateFormat property in our context ensures that the format can be configured based on what locale and your form validation expects. Extending support to transformations of just time or combined date/time values is easy enough with that code. And the best part: This transformation works on all steps, not just the one use case for filling in form fields, greatly reducing step definition duplication.

Last but not least, thanks to our awesome new intern @srizzling for getting this started!

Nov 16, 2013

DIY work setup: A combined sitting and standing desk

I’m a sloucher with terrible posture, and I would like to keep working in my sedentary profession of a programmer for quite a while. Current research suggests that sitting all day isn’t good for you (nytimes.com). Standing all day isn’t ideal either. I’m also a passionate DIYer. So I set out and built myself a standing and sitting desk, combining the best of both worlds.

Disclaimer: I’m not studied in ergonomics, and just documenting a setup which has worked for me for about half a year now.

In essence, a standing desk is nothing more than a few stacks of books and boxes on your regular desk. There’s IKEA hacks which get you a workable solution for a couple of dollars. But they usually lock you into your choice: Standing all day. I’m using a laptop with wireless keyboard and trackpad, so wanted a setup I can easily convert into sitting position.

First of all, the desk wasn’t cheap or easy. Its beautiful, solid beech, took a day to plan, two days to cut and assemble, and two days to sand and paint. So this is something for the years to come. And its still about half the price of those size adjustable ergonomic desks.

Google Sketchup is surprisingly effective for planning furniture in 3D. Once you get over the initial freakout of not being able to work primarily based on numerical measurements, that is. It allowed me to plan the desk design and parts, but also position a virtual dummy, and fill it with to-scale models of different equipment from their 3d warehouse. I made sure that it fits both my current 15inch Macbook Pro, but also a (theoretical) 27inch iMac with an external monitor at correct eye height. You can download the model if you want to poke around a bit.

So what’s special about my desk? The fact that you can take the laptop in its holder from a standing position, and place it into a sitting position, all while retaining a correct eye height. This mainly works because both keyboard and trackpad are placed in a custom-built polystyrene holder (my instructions), which sits on my lap in sitting position, freeing up the desk for the stacked-holder combo. It also means that you’re not locked in to a certain height, since the small pedestals are much easier to replace than a solid desk plate and legs. Granted, a moveable setup doesn’t work so well if you have an external monitor or iMac. But I found that I’m perfectly happy with the screen size of a (high res) laptop. Single tasking and a good window management app like SizeUp get you a long way.

A note on posture: I found a correct line of sight to be most important: With a straight look you should meet the upper third of your screen. More than a few centimetres up or down from that will give you neck pain. Many standup desks are built to operate the keyboard with your underarms at a 90 degree angle. I’ve found that less comfortable than the downwards facing angle, but that only really works if you also angle your keyboard as shown above.

Should you go off and build a fancy desk right away? Probably not. Try if working standing fits you. Get to a comfortable height, stacking more books, taking away space under your keyboard, etc. Once you’ve got it carved out of wood, any (good looking) tweaks will get more complicated.

Apart from the “hardware”, what has really helped me was a little application forcing me into regular breaks. As a Mac user, AntiRSI is simple and effective. Relaxing your eyes and stretching helps a lot, but even just moving around works wonders (my plants are always perfectly watered!).

It’s probably too early for a recommendation, after half a year of usage (read this guy’s real-life experience report). I’m averaging about four hours standing per day, so its going well.

Lastly, I’d like to thank my amazing dad for making the desk possible (I neither possess the tools nor the skill to pull this off alone). And to my multi-talented wife for her encouraging feedback and sowing the keyboard holder.

Feb 17, 2013

After being inspired by a TED talk about window farms, I decided to build my own! I’ve always been a tinkerer, and like greens around me. One day I’ll have an awesome veggie garden, but for now a window farm is the best option for our small city apartment.

So why not just put plants on the window sill? Its just more space saving with a window farm, as you use less room for containers through hydroponics and efficient continuous watering. And it was as much fun to build the whole setup than to harvest fresh veggies now!

One word of caution: Its neither the cheapest way to get fresh veggies (see my shopping list), nor the most environmental friendly. There’s the building/shipping of required parts, plus the small amount of energy consumed by the pump and artificial lights during the winter. In the end, I see it as a hobby for people without easy access to a real outdoor garden :)

So here’s some nerdy details on the farm, probably most interesting to fellow window farmers:

  • Water flow: Using a t-valve system. I was able to achieve constant slow bubbles through the right tube material (PVC, low “water resistance”), and valves to control the amount of air.
  • Suspension: Fishing string is practically invisible, easy to work with, and surprisingly strong. But that’s only for the topmost bottles, the other ones hold up themselves through the screwed in bottlecaps.
  • Reservoir: The thickest and lowest water bottles I could find (1L), as I want to maximize the height and light exposure on the window. Works as long as I’m home to refill every couple of days, need to come up with something better for longer breaks. Using about 1m of tube underneath the reservoir (mostly hidden in pictures), to have more water pressure against the t-valve, and avoid the bubbles going the wrong way. I’ve also split up this tube loop and re-connected it with an “i”-style tube connector. That allows me to easily exchange the water by letting it flow into spare bottles, and saves me from deconstructing the system, which will put too much strain on the frail tube outlets.
  • Plants: Basil and Parsley works the best for me, just planted cherry tomatoes, two types of strawberries, chives, garlic chives, rucola, lettuce, and oregano.
  • Lights: Using two 13W lights which are on 12h per day, so roughly 7ct energy costs per day. I’m hoping to turn them off during summer.
  • Safety: The lights look close to the water sources, but are actually an completely separated suspension, with drip loops for safety. I’m not using check valves, but rather gravity: The pump is sitting higher than the water reservoir levels, ensuring that no water can reach the pump or its electricity.
  • Other: Used three IKEA containers underneath the windowfarm both as a basic failsafe to catch drips and leaks, but also as easy waterproof flower pots to grow more plants in.
Apr 23, 2012

A New Home

My Mephisto powered blog has been criminally neglected, and hence self-destroyed (at least that’s how I like to think about it). I’ve finally admitted that despite being a web-dev, I don’t have enough time to devote to the technical aspects of my own blog. The consequence: I’ve moved to a hosted service, Tumblr. Soon you’ll find the old content here, hopefully including the old permalinks.

Jun 30, 2010

‘Apple of My Eye’ ∞

Short film by Michael Koerbel, shot and edited entirely on an iPhone 4. Someone apparently forgot to send him the memo that iOS devices are only for consumption, not creation.

Jun 30, 2010


Randomness #1: Turns out we were (involuntarily) following the traces of Sigourney Weaver last weekend, who happened to be at the Mighty Mighty and “Lanes”-bowling wednesday and thursday (we went friday and saturday) – see article in the Dominion Post. From now on, I’ll stalk celebrities with web 2.0 power: The local mapping service “Zoomin” actually has a Wellington Celeb Vista group which maps celebrity sightings haha.

Randomness #2: I could’ve sworn I’ve seen Reiner, an ex-workmate from german Scholz & Volkmer the other day at J.J.Murphy’s in Wellington. Haven’t seen him in three years, and wasn’t entirely sure it was him, him being uncommonly bearded and slightly broader face. So I walked past after an brief irritated look. Afterwards I looked him up on various social networks, no mention of Wellington-travel etc. Now I just got an email from another ex-workmate Diana, apparently she has seen him down south on the Abel Tasman track as well – what the… The world is surely a small place.

Nov 26, 2007

Hills, maps, sun & coffee

A quick uncoherent summary of what I’m up to down under: Last week I met Diana, an ex-workmate from good ol’ Scholz & Volkmer. She’s travelling through Ozzie and NZ with her friend Madleen, and had a two-day stop in Wellington. We didn’t manage to meet for over two years, so found it quite funny to sip a coffee on the other end of the globe :)

Concerning work, I’m pretty much fulltime managing and developing for an US-based client doing a Google maps mashup, helping to get the awesome Silverstripe 2.2 release out of the door, and coordinating translators for localization of the interface. I’m also having a closer look at agile development, a methodology which helps us to deliver great projects – and is exactly the stuff that would’ve been helpful to learn during my studies hehe.

Today I’ve had a bike trip to the Wellington Wind Turbine, which towers in the “hinterland” of Wellington. It took some sweat getting up there, and I’ll definetly won’t feel my legs tomorrow, but it was well worth the effort: A stunning 360 degree view of the harbor area, surrounding bays and even the Marlborough Sounds (northern tip of the south island). Check out the panorama-shot (requires Apple Quicktime)

More photos

Nov 25, 2007

Sign language for beginners

One of the few practical side-effects about New Zealand being on the other end of the world is that you inevitably cross a whole lot of countries on your way. This meant that an “around-the-world” flight with several stopovers was only slightly more expensive than going to Wellington non-stop (1650€ vs 1400€). So there I was, virtually pointing the finger at my spinning globe in Google Earth, looking for interesting stopovers. Although I’m a bit sceptical about high-densitiy areas, the decision fell on Japan – in specific, Osaka. With a whopping 19mio people living in the greater area, this should prove some drastic change from my 750 souls hometown.

I flew into Kansai Aiport, which is essentially a gigantic artificial island 50km away from the city. First task there: Getting paper-money from my visa. Now, you have to know that I’m bad at maths. I love my calculator-widget. Well, the currency-conversion from euros is pretty strange (1:160), so I horribily miscalculated how much money I would need for my two days stopover. I’ve changed over 1000€, about ten times of what I actually needed – and will probably loose a good chunk just changing back to dollars. Kids, learning maths can really pay sometimes! ;)

This shouldn’t be the last miscalculation for the day: I was being thrown in exactly the opposite day/night-cycle, so ended up sleeping 16h straight from midday till the next morning. After rigorously studying the subway-plan (thankfully with english translations!), I’ve endeavoured into the city. In Osaka you have to look closely to find anything that qualifies for old history, its mostly concrete and advertisements – quite different from my last city visit to Berlin, where you have historical sites all over the place. Tucked away between highways and skyscrapers you’ll find the impenetrable Osaka Castle – a fortress built to withstand every invasion, with massive 20m stone-walls and several defensive rings.

I found it interesting that you can find lots of references to Japans “golden ages” in the middle of the last millenium, but will rarely come across a mention of the second world war. You certainly would expect some information in the Osaka Museum of History, a skyscraper with 9 floors space. The only reference I could find was a map of the fire-bombings by the US in 1945, accompanied with about three sentences of indecipherable kanji (english translations at tourist attractions are a bit sparse) (turns out there’s a Peace Centre tucked away somewhere). Second day was dedicated to the more modern aspects of japanese lifestyle: eating and gadget-hunting! Both not an easy task if you don’t understand the most basic descriptions in kanji (the japanese character-set). I’ve made it a bit of a hobby to guess what products are advertised on the subway billboards (shows you how much graphic design is still dependent on context/textual information). For eating, it really helped that most restaurants have a (scaringly lifelike) plastic-representation of all meals in a showcase – its just a matter of pointing at the right stuff.

So after two days of pretty mild culture-clashes and lots of new impressions, I was finding myself back on the airport (with 1.7km the longest terminal on the planet). Now, after mostly being the only non-Japanese person wherever I went (Japan only has 2% foreigners) halfway across both my known ends of the world, I didn’t particularly watch out for a lot of familiar faces. You can imagine my surprise when I met Conor in my boarding-lounge (he’s been a client of Silverstripe and we quickly made friends). Actually he was on the same plane, sitting two rows in front of me on the same seat-position – what are the odds?! (being a math-looser, I won’t be able to give you an accurate answer to this…). After another 12h of flight I was finally back in New Zealand last Saturday, and basically went right back to my “old life” (welcome drinks on the weekends, starting work on Mondays). All feeling a bit like a strange deja-vú at the moment, but I’m really enjoying to be back!

More Photos on flickr

Nov 7, 2007

I’m about to produce 9t of CO2 emissions

Leaving Germany next week for more exciting work at Silverstripe in New Zealand, I’m researching about my travel. With Web 2.0 and buzzword power of course.

At first i tried a web-app for planning my itinary: just send your flight-confirmation-emails to tripit, and they provide you with a nice printable travel-plan (with weather/maps/directions etc.). Unfortunately it didn’t accept the format of my booking agency, so no dice here (manual entry is way too tedious). Very handy tool for US-based travellers though!

Then I looked up info about my 2-day stopover in Osaka/Japan on Wikitravel – an incredibly useful resource, one of the best use-cases of a wiki that i’ve seen so far. Seatguru provided me with a nice schematic view of the A340-600 that I’ll be taking there, showing bad seatings and wing-positions.

I had a discussion with my family the other day, about me being so eco-friendly by not commuting by car down in Wellington. They argued that I produce my year’s worth of carbon-emissions just by taking the plane down to NZ – which I couldn’t believe. Turns out it is true: The TerraPass website calculated that I spend 8,958t of CO~2~ on my 92,538km travel (roundtrip with several stopovers). I first thought this was the total emissions for all 340 passengers, but heck no, thats only my little contribution. The specifications for an A340-600 show that it can take up to 200,000 litres of fuel (how on earth does that thing even take off?!).

I could go carbon neutral by donating around $65 to planting new trees, according to TerraPass. Thats quite a bit of money, especially if you think how much good this amount could do in charity. I’m thinking about factoring it into the travel expenses though (which everybody should be forced to do anyway – see the Ökosteuer (economic tax) in Germany).

In Germany, lots of people even do short flights to Paris/Mailand/Stockholm for shopping costing €10 (made possible by cheapo airlines and EU-subventions). Definetly puts some perspective on being so “global”, and travelling across the world. Another argument for telecommuting/teleconferencing…

Oct 25, 2007

The €2 Laptop Stand


Update (04/10/2007): This article has been lifehacked. Thanks for all your comments!

Being a programmer, I crouch in front of computers a lot – obviously you want to avoid being a cripple with 30 and get an ergonomic workplace. Usually this means having a separately adjustable keyboard and screen in addition to my Macbook Pro. Currently i don’t have this luxury, so I came up with a really simple laptop stand to rise the screen-height and have a more relaxed wrist position.

This has been done before (a lot). Some of them are just clumsy, look bad, or can’t be applied to Apple laptops because of the limited bending-angle of their screens. I’m suprised nobody looked at the obvious, and constructed a stand from a ring-binder. Its very cheap, easy to build, portable, and in addition contains most of the clutter i need on my desk (post-its, pen, my two external drives). You can even bundle any cables through the metal hole present in most binders. And most important: It perfectly fits the color of my laptop! *g

What you need

  1. A stable ring binder, optimally with the latch not sticking out of the top to prevent scratches
  2. 40cm aluminium rail (0.5mm thick, 1.5cm depth/height), normally used for securing edges, its available in every utility store
  3. 40×1cm felt or fabric, to prevent scratches
  4. Double-sided adhesive tape
  5. Two small metal clamps, normally used for securing letters
  6. Optional: Some black anti-slide mat to cover the ring binder


  1. Cut the aluminium rail to the length of the ring binder with a metal saw
  2. Round the cutting edges
  3. Place adhesive tape on one inner side of the rail
  4. Drill two holes towards the sides big enough to hold the metal clamps
  5. Fit rail to one edge of the ring binder
  6. Drill holes through the binder as well, and secure them with the metal clamps
  7. Fit the strip of felt on the other inner side of the rail (which will hold the laptop)
  8. Secure the sides of the clamps facing the laptop-bottom with tape to avoid scratches


If your laptop-bottom tends to heat up with high CPU-usage, a paper-based ring binder might pose a fire hazard. Consider using an aluminium binder, leave some room for ventilation, or cut venting-holes into the binder top.


image image image image image

Oct 3, 2007

Tags english gtd

Copyright © 2013 Ingo Schommer