<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>Development Blog &#187; C#</title>
	<atom:link href="http://blog.yeticode.co.uk/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.yeticode.co.uk</link>
	<description>John Tindell's Blog For Development Related Things</description>
	<lastBuildDate>Mon, 09 Jan 2012 01:21:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Backup IIS Server Package to Amazon S3 using C#</title>
		<link>http://blog.yeticode.co.uk/2012/01/backup-iis-server-package-to-amazon-s3-using-c/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=backup-iis-server-package-to-amazon-s3-using-c</link>
		<comments>http://blog.yeticode.co.uk/2012/01/backup-iis-server-package-to-amazon-s3-using-c/#comments</comments>
		<pubDate>Sun, 08 Jan 2012 22:57:21 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Development Log]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[Backup]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[S3]]></category>

		<guid isPermaLink="false">http://blog.yeticode.co.uk/?p=926</guid>
		<description><![CDATA[I recently updated our backup process at work to store our backups on Amazon S3. I wanted a simple process to that would backup the IIS server configuration and website files that can be easily be restored on a new server in case of a major problem. Luckily Microsoft have release MSDeploy which can be [...]]]></description>
			<content:encoded><![CDATA[<p>I recently updated our backup process at work to store our backups on Amazon S3. I wanted a simple process to that would backup the IIS server configuration and website files that can be easily be restored on a new server in case of a major problem. Luckily Microsoft have release <a href="http://www.iis.net/download/webdeploy">MSDeploy</a> which can be installed using the <a href="http://www.microsoft.com/web/downloads/platform.aspx">Web Platform Installer</a>.</p>
<p><a href="http://blog.yeticode.co.uk/wp-content/uploads/2012/01/image1.png" rel="lightbox[926]"><img class="alignleft size-medium wp-image-928" title="image1" src="http://blog.yeticode.co.uk/wp-content/uploads/2012/01/image1-300x181.png" alt="" width="300" height="181" /></a></p>
<p>Within IIS you can backup everything to a server package by opening the context menu selecting depoy, then “Export Server Package”. This will create the server package containing the IIS configuration along with all the sites and their files. This is all good however it is still a manual process that is likely to be forgotten about after a while. Likely there are a series of libraries we can use to automate this process.</p>
<p>The namespace Microsoft.Web.Deployment provide the functionality we need to backup IIS, this is provided by Microsoft.Web.Deployment.dll. To backup the server we need to use the DeploymentManager to create an object use to create the package, we can then use this to “sync” the server setting to a package.</p>
<p><a href="http://blog.yeticode.co.uk/wp-content/uploads/2012/01/image2.png" rel="lightbox[926]"><img class="alignleft size-medium wp-image-929" title="image2" src="http://blog.yeticode.co.uk/wp-content/uploads/2012/01/image2-300x72.png" alt="" width="300" height="72" /></a></p>
<p>After we have backed up the site package we need to upload it to Amazon S3. To do this we can use the AWSSDK .NET library. The library can be installed via NuGet by searching for “AWS SDK”. This will install the required assemblies.</p>
<p><a href="http://blog.yeticode.co.uk/wp-content/uploads/2012/01/image3.png" rel="lightbox[926]"><img class="alignleft size-medium wp-image-930" title="image3" src="http://blog.yeticode.co.uk/wp-content/uploads/2012/01/image3-300x168.png" alt="" width="300" height="168" /></a></p>
<p>We can use the AWS SDK to upload our server package zip to S3 using the TransferUtilityUploadRequest to create our request to use with the TransferUtility to upload our file.</p>
<p><a href="http://blog.yeticode.co.uk/wp-content/uploads/2012/01/image4.png" rel="lightbox[926]"><img class="alignleft size-medium wp-image-931" title="image4" src="http://blog.yeticode.co.uk/wp-content/uploads/2012/01/image4-300x88.png" alt="" width="300" height="88" /></a></p>
<p>When this is all tied together we have an app that will backup and upload the server package to S3.</p>
<p>I have attached a sample app that can be configured using the App.config</p>
<p><strong><a href="http://blog.yeticode.co.uk/wp-content/uploads/2012/01/yeticode-utility.zip">Download yeticode-utility.zip</a></strong></p>]]></content:encoded>
			<wfw:commentRss>http://blog.yeticode.co.uk/2012/01/backup-iis-server-package-to-amazon-s3-using-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MVC Update User Online via Action Filter</title>
		<link>http://blog.yeticode.co.uk/2012/01/mvc-update-user-online-via-action-filter/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mvc-update-user-online-via-action-filter</link>
		<comments>http://blog.yeticode.co.uk/2012/01/mvc-update-user-online-via-action-filter/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 00:03:55 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Development Log]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[MVC3]]></category>

		<guid isPermaLink="false">http://blog.yeticode.co.uk/?p=904</guid>
		<description><![CDATA[Action filter to update the currently logged in users last online time to allow you to identify which of your users are online /// &#60;summary&#62; /// User Online Action Filter Attribute /// &#60;/summary&#62; public class UserOnlineActionFilterAttribute : ActionFilterAttribute { /// &#60;summary&#62; /// Called by the ASP.NET MVC framework after the action method executes. /// &#60;/summary&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Action filter to update the currently logged in users last online time to allow you to identify which of your users are online</p>
<pre>
/// &lt;summary&gt;
/// User Online Action Filter Attribute
/// &lt;/summary&gt;
public class UserOnlineActionFilterAttribute : ActionFilterAttribute
{
    /// &lt;summary&gt;
    /// Called by the ASP.NET MVC framework after the action method executes.
    /// &lt;/summary&gt;
    /// &lt;param name="filterContext"&gt;The filter context.&lt;/param&gt;
    public override void OnActionExecuted(ActionExecutedContext filterContext)
    {
        try
        {
            if (filterContext.HttpContext != null &#038;&#038; filterContext.HttpContext.User != null &#038;&#038; filterContext.HttpContext.User.Identity != null)
            {
                Membership.Provider.GetUser(filterContext.HttpContext.User.Identity.Name, true);
            }
        }
        catch
        {
            // BAD: Swallow the exception to prevent it messing with the users action
        }

        base.OnActionExecuted(filterContext);
    }
}
</pre>
<p>Add the action filter to the global list inside the global.asax Application_Start.</p>
<pre>
GlobalFilters.Filters.Add(new UserOnlineActionFilterAttribute());
</pre>]]></content:encoded>
			<wfw:commentRss>http://blog.yeticode.co.uk/2012/01/mvc-update-user-online-via-action-filter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IIS7 &amp; IIS Express 401 Access is denied due to invalid credentials Issue</title>
		<link>http://blog.yeticode.co.uk/2011/03/iis7-iis-express-401-access-is-denied-due-to-invalid-credentials-issue/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=iis7-iis-express-401-access-is-denied-due-to-invalid-credentials-issue</link>
		<comments>http://blog.yeticode.co.uk/2011/03/iis7-iis-express-401-access-is-denied-due-to-invalid-credentials-issue/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 10:05:55 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Development Log]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[IIS Express]]></category>
		<category><![CDATA[IIS7]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://blog.yeticode.co.uk/?p=822</guid>
		<description><![CDATA[I have been working on a large web application using MVC3, NHibernate using IIS Express to debug and IIS7 to stage. I&#8217;m using the membership services provided by ASP.NET to handle user authentication and provide security to the system. However I kept running across an issue, when accessing remotely, that was preventing me from logging [...]]]></description>
			<content:encoded><![CDATA[<p>I have been working on a large web application using MVC3, NHibernate using IIS Express to debug and IIS7 to stage. I&#8217;m using the membership services provided by ASP.NET to handle user authentication and provide security to the system. However I kept running across an issue, when accessing remotely, that was preventing me from logging in. Whenever I tried to view a page as a non logged in user I was returned a 404 Unauthorized error. </p>
<div id="attachment_823" class="wp-caption alignnone" style="width: 610px"><a href="http://blog.yeticode.co.uk/wp-content/uploads/2011/03/401.png" rel="lightbox[822]"><img src="http://blog.yeticode.co.uk/wp-content/uploads/2011/03/401.png" alt="401 - Unauthorized: Access is denied due to invalid credentials." title="401 - Unauthorized: Access is denied due to invalid credentials." width="600" height="183" class="size-full wp-image-823" /></a><p class="wp-caption-text">401 - Unauthorized: Access is denied due to invalid credentials.</p></div>
<p>After searching around for a solution to why this was not displaying the correct page, even if it was redirecting to the login page I decided to try to set the error displaying to return more information. After adding &lt;httpErrors errorMode=&#8221;Details&#8221; /&gt; to try and get a detail output from IIS the page started to work as expected.</p>
<p><a href="http://blog.yeticode.co.uk/wp-content/uploads/2011/03/webconfig.png" rel="lightbox[822]"><img src="http://blog.yeticode.co.uk/wp-content/uploads/2011/03/webconfig-300x95.png" alt="" title="system.WebServer" width="300" height="95" class="alignnone size-medium wp-image-827" /></a></p>
<p>With this option enabled the login page was now correctly displayed. This can be set without having to edit the web.config on IIS7 by editing the &#8220;Error Pages&#8221; features settings for your site in IIS. Set the Error Response to &#8220;Detailed errors&#8221;</p>
<p><a href="http://blog.yeticode.co.uk/wp-content/uploads/2011/03/errorpages.png" rel="lightbox[822]"><img src="http://blog.yeticode.co.uk/wp-content/uploads/2011/03/errorpages.png" alt="" title="Edut Error Pages Settings" width="407" height="378" class="alignnone size-full wp-image-831" /></a></p>
<h3>Related Reading</h3>
<table style="border: solid  0px white;">
<tr valign="top">
<td>
<a href="http://www.amazon.co.uk/gp/product/1430234040/ref=as_li_qf_sp_asin_tl?ie=UTF8&amp;tag=worldoverride-21&amp;linkCode=as2&amp;camp=1634&amp;creative=6738&amp;creativeASIN=1430234040"><img src="http://blog.yeticode.co.uk/wp-content/uploads/2011/03/51E4HoB-MPL._SL160_.jpg" alt="" title="51E4HoB-MPL._SL160_" width="121" height="160" class="alignnone size-full wp-image-836" /></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=worldoverride-21&#038;l=as2&#038;o=2&#038;a=1430234040" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></p>
</td>
<td>
<p><a href="http://www.amazon.co.uk/gp/product/B0015DYJNU/ref=as_li_qf_sp_asin_tl?ie=UTF8&#038;tag=worldoverride-21&#038;linkCode=as2&#038;camp=1634&#038;creative=6738&#038;creativeASIN=B0015DYJNU"><img alt="" src="https://images-na.ssl-images-amazon.com/images/I/51JWACNnwOL._SL160_.jpg" class="alignnone" width="127" height="160" /></a><br />
<img src="http://www.assoc-amazon.co.uk/e/ir?t=worldoverride-21&#038;l=as2&#038;o=2&#038;a=B0015DYJNU" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></p>
</td>
</tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.yeticode.co.uk/2011/03/iis7-iis-express-401-access-is-denied-due-to-invalid-credentials-issue/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Running NHibernate in Medium Trust</title>
		<link>http://blog.yeticode.co.uk/2010/03/running-nhibernate-in-medium-trust/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=running-nhibernate-in-medium-trust</link>
		<comments>http://blog.yeticode.co.uk/2010/03/running-nhibernate-in-medium-trust/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 23:34:50 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Development Log]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Castle]]></category>
		<category><![CDATA[Medium Trust]]></category>
		<category><![CDATA[NHibernate]]></category>

		<guid isPermaLink="false">http://blog.yeticode.co.uk/?p=636</guid>
		<description><![CDATA[After deploying a NHibernate to a shared host I started running into a number of issues. Whilst developing we were running in full trust not in medium trust whilst the majority of shared hosts use. After hours and hours of searching I finally come across a post on the Castle Project mailing list which detailed [...]]]></description>
			<content:encoded><![CDATA[<p>After deploying a NHibernate to a shared host I started running into a number of issues. Whilst developing we were running in full trust not in medium trust whilst the majority of shared hosts use. After hours and hours of searching I finally come across a <a href="http://groups.google.com/group/castle-project-users/browse_thread/thread/2451ef352523865f?hl=en&#038;pli=1">post</a> on the <a href="http://groups.google.com/group/castle-project-users?hl=en">Castle Project mailing list</a> which detailed how to get a nhibernate working under medium trust. Here is the steps I followed to get it working.</p>
<p>I am using NHibernate 2.1.2 and C# .NET 3.5 in Visual Studio 2008.</p>
<h3>Step 1</h3>
<p>Download Castle.Core from gitbhub<br />
git://github.com/castleproject/Castle.Core.git</p>
<p><a href="http://blog.yeticode.co.uk/wp-content/uploads/2010/03/Screenshot-1.png" rel="lightbox[636]"><img src="http://blog.yeticode.co.uk/wp-content/uploads/2010/03/Screenshot-1.png" alt="" title="Screenshot-1" width="489" height="337" class="alignnone size-full wp-image-647" /></a></p>
<h3>Step 2</h3>
<p>Enable Castle to allow partially trusted callers.<br />
Open buildscripts/CommonAssemblyInfo.cs and enable the library to enable partially trusted callers</p>
<p><a href="http://blog.yeticode.co.uk/wp-content/uploads/2010/03/Screenshot-2.png" rel="lightbox[636]"><img src="http://blog.yeticode.co.uk/wp-content/uploads/2010/03/Screenshot-2.png" alt="" title="Screenshot-2" width="589" height="286" class="alignnone size-full wp-image-654" /></a></p>
<h3>Step 3</h3>
<p>Disable generation of debug information for the projects Castle.Core and Castle.DynamicProxy.<br />
<a href="http://blog.yeticode.co.uk/wp-content/uploads/2010/03/Screenshot-4.png" rel="lightbox[636]"><img src="http://blog.yeticode.co.uk/wp-content/uploads/2010/03/Screenshot-4-300x175.png" alt="" title="Screenshot-4" width="300" height="175" class="alignnone size-medium wp-image-657" /></a></p>
<h3>Step 4</h3>
<p>Build the projects</p>
<h3>Step 5</h3>
<p>Download Nhibernate source code from source forge.</p>
<p><a href="http://sourceforge.net/projects/nhibernate/files/" rel="nofollow">http://sourceforge.net/projects/nhibernate/files/</a></p>
<h3>Step 6</h3>
<p>Open Nhibernate.Everything.sln and update the references for the NHibernate.ByteCode.Castle project so that the references for Castle.Core and Castle.DynamicProxy2 are the libraries build in step 4. Disable generation of debug information for the projects NHibernate, Iesi.Collections and NHibernate.ByteCode.Castle, similar to what was done in step 3.</p>
<p><a href="http://blog.yeticode.co.uk/wp-content/uploads/2010/03/Screenshot-5.png" rel="lightbox[636]"><img src="http://blog.yeticode.co.uk/wp-content/uploads/2010/03/Screenshot-5-300x187.png" alt="" title="Screenshot-5" width="300" height="187" class="alignnone size-medium wp-image-661" /></a></p>
<h3>Step 7</h3>
<p>Copy the outputted library files from NHibernate.ByteCode/bin/Release to your shared libs folder of your project.</p>
<p><a href="http://blog.yeticode.co.uk/wp-content/uploads/2010/03/Screenshot-6.png" rel="lightbox[636]"><img src="http://blog.yeticode.co.uk/wp-content/uploads/2010/03/Screenshot-6-300x225.png" alt="" title="Screenshot-6" width="300" height="225" class="alignnone size-medium wp-image-663" /></a></p>
<h3>Step 8</h3>
<p>Update the references in your project to point to the new libraries. Next turn off reflection optimization. This needs to be done in code before you create the configuration object. Configuring this in the hibernate.cfg.xml does not work. Update all your projects assemblies to set allow partially trusted callers, similar to step 2. Update your web.config to set requirePermission=&#8221;false&#8221; in the nhibernate section delceration</p>
<pre class="c-sharp" name="code">
NHibernate.Cfg.Environment.UseReflectionOptimizer = false;
Configuration = new Configuration();
Configuration.Configure();
</pre>
<pre name="code" class="xml">
<configSections>
<section name="hibernate-configuration" requirePermission="false" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
</configSections>
</pre>
<p>You can now run your site in medium trust using lay loading.</p>
<h2>Links</h2>
<ul>
<li><b>msysgit</b> &#8211; <a href="http://code.google.com/p/msysgit/" rel="nofollow">http://code.google.com/p/msysgit/</a></li>
<li><b>TortoiseGit</b> &#8211; <a href="http://code.google.com/p/tortoisegit/" rel="nofollow">http://code.google.com/p/tortoisegit/</a></li>
<li><b>NHibernate</b> &#8211; <a href="http://nhforge.org/" rel="nofollow">http://nhforge.org/</a></li>
<li><b>Castle.Core Source</b> &#8211; <a href="http://github.com/castleproject/" rel="nofollow">http://github.com/castleproject/</a></li>
<li><b>NHibernate Source</b> &#8211; <a href="http://sourceforge.net/projects/nhibernate/files/" rel="nofollow">http://sourceforge.net/projects/nhibernate/files/</a></li>
</ul>
<h2>Related Reading</h2>
<table>
<tr>
<td>
<a style="display:inline-block;" href="http://www.amazon.co.uk/gp/product/1932394923?ie=UTF8&#038;tag=yetiblog-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=1932394923"><img border="0" src="http://static.yeticode.co.uk/blog/images/nhibernate.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=yetiblog-21&#038;l=as2&#038;o=2&#038;a=1932394923" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</td>
<td>
<a style="display:inline-block;" href="http://www.amazon.co.uk/gp/product/0321228103?ie=UTF8&#038;tag=worldoverride-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0321228103"><img border="0" src="http://static.yeticode.co.uk/blog/images/open_source_dot_net.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=worldoverride-21&#038;l=as2&#038;o=2&#038;a=0321228103" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;display:inline-block;" />
</td>
<td>
<a style="display:inline-block;" href="http://www.amazon.co.uk/gp/product/1847198902?ie=UTF8&#038;tag=worldoverride-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=1847198902"><img border="0" src="http://static.yeticode.co.uk/blog/images/nhibernate_2.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=worldoverride-21&#038;l=as2&#038;o=2&#038;a=1847198902" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</td>
</tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.yeticode.co.uk/2010/03/running-nhibernate-in-medium-trust/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>NAnt.ToDo a NAnt Plugin</title>
		<link>http://blog.yeticode.co.uk/2010/01/nant-todo-a-nant-plugin/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nant-todo-a-nant-plugin</link>
		<comments>http://blog.yeticode.co.uk/2010/01/nant-todo-a-nant-plugin/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 19:02:25 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Development Log]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[CruiseControl.NET]]></category>
		<category><![CDATA[NAnt]]></category>

		<guid isPermaLink="false">http://blog.yeticode.co.uk/?p=611</guid>
		<description><![CDATA[This simple plugin for NAnt parses your source code and creates a report of all the TODO and comment tags in your source code. The code is hosted over at google code. Comments The task automatically identify comments in the following style //TODO: First Test to do Item //FIXME: First Fix me Item //HACK: First [...]]]></description>
			<content:encoded><![CDATA[<p>This simple plugin for NAnt parses your source code and creates a report of all the TODO and comment tags in your source code. The code is hosted over at <a href="http://code.google.com/p/nant-todo/">google code</a>.</p>
<h2>Comments</h2>
<p>The task automatically identify comments in the following style</p>
<pre name="code" class="c-sharp">
//TODO: First Test to do Item
//FIXME: First Fix me Item
//HACK: First Hack Item
</pre>
<p>Additional matches can be made by adding in Token elements to the NAnt task. </p>
<h2>Sample</h2>
<pre name="code" class="xml">
&lt;ToDo source="path/to/source" output="report.xml" searchpattern="*.cs;*.txt"&gt;
 &lt;Tokens&gt;
 &lt;Tokens Value="BUGFIX" /&gt;
 &lt;/Tokens&gt;
&lt;/ToDo&gt;
</pre>
<h2>Output</h2>
<pre name="code" class="xml">
&lt;ToDo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
 &lt;Items&gt;
 &lt;Item&gt;
 &lt;Message&gt;First Test to do Item&lt;/Message&gt;
 &lt;File&gt;NAnt.ToDo\ToDoTask.cs&lt;/File&gt;
 &lt;Line&gt;0&lt;/Line&gt;
 &lt;Type&gt;TODO&lt;/Type&gt;
 &lt;/Item&gt;
 &lt;Item&gt;
 &lt;Message&gt;First Hack Item&lt;/Message&gt;
 &lt;File&gt;NAnt.ToDo\ToDoTask.cs&lt;/File&gt;
 &lt;Line&gt;0&lt;/Line&gt;
 &lt;Type&gt;HACK&lt;/Type&gt;
 &lt;/Item&gt;
 &lt;Item&gt;
 &lt;Message&gt;First Fix me Item&lt;/Message&gt;
 &lt;File&gt;NAnt.ToDo\ToDoTask.cs&lt;/File&gt;
 &lt;Line&gt;0&lt;/Line&gt;
 &lt;Type&gt;FIXME&lt;/Type&gt;
 &lt;/Item&gt;
 &lt;/Items&gt;
&lt;/ToDo&gt;
</pre>
<h2>Cruise Control Xsl</h2>
<p>Below is a basic xsl style sheet that can be used with CruiseControl.NET to display the output from NAnt.ToDo.</p>
<pre name="code" class="xml">
&lt;?xml version="1.0"?&gt;
&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt;
 &lt;xsl:output method="html"/&gt;
 &lt;xsl:param name="applicationPath"/&gt;
 &lt;xsl:template match="/"&gt;
 &lt;div id="ToDo"&gt;
 &lt;h1&gt;ToDo List&lt;/h1&gt;
 &lt;div id="Summary"&gt;
 &lt;h3&gt;To Do&lt;/h3&gt;
 &lt;table&gt;
 &lt;tbody&gt;
 &lt;xsl:for-each select="//ToDo/Items/Item"&gt;
 &lt;tr&gt;
 &lt;td&gt;
 &lt;xsl:value-of select="Type/text()"/&gt;
 &lt;/td&gt;
 &lt;td&gt;
 &lt;xsl:value-of select="Message/text()"/&gt;
 &lt;/td&gt;
 &lt;td&gt;
 &lt;xsl:value-of select="File/text()"/&gt;
 &lt;/td&gt;
 &lt;/tr&gt;
 &lt;/xsl:for-each&gt;
 &lt;/tbody&gt;
 &lt;/table&gt;
 &lt;/div&gt;    
 &lt;/div&gt;
 &lt;/xsl:template&gt;
&lt;/xsl:stylesheet&gt;
</pre>]]></content:encoded>
			<wfw:commentRss>http://blog.yeticode.co.uk/2010/01/nant-todo-a-nant-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jqRunner Snapshot &#8211; Running Javascript Unit test with NUnit</title>
		<link>http://blog.yeticode.co.uk/2009/09/jqrunner-snapshot-running-javascript-unit-test-with-nunit/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jqrunner-snapshot-running-javascript-unit-test-with-nunit</link>
		<comments>http://blog.yeticode.co.uk/2009/09/jqrunner-snapshot-running-javascript-unit-test-with-nunit/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 21:06:47 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Development Log]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[CruiseControl.NET]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[jqunit]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://blog.yeticode.co.uk/?p=592</guid>
		<description><![CDATA[One of the nice things about unit tests is that you can use continuous integration so that you don&#8217;t have to run them yourself. At work we use CruiseControl.NET to automate our builds and run our unit tests. Now as a number of our projects are web based we use a fair amount of javascript, [...]]]></description>
			<content:encoded><![CDATA[<p>One of the nice things about unit tests is that you can use continuous integration so that you don&#8217;t have to run them yourself. At work we use <a href="http://ccnet.thoughtworks.com">CruiseControl.NET</a> to automate our builds and run our unit tests. Now as a number of our projects are web based we use a fair amount of javascript, mainly jQuery, though in-house plugins. In order to test these we use <a href="http://code.google.com/p/jqunit/">jqunit</a>, this works great and allows us to use TDD when writing javascript. However as development goes on the unit tests get forgotten about as they are not automatically ran.</p>
<p>In order so solve this I decided to experiment to find a method of getting cruise control to run our jqunit tests for me. To run the tests I looked at wrapping the jqunit tests with nunit tests.</p>
<p><a href="http://static.yeticode.co.uk/blog/images/posts/jqRunner_nunit.png" rel="lightbox"><img src="http://static.yeticode.co.uk/blog/images/posts/jqRunner_nunit_thumb.png" alt="jqRunner"/></a></p>
<p>jqRunner is designed so that you can us your existing jqunit tests in their existing location without changing them. jqRunner required that all the scripts that are needed to run are registered. The full path to the file is required. jqRunner then executes the tests and returns the results, which are then parsed by nunit as tests using the TestCaseSource attribute.</p>
<pre class="javascript" name="code">
var sampleTestCase = new jqUnit.TestCase('Sample Test Case', function() {
    /*setup*/
    // this.yep(1);
}, function() {
    /*teardown*/
    // this.ok(1)
});
sampleTestCase.test('Sample Test 1', function() {
    this.ok(1);
});
sampleTestCase.test('Sample Test 2', function() {
    this.ok(0);
});
</pre>
<pre class="c-sharp" name="code">
using System;
using System.Collections.Generic;
using NUnit.Framework;
using jqRunner;
using System.IO;
using System.Reflection;

namespace jqRunner.Tests
{
    [TestFixture,RequiresSTA]
    public class TestCaseSourceTests
    {
        [Test, TestCaseSource("GetTestResults"), RequiresSTA]
        public void CheckTest(ITestResult result)
        {
            Assert.IsTrue(result.Pass, result.Name);
        }

        private static ITestResult[] GetTestResults()
        {
            string jsFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase) + @"\jqUnitTests\SampleUnitTest.js";
            TestBed target = new TestBed();
            target.RegisterScript(jsFile);
            return target.Execute().ToArray();
        }
    }
}
</pre>
<p>This is an initial development snapshot and is bound to have plenty of problems.</p>
<p><b>Download</b><br />
<a href="http://static.yeticode.co.uk/blog/downloads/jqRunner-snapshot.zip">http://static.yeticode.co.uk/blog/downloads/jqRunner-snapshot.zip</a></p>
<h2>Related Reading</h2>
<table>
<tr>
<td>
<a href="http://www.amazon.co.uk/gp/product/0596007396?ie=UTF8&#038;tag=worldoverride-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0596007396"><img border="0" src="http://static.yeticode.co.uk/blog/images/nunit.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=worldoverride-21&#038;l=as2&#038;o=2&#038;a=0596007396" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />
</td>
<td>
<a style="display:inline-block;" href="http://www.amazon.co.uk/gp/product/0321228103?ie=UTF8&#038;tag=worldoverride-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0321228103"><img border="0" src="http://static.yeticode.co.uk/blog/images/open_source_dot_net.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=worldoverride-21&#038;l=as2&#038;o=2&#038;a=0321228103" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;display:inline-block;" />
</td>
</tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://blog.yeticode.co.uk/2009/09/jqrunner-snapshot-running-javascript-unit-test-with-nunit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More Django Plugin Stuff</title>
		<link>http://blog.yeticode.co.uk/2009/08/more-django/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=more-django</link>
		<comments>http://blog.yeticode.co.uk/2009/08/more-django/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 19:34:38 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Development Log]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mono]]></category>
		<category><![CDATA[MonoDevelop]]></category>

		<guid isPermaLink="false">http://blog.yeticode.co.uk/?p=553</guid>
		<description><![CDATA[So I&#8217;ve been working more on the support for django within monodevelop. Heres some screenshots of it.]]></description>
			<content:encoded><![CDATA[<p><a href="http://static.yeticode.co.uk/blog/images/posts/monodevelop-django-2.png" rel="lightbox"><img alt="MonoDevelop Django" src="http://static.yeticode.co.uk/blog/images/posts/monodevelop-django-2-thumb.png"/></a></p>
<p>So I&#8217;ve been working more on the support for django within monodevelop. Heres some screenshots of it.</p>
<p><img alt="MonoDevelop Django" src="http://static.yeticode.co.uk/blog/images/posts/monodevelop-django-3.png"/></p>
<p><img alt="MonoDevelop Django" src="http://static.yeticode.co.uk/blog/images/posts/monodevelop-django-4.png"/></p>]]></content:encoded>
			<wfw:commentRss>http://blog.yeticode.co.uk/2009/08/more-django/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Professional ASP.NET MVC 1.0</title>
		<link>http://blog.yeticode.co.uk/2009/06/professional-asp-net-mvc-1-0/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=professional-asp-net-mvc-1-0</link>
		<comments>http://blog.yeticode.co.uk/2009/06/professional-asp-net-mvc-1-0/#comments</comments>
		<pubDate>Sun, 28 Jun 2009 18:21:38 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Development Log]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[VS.NET]]></category>

		<guid isPermaLink="false">http://blog.yeticode.co.uk/?p=267</guid>
		<description><![CDATA[At work we have been looking at the ASP.NET MVC, model-view-controller, framework. After looking around at various different tutorials and articles we found a sample chapter from the wrox book Professional ASP.NET MVC 1.0. The sample chapter took the hello world example and create a full application. The application, NerdDinner is an application that allows [...]]]></description>
			<content:encoded><![CDATA[<p>At work we have been looking at the ASP.NET MVC, model-view-controller, framework. After looking around at various different tutorials and articles we found a sample chapter from the wrox book Professional ASP.NET MVC 1.0. The sample chapter took the hello world example and create a full application. The application, <a href="http://www.nerddinner.com/">NerdDinner</a> is an application that allows you to create dinner parties and RSPV to them. The sample covers a lot of the functionality that is within ASP.NET MVC. The sample chapter can be found online at <a href="http://tinyurl.com/aspnetmvc">Wrox&#8217;s website</a> with the source code hosted at <a href="http://nerddinner.codeplex.com/">codeplex</a>.</p>
<p align="center">
<a href="http://www.amazon.co.uk/gp/product/0470384611?ie=UTF8&amp;tag=yetiblog-21&amp;linkCode=as2&amp;camp=1634&amp;creative=19450&amp;creativeASIN=0470384611" style="display: block-inline;"><br />
<img src="http://static.yeticode.co.uk/blog/images/wrox_asp_net_mvc.jpg" alt="Professional ASP.NET MVC 1.0" /><br />
</a>
</p>
<p>Reading though the sample chapter is a good way to get started with ASP.NET MVC as the chapter explains what it is doing in a easy to understand manor, but more importantly it explains why they are being done. The chapter is a comprehensive walk through of how to create the NerdDinner application. Throughout the chapter the authors provide titbits of useful information, for example the use of the repository pattern and dependency injection. Throughout the chapter the authors trying to enforce good coding practice and often make reference to <a href="http://en.wikipedia.org/wiki/Test-driven_development">test driven development</a> which in a later chapter they go into more detail about, discussing different development techniques.</p>
<p>The sample chapter is more than enough to get anyone started with ASP.NET MVC and follows the development process from start to finish including a section on unit testing the application. The following chapters delve into more detail about specific areas of the ASP.NET MVC framework. The second and third chapters go into detail about the MVC pattern, detailing its background and its use on the web. The chapter also provides an overview, albeit brief, of other frameworks that are available. Although their coverage was brief they were not mentioned as either superior or inferior rather just as alternatives to the ASP.NET MVC framework. This tone was subsequently repeated in the third chapter when the authors compare ASP.NET with WebForms to ASP.NET MVC. They often mention that MVC is not a replacement for WebForms rather it is a different approach. These two chapters are extremely useful as they allow you to make an informed decision whether ASP.NET MVC is the right choice for you.</p>
<p>I&#8217;ve still to finish reading the rest of this book so I&#8217;ll update this post the more I read of it.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.yeticode.co.uk/2009/06/professional-asp-net-mvc-1-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NUnit and NMock</title>
		<link>http://blog.yeticode.co.uk/2009/05/nunit-and-nmock/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nunit-and-nmock</link>
		<comments>http://blog.yeticode.co.uk/2009/05/nunit-and-nmock/#comments</comments>
		<pubDate>Sun, 24 May 2009 19:14:49 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Development Log]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[nmock]]></category>
		<category><![CDATA[nunit]]></category>

		<guid isPermaLink="false">http://blog.yeticode.co.uk/?p=213</guid>
		<description><![CDATA[Whist working on a piece of course work for uni I started using NMock as part of some unit tests written using nunit. Having mainly used MSTests for unit tests at work I decided to use nunit as everyone has said that they are very similar. I&#8217;m extremely impressed with the potential power that NMock [...]]]></description>
			<content:encoded><![CDATA[<p>Whist working on a piece of course work for uni I started using <a href="http://www.nmock.org/">NMock</a> as part of some unit tests written using nunit. Having mainly used MSTests for unit tests at work I decided to use nunit as everyone has said that they are very similar. I&#8217;m extremely impressed with the potential power that NMock has given me during testing. For the assignment I wrote a small spider application that crawly a site and stores all the link. Using NMock it allowed me to test the structure of the site without requiring internet access. During this assignment I also tried to use the <a href="http://en.wikipedia.org/wiki/Test-driven_development">test driven development</a> approach, opposed to my normal sit down and hack away. Not only were there less bugs at the end, the overall quality of my code was noticeable higher. This was largely due to the fact that I had tests already created for what it was meant to do, which required me to put more effort into the implementation. Hopefully I&#8217;ll keep this style of programming up, and not just forget it as soon as I get back to work.</p>
<p>Here&#8217;s a sample nunit test that uses nmock. The nmock object mocks the calls that request specific urls and loads the data for local files.</p>
<pre name="code" class="csharp">
[Test()]
public void MockLinkFinderTest()
{
	IMock mockWebClient = new DynamicMock(typeof(IWebClient));
	mockWebClient.ExpectAndReturn("GetPage",File.ReadAllText("HTML/1.htm"),new object[]{"http://domain.example/1.htm"});
	mockWebClient.ExpectAndReturn("GetPage",File.ReadAllText("HTML/2.htm"),new object[]{"http://domain.example/2.htm"});
	mockWebClient.ExpectAndReturn("GetPage",File.ReadAllText("HTML/3.htm"),new object[]{"http://domain.example/3.htm"});

	string domain = "domain.example";
	string url = "http://domain.example/1.htm";

	LinkFinder linkFinder = new LinkFinder();
	LinkItemCollection linkCollection = linkFinder.Find(url,domain,(IWebClient)mockWebClient.MockInstance);

	int expected = 3;
	Assert.AreEqual(expected,linkCollection.Count);
}
</pre>]]></content:encoded>
			<wfw:commentRss>http://blog.yeticode.co.uk/2009/05/nunit-and-nmock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New GTK# Project</title>
		<link>http://blog.yeticode.co.uk/2009/05/new-gtk-project/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=new-gtk-project</link>
		<comments>http://blog.yeticode.co.uk/2009/05/new-gtk-project/#comments</comments>
		<pubDate>Wed, 13 May 2009 00:59:22 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Development Log]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[gtk]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mono]]></category>

		<guid isPermaLink="false">http://blog.yeticode.co.uk/?p=202</guid>
		<description><![CDATA[I&#8217;ve started a new project, RssNotify, to try and learn more about developing applications using GTK. I&#8217;ll still be developing cctray-gtk as this project is useful, but the RssNotify is more of a project to satisfy my curiosity. The RssNotify project aims to provide an easy way for a user to receive notifications when an [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started a new project, <a href="https://launchpad.net/rssnotify">RssNotify</a>, to try and learn more about developing applications using GTK. I&#8217;ll still be developing cctray-gtk as this project is useful, but the RssNotify is more of a project to satisfy my curiosity.</p>
<p>The RssNotify project aims to provide an easy way for a user to receive notifications when an rss feed has been updated. the idea is to use notify-sharp to display the new news items. The rest of the interface will be used to try to explore the features widgets that GTK# offers.</p>]]></content:encoded>
			<wfw:commentRss>http://blog.yeticode.co.uk/2009/05/new-gtk-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

