PHP: Multiple DNS Queries Using fopen

Whilst working on some inherited PHP code that used fopen I noticed an interesting comment in the PHP manual which pointed out that fopen always makes a DNS lookup for every request. Taking the following code as an example: <?php $handle = fopen("http://muffinresearch.co.uk/robots.txt", "r"…

VirtualBox: Error: Cannot register the hard disk

If when cloning VirtualBox VMs you get an error like this: $ VBoxManage clonehd WinXP-IE7.vdi WinXP-IE8.vdi VirtualBox Command Line Management Interface Version 2.2.4 (C) 2005-2009 Sun Microsystems, Inc. All rights reserved. ERROR: Cannot register the hard disk '/home/scol/.VirtualBox/VDI/WinXP-IE7.vdi' with UUID {3858b1b1-c306-4505-8264-235af812f337}…

Project Fondue Blog

Last weekend I was in Paris with Cyril and Ed spending some time on Project Fondue Projects. One of the things we got done was putting out the initial iteration of the Project Fondue Blog. This is based on Pocoo's Zine which we've really enjoyed using. The only downside so…

BASH: Using brace expansion

There's a nice feature of BASH which is to use a comma delimited list of strings inside of curly braces to reduce the amount of typing: here's an example of using brace expansion to create log files for apache: sudo touch {access,error}.log Something seen less often is a…

vim: automatically highlight long lines

This .vimrc snippet highlights lines when you exceed 77 columns - this is especially useful if you are trying to adhere to PEP8 with Python development. The if statement makes this work for older vims as well as more recent versions which is handy if you put your .vimrc on…

Bash: turn on case-insensitive tab completion

I always forget this one, but it's dead handy as it allows you to type "py" hit tab and it will auto complete for "Python" or "python" for example. Without this setting you'd have to type explicitly what you want. To enable run: echo…

Running VMware images under VirtualBox

I use the excellent VirtualBox on Ubuntu but I had a specific Debian dev environment VM that I'd previously run under VMware Fusion on my work mac when it used to have OSX on it ;-). The current versions of VirtualBox (2.2.4 in my case) support running vmdk…

Ubuntu: Turn off changing workspace with mouse wheel

I found the changing with the workspace with the mouse wheel really annoying. To disable it go to System → Preferences → CompizConfig (available if the compizconfig-settings-manager package is installed) and uncheck "Viewport Switcher" which is under the "Desktop" heading.…