Thursday, May 06, 2010

DotNetRocks in Boston

This past Monday I went to see the Boston stop of the DotNetRocks road trip, hosted by Carl Franklin and Richard Campbell. The duo put on a good event, bringing in guest Chris Sells for their podcast, as well as a panel of guests to discuss F#.

The portion of the evening I found most interesting was the F# discussion. I didn't expect to get much out of it. I had heard enough of F# to that point to make up my mind that it wasn't for me. I reasoned that if it isn't a language I can completely switch to, I'm better off focusing on VB or C#.

So I was surprised when I heard the F# experts suggest that we use the language to complement our projects rather than use it as an all-purpose language. They encouraged us to use the language for its strengths, such as asynchronous processing and parallelism. One could create an assembly written in F# and include that in a VB project, for example, to handle some heavy computations. We already use a handful of non-core languages in our projects such as HTML, Javascript, LINQ or SQL, so the idea of blending yet another language into our projects is not a foreign concept.

The panel suggested we add F# to our repertoire and understand its strengths, and use it where it's beneficial. I'm going to take that advice. Bottom line is if I can replace 50 lines of confusing C# code with 10 lines of elegant F#, I've done myself a service.

A big thank you to Carl and Richard for their hard work in putting this event together, and for entertaining me with their podcasts during my commutes, jogs, walks, and housework.

Tuesday, May 04, 2010

Setting up a Mercurial server on Win2k3 / IIS 6.0

There are several tutorials right now explaining how to setup a Mercurial server in Windows, but most are outdated just enough to make the whole process fail due to recent changes to Mercurial.  I tried a few, but the best one available as of Mercurial 1.5.2 is from Matt Hawley from  His post explains how to set up the server using IIS 7.0, and the process is slightly different in IIS 6.0, as I’ll explain.

First, read his blog post to get a sense of the procedure.  The post is broken into two major sections, Packages Installation, and Configuration.  I followed the Packages Installation section exactly as written, with the exception of downloading the latest source for Mercurial, which is 1.5.2. 

Once you’ve completed the Packages Installation, follow these steps instead to configure IIS 6.0.  Many of these steps are the same as Matt describes, but for convenience I’ve duplicated them here.  All credit for this goes to Matt for getting us 99% of the way there. 

These steps assume you have IIS installed already.

  1. Create a folder to host your Mercurial site.  As Matt suggests, you can use c:\inetpub\hg
  2. Copy the file from c:\(mercurial source code location)\contrib\win32 to c:\inetpub\hg
  3. Edit in a text editor and change the two lines as follows:

    hgweb_config = r’c:\inetpub\hg\hgweb.config’
    path_prefix = 0
  4. Open a command prompt and go to the c:\inetpub\hg folder
  5. Run python  If python isn’t installed on the system path, you may need to include the path to it and use c:\python26\python
  6. Create a new text file named hgweb.config in the c:\inetpub\hg folder and add the following.  Here c:\repos is the folder where you will store your repositories.

    / = c:\repos\*

    At this point, your folder should look like this:
  7. In IIS Manager, create a new application pool with the name Mercurial.
  8. Create a new website called Mercurial, and set the TCP port to 81 (or any unused port).  Leave the Host header field blank.
  9. Set the path to c:\inetpub\hg and finish the wizard.
  10. Right-click the Mercurial website and choose properties.
  11. On the Home Directory tab, click Configuration, and then click Insert… in the Wildcard application maps section.  Enter the path to the isapi dll (c:\inetpub\hg\_hgwebdir_wsgi.dll) and uncheck verify file exists.
  12. On the ISAPI filters tab, click Add… and enter Mercurial-ISAPI as the filter name and c:\inetpub\hg\_hgwebdir_wsgi.dll as the executable.
  13. Finally, go to the Web Service Extensions in IIS Manager and Add a new Web service extension.  Give it the name Mercurial-ISAPI, and add the required file c:\inetpub\hg\_hgwebdir_wsgi.dll, and check the “Set extension status to Allowed” option.
  14. Finally, browse to http://localhost:81 (or substitute 81 for the port you chose in step 8).  You should now see the Mercurial Repositories page!