Monthly Archives: April 2005

What are you networking skills like?

The guys over at 3 Leaf posted something up that really struck a cord with me. There are certainly developers out there that understand computer networks, but as a general rule most don’t really understand it any more than your average user.

Before I got into software development professionally I was actually a network administrator and general computer support guy. One of the things that spending time gave me was an appreciation for how things actually talk to each other – what is TCP/IP, what is HTTP, what is FTP, what is POP3 and SMTP. These questions that any network administrator should be able to answer – and I don’t just mean expanding out the acronyms. How does it actually work?

Well the way you find out is heading over to the Internet Engineering Task Force (IETF) web-site and reading Request for Comments (RFC) documents and Standards (STD). If you aren’t sure were to start – here are some entry level ones.

  • TCP/IP — A TCP/IP Tutorial (RFC1180)
  • Hypertext Transfer Protocol — HTTP/1.1 (RFC2616)
  • File Transfer Protocol (RFC959)
  • Post Office Protocol – Version 3 (RFC1939)
  • Simple Mail Transfer Protocol (RFC821)

Once you are armed with knowledge you will know how to read and send e-mail with nothing more than a TCP connection (thats telnet.exe folks), and you’ll know how to sniff a basic authentication username/password token out of a HTTP request. Ever wanted to send yourself an e-mail from Bill Gates – check this out!


Other commands that you should know about as a developer:

  • PING
  • ARP
  • FTP
  • RSH

Thats not even a complete list! Learn what they are and what they do, take the red pill.

Trading time for answers.

Recently Kim Peacoke, our Communications Manager at Readify posted an entry onto her weblog about time being the most valuable commodity in the world and how it compares (among other things) to other kinds of compensation such as money. At the end of the post, as a Readify Consultant I am left blushing.

The reality, at least for me is that my .NET developer community work is to a large degree self serving. I discovered a while ago that the best way to learn something is to teach yourself – provided you have enough lead time.

For example, when preparing for Code Camp Oz I systematically went through the base class library and looked for classes that were new to .NET 2.0. The list was huge, way to big to cover in a 45–minute session so I pared the list down to a dozen or so bullet points.

I then set about understanding the enhancements in more detail, I probably spent most of my time looking at the generic list class, and ended up writing these four posts about the associated generic delegates. Several people have commented on the posts saying they were useful – but you know what, they were more useful to me.

SOA and Interoperability

One of the pleasant surprises of Code Camp was how well the “ad-hoc” sessions held in one of the smaller rooms were recieved. Darren Neimke managed to make it along to one of the sessions on Service Oriented Architecture and on the trip back to Canberra we chatted about the subject for a while.

I took the Sessionian stance that SOA is the by-product of political boundaries in large organisations (I hope I am not misrepresenting Mr. Sessions here), whereas Darren looked at it more from an interoperability and discovery standpoint.

The reality is that we are both probably correct. Either way – I thought that this post by Aaron Skonnard was interesting.

What If: OneNote and InfoPath was embedded in Outlook.

I am a big fan of OneNote and I am a big fan of Outlook, so naturally I want these tools to work better together. Currently its possible to build an Outlook Task, Appointment and Contact from triggered by a key sequence in OneNote but thats about it.

The curious thing is that Outlook actually has a notes section which hasn’t really seen any significant feature improvements since it was first introduced. So why can’t we just get OneNote embedded in Outlook? This is what I imagine it could look like.

The question is – with a new version of Office in the pipeline, what kind of enhancements can we expect with Outlook? One thing that I would like to see is the ability to add nodes to the folder list hierarchy and customise the main view (Inspector?) and preview pane for displaying certain types of information.

For example, it would be great if the preview pane could display InfoPath forms so that you could really embed a workflow solution into Outlook.

ASP.NET 2.0 Build Providers

Its probably fair to say that the ASP.NET team has pushed the envelope as far as web-application compilation models go with the upcoming release of ASP.NET 2.0. Under the covers ASP.NET leverages “build providers” to take the various common ASP.NET files *.aspx, *.ascx and Web.config (to name but a few) and produces source code that can be compiled and executed.

For the most part you can build applications an be blissfully unaware of this feature but if you want to get invited to all the cool parties you should probably get familiar with build providers. A build provider is a class that derives from the System.Web.Compilation.BuildProvider base class, out of the box ASP.NET 2.0 comes with the following (internal) build providers.

  • ApplicationBrowserCapabilitiesBuildProvider
  • BaseResourcesBuildProvider
    • ResourcesBuildProvider
    • ResXBuildProvider
  • ForceCopyBuildProvider
  • IgnoreFileBuildProvider
  • InternalBuildProvider
    • BaseTemplateBuildProvider
      • ApplicationBuildProvider
      • PageThemeBuildProvider
        • GlobalPageThemeBuildProvider
      • TemplateControlBuildProvider
        • PageBuildProvider
        • UserControlBuildProvider
          • MasterPageBuildProvider
    • SimpleHandlerBuildProvider
      • WebHandlerBuildProvider
      • WebServiceBuildProvider
    • SourceFileBuildProvider
  • ProfileBuildProvider
  • WebReferencesBuildProvider
  • WsdlBuildProvider
  • XsdBuildProvider

As you can see there isn’t much that build providers don’t touch and if you look closely you can tell a lot about the architectural decisions that Microsoft made about certain features (notice what the MasterPageBuildProvider derives from). Build providers really support two things on top of the usual runtime compilation behaviour. First, they are used by the “aspnet_compile.exe” utility to generate the pre-compiled version of a site – this feature would have had to have been in the top five requested features by ASP.NET developers so it was great to see that they got it to work.

The second place where build providers work is at design time to ensure that the intellisense engine has type information to provide developers as they are cutting code. Have you ever wondered how VS2005 knows what properties are exposed via the code-behind file associated with a web-control when you drop it onto your web-form?

Now that we know how build providers are used out of the box lets see if we can practice our own form of ASP.NET voodoo and get them working for us. What I am going to show you is how to create your own build provider which reads a XML files located in the App_Code directory that have the *.exception extension and compiles up a custom exception class that can then be used in code. What use is that? Well thats not the point is it

The first thing that you need to do is create a custom build provider, you can see the code I used below.


We will get to the helper code in a minute, but briefly we can see that this class derives from BuildProvider and overrides the GenerateCode(…) method. The GenerateCode(…) method takes an AssemblyBuilder instance – but don’t be confused, this is not the AssemblyBuilder from the System.Reflection.Emit namespace, this is one specifically designed for the build providers in ASP.NET and it lives in the System.Web.Compilation namespace.

The idea is that we use CodeDom to generate an abstract representation of the code that represents the contents of the *.exception file and pass that to the AssemblyBuilder which then compiles it up into an assembly along with any other code that is being dealt with at the time. What code we generate is completely up to us but typically you would want to take some input from a file with an extension that the build provider is associated with.

Fortunately the BuildProvider base-class has a number of helper methods to make it easy to read in that content as the listing of helper methods show.


The key in the listing above is the call to the BuildProvider.OpenStream() method which allows us to return an open stream to the underlying file that the BuildProvider is working with. You also have access to the BuildProvider.VirtualPath property which gives the site relative path to the file being built. When you first work with the API you might be tempted to try and call MapPath to resolve that to a physical file, however at this point in the pages’ lifecycle you don’t have access to the HttpContext which is where the OpenStream method comes in.

Once you have the BuildProvider written you need to associate it with the file extension that you want to work with, you do that by registering it in the <buildProviders /> section of the Web.config file.


Here you can see that this build provider is associated with the App_Code directory (Code) and is mapped to the *.exception extension (.exception) along with a qualified reference to the BuildProvider class. Once all of this is in place, you can drop a file into the App_Code directory, my file looked like this.


As soon as you save that file and build the ExceptionBuildProvider will kick into action then you will be able to code against the exception class generated as if it was just code you had written yourself.


If you want a bit of a head start or some code to look at you can download my demo code from Project Distributor.

TortioseSVN or TortioseCVS (SVN or CVS)

Kieran asks “TortioseSVN or TortioseCVS”

Its an interesting question. I’ve actually got both tools installed on my laptop because I need to work with both source code control tools. Recently I started using Subversion to manage the versioning on the files in the My Documents directory and have found it to be quite robust.

The nice thing about Subversion is that through tools like TortoiseSVN you are able to move files and rename directories whilst still maintaining version history. When you couple this with the ability to perform atomic commits (if one commit fails they all fail) means that you will probably get a more robost experience with SVN over CVS. If you go for SVN you are probably going to need to set up an Apache box to host the underlying WebDAV infrastructure on (its still WebDAV isn’t it?).

CVS however does have a huge install base, and if you contribute to open source projects that are housed on SourceForge then you are going to need a CVS client, and as far as I am concerned TortoiseCVS is it. In addition to the large install base the number of tools that exist which integrate with it WELL are staggering.

If you are a Microsoft-oriented developer however you should probably be seriously considering Visual Studio Team System and the source code control system that is embedded into the Team Foundation Server component. The pricing isn’t quite clear at the moment (more on this later), but its a compelling package because it integrates things like issue tracking, source code control and continuous integration into one package.