My Monitors are now armed…

When I bought my PC, I wanted a no-compromise Developer and Gaming workstation. In the past, I worked with 2 Monitors (best optimization ever!), but I found even two monitors too limiting at times, especially if I need Visual Studio, my application, a Web Browser, e-Mail and Twitter clients, some command windows, explorer windows and notepad instances running, not to mention some non-development related apps like iTunes.

So this time, I wanted three monitors. As I wanted to avoid two graphics cards (always gets crowded inside the PC, also as my graphics card needs to be good enough for high-end-gaming I didn’t want to run 2 different cards, but also not buy 2 $400+ cards…), I ended up buying a ATI Radeon 5870 which has 2 DVI, 1 HDMI and 1 DisplayPort connector and can drive 3 screens at a time. Well, in theory. I’m going to make another posting, but basically one of the three monitors has to be DisplayPort, 2x DVI and 1xHDMI will not work, and neither will the cheap Adapters – I’m currently waiting for my $100 DP->DVI Adapter to be delivered as I already have 3 Monitors.

But anyway, the problem with 3 big monitors is that they take up an insane amount of space on the desk. I bought a big desk, but still it’s too much. I remembered a posting from Jeff Atwood about monitor arms and thought I’d give them a try. I bought an Ergotron LX Dual Side-by-Side Arm (45-218-194) which holds two monitors, as long as they are max. 20 lbs/9.1 kg each (basically everything up to and including 24″ – if you weigh, remember to remove the foot before). The two monitors I’ve connected currently are Acer B233HUbmidhz – 23″, 16:9, 2048×1152.

The Ergotron arms are solid metal and certainly make a very sturdy impression. The users manual on the other side is IKEA-quality, that is barely understandable pictures instead of good explanations. Definitely take some time when you install them, it took me a bit more than an hour. The nice thing about the Ergotron arms is that you can either drill through your table or mount it using a clamp – no drilling! But make sure you have some space under your desk – I thought I had enough, but I underestimated the size of the clamp…

Luckily it still fit well enough to hold the screens, phew! It takes a little time adjusting them properly, because of the two parts of the arm (one can be removed) – prepare to move the clamp. As said, take your time. Oh, and another hint: There are two plastic caps that you put on the holder after installation to make it look nice. These caps are hard to remove, so installing them should be the very last thing you do, after mounting the monitors and adjusting them completely. Also, another important hint: You can (and need) adjust the strength of the spring that holds the monitor. Do not wonder if you just mounted your monitor and it’s weight drags the arm down – do not write an angry review on Amazon that makes you look bad, but look at the (as said, horrible) manual again (Step 7a) and tighten the screw. Last hint: Make sure your cables are long enough.

I’m definitely happy with it, removing the feet of the monitors makes the desk much more tidy in my opinion. For my third Monitor, I’m looking at the normal LX Arm.

Lawyer von Gravenreuth commits suicide…

Just got the news that Gรผnter Freiherr von Gravenreuth commited suicide last night. Non-German readers may not know him, so allow me to quickly give a breakdown why he was an important figure in the German computer “scene”.

During the 1980s, he put up advertisements in newspapers, posing as 15 year old Tanja Nolte-Berndel and asking to “share” software, only to sue responders for breach of copyright laws. In later years, he was active in some controversial lawsuits regarding brand copyrights for brands like “Explorer” (suing Microsoft and some newspapers for using the brand, even though to this day it’s not entirely clear if the claim was ever valid, the German patent office even deleted the entry for Explorer). Recently, he was found guilty of Fraud and sentenced to 14 months jail, which were supposed to start this month.

Needless to say, he was not a very popular figure, and that is as nice as I can say it.

But still, he made a name for himself and to this day, “Tanja” and “Gravenreuth” remain an insider under C-64 (and other 80’s computer) users. It is part of computer history in Germany now, so when I heard the news, my first thought was “Whoa”. It’s weird seeing something or someone who just seemed to be always there go away. Maybe it’s just a sign that I’m getting old (even though I’m only 26), maybe it’s just a sign that the 1980s and my childhood are really over.

While I can’t say that I’m crying, I’m also not cheering. I can’t say much good about him, except that he was part of the culture I grew up in and as such made an impact, and so there is a certain emptiness now. That and suicide is always a horrible way to make things end.

Goodbye, 1980’s.

Why is it so hard to list proper technical specifications?

I never read user manuals, because they are usually a waste of time. The main reasons for me to read user manuals is because I need to check something that is not listed in the technical specifications.

A few weeks back I ranted about TV manufacturers unable to properly list their Inputs/Outputs in the specs and how I have to read the user manual to find out if I really am able to use it. Weirdly, some companies are unable to provide a shot from the back and a user manual.

My current reason to rant is the Acer B233HU monitor. I bought it more or less blindly because it has a resolution of 2048×1152 and because it has an HDMI input that supports that resolution (my graphics card can drive 3 monitors, but only has 2 DVI Ports, so I needed a HDMI or Display Port Monitor). Now I’m realizing how much space my monitors take up on my desk, so I remembered Jeff Atwood posting about Monitor Arms some time ago.

Now, to buy a Monitor Arm, I need to know the proper measurements for VESA Mounts. There is 75x75mm, 100x100mm and some other sizes. For my Philips 240BW that’s no problem: Go to Philips website, look at specs, see that it’s 100x100mm. But my Acer Monitor? No information. I can guess or measure myself that it’s also 100x100mm (it is), but really, that belongs in the specs or the manual!

I think it’s astounding that they list stuff like what the pins of the DVI Port do (As it’s important for me to know that Pin 24 is DDC TMDS Clock-) but not what measurements their VESA Mount it.

Seriously, why is it so hard for companies to determine which specs are important and list them? Yes, I know that I belong to the minority of people who look at the specs and buy stuff that fits a need rather than just buying stuff because of bling-bling and advertising, but do you really need to constantly remind me of that fact? Can’t you just – at least sometimes – pretend that us engineers are still valued customers?

An Extension method to replace multiple Chars in a string

I needed a Sanitizer function for a project, which will replace chars in a string with other chars. To my dismay, I found that there is only a function to replace a single char or string. Of course, I could chain multiple string.Replace calls, but that creates a new string every time which can add quite a bit of overhead. So I’ve created a function that takes two Lists of chars and then replaces each occurrence of one char with another one. This also allowed me to implement a second function I was missing from string.Replace, the ability to remove chars (it’s possible if you use the string overloads, but not the char ones). The second List is of nullable char type, so just pass in null to remove a char.

public static string ReplaceMultiple(this string input,
                                     IDictionary<char,char?> replacements)
    var sb = new StringBuilder(input.Length);
    foreach (char c in input)
        if (!replacements.ContainsKey(c))
            char? replacement = replacements[c];
            if (replacement.HasValue)
    return sb.ToString();

Usage example:

public string SanitizeTitle(string title)
    // Replace space with _ and remove ? and :
    var replacements = new Dictionary<char, char?>
                               {' ', '_'},
                               {'?', null},
                               {':', null}
    return title.ReplaceMultiple(replacements);

Update: The previous version had two lists. When working with that, I found it rather stupid to keep two lists in sync (they need to have the same count, and the order needs to be correct). So this updated version uses a Dictionary instead, which also allowed me to remove the Exception.

Important caveat: Each character is only processed once, so if you replace a char and happen to have a replacement for the replacement, it will not be processed. Example:

public string ImportantCaveat()
    string input = "ABC!DE_FG";
    // Replace ! with _ and  _ with %
    var replacements = new Dictionary<char, char?>
                               {'!', '_'},
                               {'_', '%'}
    string output = input.ReplaceMultiple(replacements);
    // Output will be ABC_DE%FG and not ABC%DE%FG

JavaScript TimeSpan library updated to 1.1

I have polished the TimeSpan library a bit more. I ran it through JSLint to get the formatting right, and I changed it’s function names to follow the common practice in the JavaScript world. Also, there is now a Documentation with some examples.

Note that due to the naming changes, this is a breaking change.

Download it from GitHub.

JavaScript TimeSpan Library

Working with Time is always weird. Some functions want milliseconds, others want seconds. And if you want to express “3 hours” in milliseconds, usually the result looks like var targetTime = 3 * 60 * 60 * 1000; which is a bit ugly in my opinion. Also, I always have to remember what to actually add together ๐Ÿ™‚

As a .net Developer, I’m used to the useful System.TimeSpan and System.DateTime structs which have such useful features like AddHours or TotalMilliseconds to have a more natural way to work with Time.

I wrote a JavaScript library that mixes useful functionality from these two structs into “class”. Here is a quick example:

var ts = new TimeSpan();
alert(ts.TotalMilliseconds()); // Outputs 10800000

// There are also "static constructors":
var ts = TimeSpan.FromHours(3);
alert(ts.TotalMilliseconds()); // Outputs 10800000

There are also functions to Add/Subtract another TimeSpan and an Equals function to compare two TimeSpans. Note that there are two types of getters. There are the TotalSeconds/Hours/etc. functions that return a floating point number. And then there are the Seconds/Hours/etc. functions that return an Integer, but that only return a fraction of the TimeSpan that can be used to create a clock. This mirrors the behavior of the .net TimeSpan.


// TimeSpan for 3 Days, 2 Hours, 10 Minutes and 4 Seconds
var ts1 = new TimeSpan(0, 4, 10, 2, 3);
alert(ts1.TotalDays()); // 3.0903240740740743
alert(ts1.TotalHours()); // 74.16777777777777
alert(ts1.Hours()); // 2, not 74.
alert(ts1.Days()); // 3

I haven’t written Documentation or VSDoc comments yet, and there is no minified version either, but in the next days I’ll add them. In the meantime, Download it from GitHub. It is licensed under MIT license.

Why I think Internet Explorer is the best browser for JavaScript development…

I’ve started learning JavaScript in November 2009, so about 2 months ago. I am a WebForms developer in my Job, thanks to SharePoint, and I was fed up one day with static/postback-only user interfaces. I wanted to make them snappy, cool, Web 2.0โ„ข.

One of the things that kept me away from JavaScript in the past was the browser support hell. Every browser has little differences in it’s implementation, and even trivial operation often require an if-statement with 3+ branches to get the differences straightened out. Luckily, libraries like jQuery are available to abstract the whole mess away and give us a clean interface to interact with the browser. I am a big fan of abstractions as long as I know what I’m abstracting away, and jQuery is pure gold that allows me to focus on the actual application/user interface I’m building. After lerning about JavaScripts scoping rules (variables are available to the entire function – { and } do not create a new scope) I was finally able to understand, troubleshoot, and (hopefully) fix a bug in a third party library that I’m using – finally being in control feels great!

But, I have one issue, which is the JavaScript support in Chrome and Firefox. This is a controversial statement for sure, as pretty much everyone agrees that Firefox and Firebug is the de-facto standard for JavaScript development, which I would normally agree with – as good as the Web Developer Toolbar became in Internet Explorer 8, Firebug is still the nicer tool. But my problem with Firefox and Chrome is that they are too lenient about bad JavaScript.

I’m guessing that this is because most JavaScript on the web is simply broken, and throwing an error every time an error is occurs would seriously degrade browsing experience. So I’m guessing that just as with broken HTML, “modern” browsers try to fuzz and fix the JavaScript. One of the reasons XHTML failed was because it was too strict, and because browsers didn’t complain loud enough.

I had 3 hard to track down JavaScript errors. Well, hard to track down for me. In all three cases, the error was mine. An extra comma before a closing bracket, forgetting to close a bracket etc. Firefox worked flawlessly. Chrome had a subtle bug. The only browser that constantly does the right thing is Internet Explorer 8: It refuses to execute the JavaScript and throws an error instead.

Internet Explorer showing an Error

When developing, this is what I want. I want any errors to be reported. I want the application to crash hard. I want the browser equivalent of -Wall and -Werror. Granted, the Internet Explorer error messages are not that helpful as they only roughly outline what the problem is, but still they are useful enough to work with.

As a developer, I still care about my code. I try to write valid HTML, valid CSS and valid JavaScript whenever possible and at least know when I’m breaking the rules in the cases where valid code is not feasible. So any functionality that sweetens the experience for the end user by hiding errors is making the experience for the developer worse. I know that there are many advocates of loose standards and “just somehow automatically fix it”, but ultimately I think that standards exist for a reason and I’d like to at least know that I’m doing something wrong.

But then again, this is the Internet and I realize that design and content are much, much more important than code quality, and I agree that providing value to the customer is ultimately more important than having a solid code base. But still, please leave me my illusion that good code and web application are not mutually exclusive ๐Ÿ™‚

Beginning Debugging in VS2010 Episode 2: Advanced Breakpoints

This episode focuses on some advanced concepts with breakpoints, like conditions or exporting/importing them. We also look at the breakpoint window. After this episode, you should be able to use breakpoints more efficiently than just as on/off switches.

Okay, this took a little longer because of a broken Power Supply in my PC. Also, due to software problems, there are no titles, but I didn’t want to wait much longer. If you happen to know a proper Video Editing solution for Windows, please answer this SuperUser question ๐Ÿ™‚

Beginning Debugging in VS2010 Episode 2: Advanced Breakpoints from Michael Stum on Vimeo.

The source code for the demo application is available here.

Overview of all Episodes

Re-Thinking SWiki

Yesterday, I spent an hour setting up a Debian Linux VM to host a MediaWiki, which is now a 1.2 GB big folder in the /doc folder of a new project, checked into SVN. While I was doing that despite the utter stupidity behind it, I was remembering that I tried to create a better Wiki System a few months back with SWiki. Now SWiki is nice in theory, but I think I made some fundamentally wrong decisions in it’s scope and in the end, I didn’t want to use it myself for anything. So I was thinking again about what problem I tried to solve and what I want to achieve.

MediaWiki is a fantastic system, but it requires a LAMP Stack to really work, and the fact that all data is in a database doesn’t make it very Source Control friendly. So I really wanted to solve two different problems: I wanted all the data in the file system, so that it can be checked into source control and easily be shared by other people. So no database server. But to share it with other people, they need to be easily able to read the files. I did not want an application that digs deep into the system. Ideally, I do not want to require installation at all and leave no marks in the system.

So the original SWiki solved problem 1 by using a SQLite Database. There is nothing wrong with using a database as long as it’s 100% filesystem based. My attempt at Problem 2 was to host the Internet Explorer COM Object Microsoft exposes and feed it HTML. That way, I don’t even need a web server. But that attempt ultimately proved a failure. I could not do much of the rich formatting I wanted, even embedding images was impossible. At some point I questioned whether my use of HTML was correct, or if I shouldn’t just use RTF and embed stuff using OLE.

But my problem wasn’t the Markup part. I like the WikiPlex markup, and the library is clean and extensible. I really didn’t want to try using OLE/RTF as these technologies are not meant for human consumption. Also, I want to keep the ability to export the Wiki to HTML so that it can be hosted on a real web server if desired (e.g., the documentation section of a project).

So really, I need a Web Server. But I don’t need a particularly “good” one, especially because I do not want a large “footprint” in the network. Really, running a web server is a great way to trigger all sorts of security software across the entire company. But without a webserver, SWiki is simply not good. So I’ve started looking at the Cassini Web Server, which is conveniently open source under Ms-PL. This is a great server for many reasons. One, it’s 100% managed code, so it can be completely embedded in my app. But more importantly, it can be configured to only ever listen on local loopback, that is for IPv4 or ::1 for IPv6. This may still trigger some security software, but it seals off the application from the network, so no interruption should be caused in theory.

Overall, this is a good compromise. I gain the ability to turn SWiki into a full-blown application by simply bundling it with a lightweight web server and control utility, all while still being able to keep the data in a single file. So this is what I will do now. I haven’t decided if I keep SQLite as database or use SQL Compact due to it’s much better integration and if I’m able to offer an upgrade for databases between “SWiki old” and “SWiki new”. I haven’t even decided if I keep the name or change it, although the existence of another wiki by that name makes me want to change it.

The only thing I really have decided on is that it will support images and that it will still use WikiPlex as it’s parser, all while still requiring .net 3.5 and all while – at it’s core – still being a simple, standalone desktop wiki, although a little bit less simple than originally envisioned.