Monthly Archives: July 2008

Burning the feed

I’ve moved my RSS feed over to Feedburner. For those of you who are subscribing, I’ve done my best to add redirection to the HTTP response from Community Server so that you don’t need to update the URL (keeping my fingers crossed).

The new URL for my feed is :

Silverlight 2 – texturemapping

I’ve been quite busy the last week working on the Balder engine. I’ve focused my energy on improving the rendering pipeline, both for functionality and speed and have managed to overhaul it quite a bit. In addition, texturemapping is becoming a fact. Thanks to Whizzkid for pointing out problems that was in the Matrix class in version 1.1 that was now fixed and to this article by Florian Kruesch

You can have a look at a very crude sample here with a lot of bugs in it due to heavy refactoring. I’ve decreased the framerate of the sample by purpose, I’ll be working to improve the samples as well as improving the engine and its features the next couple of weeks. All sourcecode will as always be checked in and available at the Balder Codeplex project.


Environment aware development

I must warn you, this post might contain ramblings of a mad man.. 🙂

I’m not going to debate wether or not we have a problem with regards to the environment, but one thing is for sure, we can all become better consumers and consume less. We, and then I mean everyone not only developers, tend to consume more than we need. For instance, when going into a meeting, everyone grabs a pen and some paper in case they want to make notes. Most of us don’t write any thing sensible, we doodle crazy drawings, play tic-tac-toe with ourselves or other participants of the meeting. On occasion we make a note of something and in many cases we don’t look at the note anymore. Of-course this is generalizing and hopefully not everyone does this, but I think a lot do. A better way would be to let one person take notes of the entire meeting, on a laptop even, and distribute this afterwards – digitally. I also see a lot of people printing emails and walking into someone’s office with the printout to discuss the content. There is something called the forward button. 🙂

One thing that would probably give even better results, would be to put your computer in sleep mode when you leave work for the day and have a scheduled task that wakes it up right before you get to work again (Vista only – read Sarah Perez’ recipe here). This is a pretty good option if you don’t want to shutdown completely. Going into sleep, all your applications are sleeping as well. When it’s waking up, everything is just the way you left it.

Now, what can we as developers do to be more environment aware? I know this is at best provocative for some; Write optimal code. Imagine if all the code all developers wrote was written to execute optimally on the processor and didn’t use more memory than it actually needed, then 640KB would actually be enough, just kidding. In fact, I think there could actually be an environmental upside if one were to start considering optimal code as a feature. We wouldn’t need all that RAM in our computers, for one. We wouldn’t need to scale into clusters or increase cluster sizes as often, which would lead to less hardware.  Most computer hardware is manufactured in Asia, they use a lot of coal to generate power there that the factories use, coal produce CO2 and is not cleaned as with modern coal plants. After manufacturing they need to package it. Products like RAM are often put inside plastic containers and these are then placed in larger cardboard boxes. After its been packaged, it needs to be shipped. This is usually done by boat, which has a CO2 footprint attached to it.

There are of-course economical consequences if people don’t need all that RAM anymore and RAM prices would go up. Other consequences such as they wouldn’t need all the factory workers, seeing that demand would go down. And most likely a bunch of other consequences. But still, it’s an interesting thought I think.

What do I mean by writing optimal code? Should everyone start writing native assembly language? That would be cool. Time to market would end up at a ten-fold of what we’re able to do today. This is probably not the solution. I think the solution lies within a couple of things. Writing optimal code does not necessarily mean that you’re going to spend a lot of time doing just that, but being aware of a couple of things might help you out and understand the platform the code is running on. With the knowledge of how the execution environment works and how the platform works, the developer has the power to improve their code from the first line one writes. In addition to this, one could use profilers to find bottlenecks in the code. Companies are too focused on getting stuff out the door as fast as possible that for instance the speed of a solution is often compromised. I think it is very important that when planning a project, one includes speed as a feature. Almost every user story/Scenario/Product backlog item should have a QOS (Quality of Service – MSF Agile terminology) attached to it stating the performance requirements. The same goes for memory consumption. Too often we see that developers use caching to overcome speed issues, resulting in heavy memory usage. I think that in many cases the speed issue could have been solved at a lower level if the developers had the time and resources (money) to do it. So in many ways, management and marketing must be willing to give the developers more time or cut back on the feature list and be willing to let the developers have speed as required feature. After all, the customers will be happier with a more responsive solution.

I realize that I’m not exactly going to change the world by posting this. I’ll probably just piss someone off instead, or be completely written off as an fool or something. But it’s a risk I’m willing to take. :) 

On a side-note, very much related though; I’m looking forward to the Performance by design using the .net framework that is one of the sessions for the pre-conference at PDC this year.


Have a nice weekend everyone. If I’m not put in a straightjacket during the course of the weekend, I’ll probably post something next week. 🙂

NNUG Bergen in August

August is traditionally the startup month after the summer for NNUG activities and NNUG Bergen has really put together a killer evening as a startup for the fall.

On the 29th of August, they’re having the most impressive lineup in NNUGs history (as far as I know). Dan North from ThoughtWorks and Christian Weyer from Thinktecture are coming.

Keep up the good work guys!!


Read more about it over at Jon Tørresdals’ blog.

What programmer personality are you?

I’m always eager to know who actually reads my blog, whenever someone leaves me a comment I go straight to find out if the person has a blog. Stefaan Rillaert left me a comment and he had a blog and his latest posting made me curious. It was a link to a test that apparently will reveal what kind of programmer you are.

I became the following.



You’ll find the test here. And of-course we put our complete faith in these tests. :)  Actually, I think my result came out pretty good. It is at least how I see myself.

SlotMachine for Silverlight 2 beta 2

Finally managed to fix the 2D parts of the Balder engine and also the SlotMachine game I entered the European Silverlight Challenge with earlier. There are so many breaking changes between the versions of Silverlight that I see now that I need to rewrite quite a bit of my projects. You can find the game here.


Silverlight 3D Engine : Balder – Finally up and running on SL 2 Beta 2

UPDATE 8th of July 2010 : is out – read more here.

UPDATE, 12th of February 2010, Balder is out, take a look at the sample browser here – read more about the new features here.


I’ve been swamped with work the last 6 months and haven’t had time to do any Silverlight stuff, but now I’m bouncing back and have started to get all my projects up and running again on SL 2 Beta 2.

First off is the 3D engine I started on last year; Balder. I’ve got a couple of issues I need to solve, but it is basically working again, have a look here. You might find quite jerky at the moment, I need to alter the entire rendering pipeline as it was originally optimized for Silverlight 1.1 back in the days :). Quite a lot of water has gone under the bridge since then.

Registering XAP MIME type in IIS 6.0

I’m still running Windows 2003 and IIS 6.0 on my server and needed to register XAP as a global MIME type for my server, seeing that I will be publishing a bit of Silverlight bits now and then. I’ve only come across IIS 7.0 guides for this, so I thought I’d share how to do this in IIS 6.0.

Open up IIS Manager (mmc %systemroot%system32inetsrviis.msc). Right click the computer name an select properties.


Click the MIME types:


Click new and type in the following:


Then you will probably need to reset IIS (run->iisreset or right click computer->All Tasks->Restart IIS).

Now you can deploy your Silverlight 2 XAP application to IIS 6.0.

Where is my Silverlight 2 help in Visual Studio help ?

If you’re like me, you skip all readme files when installing something new and start hacking away instead. In most cases this works out fine, but every so often I would probably be better off just reading the readme or any other documents that came with the software I installed. Anyhow, this was also the case when I installed the latest Silverlight 2 Beta 2 SDK. There was a lot of broken changes between beta 1 and beta 2 and I wanted to update all my Silverlight projects and republish them on my blog, but ran into a couple of cases I’d like to read more about in the documentation, only to find out that the documentation was not where I expected it to be; in my MS-help, like all the other help collections I’ve got installed. Well, to make a long story short, here’s the recipe:

Open MS-help from VS2008 choosing Index. Type in Collection Manager :


Then select Help. You’ll get a nice page you can start selecting what collections to enable or not:


Select your collections, such as the Silverlight 2 SDK Documentation.

2D Animation Content Pipeline

During my stay in Turkey for the Xna workshop I created a simple content importer that makes it easier to work with 2D animations. Very often you see people use spritesheets as the solution for animating 2D, which is of course not a bad way, it is a very optimal way to do things. I’ve always liked the simplicity of working with single frames, at least while I’m working on a solution, that way I can easily change stuff around. The content importer I created works with a simple Xml file (in fact just a serialized version of an object called SpriteAnimation), in this Xml file you can specify a base assetname as a format string, and you specify how many frames there are in the animation. The assetname must include the asset path as well.

The SpriteAnimation class is the one to use, it is also found in the content pipeline project, not exactly best practice. But it works for the demonstration purpose it was intended. 🙂

Using it is very simple:


In your draw method call the animations draw method with the spritebatch to draw into.


You can dowload the project from here.