Bash control structures have redirection too

I found out a useful thing today. You can redirect output of bash control structures as well. Typically useful for for loops, which would need a buffer of some kind otherwise to have it’s output sorted, for example.

Read More »

Posted in Linux & BSD | Tagged , , | 1 Response

Binding keyboard volume buttons to mixer control

Here’s how to bind your specific buttons (such as + and – controls for volume and the mute button) to controlling your mixer in openbox. Open your ~/.config/openbox/rc.xml in your favorite editor. Also open a terminal window. In the terminal window start xev to find out what keys you are pressing: Read More »

Posted in Linux & BSD | Tagged , | Leave a comment

Raising windows in stead of opening new ones

This is a pretty useful utility script for EWMH-compliant window managers, such as openbox. Since I use my terminal a lot, I don’t want to get stuck with 500 terminal windows at the end of the day because of all the terminal shortcuts (W+T) I used. So, let’s add a modifier to the shortcut to open new ones, and use the following script to open the first you opened. Read More »

Posted in Linux & BSD | Tagged , | Leave a comment

NginX for Apache users

Since some time now, I’ve been using NginX as a local development web server. After numerous years of Apache, the configuration of NginX needs some getting used to, but in the end, it is a lot easier and more flexible. Here are a few mappings to get you started if you’re used to Apache.

Read More »

Posted in Linux & BSD | Tagged , , | 1 Response

How to restore grub with a live CD

I borked my primary boot device’s grub installation last week because I wanted to start Windows 7 to play some LAN games. Windows 7 wouldn’t boot from grub, so I thought I’d install a new grub version. I reinstalled grub before regenerating the config file and rebooted. Too bad the Arch packages don’t handle that for you, as I was used to in Debian. This caused the grub to fail booting both Windows and Arch, so I resorted to changing my primary boot device in the BIOS.

Now, one week later, I decided to fix it, and as I can never recall by heart what the steps to take are, here’s a recipe, pretty much for my own convenience.

Read More »

Posted in Linux & BSD | Tagged , | 2 Responses

Unit testing and Drupal; what’s wrong with this picture?

I guess the guys at didn’t really understand the concept of unit testing. In comparison to the Zend Framework 1.13 and Symfony 1.4 test suites, of which some tests did not pass mainly due to some configuration issues (98.6% and 99.9% respectively), Drupal had some, let’s say, surprising results. Though it reported 100% of the tests to pass, 2 fatal errors occured. That might indicate expected fatal errors, but I doubt that. But the real surprising bit was that the tests took nearly 2 hours (!!) to finish.

Read More »

Posted in Development | Tagged , , | Leave a comment

Enhancing Python unit tests further with decorators

Decorators in Python are awesome. In follow-up to my previous post on a missing feature in Python’s unittest module in comparison to PHPUnit, here’s the implementation of PHPUnit’s @expectedException annotation in form of a Python decorator

Read More »

Posted in Development | Tagged , | 4 Responses

Endless scrolling based on a simple HTML pager

We had a little brainstorm today at work at how endless scrolling could be best implemented utilizing progressive enhancement. Here’s my idea and a proof of concept. And a good example of progressive enhancement in pure form, if I may say so.

The concept

When I think of endless scrolling, I see it as just another form of paging. Any content asynchronously loaded when scrolling down is in fact the same you would have seen when an ordinary pager was implemented, clicking on a link “next”. In practice, you don’t see the page change, the content is just loaded below the content already there.

Read More »

Posted in Development | Tagged , , | 5 Responses

PHPUnit style dataProvider in Python unit test

PHPUnit has a handy feature with which you can provide testdata to your tests. This is called a data provider, and is implemented by annotating a test with @dataProvider methodName. Python’s unittest module doesn’t seem to have such a feature.

Read More »

Posted in Development | Tagged , | 7 Responses

Introducing Spritzer: A CSS sprite generator

CSS sprites are pretty useful in web development. The general idea is you use one big image that contains all your icons and other interface-related images and use that image as a background for your HTML elements, shifting it’s position such that the right portion of the sprite is displayed.

This technique is becoming more and more popular, but the setting up of sprites can be a time consuming process. Spritzer is a little tool that can help you do the job so you have extra time for more fun things.

Read More »

Posted in Development | Tagged , , | 6 Responses