Monthly Archives: February 2006

I am currently running Windows Vista Ultimate Edition Version 6.0 build 5308 on my home PC. This is a dual boot installation with my old Windows XP Professional so I have something to fall back on. There has definitely been a lot of progress since I installed Beta 1 back in July 2005. But I cannot help but feeling some disappointment as well.

The first sign of progress is of course Windows Solitaire 😉 Yes, it has improved! Actually a new version has been included since the PDC05 build of Windows Vista.

Screenshot of Solitaire on Windows Vista (build 5308).

But Windows Presentation Foundation is still nowhere in sight ;( The WinFX runtime components are still not installed out-of-the-box. The .NET Framework 2.0 is installed out-of-the-box, but it is not used in any process right after Windows Vista boots. So the dirty little secret I blogged about for Windows Vista Beta 1 about still hold true in build 5308 ;( There are two pieces of software in Windows Vista that do use the .NET Framework: the Event Viewer and the Windows Media Center shell. The Event Viewer is still the same sluggish piece of crap that it was in Beta 1. Look at these strange triply nested corners for the view of an event:

Screenshot of Event Viewer detail on Windows Vista (build 5308).

The Windows Media Center shell in XP proved that you can develop shiny, flashy apps in .NET. However I find Media Center shell in Windows Vista has detoriated compared to the one in Windows XP Media Center Edition 2005 (when are those product branders at Microsoft responsible for these terribly long names going to get fired?!) . It feels more static (the background has no moving glow), it has less shine and polish and usability has gone down.

Screenshot of the Windows Vista Media Center shell (build 5308).

Rabobank TV works just fine in this new Windows Media Center version, though 😉

1 Comment

Thinktecture has released version 0.6 of their Web Services Contract-First tool. It is the Visual Studio 2005/.NET 2.0 version of their WCSF add-in for Visual Studio. It also features a command-line version.

Contract First is the best approach to design and develop web services whenever interoperability matters.

You can find more information about this excellent tool and download it from thinktecture's web site.

1 Comment

[Update 2006-04-18: Removed obsolete information from this blog entry. The latest information about the RollingFileTraceListener and the download link can always be found in this article on my blog.]

In January 2006 Microsoft released version 2.0 of the Enterprise Library. The Logging block now uses the trace listeners infrastructure of the .NET Framework 2.0 instead of "logging sinks". Read more about this change. The separate Configuration block is gone. Enterprise Library now builds on System.Configuration.

A problem with the 1.0 and 1.1 releases of the Enterprise Library was that these releases didn't ship with roll-over capabilities for log files. Log files continue to grow unchecked. Hisham Baz developed an extension for these versions called the Rolling File Sink. This custom logging sink allows you to set size and age limits for log files. I've blogged about a problem I had with this extension here and here.

Inspired by Olaf Conijn's Enterprise Library Extensions, I decided to create an EntLib 2.0 version of the Rolling File Sink. My version is called the Rolling File Trace Listener. You can find the documentation and the download link for the sources in this article on my blog. The source code and documentation is provided "AS-IS". Feel free to change and/or extend it.

The VS 2005 solution and projects are set up in such a way that is is easy to add additional extensions. They follow the structure of the EntLib 2.0 sources. My extension also comes with a test application to stress test the log file roll-over and the thread safety of the code. It logs 10,000 messages. First from a single thread and after that from dozens of threads simultaneously. Both test cases take a couple of seconds to run. You can edit the app.config file of the test application (either by hand or by using the Enterprise Library Configuration tool) to try out different settings.

1 Comment

Rolling File Trace Listener


Erwyn van der Meer, LogicaCMG
Based on Rolling File Sink by Hisham Baz, Avanade

Download v0.5.2.0 source code + documentation. The source code and documentation are provided "AS-IS". Feel free to change and/or extend them. Please contact me or leave a comment if you find an issue.


Last updated: April 18, 2006


Overview


This article describes the RollingFileTraceListener extension of the Logging block of version 2.0 of the Microsoft Enterprise Library.  This is a custom trace listener that can be plugged into the Enterprise Library Logging block like the standard trace listeners that are included. The FlatFileTraceListener shipped with EntLib 2.0 may not be adequate for enterprise systems since log files by default will continue to grow unchecked.  This new trace listener provides support for rolling over log files based on age of the log file or file size.


Usage


The ZIP file contains a Visual Studio 2005 solution and projects with C# sources that are fully documented with XML comments. Extract the ZIP file, open the EnterpriseLibraryExtensions.sln solution in Visual Studio 2005 and build the solution. This will create the assemblies for the RollingFileTraceListener and a test application.


In Windows the maximum path + filename length for a file is 260 characters. Please ensure you extract the ZIP file into a directory with a path that is less than 82 characters in length. Otherwise you will get a compilation error because during compilation Visual Studio will create an intermediate file with a really long name for which the path exceeds the limit of 260 characters.


In order to use the new trace listener from the Enterprise Library Configuration tool, you must copy the assemblies into the same directory as the configuration tool. There are two files that need to be copied - LogicaCMG.EnterpriseLibraryExtensions.Logging.dll and LogicaCMG.EnterpriseLibraryExtensions.Logging.Configuration.Design.dll.  When these files are in the same directory, they will be registered during the startup of the tool. This will allow you to add a new Rolling File Trace Listener from the right-click context menu on the Trace Listeners collection node.


Screenshot of how you can add a RollingFileTraceListener to an application configuration file using the Enterprise Library Configuration Console.


Configuration


The trace listener creates a new log file when the current file exceeds defined thresholds.  The RollingFileTraceListener provides file age and file size thresholds that can be configured using the Enterprise Library Configuration tool like any other trace listener.


Screenshot of the configuration properties that can be set for a RollingFileTraceListener.


 The RollingFileTraceListener has the following properties



  • Filename – filename with optional relative or full path
  • Header – string (optional)
  • Footer – string (optional)
  • MaximumLogFilesBeforePurge – integer
  • Timestamp Format – string, e.g., yyyy-MM-dd [HH:mm:ss]  (optional)
  • Age Threshold - integer
  • Age Unit – None, Minutes, Hours, Days, Weeks, Months
  • Size Threshold – integer
  • Size Unit – None, KB, MB, GB

Design


The RollingFileTraceListener uses a database-style log roll-over process.  All new log entries are written to the file defined in the FileName property.  Before a log entry is written, the trace listener checks to see if the file has grown too big or the age limit has expired.  If the current log file exceeds the size or age threshold, then the log file is renamed with the current timestamp or an incremental counter.  The new file is created with the same name defined in FileName. So the current log file always has the same name.


Age Threshold


The age threshold allows you to limit the growth of your log files according to age.  The threshold is compared by evaluating the current date/time against the log file creation date/time.  For example, if the log file was created on 1/1/2006 at 3PM and the age threshold was set to 2 days, a new log file will be created for the first log entry written after 1/3/2006 at 3PM.


There are two properties that control the age threshold behavior – AgeThreshold and AgeUnit.  Select the appropriate unit size first – None, Minutes, Hours, Days, Weeks or Months - by setting the AgeUnit property.  Set the AgeThreshold property to 0 or the AgeUnit to None to disable the age threshold check.


Size Threshold


In addition to age threshold, you can limit log file growth based on file size


There are two properties that control the age threshold behavior – SizeThreshold and SizeUnit.  Select the appropriate unit size first – None, Kilobytes, Megabytes or Gigabytes - by setting the SizeUnit property.  Set the SizeThreshold property to 0 or the SizeUnit to None to disable the file size threshold check. 


Combination Thresholds


Both the age and size thresholds can be applied at the same time.  For example, logs can be configured to roll-over every week or earlier if the file grows over 10MB. To accomplish this, set the AgeUnit to Weeks, AgeThreshold to 1, SizeUnit to Megabytes and SizeThreshold to 10.


Filename Formatting


When log file exceeds the defined thresholds, it is given a new unique name.


The TimestampFormat property can be used to define a date-time format string used for generating new file names.  This allows overgrown or overaged log files to be renamed and stamped with the current timestamp. The timestamp is appended to the end of the new filename, before the extension.  For example, if TimestampFormat is set to yyyy-MM-dd and FileName is set to app.log, then when rolling over on February 15, 2006 the current log file is renamed to app2006-02-15.log.


If the new filename already exists, then an incremental counter is added until a unique combination is found.  If the TimestampFormat property is left blank, the counter will always be appended to the end of the FileName.  The counter is formatted to 7 digits (e.g., app[0000123].log) and counting begins from 1.


Purging


Log files can be automatically deleted after a certain maximum number of log files are present by setting the MaximumLogFilesBeforePurge property.  Set this property to 0 to disable automatic purging.  Purging occurs before the current log file is renamed. The log files are deleted in reverse order of their last modification time.



Change log


Version 0.5.2.0 – Fixed a bug that occurred when the application configuration file is changed while an application using the RollingFileTraceListener is running. In that case a GUID was prepended to the filename of the log file, because the log file was still locked by another RollingFileTraceListener instance.


Version 0.5.1.0 – Fixed a bug that prevented the formatter name from being saved correctly when using the Enterprise Library Configuration tool.


Version 0.5.0.0 – First public release.



Known problems


A GUID might be prepended to the filename of the log file


A RollingFileTraceListener instance "owns" the log file it is writing to and locks it for exclusive write access when it writes the first log entry. It keeps the file locked until the instance is disposed. If another RollingFileTraceListener  instance is created that points to the same file, before the first instance is disposed, the second instance cannot open this file for writing and will write to a new file with a GUID prepended to its name.


The RollingFileTraceListener indirectly derives from System.Diagnostics.TextWriterTraceListener. This class changes the filename to include a GUID when the file with the specified filename cannot be written to. This is because RollingFileTraceListener indirectly calls the EnsureWriter method on its base class TextWriterTraceListener. .NET Reflector shows this code for System.Diagnostics.TextWriterTraceListener.EnsureWriter() in System.dll (slightly rewritten to improve clarity):


    try
    {
        this.writer = new StreamWriter(fileNameWithPath, true, encoding1, 0x1000);
        break;
    }
    catch (IOException)
    {
        Guid guid1 = Guid.NewGuid();
        fileName = guid1.ToString() + fileName;
        fileNameWithPath = Path.Combine(folderPath, fileName );
    }

The new interactive-TV (iTV) website of the Rabobank has gone live this week. In this case going live, means being featured in the Windows Media Center Online Spotlight for the Netherlands. Check out this screenshot:

Screenshot of the Rabobank TV web site featured in the Windows Media Center Online Spotlight

You can see the URL of the Online Spotlight in this screenshot, but you must have a Media Center PC to view it as in the screenshot above. This page will redirect any other user agent to the Media Center product page on the Microsoft site.

Or you can do as I did: trick IE6.0 to sent a HTTP user-agent header with a value of something like Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Media Center PC 4.0; .NET CLR 1.0.3705; MediaCenter 5.1.2710.27320). You can fake the user agent string in Firefox through the User Agent Switcher Extension, but the Online Spotlight page will look absolutely horrible in Firefox.

Rabobank is the first Dutch bank with a TV banking site. In the UK TV banking has been available with some banks since 1999.

If you would like to see what Rabobank TV looks like, you can access it directly through itv.rabobank.nl. This will even work in Firefox, Opera or Pocket Internet Explorer without faking your user-agent string! I haven't tested in Safari, because I don't have a Mac.

Here is what the site looks like in Firefox:

Screenshot of Rabobank TV (itv.rabobank.nl) in Firefox

At the bottom it has a disclaimer that says (translated from Dutch) "Rabobank is optimized for Windows Media Center and may not work optimally in your browser". The disclaimer is there, because the site does provide a better user experience in Windows Media Center and IE6.0. However all content, including video, is accessible from all devices that support XHTML 1.0. One caveat: video is currently only available in Windows Media Video 9 format, so your device has to support this format.  For example, it works on my Pocket PC using WiFi.

Rabobank TV consists of two parts: the content site http://itv.rabobank.nl/ and the secure TV banking site https://itvbankieren.rabobank.nl/. The content site was built using ASP.NET 2.0 on the Windows platform by LogicaCMG for the Rabobank. The secure site uses another technology on a non-Windows platform and was built internally at the Rabobank. The graphical design for both sites was done by  another company. If you are a customer of the Rabobank the TV-banking site allows you to check up on your accounts, pay bills, move money from your savings account to your checkings account, etc. All using a remote control. Using a keyboard or mouse is optional.

The TV banking site is currently only accessible using Windows Media Center. I wasn't deeply involved in the development and design of the secure site, so I will not talk about the technology used by the TV banking site.

Although Rabobank TV has been optimized for Windows Media Center/IE6.0, the content site is quite unique in how it is built. I am not aware of any other Media Center hosted HTML application that even remotely works in other browsers. Rabobank TV works in Firefox because of the requirement that  Rabobank TV should be able to support other iTV devices with only a couple of weeks of additional development effort. Exampes of iTV devices are set-top boxes that are distributed by cable companies. The more advanced versions have embedded web browsers that can display content from the Internet.

The magic of our solution: using XHTML 1.0, CSS 2.1 and unobtrusive JavaScript. Of course that's no real magic for developing ordinary websites, because it's the current best practice.

However, developing for Windows Media Center has some unique challenges. One reason is that its underlying browser is IE6.0 (with its usual CSS non-conformance problems). This is amplified by some WMC specific issues that force us to use IE's quirks mode. Another reason are the bad examples in the Windows Media Center SDK provided by Microsoft. All Media Center websites that I am aware of follow these bad practices. For example, check out Reuters, Nederland 4, Free Record Shop and Fox Sports in IE6.0 and Firefox.

More details on our solution to follow in an upcoming blog post. I'll end with a screenshot of a Rabobank TV page showing realtime(*) AEX quotes:

Screenshot of page in Rabobank TV showing realtime AEX quotes data

(*) In the middle of the night the difference between delayed stock quotes and realtime quotes is not that impressive 😉

Yesterday the Release Candidate for Team Foundation Server was released on MSDN Subscriber downloads.

We used the Beta 3 Refresh version for source control for the Rabobank TV project at LogicaCMG since Beta 3 Refresh already came with a Go-Live license. I also have a Team Foundation Server installation running in a Virtual PC image for research purposes. In preparation for upgrading our "production" server I just upgraded this installation to the Release Candidate. Rob Caron has a short version of the upgrade procedure on his blog but I also read the longer Upgrade Guide. This guide is included in the upgrade utilities package that Rob links to.

The upgrade went smooth in one try. After some tests I took the the installation survey and I submitted my upgrade logs to Microsoft. The first 300 people to do this are eligible for receiving a Team Foundation Server T-shirt.

I checked if it had become easier to label files. One of the first things I noticed in the Release Candidate of Team Explorer is that it is easier to label a set of source-controlled files. You can now first select a folder or a set of files and then type in the details for the label. The old implementation made you type in the label data first and in the next step had forgotten on which folder you selected "Apply Label" so you had to select it again.

Next I wondered if viewing labels had also become easier. I knew how to do it using this procedure:

  • Select "Get Specific Version" on a folder or file.
  • Change the version type to "Label" in the "Get" dialog box that pops up.
  • Click the button with three dots after the input field. The "Find Label" dialog box pops up.
  • Optionally select a project and click "Find". You now get a list of labels.

You can see these dialog boxes  in this screenshot:

Screenshot of finding a label in Team Foundation Server

Note: This TFS source control repository only contains the latest version of Rabobank TV, that's why you see only one label.

Today I found an alternative way is to use the menu item "File | Source Control | Label | Find label", as documented in MSDN. This immediately pops up the "Find Label" dialog box. A blog entry by Brain Harry from November 2005 already describes this method. I guess it must have been in Beta 3 Refresh all along. So his fear that this option wasn't really discoverable turns out to be true. Brian also explains why it is very difficult for Microsoft to include label information in  the "View History" information as SourceSafe does. TFS labels are not really point-in-time labels as they were in SourceSafe.

1 Comment

The new www.rabobank.nl web site has just gone live. I am proud to have been one of the members of the team at the Rabobank that developed this web site. The development of this site was the project I blogged about back in August 2005. Rabobank is one of the largest Dutch banks. It was the first Dutch bank with a website in 1994. Rabobank has the largest online-banking customer base in Europe.

This is what the new site looks like:

Screenshot of the new www.rabobank.nl web site

As you can see, this site looks great in Mozilla Firefox. But it also looks great in Internet Explorer 6.0. The site is rendered using XHTML 1.0 Strict. It uses CSS 2.1 and JavaScript in a non-obtrusive way. That means the site degrades gracefully if JavaScript and/or CSS are turned off or not available in the browser. The site is also highly accessible for people with disabilities ("drempels weg" in Dutch). This can best be seen by turning CSS and JavaScript off using the Web Developer Toolbar extension for Firefox. Without CSS and JavaScript the page is rendered as:

Screenshot of unstyled Rabobank homepage

The home page is now just one long column with lots of links. In the picture above I have split up the text in three columns for easier display. What was displayed as a drop down list box in the first screen shot (with CSS+JavaScript turned on), is just a bullet list of links in this rendition. And that is just what a list of links should be semantically. So if you look at the HTML source for the page you see something like: <ul><li><a ..>..</a></li><li>..</li></ul>. When JavaScript is enabled, this list is transformed to a drop down list box. If you look really carefully at the two versions, you can actually see some accessibility issues (all of the same kind). Guess which one? The cause is probably that the content editors that maintain this page (using a Content Management System) mostly look at the stylized version. The fix should be easy.

Most pages on the new site are static content (XHTML files) on the webserver. Most dynamic pages are rendered using ASP.NET 1.1. One of the larger modules that was developed in .NET is the "Naar uw Bank" ("To your Bank" in English) module. It has mapping functionality and you can get directions to get to a Rabobank office near you (or on the other side of the Netherlands if you like).

Screenshot of the Rabobank "Naar uw bank" module that was developed in ASP.NET 1.1

Above you can see a page from "Naar uw Bank". It uses Lokatienet web services (server-side) to get the directions and the URL of  the map. The mark up for this page is a combination of dynamic mark up generated by ASP.NET and a navigation context page. The navigation context page is the static content page from the Content Management System that linked to this dynamic page. In this case the navigation context page is http://www.rabobank.nl/particulieren/lokalebanken/uhr/. Check out my blog post from August 2005 for an explanation of how this works.

Thanks a lot to all of the project members at the Rabobank for making the new www.rabobank.nl possible. I have learned some good lessons during this project that I could apply to the development of another website for the Rabobank. That website will soon go live as well. Going live in this case means that it will appear in the Online Spotlight of Windows Media Center for the Netherlands. This web site is the Windows Media Center project I blogged about. More details about Rabobank TV (and the URL 😉 to follow in the near future. If you are really good with DNS queries for the rabobank.nl domain you can already look at the site. It has already gone live in the sense that it is available if you know the URL.