Wednesday, February 25, 2009

MaxSmash – Yet Another Babysmash application

My son, Maximilian (age 1½ years old), is (not unlike his father) a big fan of technology and computers. In fact, every time I open my laptop at home, he’ll notice, stop doing whatever it is he is doing and run to me, climb on my lap and start pounding the keyboard. While at the laptop, these are the things he prefers to do:

  1. Send messenger/skype messages to whomever I was talking to like this “lkhdsalnhjkdnnn vvvcccccccc……”
  2. Code in visual studio – unfortunately he hasn’t really grasped the entire “syntax” concept yet.
  3. Look at pictures of himself or other family members and yell out their name in an excited high pitch voice if he sees someone in the pictures he recognizes.
  4. Watch old russian cartoons on YouTube. At the moment his favorite is this:

To try to protect my computer, coding projects and messenger conversations I’ve been a big fan of Hanselmans Babysmash application that locks down the computer and lets a kid smash the keyboard all he wants – and see various figures, sounds and characters being displayed.

However, after a while Max started getting bored with it – so I’ve made my own that instead of characters and sounds simply display random pictures of people he knows. That’s a big hit at the moment.

All configuration (like setting up paths to image folders, cache-usage, etc) is done in an xml config file.

Once it’s running you have to hit ALT+F4 or CTRL+ALT+DEL to get out – everything else should be locked down.

Download it here

Comments are welcome!

Tuesday, February 24, 2009

Cool Tool: XDELTA

Yesterday, while trying to find a solution to a minor distribution problem I came across xdelta. It seems to be an awesome tool – just the way I like it: simple, fast, transparent and commandline based. It can find the difference between two binary files and store that compressed, and then later apply it as a patch. “Why is that neat?”, I hear you cry. Well – simple – now instead of storing a lot of really huge binary files where most of the contents is identical you can just store a source and then the different changes to that. Still don’t get it? Here’s the problem we’re going to solve with it.

Problem: X sales people located all around the world will get an external harddisk with a wmware image featuring all our amazing products for demo purposes. The problem arises whenever new versions of the image is created and needs to be distributed to all the sales people (probably going to happen several times a year). Not all internet connections are just as good for downloading 10gb files. Of course we could split it up, put it on an ftp-server or force everyone to install another of my favorite tools Free Download Manager. However, keeping our audience in mind, an automated solution would probably best.

Potential solution: On all the harddisks we put two images – a working copy they can use for demo’s and a virgin. Whenever we create a new version of the vmware image we’ll use xdelta to make a file containing all binary differences between the virgin image and the latest version – and at the same time compress the differences. We’ll do this using a command-line like this:

xdelta3.0u.x86-32.exe -e -5 -S djw -v -s "virgin-image-file" "newest-image-file" "difference-output-file"

The ‘-5’ indicates medium compression level, ‘-S djw’ is to turn on secondary compression, ‘-v’ is verbose mode – mostly because I’m a geek that likes to see what happens and ‘-s’ indicates the source file.
We can now let the sales people download the difference file together with a small batch-script that’ll apply the differences to their virgin-image and thereby recreating the latest version of the vmware image file using a syntax like this:

xdelta3.0u.x86-32.exe -d -s "virgin-image-file" "difference-file" "newest-image-file"

It tested it and it works. On a 9 GB image, I made some minor changes – like upgraded the EPiServer installed, removed old unused files, etc. That gave me a diff-file of 74 MB – which is a lot easier to download than 9 GB – and applying that file to a virgin image produced a new working image with the latest version installed :-)

Processing time on my laptop was around 800 seconds (< 15 min) for each action.

Enjoy