November 2003 - Posts

For the SchoolServer project I needed to create Word documents which contain the login, initial password and root folder for each student, teacher and staff member (mail merge). Thanks to Office 2003 and the support for XML in Word it's now possible to create Word 2003 documents by transforming and XML data source (i.e. a DataSet object) using and XSLT stylesheet to a Word document. Really cool! Let's post some code:

XmlDocument doc=

new XmlDataDocument(persons);
XslTransform students =
students.Load(dir + "students.xsl");
XmlWriter oStudents =
XmlTextWriter(dir + "\\students.xml",Encoding.Default);

In here, the persons object is a dataset which contains all the data of the students. The output document is students.xml (dir is just the output directory of the mail merge), so it has the extension .xml instead of .doc. Now, how does the system know it's a word document? This is specified in the first part of the XSLT file:

<xsl:stylesheet version="1.0"
xmlns:w="" >
   < xsl:template match="/" >
      < xsl:processing-instruction name="mso-application">progid="Word.Document"< / xsl:processing-instruction >
      < w:wordDocument xmlns:w="" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:sl="" xmlns:aml="" xmlns:wx="" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" w:macrosPresent="no" w:embeddedObjPresent="no" w:ocxPresent="no" xml:space="preserve" >
         < w:docPr >
            < w:view w:val="print" / >
         < / w:docPr >
         < w:body >
            < wx:sect >
               < xsl:apply-templates / >
            < / wx:sect >
         < / w:body >
      < / w:wordDocument >
   < / xsl:template >

The xsl:processing-instruction part does the trick. This value is read by the Windows shell to determine the associated program for the xml file type. Of course your primary question is how to find this XML code with the , , magic tags? Well, that's very easy: open Word 2003 and save the document as an XML document. The only thing left you need to do is to create an XSLT file based on the generated XML file.

Welcome in the world of WordML! Enjoy it...

?> | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Lots of people joke that Microsoft products are useful only if those products are v3.0 or higher. Now, consider this idea which I made during my last ASP.NET presentation: ".NET is Microsoft v3.0". First there was DOS "Disk Operating System", a pure desktop oriented system on which the first v2.0 products, Windows 95, 98, Me, were built. Version 2.0 was all about GUIs with Windows 9x and networking with Windows NT "new technology". So, we were in a client-server environment. Today we're in version 3.0  - .NET - in which we have not only clients and servers but also the bridges between all those systems (server-server, client-server, client-client) with services based on open standards such as XML, SOAP, ... And I have the feeling (and a lot of people with me) that this is a great vision ... it's version 3.0, remember :-) | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

It's an exciting time to work with Microsoft products. My machine contains more alpha and beta than ever before. Let's give a short overview:


  • Windows codename "Longhorn" build 4051 (available on MSDN Universal and via the PDC)
  • Whidbey:
    • .NET Framework v1.2
    • ASP.NET v2.0 (I'll write some articles on ASP.NET v2.0 in Q1 next year, be sure to check out regularly)
    • Visual Studio .NET "Whidbey"
  • Visual SourceSafe 2004


  • Rosetta (SQL Server 2000 Reporting Services)
  • Windows Update v5.0 beta program (on betaplace)
  • BizTalk 2004

Gamma (new releases):

  • SMS 2003
  • Virtual PC
  • Windows Media Center Edition 2004 (running in Virtual PC)

Recent releases:

Waiting for:

I really believe in all those products and how those products fit together, as the pieces of the old Office-logo??? :-). Maybe this is the reason why the Office logo was replaced in Office 2003?

The best is yet to come! | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Whidbey will not only be the release of ASP.NET v2.0, the release of major improvements in the field of Web Services, and so on, it will be the release of C# 2.0 as well. C# 2.0 contains a lot of great new features which were only available to C++ developers today:

  • Generics: think of collections today, such as a queue, stack, list, map, etc. To make sure such collections can contain any possible element, all the methods (such as Pop and Push for a queue) work with the object type. However, this causes a lot of overhead since you'll need to cast retrieved elements back to their original type. Generics (which are much like the C++ templates) solve this problem by allowing the user of such a collection to specify the type of the elements which will be stored in the collection.

    Stack stack = new Stack();
    string s = (string) stack.Pop();

    Stack<string> stack = new Stack<string>();
    string s = stack.Pop();

    To make such a generic class take a look at this little example:
    public class Stack<T>

       public void Push(T item)
       public T Pop()

    Things such as multiple generic types are also possible (think of a LinkedList with two associated types, one as the value and one as the key):
    public class LinkedList<K,T>

    Make sure to read this article on MSDN:

    Other features which have to do with generics are:
    • generic constraints (allowing you to define a constraint on the 'associated types' of a generic type
    • inheritance of generic types
    • generic methods and generic delegates
  • Iterators
  • Anonymus methods/delegates
  • Partial classes

You can find the specifications in this document on As sneak preview on C# 2.0 in Whidbey can be downloaded here: | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

I've made the RSS stream available via my site on This is a place where I bring all those interesting streams together. Be sure to read my previous post on RSS as well on In this post I explain how easy it is to create an .aspx page which uses an .xslt style sheet and ASP.NET <asp:Xml> control to display an RSS | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Yesterday I was struggling around with some 3rd party tools which (untfortunately) causes my system to spit blue :(. Fortunately the registry was back upped by this tool, so I could restore it from another OS. That's where Windows PE comes into play. Thanks to Windows PE, I was able to restore my system without the need to install another OS parallel with my Windows Server 2003 installation. Great!!! | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Longhorn is the code name of the next release of the Microsoft Windows OS and is scheduled to go gold somewhere in 2005 (probably). Today, several great demo's and articles on Longhorn are already available around the net. I just installed installed Longhorn on my machine (build 4051) and it's pretty cool to mess around with the new .NET Framework base class library for Avalon, Indigo, etc. Avalon is the code-name for the new architecture of the graphical environment of the Windows OS based on another XML "format" called XAML. There's some great stuff around XAML on this site: The Longhorn SDK can be found on Today I tried a lot of things in Avalon which worked great (although being a very early beta). Make sure you watch the latest episode of MSDN TV on on Longhorn by Don Box (Indigo) and Chris Anderson (Avalon). Indigo is the name of a set of tools and technologies to extend the power of web services.

The sky is the limit :) | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Time for some non-sense blogging :-). Tonight I was watching tele on VRT - TV 1 (which is the first channel of the national Belgian television broadcasting company) to a tv programme called "Koppen" (in English this probably would be "Heads" or "Headlines"), not that interesting at all, but - you won't believe it - the credit titles were the most interesting part of the programme in fact. If you have the time to watch an episode of "Koppen" you should take a close look at the letters on the background of the credits. When you look with your best cat's eyes, you'll notice pieces of code, to be more precise VB, in the blurred background-text. Tonight I could distinguish the words "select case", on Thursday I'll see the "case"'s maybe? I guess it will take another 100 times to get the meaning of the code (maybe I can compile it :-)). Check it out! | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

We've started to debug and fine-tune the beta 2 release of the Microsoft SchoolServer solution. Last Friday this solution was presented at Vilvoorde for about 30 people; most of the attendees (from different companies and schools) were very excited about this product. Already looking forward to the beta 2 timeframe in which we'll introduce a lot of new features such as internet blocking. But first things first, let's make sure the beta 2 is worth the word "beta". We expect to ship beta 2 on November 17th.

Thanks to the whole team: Christian, Ritchie, Jan, Pieter, André, Hans, Bregt, ... (I hope I didn't forget somebody in the list :)) | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

I've been playing around with this exciting new feature of ASP.NET v2.0. It's really cool to see it working on my system :-). Let me give a short overview of how it works:

  • Almost everyone who has been working with ASP.NET v1.x in some professional way knows of the directive <%@ OutputCache ... %>. This is the way to activate caching in ASP.NET v1.x. What it does it very simple: it holds the (response HTML) result of an .aspx or .ascx for a specified time and in that timeframe every request made to the page or control is responded with this result. However, the problem is that the cached date can be invalid (for example, a price could be updated in the database)
  • In ASP.NET v2.0 there's a class called CacheDependency which can be used to create a dependency for a cache (today you have file-based invalidation support in ASP.NET v1.x)
  • On of those dependencies which are ready-to-run is the SqlCacheDependency which works with SQL Server 7, 2000 and Yukon:
    • Specify the cache dependency in the output cache directive, e.g. sqldependency="Database:Table"
    • In the web.config add a section <sqlCacheDependency> in <system.web><cache>:

            <sqlCacheDependency enabled="true" pollTime="10000">
                  <add name="Database" connectionStringName="Northwind" />
    • Furthermore there is a new section in web.config called <connectionString> in which you add the DSN to the database. The connectionStringName attribute for the cache dependency refers to such a DSN.
  • You can use the SqlCacheDependency class directly from within your code as well, which is not difficult at all.

SQL Server Yukon edition has a feature which interacts with http.sys of IIS 6.0 and higher to notify the webserver of updates (using a so-called Notification Delivery Service over port 80). However, in SQL Server 7 and 2000 you must extend your database using one of the tools in the new .NET Framework "Whidbey", called aspnet_regsqlcache.exe:

  • What is does is creating some extra tables (ChangeNotification table) and a SqlCacheNotification trigger on the tables of the database.
  • There are several ways to use this exe, for example:
       aspnet_regsqlcache.exe -S jefken -E -d Northwind -ed
    which will enable the database Northwind on my server (called Jefken) for SQL Cache Dependencies.

This really rocks! Check out more of this great stuff on the ppts of the PDC on Check out the great hands-on labs as well! | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

More Posts