Daniel Hoelbling-Inzko talks about programming

imagineClub.at is now finally online

logo After almost 4 months of work I am pleased to announce that the new imagineClub Website is finally online at


You can read what this is all about here.

Besides the obvious design refresh the new website has numerous administrative improvements that allow us to more easily share information with members and also allow new members to join the fun since we are now able to unlock their accounts without having to hack SQL together.

As you may already know, the new website is also licensed as open-source software and the code is freely available from my GitHub Repository. Since we allow our users to use MSDN-AA the site internally uses my other open-source project elms-connector (source on GitHub) to connect up to the Microsoft servers.

And to take dogfooding to a new level, I already have a unpublished changeset that will make imagineClub.at use the dotlesscss project to improve the project's CSS.

You may have guessed by now that the whole site is completely built ontop of open-source frameworks. It is based on Castle MonoRail, running ontop of Castle ActiveRecord with some (but not deep) Castle Windsor integration.
In fact, I would have used Windsor more, but using the ActiveRecord pattern with all it's static goodness somehow limited the use of inversion of control.

I primarily chose Castle MonoRail due to the fact that I had come off a ASP.NET MVC project and wanted to learn another MVC framework besides the blue one. I can't say I'm sorry for that decision. MonoRail has proven itself to be a very mature and very extensible framework that supported me all the way to releasing the site. 
I do regret however chosing NVelocity as my viewengine, Spark seems to be the better choice at the moment and NVelocity is really awful when it comes to debugging problems.

Anyway: Thanks to all these great open-source projects that made this possible, and also a big thanks to Kristof who sponsored the new design!

imagineClub Website source has moved to GitHub

I have been using Mercurial as my SCM of choice for quite some time now, and I’ve been loving it ever since. Working with a DVCS is a pleasure compared to the slow and painful experience I see when using Subversion. Not that Subversion is a bad product, but my workflow is just totally different from what SVN was built for.

Having used git now a bit while helping Erik on the Less.Net project, I discovered that it feels a tad better workflow wise. I especially like it’s much better branching support and it’s support for shelving changes. Both things already in hg, but not as easy to use or only available through addons.

Another thing that made the switch tempting was the fact that it seems almost the whole .NET community decided to head over to GitHub to continue development. There are NHibernate forks, there are Castle forks etc etc.. Even Ayende moved there!

So I decided to follow the herd, being familiar with the tools the community uses is very important to me, so today I finally moved the imagineClub website source to GitHub.

Why finally? Well, I’ve been trying to for now 2 days and simply failed. Today i finally decided that it’s OK for me to loose all my history and to start a fresh repo with the existing code. The migration from hg to git seems to be so uncommon that there is a significant lack of tools for that.

There is the hg2git from the GitHub crew, that didn’t work for me. And there is a hg2git script inside fast-export that I couldn’t run on Windows. Although Zerok managed to convert it on his Mac machine, all the linefeeds were wrong and therefore the history was rendered useless. So I decided to quit trying and simply wipe the history, start from scratch and be done with it.

So, now the new home of the imagineClub source is located here:

Feel free to watch / fork the repo.

The fairy tale of binary blob fields

One of the main advantages students get from being members of imagineClub is that they get access to uploaded course materials through the website. Naturally, the new site has to support file upload and download somehow, and yesterday I started implementation of that feature.

In theory this sounds really simple, especially since the file upload in MonoRail is so trivial I figured it wouldn’t be a problem to implement.

One major thing to consider when designing a file upload feature is the question: Save to disk or save to database? Let’s look at the two options:

Save to disk:

Pro: Very easy
Con: Requires metadata to be kept in the database. Could go out of sync with the db. Requires backup. Requires special permissions.

Save to db:

Pro: Zero setup. Data all in one place, backup hugely simplified. Enforces data integrity
Con: Non-trivial implementation.

Now, I naturally went with the db option. Deployment is hugely facilitated if you don’t need to look at file permissions, and most hosters have databases backed up anyway. So things go south, the only thing I need to recover the site would be the database file.

Some searching revealed that binary data could be mapped to the database through AR quite easily:

[Property(ColumnType = "BinaryBlob", SqlType = "varbinary(MAX)")]
public byte[] BinaryData { get; set; }

Problem with that is that it crashed ALL of my database dependant unit-tests:

------------ System.Data.SQLite.SQLiteException : SQLite error
near "MAX": syntax error

Apparently SqlLite can’t figure out that MAX thing and will crash. Since it would accept a numeric value instead I looked at the SqlServer 2008 documentation for varbinary to find out what MAX would be. Turns out it’s exaclty 2147483647 (2^31-1), so my natural reaction was to change the SqlType to be exactly varbinary(2147483647) instead of MAX. Now SqlLite can interpret it and all tests run great again, but creating the schema on SqlServer isn’t possible any more due to the following (odd) error:

The size (2147483647) given to the column 'BinaryData' exceeds the maximum allowed for any data type (8000).

So, what we just saw is a leaky abstraction inside the ORM. But NHibernate never claimed to abstract the DB completely away from me, so we’ll not use that against it. NHibernate explicitly supports these scenarios and in a real NHibernate scenario it’s just a matter of having two different mapping files, one mapping to the appropriate SQLite datatype and the other mapping to the Sql2008 datatype that would be varbinary(MAX).
But, I’m not using NHibernate here, I’m using ActiveRecord that handles mapping through attributes on the data classes, and I’ve no intention of using #ifdef statements anywhere around my code.

The problem here is mainly that whenever you are trying to use two different RDBMS at once you are limiting yourself to the least common denominator, and you have to deal with that.

I won’t be able to use advanced Sql2008 features, and I also won’t be able to use anything fancy inside SQLite either.

The least common denominator in this case is the datatype IMAGE, something that Microsoft is discouraging people to do in their documentation:


This puts me in a delicate position since the imagineClub website is hosted on a server I don’t control. So I could just wake up one morning and seeing the iC website down because the hosting company decided to upgrade all users to 2010 (or whatever version the next SQL Server will have).

And I know, usually providers send out warning for stuff like this, but I doubt that through all the structural changes with imagineClub lately they even know where to send those warnings to.

So: Long story short, use image over varbinary(MAX) if you plan on doing in-memory SQLite testing, just keep in mind that your app will break when you upgrade to a newer version of SqlServer.

Update: Looks like Krzysztof Kozmic had the same issues and found a quite clever solution for that. I’m not totally clear on how to do this with ActiveRecord, but it’s a very pragmatic approach to a problem that seems to not have a perfect solution anyway.

ImagineClub Website: File upload/download works

Oh it’s been quiet for a very very long time around here imagineClub-wise. And I’m afraid to say that progress has been rather slow.

Well, today I finally around to implement file downloads/uploads and the file listing in the sidebar section. In all it’s glory it was nothing more than 10 lines of C# code and tons and tons of XHTML and CSS that I’d rather not go into.

Here are some screenshots of the current version:

 image image

It’s really rough around the edges and I will probably need to bring in a markdown editor to allow formatting when posting. I plan on stealing Ken Egozi’s Windows Live Writer integration for the news section, but when users upload files to the site they need to have some way of formatting their text.

Also I’ll look into Less.NET to manage my CSS because it is becoming very very verbose at the moment and restructuring it is just painful. This is mainly due to the fact that I want to keep the markup was ignorant to presentation as possible and as expressive as possible. All forms are built with accessibility in mind and are passing the webaim tests.

Next up on my list is a search/list option for uploaded files. Maybe improve the file organization a bit more and then start to write the ELMS integration to allows logged in users access to the MSDN-AA. Once we are done with the ELMS thing I’d dare to launch the site.

Dropping IE6

This one’s going to be quick. While doing the xhtml/css for the new iC-Website I decided that there will be no IE6 support. The site will be standards compliant and should pass W3C XHTML 1.0 strict validation.

The current markup already works quite well with absolutely no hacks/js-tricks to look like this:


Since IE8 renders this flawlessly (except for the rounded corners within the date), I see no real value in trying to make this check out in IE6. I’ve spent too much time on this already so in case you haven’t upgraded yet: Get IE8!

On a side note: I’m amazed how well IE8 renders the site. Everything I did so far worked perfectly on all 3 rendering engines without any problem. Thank god the dark days are over!

As always, you can follow the development on BitBucket. The site’s source code is available there. Feel free to comment on the markup :).

imagineClub Website feedback results

I hate web development, I learned to hate it when I was translating Photoshop designs into XHTML years ago and I was really hoping to never do it again.

Unfortunately, most people who took the iC Website design survey really liked the new design, so I decided to start working to get this thing done sometime soon. Here is the poll result:


Thanks again to all who participated!

So, where are we? First: I am developing the iC website in the open. The source code is available at the project’s BitBucket site, so if you want to see what progress has been made just follow the project’s commit history RSS.

Sadly, Currently the repository is more or less a blank MonoRail template while I am trying to get the XHTML to look like Kristof’s design. I am really trying hard to maintain a clean markup to enable accessibility to all users.

Unfortunately, my CSS skills are somewhat lacking, so I had to learn the hard way that background-position won’t work with background-repeat, and that there is no chance in hell we’ll ever support IE6.

I’m also not sure yet on what license the project should use. I slashed a APL2 license on it just to have one, but I guess we’ll drop that in favor of a CC license.

New imagineClub website design poll

I just got email from Kristof  with a raw draft of a new design for the imagineClub website I’m currently building. I’d really like to hear your feedback on this:


Update: Sorry I didn’t include any more background on the topic. imagineClub is a club that focuses on helping students at Klagenfurt University with their studies and enable them to easily access new Microsoft technology. I wrote a more complete article about the imagineClub some time ago.

Please take a few seconds to answer this little survey. It will help us reach a decision and improve the design:

My Photography business


dynamic css for .NET