Monthly Archives: July 2012

Comparing version control systems: SVN, HG, and GIT

It was my pleasure to talk about version control systems: svn (subversion), hg (mercurial), and git at the NWVDNUG.  It was a great discussion about the value of DCVS (Distributed Version Control Systems) vs. Centralized Version Control Systems.  We also hit the main purposes of source control: (1) to facilitate collaboration among developers and (2) keep an audit history of the code changes.  Our purpose was a paradigm change, so our content was really driven by slides, the corresponding discussion, and the questions and answers we delved into.  You can download the slides from  Enjoy!


Git Tools for Windows

I get asked from time to time what tools I would install to use Git on Windows.  I randomly spout off a list that looks something like this.  In time, this list grew to something bigger than just a list.  It seems natural for it to evolve into a post.  In no particular order, here are installers for getting Git running on both/either client and server.  (Granted, the philosophical discussion of “client” and “server” are not technically relevant in distributed source control systems as everything is technically both, but it’s good to designate one of the “clients” as a “server” by policy so there’s a “canonical truth” all can go to for the latest official copy.)

Client tools:

– mSysGit ( is the base engine, and is needed to do anything git related.  Most other tools presume this is installed.  The CygWin route is a trap.  I install with these options:
   – Run Git from the Windows Command Prompt (middle option)
   – Checkout Windows-style, commit Unix-style
   – Use OpenSSH (unless you’ve previously installed Putty, you don’t need it for Git with this option)
– Git Extensions ( is GUI tools for both Explorer and Visual Studio (and Eclipse and a few other things). Includes kdiff3, a diff tool for Windows.  Ensure you choose the same options you did for mSysGit.  (Note that by default mSysGit says “OpenSSH” and Git Extensions says “TortoisePlink”.)

– git-flow ( is a great workflow for git
– TortoiseGit provides icon overlays in Windows Explorer but their commit dialog “simplifies” the difference between push and commit making it absolutely useless aside from the icon overlays
– Git Source Control Provider ( provides icon overlays in Visual Studio

– SmartGit ( “smartgit” is also a protocol, making this a confusing name, client also does hg and svn
– GitHub for Windows: “simplifies” git for Windows users — that sounds like the buzz word for “doesn’t quite do it right”, I have no experience with it.

Server tools:

file urls (not preferred, only works on a lan, e.g. \serverfoldergitrepo):
– mSysGit
– share the git repository on a file share

http(s):// protocol (pick one):
– (prefered) WebGit.NET (
– Azure’s http git server ( If only I had another 854 hours in the day, I’d get this running and make it the preferred mechanism. It is the newest and best supported of the bunch.
– Bonobo ( It’s abandon-ware and didn’t have many features.
– GitWebAccess ( The website is great for configuring http access to git, but the admin interface has no authentication. Thus anyone with a web browser can reconfigure my server. Oops.
– GitStack ( It runs on Apache, the rest of these run on IIS. Granted one can proxy Apache behind IIS:

git:// protocol (basically ssh://):
Guides: (follow them all — more-or-less)
– expose mSysGit over CopSSH daemon
– GitExtensions and Putty aren’t needed server-side, but may make debugging easier
– CopSSH is OpenSSHD compiled for Windows, doesn’t need cygwin, daemon is built-in, can be configured for user/pass or preshared keys
– point this to the same Git repositories hosted in http(s) above and now it works both ways
Alternatives: does this setup for you, purchase for 14 euro, docs are very thin, probably better to do it yourself to learn more about what’s going on under the hood.

alternatives / hosted providers:
Most of these providers host open-source projects for free, and closed-source projects for a price, and include both https:// and git://
– GitHub (
– BitBucket
– CodePlex
– Pretty much any source code hosting provider

HTML5: A Primer

It was my pleasure to speak at the Phoenix Java User Group this evening, discussing HTML5.  By all accounts, it was a very fun evening, and of course, I’m sure I enjoyed it most of all.  The slides for this evening’s discussion are available here.  If you’re really curious about HTML5, I suggest you watch the HTML5 Camp Videos and in particular Stephanie (Sullivan) Rewis, a great HTML5 intro.

IIS Express /protocol:https

IIS Express is awesome, a great upgrade from Cassini.  It supports https, Windows Authentication, persistent sites even if Visual Studio is closed, command-line launching, it’s great.  However combining them sometimes doesn’t work too well.

In Cassini (Visual Web Developer) I could launch it like this:

WebDev.WebServer40.EXE /port:1234 /path:C:pathtosite

This works wonderfully in IIS Express as well:

iisexpress.exe /port:1234 /path:C:pathtosite

This gets awkward when moving to https.  This doesn’t work:

iisexpress.exe /port:1234 /path:C:pathtosite /protocol:https

Why doesn’t it work?  Because iisexpress has no /protocol switch.  Bummer.  I flung a request for this and got a great response from Robert McMurray.

A Step Back

Robert McMurray summarizes the two modes of IIS Express nicely as “Personal Web Server Mode” (e.g. “IIS Lite”) and “Application Server Mode” (e.g. “just launch this”).

“Personal Web Server Mode” is a durable version of (almost all of) IIS launched in the user’s context.  There’s a great system tray icon that centralizes all the running sites, and the applicationHost.config file is identical to regular IIS.  One can rig Windows Authentication, HTTPS, tracing, classic ASP, the works.  (Why “almost”?  Because there’s no tooling for configuration.  There are a few settings in Visual Studio, but nothing of consequence.  The perfect solution would be a way to point IIS Manager at it.  Unfortunately, typically the easiest way to configure IIS Express is to configure IIS proper, then diff their config files.  But I digress.)

“Application Server Mode” is much like Cassini was.  When you launch it, you specify /port: and /path:.  The unfortunate part of this mode is it presumes http.  To their credit, this mode is likely solely for backwards compatibility with Cassini, and Cassini didn’t support https at all.

Now What?

My goal is to run IIS Express in “just do it” mode, pass in a /port: and /path:, and test my https site.  All else being equal, a /protocol: parameter to iisexpress.exe would be easiest.  In its absence, let’s go hacking.  Back to Robert McMurray.  He proposes a batch file that uses appcmd.exe to rig adjustments to a cloned applicationHost.config, passing in IIS Express 8’s new /apphostconfig: flag, which specifies the config to modify.  It’s a bit of a long way around, but ok.  In theory it’s easier than brute-forcing some XPath.

A bit of tinkering, a lot of elbow grease, and an extra quarter or two into the command-line meter, and I have a batch file that allows me to launch IIS Express like this:

iisexpress.bat /port:1234 /path:C:pathtosite /protocol:https

The batch file takes care of shimming the difference between me using it like “Application Server Mode” and it running in “Personal Web Server Mode” (with a temporary config).  Thanks to Robert McMurray for pointing me in the right direction.

For compatibility’s sake, it has a PowerShell XPath mechanism for users of IIS Express 7.x, though for those with IIS Express 8, flip over into appcmd and you’re golden.

The Batch File

@echo off
setlocal enabledelayedexpansion
pushd “%~dp0”

REM because we’re shifting this off the grid soon
set script_name=%0

if ‘%1’==” GOTO help

set site_port=8080
set site_protocol=http

if ‘%1’==” GOTO :args_done

set arg=”%1″
set argv=%arg:/path:=%
if “%argv%”==”%arg%” goto not_path

set site_path=%argv:”=%
goto get_args


set argv=%arg:/port:=%
if “%argv%”==”%arg%” goto not_port

set site_port=%argv:”=%
goto get_args


set argv=%arg:/protocol:=%
if “%argv%”==”%arg%” goto not_https

set site_protocol=%argv:”=%
goto get_args


if ‘%1’==’/?’ GOTO help
if ‘%1’==’/h’ GOTO help
if ‘%1’==’-?’ GOTO help
if ‘%1’==’-h’ GOTO help

echo Invalid parameter: %1
goto help


if “%site_path%”==”” GOTO no_path
if “%site_port%”==”” GOTO no_port
if not exist “%site_path%” GOTO invalid_path


set sitename=%TIME::=.%-%RANDOM%
set tempdir=%TEMP%iisexpress-temp%sitename%
if exist “%tempdir%” GOTO :get_tempdir
mkdir “%tempdir%”


if “%PROGRAMFILES(x86)%”==”” goto x86
set iis_dir=%PROGRAMFILES(x86)%IIS Express
goto iis_done
set iis_dir=%PROGRAMFILES%IIS Express
if not exist “%iis_dir%iisexpress.exe” GOTO iis_missing


copy “%iis_dir%AppServerapplicationHost.config” “%tempdir%”

REM Mangle ‘Development Web Site’ to match what we’re after

REM These need IIS Express 8:
REM “%iis_dir%appcmd.exe” set config -section:system.applicationHost/sites /”[name=’Development Web Site’].[path=’/’].[path=’/’].physicalPath:%site_path%” /commit:apphost /apphostconfig:%tempdir%applicationHost.config
REM “%iis_dir%appcmd.exe” set config -section:system.applicationHost/sites /~”[name=’Development Web Site’].bindings” /commit:apphost /apphostconfig:%tempdir%applicationHost.config
REM “%iis_dir%appcmd.exe” set config -section:system.applicationHost/sites /+”[name=’Development Web Site’].bindings.[protocol=’%site_protocol%’,bindingInformation=’’]” /commit:apphost /apphostconfig:%tempdir%applicationHost.config
REM This doesn’t
Powershell.exe -Command “& {$a=New-Object System.Xml.XmlDocument;$a.Load(“%tempdir%applicationHost.config”);$b=$a.SelectSingleNode(“//sites/site[@id=’1′]//virtualDirectory”);$b.physicalPath=”%site_path%”;$c=$a.SelectSingleNode(“//sites/site[@id=’1′]//binding”);$c.protocol=”%site_protocol%”;$c.bindingInformation=”:%site_port%:localhost”;$a.Save(“%tempdir%applicationHost.config”)}”


echo Running IIS Express: /port:%site_port% /protocol:%site_protocol% /path:%site_path%, temp-config: %tempdir%applicationHost.config
“%iis_dir%iisexpress.exe” /config:%tempdir%applicationHost.config /siteid:1 /systray:false

rd /q /s %tempdir%

goto exit

echo /port not specified
goto help

echo /path not specified
goto help

echo /path doesn’t exist: %site_path%
exit /b 2

echo can’t find iisexpress.exe in %iis_dir%
exit /b 3


echo %script_name% [/port:1234] [/protocol:https] “/path:C:pathtositedir”
echo default: /port:8080 /protocol:http
exit /b 1

GOTO exit



exit /b

Here’s hoping this solution works as well for you as it does for me.  Enjoy!