<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">

<channel>
	<title>Technical Jargon</title>
	
	<link>http://www.jeremyskinner.co.uk</link>
	<description>On Error Resume Coding</description>
	<lastBuildDate>Sun, 08 Aug 2010 13:36:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/TechnicalJargon" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="technicaljargon" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Hosting a Git server under Apache on Windows</title>
		<link>http://www.jeremyskinner.co.uk/2010/07/31/hosting-a-git-server-under-apache-on-windows/</link>
		<comments>http://www.jeremyskinner.co.uk/2010/07/31/hosting-a-git-server-under-apache-on-windows/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 12:12:00 +0000</pubDate>
		<dc:creator>Jeremy Skinner</dc:creator>
				<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://www.jeremyskinner.co.uk/2010/07/31/hosting-a-git-server-under-apache-on-windows/</guid>
		<description><![CDATA[Last month I posted about hosting a git server under IIS by using GitAspx. While this is certainly one way to host a git server on windows, I wouldn’t recommend this in a production environment. An alternative (and somewhat more stable) approach is to use the native implementation of git-http-backend that ships with msysgit along [...]]]></description>
			<content:encoded><![CDATA[<p>Last month I posted about <a href="http://www.jeremyskinner.co.uk/2010/06/25/hosting-a-git-server-under-iis7-on-windows/">hosting a git server under IIS</a> by using <a href="http://github.com/jeremyskinner/git-dot-aspx">GitAspx</a>. While this is certainly one way to host a git server on windows, I wouldn’t recommend this in a production environment. </p>
<p>An alternative (and somewhat more stable) approach is to use the native implementation of git-http-backend that ships with <a href="http://code.google.com/p/msysgit">msysgit</a> along with Apache. </p>
<h3>Step 1: Install Git</h3>
<p>Firstly you’ll need to install <a href="http://code.google.com/p/msysgit">msysgit</a>. The current stable version is 1.7.0.2, but this process should also work with the 1.7.1 beta. Be sure to select <strong>Run git from the Windows Command prompt</strong> when the installer asks you if you want to modify your PATH variable.</p>
<p>Once installed, you’ll need to tweak the installation slightly. By default, the git http server is located at C<strong>:\Program Files (x86)\Git\libexec\git-core\git-http-backend.exe </strong>(on x64 systems). If you try and run git-http-backend.exe you’ll get the message that the application couldn’t be started because libiconv2.dll is missing:</p>
<p><a href="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image6.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image_thumb6.png" width="419" height="148" /></a></p>
<p>In order to fix this, copy libiconv2.dll from <strong>C:\Program Files (x86)\Git\bin</strong> to <strong>C:\Program Files (x86)\Git\libexec\git-core</strong></p>
<p>Now when you run git-http-backend.exe from a command prompt, the application should run and you should see an HTTP 500 server error:</p>
<p><a href="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image7.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image_thumb7.png" width="670" height="172" /></a></p>
<h3><strong>Step 2: Install Apache</strong></h3>
<p><strong></strong>Next you’ll need to install the Apache webserver. I’m using the 2.2.16 installer <a href="http://apache.mirror.anlx.net/httpd/binaries/win32/httpd-2.2.16-win32-x86-no_ssl.msi">which can be found here</a>. I ran through the installation using the default options so my Apache instance is running on port 80. </p>
<p>If you visit http://localhost at this point you should be greeted with Apache’s standard “It works!” message.</p>
<h3>Step 3: Create Repositories Directory</h3>
<p>Create the directory where you want to store your git repositores. I’m using <strong>C:\Repositories. </strong>For testing purposes I created an empty test repository:</p>
<p><a href="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image8.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image_thumb8.png" width="531" height="173" /></a></p>
<p>You’ll also need to put some content in this test repositor    </p>
<h3></h3>
<h3>Step 4: Modify Apache Configuration</h3>
<p>Next, you’ll need to modify the Apache configuration file so that it forwards requests to git-http-backend.exe. This is done by editing <strong>httpd.conf</strong> in <strong>C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\</strong></p>
<p>At the bottom of httpd.conf, add the following lines:</p>
<pre>SetEnv GIT_PROJECT_ROOT C:/Repositories
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAliasMatch \
        &quot;(?x)^/(.*/(HEAD | \
                        info/refs | \
                        objects/(info/[^/]+ | \
                                 [0-9a-f]{2}/[0-9a-f]{38} | \
                                 pack/pack-[0-9a-f]{40}\.(pack|idx)) | \
                        git-(upload|receive)-pack))$&quot; \
                        &quot;C:/Program Files (x86)/git/libexec/git-core/git-http-backend.exe/$1&quot;</pre>
<p>The first line tells git where your repositories are located. The second line tells git that all repositories in this directory should be published over http (by default, git will only publish those repositories that contain a file named “git-daemon-export-ok”). The final lines tell apache to route git-specific URLs to the git http server.</p>
<p>Finally, if you want to be able to clone from the server without authentication, then you’ll need to tell Apache to allow anonymous access by adding the following lines into httpd.conf:</p>
<pre>&lt;Directory /&gt;
  Allow from all
&lt;/Directory&gt;</pre>
<p>After saving the changes, restart the Apache service.</p>
<h3>Step 5: Clone the test repository</h3>
<p>Next, clone the test repository that you crated in step 3 by issuing the command<strong> git clone http://localhost/Test.git</strong> </p>
<p>If all goes well, you should see the following output:</p>
<p><a href="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image9.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image_thumb9.png" width="512" height="131" /></a></p>
<p>At this point, you can now clone repositories from the server without any authentication.</p>
<h3>Step 6: Authentication</h3>
<p>If you try to push changes to the repository you cloned in step 5, you’ll receive an error:</p>
<p><a href="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image10.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image_thumb10.png" width="668" height="282" /></a></p>
<p></p>
<p>This is because by default, you can only pull from repositories anonymously, while pushing requires authentication to be enabled. </p>
<h4>Scenario 1: Allow anonymous pushes</h4>
<p>Sometimes you may want to allow users to push to your repositories without authentication, for example when using an internal, privately hosted server. </p>
<p>To enable this scenario, edit the <strong>config </strong>file in C:\Repositories\Test.git on the server and add the following lines to the bottom of the file:</p>
<pre>[http]
  receivepack = true</pre>
<p>This will allow git to accept pushes from anonymous users. </p>
<p>Note that you’ll have to add this to every repository that you create. I’ll show a nicer way to do this later in the tutorial.</p>
<h4>Scenario 2: Anonymous pull, authenticated push</h4>
<p>This is the default scenario. Git will only allow users to push if they have been authenticated with apache. </p>
<p>There are several ways to enable user accounts with apache. The most basic is to use .htaccess files, although you can also configure integration with Windows user accounts and Active Directory by using mod_authnz_ldap. Configuring these is outside the scope for this tutorial, but there are plenty of examples on the internets. </p>
<p>Once authentication is set up, you’ll need to ensure that you clone your repositories with the username in the URL, as git will not prompt you for a username by default:</p>
<p><strong>git clone http://MyUserName@mygitserver/Test.git</strong></p>
<p>Git will then prompt you for a password every time that you try to push. You can also hard code the password in the URL (somewhat insecure) if you want to avoid this prompt:</p>
<p><strong>git clone http://MyUserName:Password@mygitserver/Test.git</strong></p>
<p>To make this more secure, you could enable SSL on the server and require authenticated traffic to go over HTTPS. Although configuring OpenSSL with apache is outside the scope for this tutorial, I will point out that once configured, you will need to disable the SSL verification on your git client by running:</p>
<p><strong>git config &#8211;global http.sslverify false</strong></p>
<p>If you don’t do this, you’ll get an error saying <strong>“error setting certificate verify locations”</strong> every time you try to clone/push/pull over HTTPS.</p>
<h3>Step 7: A prettier UI</h3>
<p>At this point, you should be able to clone, pull from and push to the server. However, creating new repositories requires that you connect remotely to the server and run git init from a command prompt on the server. </p>
<p>A nicer alternative is to use a web-based front for the creation of repositories. For this I’ll be using <a href="http://github.com/JeremySkinner/GitPhpHomepage">GitPhpHomepage</a> which is a small collection of PHP scripts that I ported from <a href="http://github.com/JeremySkinner/git-dot-aspx">GitAspx&#8217;s</a> ASP.NET-based UI to PHP in order to get it working under Apache.</p>
<p>First, you’ll need to install PHP on the server. I’ll be using the PHP 5.3.3 Windows binaries that can be found at <a href="http://windows.php.net/download/">http://windows.php.net/download/</a>. The download page is somewhat confusing, offering both thread-safe and non-thread-safe versions compiled with both VC6 and VC9. For use with Apache 2.2 be sure to select the <strong>VC6 x86 Thread Safe zip package</strong>. Here’s <a href="http://windows.php.net/downloads/releases/php-5.3.3-Win32-VC6-x86.zip">a direct link</a>.</p>
<p>Unzip the contents of this package to <strong>C:\PHP</strong> on the server and add this directory to Windows’ PATH environment variable:</p>
<p><a href="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image11.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image_thumb11.png" width="413" height="475" /></a></p>
<p>Next, rename the php.ini-production file to just php.ini and edit the following settings:</p>
<p>Uncomment and edit the “extension_dir” (about half way through the file) so that it says the following:</p>
<pre>extension_dir = &quot;c:\php\ext&quot;</pre>
<p>Next, edit your Apache configuration file (C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\httpd.conf) and add the following lines to the bottom of the file:</p>
<pre>AddType application/x-httpd-php .php
LoadModule php5_module &quot;C:/php/php5apache2_2.dll&quot;
PHPIniDir &quot;C:/php&quot;</pre>
<p>This tells Apache to map .php file extensions to the PHP5 apache module located in C:\php.</p>
<p>You’ll also need to tell Apache to look for index.php as a default index file. This can be done by searching for the lines that look like this:</p>
<pre>&lt;IfModule dir_module&gt;&#160;&#160;&#160;&#160;
  DirectoryIndex index.html
&lt;/IfModule&gt;</pre>
<p>…and changing them to this:</p>
<pre>&lt;IfModule dir_module&gt;&#160;&#160;&#160;&#160;
  DirectoryIndex index.php index.html
&lt;/IfModule&gt;</pre>
<p>Be sure to restart the Apache server once you’ve made these changes.</p>
<p>To see whether this is working, create a file called phpinfo.php in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs and place in it the following content:</p>
<pre>&lt;?php phpinfo(); ?&gt;</pre>
<p>Now, visiting http://mygitserver/phpinfo.php should display a page containing PHP configuration information.</p>
<p>Now that PHP is configured, download the GitPhpHomepage files from <a href="http://github.com/JeremySkinner/GitPhpHomepage">http://github.com/JeremySkinner/GitPhpHomepage</a> and unzip them into C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs </p>
<p>Be sure to edit the config.php file so that it accurately reflects both the git installation directory and your repositories directory. </p>
<p>At this point, visiting http://mygitserver should display a page where you can view and create repositories:</p>
<p><a href="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image12.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image_thumb12.png" width="644" height="358" /></a></p>
<p>Pressing the “Create a new bare repository” button will open a dialog where you can create a new repository, including the option to enable anonymous pushes:</p>
<p><a href="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image13.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image_thumb13.png" width="656" height="189" /></a></p>
<p>Obviously, if you’re thinking of using this on a public-facing server you should enable authentication so that not just anyone can create repositories on your server. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremyskinner.co.uk/2010/07/31/hosting-a-git-server-under-apache-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FluentValidation 1.3 Released</title>
		<link>http://www.jeremyskinner.co.uk/2010/07/26/fluentvalidation-1-3-released/</link>
		<comments>http://www.jeremyskinner.co.uk/2010/07/26/fluentvalidation-1-3-released/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 11:21:00 +0000</pubDate>
		<dc:creator>Jeremy Skinner</dc:creator>
				<category><![CDATA[FluentValidation]]></category>

		<guid isPermaLink="false">http://www.jeremyskinner.co.uk/2010/07/26/fluentvalidation-1-3-released/</guid>
		<description><![CDATA[FluentValidation 1.3 is now available for download. Here’s what’s changed: Silverlight 4 compatibility The Silverlight build of FluentValidation now targets Silverlight 4 rather than Silverlight 3. The Silverlight build is now signed like the main binaries. Changes to When/Unless In previous versions of FluentValidation, calls to When or Unless only applied to the current validator [...]]]></description>
			<content:encoded><![CDATA[<p>FluentValidation 1.3 is now <a href="http://fluentvalidation.codeplex.com/releases/view/49572">available for download</a>. Here’s what’s changed:</p>
<h3>Silverlight 4 compatibility</h3>
<p>The Silverlight build of FluentValidation now targets Silverlight 4 rather than Silverlight 3. The Silverlight build is now signed like the main binaries.</p>
<h3>Changes to When/Unless</h3>
<p>In previous versions of FluentValidation, calls to When or Unless only applied to the current validator in the chain. For example, if you declare a rule that has two validators and a condition:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:4318B029-7F5A-4155-A9CF-329C469B73B3:b97a549a-bf06-494f-8492-b03df29b5dbf" class="wlWriterEditableSmartContent">

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> PersonValidator <span style="color: #008000;">:</span> AbstractValidator<span style="color: #008000;">&lt;</span>Person<span style="color: #008000;">&gt;</span> <span style="color: #000000;">&#123;</span>
  <span style="color: #0600FF;">public</span> PersonValidator<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
    RuleFor<span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x.<span style="color: #0000FF;">Surname</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">NotNull</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">NotEqual</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;foo&quot;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">When</span><span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x.<span style="color: #0000FF;">Id</span> <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
  <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

</div>
<p>…then the condition would only be applied to the validator that directly preceded it (in this case, the NotEqual validator). </p>
<p>With 1.3, the default behaviour of When and Unless is to apply to <strong>all previous validators in the chain. This is a potentially breaking change</strong>. This behaviour is slightly more intuitive, but you can still use the pre-1.3 behaviour if you need to by specifying ApplyConditionTo.CurrentValidator:</p>
<h3></h3>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:4318B029-7F5A-4155-A9CF-329C469B73B3:9b47a362-fa1f-453c-9087-c8d9a817c2d7" class="wlWriterEditableSmartContent">

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">RuleFor<span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x.<span style="color: #0000FF;">Surname</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">NotNull</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">NotEqual</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;foo&quot;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">When</span><span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x.<span style="color: #0000FF;">Id</span> <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">0</span>, ApplyConditionTo.<span style="color: #0000FF;">CurrentValidator</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

</div>
<h3>Minor changes to NotEmptyValidator</h3>
<p>The NotEmptyValidator now treats strings that contain only whitespace as empty. Previously, only null or empty strings were considered.</p>
<h3>New Test Helpers</h3>
<p>New test helpers were added for checking whether a property has a child validator applied to it:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:4318B029-7F5A-4155-A9CF-329C469B73B3:46fab88e-a981-453e-9a61-516e400861da" class="wlWriterEditableSmartContent">

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> PersonValidator <span style="color: #008000;">:</span> AbstractValidator<span style="color: #008000;">&lt;</span>Person<span style="color: #008000;">&gt;</span> <span style="color: #000000;">&#123;</span>
  <span style="color: #0600FF;">public</span> PersonValidator<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
   RuleFor<span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x.<span style="color: #0000FF;">Address</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">SetValidator</span><span style="color: #000000;">&#40;</span><span style="color: #008000;">new</span> AddressValidator<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
  <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
var validator <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> PersonValidator<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
validator.<span style="color: #0000FF;">ShouldHaveChildValidator</span><span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x.<span style="color: #0000FF;">Address</span>, <span style="color: #008000;">typeof</span><span style="color: #000000;">&#40;</span>AddressValidator<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

</div>
<h3>Changes to Cascade</h3>
<p>To recap, FV 1.2 <a href="http://www.jeremyskinner.co.uk/2010/01/23/fluentvalidation-1-2-beta-1-available/">introduced the concept of a Cascade Mode</a> which controls how execution of rules should continue when the first rule fails. For example, you could specify a CascadeMode of StopOnFirstFailure:</p>
<p>&#160;</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:4318B029-7F5A-4155-A9CF-329C469B73B3:95569bb4-6a0c-4ee7-b015-3ca40ec0649b" class="wlWriterEditableSmartContent">

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">RuleFor<span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x.<span style="color: #0000FF;">Surname</span><span style="color: #000000;">&#41;</span>
  .<span style="color: #0000FF;">Cascade</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">StopOnFirstFailure</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
  .<span style="color: #0000FF;">NotNull</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
  .<span style="color: #0000FF;">Length</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">1</span>, <span style="color: #FF0000;">250</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

</div>
<p>&#160;</p>
<p>…which would prevent the Length rule from running if the NotNull rule fails. With 1.3, this method has been deprecated in favour of an overload for Cascade that takes an enum value:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:4318B029-7F5A-4155-A9CF-329C469B73B3:89baaf9b-98c7-4154-8430-a2c976385eb2" class="wlWriterEditableSmartContent">

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">RuleFor<span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> x.<span style="color: #0000FF;">Surname</span><span style="color: #000000;">&#41;</span>
  .<span style="color: #0000FF;">Cascade</span><span style="color: #000000;">&#40;</span>CascadeMode.<span style="color: #0000FF;">StopOnFirstFailure</span><span style="color: #000000;">&#41;</span>
  .<span style="color: #0000FF;">NotNull</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
  .<span style="color: #0000FF;">Length</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">1</span>, <span style="color: #FF0000;">250</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

</div>
<p>This was done for consistency with the other methods for setting the cascade mode (more on this in a second).</p>
<p>In 1.2, the cascade mode could either be set globally (by using the static ValidatorOptions.CascadeMode property) or at the rule level. 1.3 introduces the ability to set the validator cascade mode at the Validator level:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:4318B029-7F5A-4155-A9CF-329C469B73B3:bfdd3b21-4abd-4d41-b529-cc9707289a50" class="wlWriterEditableSmartContent">

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> PersonValidator <span style="color: #008000;">:</span> AbstractValidator<span style="color: #008000;">&lt;</span>Person<span style="color: #008000;">&gt;</span> <span style="color: #000000;">&#123;</span>
  <span style="color: #0600FF;">public</span> PersonValidator<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
    CascadeMode <span style="color: #008000;">=</span> CascadeMode.<span style="color: #0000FF;">StopOnFirstFailure</span><span style="color: #008000;">;</span>
&nbsp;
    RuleFor<span style="color: #000000;">&#40;</span>....<span style="color: #000000;">&#41;</span>
  <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

</div>
<h3>Other Changes</h3>
<ul>
<li>Italian translations of the default error messages are now available. </li>
<li>ChildValidatorAdaptor is now public </li>
<li>IAttributeMetadataValidator is now public </li>
<li>Added a non-generic ValidatorContext class so that validator selectors can be used with non-generic IValidator instances </li>
<li>The internal model was greatly simplified </li>
<li>Introduced IErrorMessageSource as a way to abstract the different mechanisms for building error messages. The end result is that the PropertyValidator base class is significantly simpler. </li>
<li>xVal integration supports custom error messages </li>
</ul>
<h3>What’s coming with FluentValidation 2.0?</h3>
<p>The next release of FluentValidation will be v2.0. My current plans for this release are:</p>
<ul>
<li>ASP.NET MVC 3 integration </li>
<li>Major rewrite of the fluent interface to allow for validator-specific options. At the moment, all validators share the same options (eg When, Unless, WithMessage, WithState etc). The new fluent interface will allow options that only apply to some validators. </li>
<li>Remove ASP.NET MVC 1 integration (MVC2 will still be supported). </li>
<li>Remove the FluentValidation 1.0 backwards compatibility layer </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremyskinner.co.uk/2010/07/26/fluentvalidation-1-3-released/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Using TeamCity with PartCover 4</title>
		<link>http://www.jeremyskinner.co.uk/2010/07/23/using-teamcity-with-partcover-4/</link>
		<comments>http://www.jeremyskinner.co.uk/2010/07/23/using-teamcity-with-partcover-4/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 17:42:00 +0000</pubDate>
		<dc:creator>Jeremy Skinner</dc:creator>
				<category><![CDATA[TeamCity]]></category>

		<guid isPermaLink="false">http://www.jeremyskinner.co.uk/2010/07/23/using-teamcity-with-partcover-4/</guid>
		<description><![CDATA[TeamCity 5 has support for .NET code coverage by using nunit with either NCover or PartCover. However, in order to get this working with the latest version of PartCover (4.0.10705) you’ll need to make a few tweaks to the PartCover installation. Step 1 – Install or Upgrade TeamCity Make sure you’re running the latest version [...]]]></description>
			<content:encoded><![CDATA[<p>TeamCity 5 has support for .NET code coverage by using nunit with either NCover or PartCover. However, in order to get this working with the latest version of PartCover (4.0.10705) you’ll need to make a few tweaks to the PartCover installation.</p>
<h3>Step 1 – Install or Upgrade TeamCity</h3>
<p>Make sure you’re running the latest version of TeamCity (currently 5.1.3) as older versions do not have the code coverage support out of the box.</p>
<h3>Step 2 – Install &amp; Tweak PartCover</h3>
<p>PartCover 4 can be <a href="http://sourceforge.net/projects/partcover/">downloaded from sourceforge</a>. Run through the installer, which will install PartCover to C:\Program Files (x86)\PartCover\PartCover .NET 4.0 (on a x64 system):</p>
<p><a href="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image_thumb.png" width="507" height="410" /></a></p>
<p>&#160;</p>
<p>TeamCity expects to find a file called <strong>PartCover.CorDriver.dll</strong> in the installation directory. However, with PartCover 4 this was renamed to PartCover.dll, so in order to get PartCover working with TeamCity, copy PartCover.dll and rename the copy to PartCover.CorDriver.dll    </p>
<p><a href="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image_thumb1.png" width="515" height="465" /></a></p>
<p> <br />
<h3>Step 4 – Fix the XSLT Templates</h3>
<p>TeamCity seems to have problems rendering PartCover’s XSLT templates. I’ve put together a modified version that seems to work, and also allows you to click an assembly name to view the classes in that assembly. The template can be downloaded <a href="http://github.com/downloads/JeremySkinner/Experiments/Coverage.xslt">from here</a>.</p>
<p>The fixed XSLT template should be placed in C:\program files (x86)\PartCover\PartCover .NET 4.0\xslt</p>
<h3>Step 5 – Configure your build</h3>
<p>In this example, I’ll be running my unit tests through nant’s <a href="http://nant.sourceforge.net/release/0.85-rc2/help/tasks/nunit2.html">NUnit2 task</a>, although this also works if you invoke TeamCity’s nunit-launcher directly as well as the teamcity-specific NUnitTeamCity task.</p>
<p>The “test” target in my nant script looks like this:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:4318B029-7F5A-4155-A9CF-329C469B73B3:a663bd6d-f5cb-4774-9e7e-94006075f166" class="wlWriterEditableSmartContent">

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;test&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;nunit2<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;formatter</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;Plain&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;test</span> <span style="color: #000066;">assemblyname</span>=<span style="color: #ff0000;">&quot;Path\To\MyProject.Tests.dll&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/nunit2<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

</div>
<p>When configuring your TeamCity build, select “PartCover (2.2 or 2.3)” from the “.NET Coverage tool” section on the “Runner” page. Be sure to correctly set the path to the PartCover installation on the build server:</p>
<p><a href="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image_thumb2.png" width="449" height="484" /></a></p>
<p>&#160;</p>
<p>In this example, my build configuration is set to invoke the “ci” target of my build script which in turn calls the “test”target.</p>
<p>You’ll also need to select the assemblies to include/exclude. These are specified in the format of [assemblypattern]namespacepattern.</p>
<p>For example, to include all assemblies beginning with “MyApp”, but excluding the test assembly, the include/exclude patterns would look like this:</p>
<p><a href="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image3.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image_thumb3.png" width="526" height="484" /></a></p>
<p></p>
<p>Note that I also specify the path to my custom XSLT template as : </p>
<p>C:\Program Files\PartCover\PartCover .NET 4.0\xslt\Coverage.xslt=&gt;index.html</p>
<p>This tells TeamCity to use the custom Coverage.xslt file when transforming PartCover’s outputs and to store the resulting HTML page as index.html.</p>
<p>Once this is done, you can run a build and look at the results. The summary page will contain a sumary of the coverage, as well as a link and a tab to view the full report:</p>
<p><a href="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image_thumb4.png" width="644" height="227" /></a></p>
<p>The resulting code coverage file will look something like this:</p>
<p><a href="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image5.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/07/image_thumb5.png" width="599" height="467" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremyskinner.co.uk/2010/07/23/using-teamcity-with-partcover-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hosting a Git server under IIS7 on Windows</title>
		<link>http://www.jeremyskinner.co.uk/2010/06/25/hosting-a-git-server-under-iis7-on-windows/</link>
		<comments>http://www.jeremyskinner.co.uk/2010/06/25/hosting-a-git-server-under-iis7-on-windows/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 17:20:00 +0000</pubDate>
		<dc:creator>Jeremy Skinner</dc:creator>
				<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://www.jeremyskinner.co.uk/2010/06/25/hosting-a-git-server-under-iis7-on-windows/</guid>
		<description><![CDATA[Traditionally Git requires the use of SSH if you want to host read/write repositories on a server. While this is certainly possible to do on Windows by running OpenSSH under Cygwin, it isn’t a particularly simple process and does require some familiarity with unix/linux. However, with the smart HTTP support introduced with with Git 1.6.6 [...]]]></description>
			<content:encoded><![CDATA[<p>Traditionally <a href="http://git-scm.com/">Git</a> requires the use of SSH if you want to host read/write repositories on a server. While this is certainly possible to do on Windows by running <a href="http://www.markembling.info/view/git-server-gitosis-and-cygwin-on-windows">OpenSSH under Cygwin</a>, it isn’t a particularly simple process and does require some familiarity with unix/linux. </p>
<p>However, with the <a href="http://progit.org/2010/03/04/smart-http.html">smart HTTP support</a> introduced with with Git 1.6.6 it is now possible to push to git repositories over HTTP. Although the default implementation of the smart http protocol requires the use of apache, there are other implementations available. For example, <a href="http://github.com/schacon/grack">Grack</a> is a ruby-based implementation using the Rack framework and <a href="http://github.com/dvdotsenko/git_http_backend.py">git_http_backend.py</a> implements similar functionality in Python.</p>
<p>I decided to have a go at putting together a native .NET implementation of git-http-backend using ASP.NET MVC and the excellent <a href="http://www.eqqon.com/index.php/GitSharp">GitSharp</a> library. The result is available on GitHub in the imaginatively titled <a href="http://github.com/jeremyskinner/git-dot-aspx">git-dot-aspx</a> (GitAspx) project. </p>
<p>To get started, you’ll need to <a href="http://github.com/jeremyskinner/git-dot-aspx">download the source</a> and compile the project. It is built using .NET 4 and ASP.NET MVC2, so you’ll need Visual Studio 2010 installed in order to open the solution.</p>
<p>Once compiled, create a new web site in IIS and point it at the directory containing the application. Be sure to select the ASP.NET v4 Application Pool.</p>
<p><a href="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/06/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/06/image_thumb.png" width="386" height="484" /></a></p>
<p>Next, you’ll need to edit the application’s web.config so GitAspx knows where to look for your repositories. This is done by setting the “RepositoriesDirectory” app setting:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:4318B029-7F5A-4155-A9CF-329C469B73B3:c6fa5a1c-45a7-491f-a405-639043372218" class="wlWriterEditableSmartContent">

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appSettings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;add</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;RepositoriesDirectory&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;C:\Repositories&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/appSettings<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

</div>
<p>Once configured, browsing to the application will display a list of projects (the default homepage is currently unstyled – I hope to have a nicer UI in place shortly!). Clicking on a project shows the clone URL:</p>
<p><a href="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/06/image1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/06/image_thumb1.png" width="644" height="371" /></a></p>
<p>You can now clone, pull and push from this URL:</p>
<pre>git clone http://localhost:8080/FluentValidation
echo foo &gt; foo.txt
git add -A
git commit -m &quot;Committing&quot;
git push origin master</pre>
<p>It’s probably a good idea to put some authentication in place (eg basic authentication over SSL) so not just everyone can push to your repositories! You can also allow/deny access to specific projects using the standard ASP.NET URL authorization mechanism. </p>
<p>At present, this is only an implementation of the “smart” protocol (which allows both push/pull), but I’m also planning on adding support for the “dumb” protocol to be backwards compatible with older clients. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremyskinner.co.uk/2010/06/25/hosting-a-git-server-under-iis7-on-windows/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Using Mercurial with Subversion</title>
		<link>http://www.jeremyskinner.co.uk/2010/05/13/using-mercurial-with-subversion/</link>
		<comments>http://www.jeremyskinner.co.uk/2010/05/13/using-mercurial-with-subversion/#comments</comments>
		<pubDate>Thu, 13 May 2010 17:55:00 +0000</pubDate>
		<dc:creator>Jeremy Skinner</dc:creator>
				<category><![CDATA[mercurial]]></category>

		<guid isPermaLink="false">http://www.jeremyskinner.co.uk/2010/05/13/using-mercurial-with-subversion/</guid>
		<description><![CDATA[If you’re a user of distributed source control systems such as Git and Mercurial then you may find it painful having to work with subversion (either at work or for an open source project). Recently I started playing with the excellent hgsubversion extension which allows you to use mercurial as a subversion client. Assuming you [...]]]></description>
			<content:encoded><![CDATA[<p>If you’re a user of <a href="http://en.wikipedia.org/wiki/Distributed_revision_control">distributed source control</a> systems such as <a href="http://git-scm.com/">Git</a> and <a href="http://mercurial.selenic.com">Mercurial</a> then you may find it painful having to work with subversion (either at work or for an open source project). Recently I started playing with the excellent <a href="http://bitbucket.org/durin42/hgsubversion/wiki/Home">hgsubversion</a> extension which allows you to use mercurial as a subversion client. </p>
<p>Assuming you already have Mercurial installed (or <a href="http://tortoisehg.bitbucket.org/">TortoiseHg</a>) then you can easily grab the hgsubversion extension by grabbing its source <a href="http://bitbucket.org/durin42/hgsubversion/wiki/Home">from bitbucket</a>:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:4318B029-7F5A-4155-A9CF-329C469B73B3:a8ae8e27-c740-4171-8310-df8fa7034fa3" class="wlWriterEditableSmartContent">

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;"><span style="color: #b1b100; font-weight: bold;">cd</span> c:\Projects
hg clone http://bitbucket.org/durin42/hgsubversion</pre></div></div>

</div>
<p>Here I’ve simply cloned hgsubversion in to my C:\Projects directory. </p>
<p>Next, edit your Mercurial.ini file (in your home directory) and enable both the rebase and svn extensions. Note that rebase is distributed with Mercurial so you don’t need to specify a path:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:4318B029-7F5A-4155-A9CF-329C469B73B3:98e1d102-7426-4c47-aba2-4b3740d64706" class="wlWriterEditableSmartContent">

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>extensions<span style="">&#93;</span></span>
<span style="color: #000099;">rebase</span><span style="color: #000066; font-weight:bold;">=</span>
<span style="color: #000099;">svn</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">c:\projects\hgsubversion\hgsubversion</span></pre></div></div>

</div>
<p>Now you can clone a subversion repository locally:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:4318B029-7F5A-4155-A9CF-329C469B73B3:e6477edf-0796-4278-9ec3-ff76ec72e1f8" class="wlWriterEditableSmartContent">

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">hg clone svn+https://path/to/someproject/svn/trunk someproject-hg</pre></div></div>

</div>
<p>Here I’m cloning a subversion repository to the local “someproject-hg” directory. Note the svn+https in the URL.</p>
<p>If you want to generate a .hgignore file based on the svn:ignore properties in the remote repository then you can issue the following command:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:4318B029-7F5A-4155-A9CF-329C469B73B3:4911635a-67c8-48e0-9e57-ec3d16f6ac0e" class="wlWriterEditableSmartContent">

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">hg svn genignore</pre></div></div>

</div>
<p>At this point I can interact with someproject-hg as with any other mercurial repository – I can edit files and make local commits. When I’m ready to push the changes back to the subversion server I can issue a “hg push” just as if I were pushing to a remote mercurial repository. </p>
<p>Likewise, if I want to retrieve new changesets from svn then I can issue a “hg pull” as normal. When you pull the changes, this will create a branch in the local repository’s history. At this point, rather than performing a “hg merge” (as you would with a normal mercurial repository) it is necessary to rebase your changes to ensure that you keep a linear history. To perform a rebase, you can issue the command:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:4318B029-7F5A-4155-A9CF-329C469B73B3:620fee35-21c3-4b62-8c45-d41eecd65aac" class="wlWriterEditableSmartContent">

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">hg rebase <span style="color: #008000;">--</span>svn</pre></div></div>

</div>
<p>If you’re in a situation where you have an existing Subversion repository and you’re not yet willing to fully commit to using a DVCS, hgsubversion is a great way to let committers work with mercurial locally without needing to make any changes to your existing server.</p>
<p>For more information on hgsubversion, be sure to check out the documentation <a href="http://mercurial.selenic.com/wiki/HgSubversion">here</a> and <a href="http://mercurial.aragost.com/kick-start/hgsubversion.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremyskinner.co.uk/2010/05/13/using-mercurial-with-subversion/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MvcContrib Grid Presentation</title>
		<link>http://www.jeremyskinner.co.uk/2010/04/28/mvccontrib-grid-presentation/</link>
		<comments>http://www.jeremyskinner.co.uk/2010/04/28/mvccontrib-grid-presentation/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 18:14:00 +0000</pubDate>
		<dc:creator>Jeremy Skinner</dc:creator>
				<category><![CDATA[mvccontrib]]></category>

		<guid isPermaLink="false">http://www.jeremyskinner.co.uk/2010/04/28/mvccontrib-grid-presentation/</guid>
		<description><![CDATA[Today I did a presentation for the C4mvc virtual usergroup on the MvcContrib grid component.&#160; In the presentation I covered basic grid usage, auto-generated columns, paging, sorting and extensibility using custom grid renderers. The sample code that I used in the presentation is available here. The video for the talk is available on viddler.]]></description>
			<content:encoded><![CDATA[<p>Today I did a presentation for the <a href="http://c4mvc.net">C4mvc</a> virtual usergroup on the <a href="http://mvccontrib.codeplex.com/wikipage?title=Grid&amp;referringTitle=Documentation">MvcContrib grid component</a>.&#160; </p>
<p>In the presentation I covered basic grid usage, auto-generated columns, paging, sorting and extensibility using custom grid renderers. </p>
<p>The sample code that I used in the presentation <a href="http://github.com/downloads/JeremySkinner/Presentations/GridDemo-2010-04-28.zip">is available here</a>. The video for the talk <a href="http://www.viddler.com/explore/c4mvc/videos/38/">is available on viddler</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremyskinner.co.uk/2010/04/28/mvccontrib-grid-presentation/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>MvcContrib Grid Part 7 – Auto-generated columns</title>
		<link>http://www.jeremyskinner.co.uk/2010/04/27/mvccontrib-grid-part-7-auto-generated-columns/</link>
		<comments>http://www.jeremyskinner.co.uk/2010/04/27/mvccontrib-grid-part-7-auto-generated-columns/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 09:18:39 +0000</pubDate>
		<dc:creator>Jeremy Skinner</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[mvccontrib]]></category>

		<guid isPermaLink="false">http://www.jeremyskinner.co.uk/2010/04/27/mvccontrib-grid-part-7-auto-generated-columns/</guid>
		<description><![CDATA[This is part 7 of a series of posts on the MvcContrib grid component. Part 1 – Introduction Part 2 – New Syntax Part 3 – GridModels and GridRenderes Part 4 – Limitations of the WebFormsViewEngine Part 5 – The Action Syntax Part 6 – Sorting Part 7 – Auto-generated columns The MvcContrib grid provides [...]]]></description>
			<content:encoded><![CDATA[<p>This is part 7 of a series of posts on the <a href="http://mvccontrib.codeplex.com/wikipage?title=Grid">MvcContrib grid component</a>.</p>
<ul>
<li><a href="http://www.jeremyskinner.co.uk/2009/02/08/rewriting-the-mvccontrib-grid/">Part 1 – Introduction</a> </li>
<li><a href="http://www.jeremyskinner.co.uk/2009/02/22/rewriting-the-mvccontrib-grid-part-2-new-syntax/">Part 2 – New Syntax</a> </li>
<li><a href="http://www.jeremyskinner.co.uk/2009/02/23/rewriting-the-mvccontrib-grid-part-3-gridmodels-and-gridrenderers">Part 3 – GridModels and GridRenderes</a> </li>
<li><a href="http://www.jeremyskinner.co.uk/2009/02/28/mvccontrib-grid-part-4-limitations-of-the-webformsviewengine">Part 4 – Limitations of the WebFormsViewEngine</a> </li>
<li><a href="http://www.jeremyskinner.co.uk/2009/03/01/mvccontrib-grid-part-5-the-action-syntax">Part 5 – The Action Syntax</a> </li>
<li><a href="http://www.jeremyskinner.co.uk/2010/03/14/mvccontrib-grid-part-6-sorting/">Part 6 – Sorting</a> </li>
<li><a href="http://www.jeremyskinner.co.uk/2010/04/27/mvccontrib-grid-part-7-auto-generated-columns/">Part 7 – Auto-generated columns</a></li>
</ul>
<p>The MvcContrib grid provides a way to automatically generate columns based on the public properties of an object. This is particularly useful when you are using a dedicated <a href="http://martinfowler.com/eaaDev/PresentationModel.html">presentation model</a> where the object properties map directly to the columns that you want to display. </p>
<p>To make use of this feature, you can call the <strong>AutoGenerateColumns</strong> method in the Grid declaration:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:4318B029-7F5A-4155-A9CF-329C469B73B3:b51d0d81-c85d-4f64-ae16-23cde9daa90f" class="wlWriterEditableSmartContent">

<div class="wp_syntax"><div class="code"><pre class="asp" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;%</span><span style="color: #006600; font-weight: bold;">=</span> Html.<span style="color: #9900cc;">Grid</span><span style="color: #006600; font-weight:bold;">&#40;</span>Model<span style="color: #006600; font-weight:bold;">&#41;</span>.<span style="color: #9900cc;">AutoGenerateColumns</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #006600; font-weight:bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">%&gt;</span></pre></div></div>

</div>
<p>By default, this will generate one column per public property and the name of the property will be used as the column heading (although PascalCased properties will have spaces inserted, eg “DateOfBirth” would be rendered as “Date Of Birth”).</p>
<p>This output can be customised by making use of MVC2’s ModelMetadata.</p>
<p>Out of the box, MVC2 uses the System.ComponentModel.DataAnnotations attributes to obtain metadata about a particular type (although you can also use <a href="http://fluentvalidation.codeplex.com">other frameworks</a>). The following attributes can be used to customise the auto-generated columns:</p>
<ul>
<li>ScaffoldColumn – can be used to prevent a property from being rendered as a grid column</li>
<li>DisplayName – can be used to provide a custom column heading</li>
<li>DisplayFormat – can be used to specify a custom display format</li>
</ul>
<p>Additional columns not on your presentation model can also be added by making a call to the normal <strong>Columns</strong> method after the call to <strong>AutoGenerateColumns</strong>. For example, imagine we have a CustomerPresentationModel:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:4318B029-7F5A-4155-A9CF-329C469B73B3:86b1f7f8-b42e-49bd-aa1f-eb32a7b604bb" class="wlWriterEditableSmartContent">

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> CustomerPresentationModel <span style="color: #000000;">&#123;</span>
&nbsp;
   <span style="color: #000000;">&#91;</span>ScaffoldColumn<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">false</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
   <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span> CustomerId <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
&nbsp;
   <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> Name <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
   <span style="color: #0600FF;">public</span> DateTime DateOfBirth <span style="color: #000000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

</div>
<p>If a collection of these objects is passed to the Grid method, then two columns will be auto-generated – one for Name and one for DateOfBirth (CustomerId is excluded because it is decorated with ScaffoldColumn(false))</p>
<p>If we also want to add an “Edit” link for the customer, then we could add an additional column:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:4318B029-7F5A-4155-A9CF-329C469B73B3:40529881-3035-4a98-aca8-d2068d2ae5c9" class="wlWriterEditableSmartContent">

<div class="wp_syntax"><div class="code"><pre class="asp" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;%</span><span style="color: #006600; font-weight: bold;">=</span> Html.<span style="color: #9900cc;">Grid</span><span style="color: #006600; font-weight:bold;">&#40;</span>Model<span style="color: #006600; font-weight:bold;">&#41;</span>.<span style="color: #9900cc;">AutoGenerateColumns</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #006600; font-weight:bold;">&#41;</span>.<span style="color: #9900cc;">Columns</span><span style="color: #006600; font-weight:bold;">&#40;</span>extraColumns <span style="color: #006600; font-weight: bold;">=&gt;</span> <span style="color: #006600; font-weight:bold;">&#123;</span>
        extraColumns.<span style="color: #990099; font-weight: bold;">For</span><span style="color: #006600; font-weight:bold;">&#40;</span>x <span style="color: #006600; font-weight: bold;">=&gt;</span> Html.<span style="color: #9900cc;">ActionLink</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #cc0000;">&quot;Edit Customer&quot;</span>, <span style="color: #cc0000;">&quot;Edit&quot;</span>, <span style="color: #0000ff; font-weight: bold;">new</span><span style="color: #006600; font-weight:bold;">&#123;</span> id <span style="color: #006600; font-weight: bold;">=</span> x.<span style="color: #9900cc;">CustomerId</span> <span style="color: #006600; font-weight:bold;">&#125;</span><span style="color: #006600; font-weight:bold;">&#41;</span><span style="color: #006600; font-weight: bold;">;</span>
<span style="color: #006600; font-weight:bold;">&#125;</span><span style="color: #006600; font-weight:bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">%&gt;</span></pre></div></div>

</div>
<p>The additional column contains a link to the edit page for each customer. Note that while columns are automatically HTML-encoded, the grid will detect that ActionLink returns an instance of MvcHtmlString and therefore won’t encode this particular column.</p>
<p>Additional columns can also be re-ordered. For example, if we wanted our “Edit” link to appear before the Name/DateOfBirth then the <strong>InsertAt </strong>method could be used:</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:4318B029-7F5A-4155-A9CF-329C469B73B3:83f8e90d-f263-4fa5-b0a1-30a607477686" class="wlWriterEditableSmartContent">

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&lt;%=</span> Html.<span style="color: #0000FF;">Grid</span><span style="color: #000000;">&#40;</span>Model<span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">AutoGenerateColumns</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Columns</span><span style="color: #000000;">&#40;</span>extraColumns <span style="color: #008000;">=&gt;</span> <span style="color: #000000;">&#123;</span>
        extraColumns.<span style="color: #0600FF;">For</span><span style="color: #000000;">&#40;</span>x <span style="color: #008000;">=&gt;</span> Html.<span style="color: #0000FF;">ActionLink</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Edit Customer&quot;</span>, <span style="color: #666666;">&quot;Edit&quot;</span>, <span style="color: #008000;">new</span><span style="color: #000000;">&#123;</span> id <span style="color: #008000;">=</span> x.<span style="color: #0000FF;">CustomerId</span> <span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span>
            .<span style="color: #0000FF;">InsertAt</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">%&gt;</span></pre></div></div>

</div>
<p>Note that the InsertAt method is not contained in the latest MvcContrib release – you’ll need to build from source to get this.</p>
<p>I’ve also started to put together some <a href="http://mvccontrib.codeplex.com/wikipage?title=Grid">documentation for the grid</a> on the MvcContrib wiki.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremyskinner.co.uk/2010/04/27/mvccontrib-grid-part-7-auto-generated-columns/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Using Mercurial with Windows Powershell</title>
		<link>http://www.jeremyskinner.co.uk/2010/04/21/using-mercurial-with-windows-powershell/</link>
		<comments>http://www.jeremyskinner.co.uk/2010/04/21/using-mercurial-with-windows-powershell/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 08:12:00 +0000</pubDate>
		<dc:creator>Jeremy Skinner</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[mercurial]]></category>

		<guid isPermaLink="false">http://www.jeremyskinner.co.uk/2010/04/21/using-mercurial-with-windows-powershell/</guid>
		<description><![CDATA[Last month I wrote about using git with Windows Powershell by making use of a custom prompt function as well as tab expansion. My sample code for the git tab expansion and Mark’s custom prompt are now available on GitHub in the posh-git project. I’ve also ported both the prompt and the tab expansion to [...]]]></description>
			<content:encoded><![CDATA[<p>Last month I wrote about using <a href="http://www.jeremyskinner.co.uk/2010/03/07/using-git-with-windows-powershell/">git with Windows Powershell</a> by making use of a custom prompt function as well as tab expansion. My sample code for the git tab expansion and <a href="http://www.markembling.info/view/git-powershell-revisited">Mark’s custom prompt</a> are now available on GitHub in the <a href="http://github.com/dahlbyk/posh-git">posh-git project</a>.</p>
<p>I’ve also ported both the prompt and the tab expansion to work with <a href="http://mercurial.selenic.com">Mercurial</a>. </p>
<p><a href="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/04/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.jeremyskinner.co.uk/wp-content/uploads/2010/04/image_thumb.png" width="530" height="292" /></a> </p>
<p>Much like the git prompt, the Mercurial prompt shows the name of the branch as well as other information. The prompt shows the following information:</p>
<ul>
<li>“hg” – Identifies this as a mercurial repository (so I can tell whether I’m using git or mercurial) </li>
<li>“default” – We’re currently on the “default” branch </li>
<li>“+&lt;number&gt;” – Number of files that have been added but not yet committed </li>
<li>“~&lt;number&gt;” – Number of files that have been modified but not yet committed </li>
<li>“-&lt;number&gt;” – Number of files that have been removed but not yet committed </li>
<li>“?&lt;number&gt;” – Number of untracked files in the repository </li>
<li>“!&lt;number&gt;” – Number of missing files </li>
</ul>
<p>I’ve also written some basic tab expansion functionality that provides completion for hg commands as well as hgtk commands (the <a href="http://tortoisehg.bitbucket.org/">TortoiseHg</a> command line tool).</p>
<p>Code can be found in the <a href="http://github.com/jeremyskinner/posh-hg">posh-hg repository</a> (somewhat ironically hosted on GitHub).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremyskinner.co.uk/2010/04/21/using-mercurial-with-windows-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FluentValidation presentation – London – Wed 14 April</title>
		<link>http://www.jeremyskinner.co.uk/2010/04/01/fluentvalidation-presentation-london-wed-14-april/</link>
		<comments>http://www.jeremyskinner.co.uk/2010/04/01/fluentvalidation-presentation-london-wed-14-april/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 16:20:26 +0000</pubDate>
		<dc:creator>Jeremy Skinner</dc:creator>
				<category><![CDATA[FluentValidation]]></category>

		<guid isPermaLink="false">http://www.jeremyskinner.co.uk/2010/04/01/fluentvalidation-presentation-london-wed-14-april/</guid>
		<description><![CDATA[I’m going to be giving a short (20 minute) presentation about FluentValidation as part of the “OpenSource on .NET” event on Wednesday 14 April. Other Open Source frameworks/libraries being covered are: OpenRasta Castle Windsor CouchDB IronRuby Fluent NHibernate If you’re interested in coming along, please register on Event Brite.]]></description>
			<content:encoded><![CDATA[<p>I’m going to be giving a short (20 minute) presentation about <a href="http://fluentvalidation.codeplex.com/">FluentValidation</a> as part of the <a href="http://techdays-oss.eventbrite.com/">“OpenSource on .NET”</a> event on Wednesday 14 April.</p>
<p>Other Open Source frameworks/libraries being covered are:</p>
<ul>
<li>OpenRasta</li>
<li>Castle Windsor</li>
<li>CouchDB</li>
<li>IronRuby</li>
<li>Fluent NHibernate</li>
</ul>
<p>If you’re interested in coming along, please <a href="http://techdays-oss.eventbrite.com/">register on Event Brite.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremyskinner.co.uk/2010/04/01/fluentvalidation-presentation-london-wed-14-april/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>FluentValidation 1.2 RC available</title>
		<link>http://www.jeremyskinner.co.uk/2010/03/14/fluentvalidation-1-2-rc-available/</link>
		<comments>http://www.jeremyskinner.co.uk/2010/03/14/fluentvalidation-1-2-rc-available/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 18:22:00 +0000</pubDate>
		<dc:creator>Jeremy Skinner</dc:creator>
				<category><![CDATA[FluentValidation]]></category>

		<guid isPermaLink="false">http://www.jeremyskinner.co.uk/2010/03/14/fluentvalidation-1-2-rc-available/</guid>
		<description><![CDATA[The Release Candidate for FluentValidation 1.2 is now available. This build contains minor bug fixes from 1.2 beta 3, the AssemblyScanner class that I mentioned in this post and compatibility with ASP.NET MVC 2 RTM. If there are no serious bugs found with this build in the next couple of weeks then I will declare [...]]]></description>
			<content:encoded><![CDATA[<p>The Release Candidate for FluentValidation 1.2 is <a href="http://fluentvalidation.codeplex.com/">now available</a>.</p>
<p>This build contains minor bug fixes from 1.2 beta 3, the AssemblyScanner class that I mentioned <a href="http://www.jeremyskinner.co.uk/2010/02/22/using-fluentvalidation-with-an-ioc-container/">in this post</a> and compatibility with ASP.NET MVC 2 RTM.</p>
<p>If there are no serious bugs found with this build in the next couple of weeks then I will declare it as the “RTM” version.</p>
<p>As usual, binaries can be found <a href="http://fluentvalidation.codeplex.com/releases/view/41768">on CodePlex</a> and the source code is available <a href="http://github.com/JeremySkinner/FluentValidation">on GitHub</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremyskinner.co.uk/2010/03/14/fluentvalidation-1-2-rc-available/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
