June 14, 2009 at 12:00am
Notes
Direct links to all DevDays’09 videos
I’ve created a list of direct links to the videos taken at the DevDays’09 in The Hague. The list was created by parsing the devdays session timeline. Unfortunately Silverlight is needed to watch the videos, and many videos are still not uploaded
Thursday
Friday
Many of these videos can be downloaded from Channel9 in multiple formats
April 20, 2009 at 12:00am
Notes
Greyscale Tweetie for Mac menubar icons
Tweetie for Mac has been released, a Twitter client with a simple, but still feature rich, user-interface.
Unfortunately the menubar icon uses a glowing blue icon to indicate new Twitter messages.

I’ve changed both icons to be greyscale and made them less heavy by making them an outline of the Tweetie dock icon. I’ve also added one pixel to their height to make it align better vertically.

Download the zip file containing both icon, copy them to
/Applications/Tweetie.app/Contents/Resources
and restart Tweetie to use these icons yourself.
April 18, 2009 at 12:00am
Notes
Introducing www.sofinummer.com
In the first days of january Dreamhost ran a promotion where one could get two years of hosting for about 20 dollars on which I acted. As part of this package came a free one year .com registration. I used it to registrer www.sofinummer.com on which I intended to implement a tiny web application that can be used to generate and validate BSN/sofinummers
I have tried to keep the site as simple as possible. It shows an oversized text input field that is used for both validating and generating numbers and a message box that shows if the input field contains a correct sofinummer. After generating a number the contents of the input field are selected for easy copy/pasting.
Initially I wanted to use Ruby and learn a little about Sinatra and Haml. When I found out that deploying was quite hard I decided to rewrite it in Javascript.
The javascript has been split in two scripts. The first handles the user-interface and uses jQuery to add some event handlers and to show/hide the message boxes. The second script handles validating and generating numbers. I’ve implemented generating numbers by simply taking a random number, validating it and retrying if incorrect. In modern browsers Javascript is fast enough to make a few tries before arriving at a correct number and this has the advantage that the code is kept simple and that the numbers aren’t pulled from a skewed distribution.
I’ve used TDD and QUnit when creating the second script, and the test suite has really saved me a lot of times. To test the user-interface I’m thinking of using Selenium as I want to get some knowledge of it.
As dutch bankaccount numbers use almost the same check I’ve also registered www.banknummer.com to check bankaccount numbers that are 9 decimals large. Perhaps one day I’ll extend this to bankaccount numbers that are 10 decimals large, or to SEPA numbers
April 1, 2009 at 12:00am
Notes
Grayscale Little Snitch Network Monitor
A great tool for Mac OS X is Little Snitch. It’s a tool that monitors all your applications network activity and lets you create rules to allow/disallow certain network activity.
It comes with a small menubar application, Little Snitch Network Monitor, that shows the current network activity. The menubar icon uses red and green bars to show the amount of download and upload. This choice of color conflicts with Mac OS X Leopards system wide use of grayscale menubar icons.
I’ve changed the tiff files used by Little Snitch Network Monitor to grayscale pictures to make it more inline with the rest of my menubar icons. To do this yourself copy the files from the zip-file into /Library/Little Snitch/Little Snitch Network Monitor.app/Contents/Resources.
February 4, 2009 at 12:00am
2 notes
How to create a md5sum of a partial part of a file
At home I have a NAS that holds all my media files. Next to residing on my NAS these files are also backed up to dvd. To be able to move these files around while also changing their filenames I needed an way to fingerprint these files.
As I only needed the fingerprint to match files to each other, not to validate their contents, and as the files reside on an external disk I though that using md5sum would be too much. So I’ve created a small shell script that creates a fingerprint using only the first megabyte of a file.
The script md5sum_partial:
!/bin/sh
FILE=”$1”
MD5=head -c 1M "$FILE" | md5sum | sed -e 's/ -//'
echo “$MD5 $FILE”
To recursively run it on an entire directory and send the output the STDOUT run
find . -type f -print0 |xargs -0 -IF md5sum_partial F
February 2, 2009 at 12:00am
0 notes
Restoring a corrupt iTunes library
After inserting an external hard drive yesterday, my iTunes library became corrupt. It apparently saw the external hard drive as the location of my music, something for which I indeed used the drive eons ago.
After disconnecting the drive I noticed that some newly added songs would not sync to my iPhone. I reconnected the external drive, checked the location of my music (which as I later found out is only updated after relaunching iTunes) and used the _File > Library > Consolidate _ . When I noticed that it was copying all my music to instead of from the external drive I canceled the process. And so I ended up with an iTunes library that thinks that my music is split between two disks even when all the music is still available in its original location.
I’ve quit iTunes and tried to fix iTunes library. iTunes keeps its music library in the file ~/Music/iTunes/iTunes Library and also exports it the XML file ~/Music/iTunes/iTunes Music Library.xml. iTunes directly uses ~/Music/iTunes/iTunes Library and will only reconstruct it from the XML file when this file is corrupt (if it’s simply deleted iTunes will start with an empty library).
First I’ve made a backup of ~/Music as these steps might make the problem even worse.
mv ~/Music/iTunes Music Library.xml ~/Music/iTunes Music Library.xml.backup
Corrupt the database by replacing it with some data, I suggest
echo ‘stupid iTunes’ > ~/Music/iTunes Library
Then replace all occurrences to the external hard drive with the original location. In my case the external hard drive lives at /Volumes/Music/Music and the original location was /Users/ckuijjer/Music
perl -pe ‘s@Volumes/Music@Users/ckuijjer@g’ ~/Music/iTunes Music Library.xml.backup > ~/Music/iTunes Music Library.xml
Start iTunes and wait for it to import the XML file
Now lets see if all my iPhone applications are still there and that it still syncs with my iPhone. Also updating Time Machine as I had it configured to skip ~/Music. Changing that to skip ~/Music/iTunes/iTunes Music, e.g. skip the music files itself, but please, please backup iTunes library.
October 19, 2008 at 12:00am
Notes
Moving a NTFS Windows XP installation to a new harddrive
This weekend I’ve been trying to move Esther her Windows XP installation from a NTFS partition to a new, larger harddrive.
Initially I tried doing this using a Clonezilla live CD, by letting Clonezilla create an image of each partition (the Windows XP installation, the rescue partition, etc.) to an USB drive. Restoring the images to the new harddrive failed because there appeared to be some bad sectors on the old harddrive.
After this I used SystemRescueCd to manually clone the Windows XP installation:
- Create an image of the Windows XP partition (in my case the 2nd partition, /dev/sda2) using
--rescue to ignore bad sectors: ntfsclone --rescue --save-image --output sda2.img /dev/sda2
- Replace the old harddrive with the new harddrive
- Recreate the partition table on the new harddrive. Apparently Windows will not (easily) boot if the partition number or starting sector is different. As the 1st partition was only 100 MB large, and Clonezilla already recreated the partition table, I’ll restore the image to the 2nd partition.
- Restore the image:
ntfsclone --restore-image /dev/sda2 sda2.img
- The bad sectors are also copied to the new harddrive, but do not exist there. Reset the bad sector list using:
ntfsinfo -i 8 /dev/sda2 and write down the “Allocated size” close to ‘$Bad’
ntfstruncate /dev/sda2 8 0x80 '$Bad' 0
ntfstruncate /dev/sda2 8 0x80 '$Bad' "Allocated size"
- Reboot into Windows and check the harddrive for bad sectors (by right-clicking on the harddrive, Settings, TODO
- Reboot into SystemRescueCd
- Resize the partition to cover the rest of the harddrive
- Start fdisk:
fdisk /dev/sda
- Set the display units from cylinders to sectors:
u [enter]
- Delete the partition (in my case the 2nd partition):
d [enter] 2 [enter]
- Recreate the partition:
n [enter] p [enter] 2 [enter]. By default the 1st sector is the 1st sector of the deleted partition, and the last sector the last sector on the disk, so [enter] [enter]
- Set the partition type to HPFS/NTFS:
t [enter] 2 [enter] 7 [enter]
- Set the 2nd partition active, so that it will be booted:
a [enter] 2 [enter]
- Write the partition to disk:
w [enter] and quit: q [enter]
- Resize the filesystem to fill the enlarged partition (by default the filesystem gets resized to the entire partition):
ntfsresize /dev/sda2
- Boot into Windows
October 6, 2008 at 12:00am
Notes
Moving from Google Reader back to NetNewsWire
On my daily commute I pass some spots where my iPhones reception is flaky at best. As this leads me to staring into the void of Google Reader trying to fetch some articles, I really want to use a feed reader that downloads articles in advance. Next to this I didn’t really like Google Readers interface on the iPhone (too much unnecessary links on the frontpage and the fixed viewport makes long lines of code to be cut off) and can’t seem to recall why I left NetNewsWire in the first place.
When comparing Google Readers OPML export to an old OPML export from NetNewsWire I noticed that quite a few feeds appeared in only one of the two exports. After googling for a way create an union out of more than one OPML file, and contemplating to make one myself using the XML::OPML CPAN module I settled for the following workflow to find get the feeds unique to Google Readers OPML export
Creating an OPML export out of Google Reader can be done in Settings and then Import/Export
In TextMate
- Apply a regular expression replace to both OPML files. Replace
.*xmlUrl="(.*?)".*|.* with $1
- Use the Filter through Command
sort|uniq on both files and save them
- Select both files in the Project Drawer and apply a diff to the selected files
- To only keep feeds unique to the first OPML file use the Filter through Command
grep '^-'
- Apply a regular expression replace replacing
^(.*)$ with <outline xmlUrl="$1" />
- Add
<opml version="1.0"><body> to the begin and <body/><opml/> to the end of the file and save the file
- Import the OPML file in NetNewsWire and refresh all subscriptions
Now lets hope that the web interface to NewsGator is as nice as Google Reader
Edit: Hmm, just thought that I could also do this by importing my old NetNewsWire OPML, replacing the NewsGator subscriptions with NetNewsWire, removing all subscriptions from NetNewsWire and then importing Google Readers OPML and merging NetNewsWire and NewsGator. But where is the fun in that :)
Googling for my domain name
While googling for www.kuijjer.com I found out that the Did you mean result gives a lot of insight in Googles pervasive knowledge. It even has knowledge of my family relations and shows the last name of my mother :) 
Adding Google Analytics to DotClear
To add the JavaScript needed by Google Analytics to DotClear I simply added a text widget using the Presentation widgets menu option.
Keeping the Title empty makes the script appear invisible, and dechecking the Home page only checkbox adds the script to every page.

2.