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

Sunday, January 4, 2009

Fun with card games

I just published one of my holiday pet projects on Codeplex. It's a very basic framework for building your own card games in .net.

With time, I'll also publish some sample projects, and hopefully even expand the project to include some basic AI logic as well.

Check it out: http://www.codeplex.com/CardGameLib

Even though it's still missing a lot of parts, I've already begun to use it for 2 other pet projects. One is a code competition I plan to put out soon - just looking for price-sponsors now, the other is a web-edition of the classic 500-Rummy card game, a game that I really enjoyed growing up - and still play when I'm vacationing with my family. Card games are an excellent form of entertainment - and remember, there's more than poker and blackjack to life.

Drop me a line - or leave a comment, if you want to contribute to the project, sponsor a price for the upcoming code-competition or just have an opinion to share :-)

WikiX - a Wiki for EPiServer CMS

Just before Christmas I was part of a team that launched WikiX an Open Source Wiki for EPiServer CMS 5 R2. Even though it's still in beta, it is actually really nice with a lot of cool features. WikiX is based on some of the thoughts and ideas presented here: http://allantech.blogspot.com/2008/10/wiki-vs-cms-difference-is-psychological.html.

wikix

See the announcement: http://labs.episerver.com/en/Blogs/Allan/Dates/112230/12/Announcement-WikiX-is-here/

Try it live here: http://wiki.demo.episerver.com/

Download it from Codeplex:http://www.codeplex.com/EPiServerWiki

Connect4 in Flash


Inspired by Giorgio Sardo who used my old Connect4 code to demonstrate moving a c# game to Silverlight for Mobile (when will you put that code online, Giorgio?) in a PDC 2008 session, I decided to use the same code as the basis of a project I had to do for a flash course last year.

This time, I didn't migrate all of the code, but rather made the flash talk to a back-end c# web service that calculated computer moves.

I know it's still a bit buggy - but some of you out there might enjoy it. While making it I found what could seem like a bug in ActionScript 3 - making it quite difficult to drag and drop nested objects....But I might share more about that later.


Try the original plain html here.

Try the new flash version here.

Code and written project will be available later.