Swoosh! There it went, like a deadline passing by. The most useful feature of gmail labs, auto reply-all, has disappeared =/
Archive for the ‘Geek’ Category

Displaying XML in the .NET WebBrowser Control
October 17, 2006Internet Explorer displays XML in a pretty decent manner. Today I figured I would use the same engine to display XML in a .NET 2.0 application. So I dropped a WebBrowser control on to a form, and assigned my XML string to the DocumentText property. Voila? Of course not.
After some digging, I found that IE uses a built-in XSLT-transform to present XML as HTML in the browser. The stylesheet in question is available from the following uri in IE: res://msxml.dll/defaultss.xsl. Ok then, so one can just save this string, and use it in .NET? Not quite. As it turns out, the XSL that IE uses is not compatible with .NET’s XslCompiledTransform class. D’oh!
After some more digging, it turns out that Steve Muench has done the conversion to the XSLT 1.0 REC that .NET requires. Thanks, man! The file can be downloaded here.
I added the following code to my WebBrowser base class, to allow developers to display XML by setting a property:
public XmlDocument DocumentXml
{
set
{
Stream s = <defaultss.xsl from embedded resource file>
XmlReader xr = XmlReader.Create(s);
XslCompiledTransform xct = new XslCompiledTransform();
xct.Load(xr);
StringBuilder sb = new StringBuilder();
XmlWriter xw = XmlWriter.Create(sb);
xct.Transform(value, xw);
this.DocumentText = sb.ToString();
}
}
Turned out kind of neat in the end, huh?

O’ project, where art thou?
September 14, 2006If you have been using Visual Studio 2005 and data adapters in the designer, I bet the following error message have caused you quite a lot of grief:
“Could not retrieve the current project”
Some days ago, I found a solution that seems to work every time: select the data adapter in the designer, bring up its property page, edit the connection string, and then change it back again, and voila – the missing project is back! I suspect that it is not the connection string itself that does the magic, but rather that I am configuring some other component that probably is in a more “stable” state, and hence is able to restore whatever link that has been lost to the current project.

Iron to the people!
September 7, 2006That’s right, IronPython v1.0 has hit the streets. If you like your evenings dynamic, check it out!

Visual Studio 2005 Service Pack 1
July 25, 2006According to MS, it will now be released by September 2006 – about friggin time, if you ask me.
http://msdn.microsoft.com/vstudio/support/servicing/sp1_vs05/default.aspx

I – conflict resolver
July 25, 2006At times, Visual SourceSafe finds it best to upon checkin ask me: “have any conflicts in [file] been properly resolved?”. Now, how the #¤! am I supposed to know that, Mr. VSS? Oh, the horror!

Tempting as it is, pressing “Help” won’t help you out either…

Generic mindf*ck
July 17, 2006With the introduction (in .NET 2.0) of the System.Collections.Generic namespace, what are we now to call the, ehrm, generic collection classes of the v1.1 System.Collections namespace?

Matt does not like dynamic languages
July 17, 2006http://blogs.msdn.com/mattwar/archive/2006/04/28/585910.aspx
Even though his attempt at ridicule is clearly done with a humorous twist, he has some valid points – there does indeed seem to be some kind of a hype when it comes to dynamic languages these days. Now, don’t get me wrong, the freedom that a dynamic language can provide can at times be extremely empowering and productive (not to mention fun!), but for our current development project, I praise myself lucky that we went with a statically typed language (C#) every time I have to do a major refactoring, which happens more often than you might think…
Still, we are not totally without dynamics <g>. Some bits of the project are actually being written in IronPython, more on that later (maybe).