<?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>chillijam.co.uk &#187; Uncategorized</title>
	<atom:link href="http://chillijam.co.uk/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://chillijam.co.uk</link>
	<description></description>
	<lastBuildDate>Thu, 20 May 2010 08:00:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Split a Camel-Cased word into its components</title>
		<link>http://chillijam.co.uk/2010/05/20/split-a-camel-cased-word-into-its-components/</link>
		<comments>http://chillijam.co.uk/2010/05/20/split-a-camel-cased-word-into-its-components/#comments</comments>
		<pubDate>Thu, 20 May 2010 08:00:03 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C# Snippets]]></category>
		<category><![CDATA[Extension Methods]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chillijam.co.uk/?p=304</guid>
		<description><![CDATA[I needed to split a camel-cased word into it&#8217;s component parts, and found the following extension method to help out.  It works pretty well. public static string SplitCamelCase( this string str ) { return Regex.Replace( Regex.Replace( str, @&#34;(\P{Ll})(\P{Ll}\p{Ll})&#34;, &#34;$1 $2&#34; &#8230; <a href="http://chillijam.co.uk/2010/05/20/split-a-camel-cased-word-into-its-components/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I needed to split a camel-cased word into it&#8217;s component parts, and found the following extension method to help out.  It works pretty well.</p>
<pre class="brush: csharp;">
public static string SplitCamelCase( this string str )
{
return Regex.Replace( Regex.Replace( str, @&quot;(\P{Ll})(\P{Ll}\p{Ll})&quot;, &quot;$1 $2&quot; ), @&quot;(\p{Ll})(\P{Ll})&quot;, &quot;$1 $2&quot; );
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2010/05/20/split-a-camel-cased-word-into-its-components/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Marshaling – How I got involved (Part 2)</title>
		<link>http://chillijam.co.uk/2009/12/21/marshaling-%e2%80%93-how-i-got-involved-part-2/</link>
		<comments>http://chillijam.co.uk/2009/12/21/marshaling-%e2%80%93-how-i-got-involved-part-2/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 11:44:54 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chillijam.co.uk/?p=295</guid>
		<description><![CDATA[I left you last time having completed my morning at Donington, looking around the circuit and behind the scenes.  The afternoon was where my marshaling career really began &#8211; out &#8220;on the bank&#8221;. I&#8217;d been allocated a position on post &#8230; <a href="http://chillijam.co.uk/2009/12/21/marshaling-%e2%80%93-how-i-got-involved-part-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://chillijam.co.uk/2009/11/26/marshaling-how-i-got-involved/">I left you last time</a> having completed my morning at Donington, looking around the circuit and behind the scenes.  The afternoon was where my marshaling career really began &#8211; out &#8220;on the bank&#8221;.</p>
<p>I&#8217;d been allocated a position on post 12, on the outside of the Craner Curves.  To get to the post, I had to drive around the service road that runs around the circuit.  When I eventually found where post 12 was located (after a lengthy detour, almost all the way round to McLeans) I parked up and went to meet my colleagues for the afternoon.  I was on post with two more experienced marshals, and another of the trainees.  (This is where it all gets a bit embarrassing &#8211; I&#8217;ve met the others several times since that first day, but my memory for names has completely failed me.  When I remember them I shall come back and redress this injustice, but until then please bear with me.)</p>
<p>The first thing that happened in the afternoon was an on-post briefing covering safety and general behaviour while on post.  Essentially this boils down to the following rules.</p>
<ol>
<li>Always keep an eye on oncoming traffic on track.  This may seem like a very trivial thing to say, but when you are standing trackside you absolutely have to know what is coming toward you.  Marshal posts are positioned according to where they are most likely to be needed and often this is where the cars are most likely to lose grip and spear off the track.  The last thing you want to happen is to get hit by an out of control vehicle because you weren&#8217;t watching what was going on.</li>
<li>When there are cars on track, don&#8217;t sit or kneel down.  Again, you never know when you might have to run.</li>
<li>When there are cars on track, don&#8217;t eat or drink.  This is an extension of the first two rules.  Keep your focus where it needs to be.</li>
</ol>
<p>So, with the basics covered we were ready for an afternoon of racing.  Although I love watching the racing, I&#8217;m not going to bore you with a rundown of what was out on track when.  Instead I&#8217;ll just tell you that after a couple of hours of various qualification sessions, the heavens opened.  When I say that the heavens opened, it really doesn&#8217;t do justice to the amount of rain that fell.  Racing was suspended for the duration of the rain storm because the track was simply unable to clear enough water for safe racing.</p>
<p>This brings me onto a very important lesson that I learned that afternoon &#8211; appropriate clothing.  Obviously marshals are famed for (in most instances) wearing orange overalls so they stand out from the background.  Just as important as high-vis clothing is a really good set of waterproofs, good quality waterproof boots and a hat.  I was fortunate that I was reasonably well-equipped in the hat and waterproof jacket/trousers stakes, but my boots just weren&#8217;t up to the job.  Lesson : buy some decent boots.</p>
<p>I&#8217;m afraid to say that that pretty much wraps up my first afternoon on the bank.  When the rain stopped, the superkarts came out for a few laps, until it was discovered that the amount of water falling from the sky had caused some subsidence along side the track (actually, a part of the newly built tunnel had collapsed*) and the decision was taken to halt activities for the day.</p>
<p>Was I disappointed to have my first day cut short?  You bet.  Did I regret having driven the hundred or so miles to stand for three hours in the rain?  Not even slightly.  You see, the thing about marshals is that we are a very friendly bunch.  In adverse conditions we all make the effort to keep each others spirits up.  On this occasion the opportunities for entertainment were a little unusual.  If you were watching the Eurosport coverage of the day you may have seen four mad people racing rubber ducks down the river that was the hill at Craner Curves.  That was us.  I don&#8217;t for a second recommend using a racing circuit as a playground, but in this instance there were not going to be any vehicles out for the foreseeable future and it was better than standing around looking glum.</p>
<p>So, that was the first day over with.  In the next part, I&#8217;ll talk about the benefits of joining the <a title="BMMC" href="http://marshals.co.uk/">BMMC</a>, what you can expect to pay to equip yourself as a marshal, and generally flesh out the details of how you take the next steps.</p>
<p>* I swear the following radio transmission about the subsidence was real.  From one of the posts near the affected area : &#8220;Race Control, this is post xx.  A hole in the ground has appeared trackside &#8211; we&#8217;re looking into it!&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2009/12/21/marshaling-%e2%80%93-how-i-got-involved-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WCF Restful interface</title>
		<link>http://chillijam.co.uk/2009/10/07/wcf-restful-interface/</link>
		<comments>http://chillijam.co.uk/2009/10/07/wcf-restful-interface/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 12:51:14 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chillijam.co.uk/?p=284</guid>
		<description><![CDATA[For one of the projects I am working on, I needed to be able to self-host a WCF service.  That in itself is a fairly simple task.  It was, however, complicated by the need to allow a SilverLight 3 application &#8230; <a href="http://chillijam.co.uk/2009/10/07/wcf-restful-interface/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For one of the projects I am working on, I needed to be able to self-host a WCF service.  That in itself is a fairly simple task.  It was, however, complicated by the need to allow a SilverLight 3 application on another domain access to the service.  I kept getting errors relating to cross-domain permissions.</p>
<p>A little search on Google led me to the solution (adding the file crossdomain.xml to the root of the hosting site) but it was not the full solution.  Self hosted services don&#8217;t have a site, so they don&#8217;t have a root path since there is no site.</p>
<p>The answer was to implement a restful interface on the service.  The original posts that told me what I needed top do are <a href="http://beta.blogs.microsoft.co.il/blogs/davids/archive/2009/08/14/cross-domain-policy-files-for-flash-and-silverlight-with-wcf.aspx" target="_blank">here</a> and <a href="http://blogs.microsoft.co.il/blogs/davids/archive/2009/08/14/enabling-restful-services-with-wcf.aspx" target="_blank">here</a>.</p>
<p>Essentially, I had to set up a new interface to allow restful communications.  A stripped-down example is as follows.</p>
<pre class="brush: csharp;">
using System.ServiceModel;
using System.ServiceModel.Web;
namespace TestPOCService
{
[ServiceContract]
public interface IRestfulData
{
[OperationContract, WebGet(UriTemplate = &quot;/clientaccesspolicy.xml&quot;)]
Stream GetSilverlightPolicy();
[OperationContract, WebGet(UriTemplate = &quot;/crossdomain.xml&quot;)]
Stream GetFlashPolicy();
}
}
</pre>
<p>The implementation included the main service interface I had defined for other purposes (and which won&#8217;t be included here) as well as the implementation of the IRestfulData interface, as follows.</p>
<pre class="brush: csharp;">
using System.IO;
using System.Linq;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Text;
using System.Xml.Linq;
namespace TestPOCService
{
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1 : IService1, IRestfulData
{
static string CONTENT_TYPE_HTML = &quot;text/html&quot;;
static string CONTENT_TYPE_XML = &quot;application/xml&quot;;
static string CONTENT_TYPE_APPLICATION = &quot;application/octet-stream&quot;;
// IService1 implementation
public Stream GetSilverlightPolicy()
{
WebOperationContext.Current.OutgoingResponse.ContentType = CONTENT_TYPE_XML;
return new MemoryStream(File.ReadAllBytes(&quot;Content/crossdomain.xml&quot;));
}
public Stream GetFlashPolicy()
{
WebOperationContext.Current.OutgoingResponse.ContentType = CONTENT_TYPE_XML;
return new MemoryStream(File.ReadAllBytes(&quot;Content/clientaccesspolicy.xml&quot;));
}
}
}
&lt;div&gt;</pre>
<div>As you can see, This relies on the files themselves being hosted in a folder called &#8220;Content&#8221; beneath the service&#8217;s host file structure.</div>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2009/10/07/wcf-restful-interface/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Renault and the Future of Formula 1</title>
		<link>http://chillijam.co.uk/2009/09/16/renault-and-the-future-of-formula-1/</link>
		<comments>http://chillijam.co.uk/2009/09/16/renault-and-the-future-of-formula-1/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 18:49:01 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chillijam.co.uk/?p=282</guid>
		<description><![CDATA[As some of you already know, I&#8217;ve been volunteering as a motor sport marshal for a few months now, and so I wanted to share my thoughts about today&#8217;s announcement that Flavio Briatore and Pat Symmonds of Renault&#8217;s Formula One &#8230; <a href="http://chillijam.co.uk/2009/09/16/renault-and-the-future-of-formula-1/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As some of you already know, I&#8217;ve been volunteering as a motor sport marshal for a few months now, and so I wanted to share my thoughts about today&#8217;s announcement that Flavio Briatore and Pat Symmonds of Renault&#8217;s Formula One team have decided to stand down.  This follows allegations of race fixing during the 2008 season, specifically in the team allegedly asking Nelson Piquet Jr to deliberately crash in order to bring out a safety car. A fuller picture of the story can be found <a href="http://www.bbc.co.uk/blogs/andrewbenson/2009/09/briatore_bows_out_in_unsavoury.html" target="_blank">here</a>.</p>
<p>From my point of view, I find the idea of deliberately causing an accident to be completely abhorrent.  I am one of a group of people who regularly turn up at motorsports events and put our safety at risk to ensure that the events run as safely as possible, for us, the drivers, other officials and the public.  We do it unpaid, and often unthanked by the teams and drivers.  We do it because we love motor sports, and want to ensure that the spectacle may continue to be enjoyed by the public, and everyone involved.</p>
<p>In the short space of time in which I have been a marshal I have made some very good friends within the community.  I cannot begin to express my displeasure at the thought that someone may go out of their way to cause an accident, let alone one in which innocent people&#8217;s lives are at stake.  If I was involved at a race meeting where the life of one of my friends, or that of an innocent bystander was put in jeopardy by the irresponsibility of a team or a driver purely for the sake of a larger slice of the prize money I would be incredibly angry.</p>
<p>Although I will miss TV coverage of Flav being the eccentric character that he undoubtedly is, I will not miss his presence if it actually turns out that the allegations are true.</p>
<p>The other consideration is how much punishment Renault themselves should be given.  If they get off lightly since the departure of the two remaining team members at the centre of the allegations, then surely that will leave the door open for similar acts of stupidity from other teams.  It should not be enough to be able to say &#8220;Yes, we were wrong, but the people concerned have now left&#8221;.  The team as a whole should bear the responsibility for their actions.  I realise this will probably put the jobs of many people in jeopardy, but rather that than compromised safety.  The bulk of the Renault team will have enough contacts and respect within the Formula One paddock to be able to find work at other teams &#8211; maybe one of the newly signed-up teams.</p>
<p>The bottom line here is that safety is vital, and the allegations are that this fundamental fact has been ignored.  Formula One will more-than-likely survive the scandal, but it should not pass unmarked.</p>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2009/09/16/renault-and-the-future-of-formula-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New comment added to a stored procedure</title>
		<link>http://chillijam.co.uk/2009/08/19/new-comment-added-to-a-stored-procedure/</link>
		<comments>http://chillijam.co.uk/2009/08/19/new-comment-added-to-a-stored-procedure/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 09:53:12 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chillijam.co.uk/?p=278</guid>
		<description><![CDATA[Today, I had occasion to add a comment to a stored procedure. Can you tell exactly how happy I was about it? -- -- IMPORTANT!!!!! -- -- This procedure has been replaced with **name witheld** -- -- Any modifications made &#8230; <a href="http://chillijam.co.uk/2009/08/19/new-comment-added-to-a-stored-procedure/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Today, I had occasion to add a comment to a stored procedure.  Can you tell exactly how happy I was about it?</p>
<pre class="brush: sql;">--
-- IMPORTANT!!!!!
--
-- This procedure has been replaced with **name witheld**
--
-- Any modifications made to this procedure will not take effect in the live
-- system.  You'd be wasting your time, just like I did today and let me tell
-- you, it's really, really annoying to put the effort into changing a
-- deprecated procedure becuase nobody though to put a comment in, or better still
-- to remove the procedure altogether.
-- Of course, the logical thing to do would be to make the changes to the
-- existing code rather rather than complicate matters with a new procedure,
-- but then that would be too sensible, wouldn't it?
--
</pre>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2009/08/19/new-comment-added-to-a-stored-procedure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Who says .Net can&#8217;t be fun?</title>
		<link>http://chillijam.co.uk/2009/06/16/who-says-net-cant-be-fun/</link>
		<comments>http://chillijam.co.uk/2009/06/16/who-says-net-cant-be-fun/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 14:32:28 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chillijam.co.uk/2009/06/16/who-says-net-cant-be-fun/</guid>
		<description><![CDATA[or at least, mildly amusing on a dull afternoon&#8230; &#8220;The CLR has been unable to transition from COM context 0x21b378 to COM context 0x21b4e8 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a &#8230; <a href="http://chillijam.co.uk/2009/06/16/who-says-net-cant-be-fun/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>or at least, mildly amusing on a dull afternoon&#8230;</p>
<p>&#8220;The CLR has been unable to transition from COM context 0x21b378 to COM context 0x21b4e8 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2009/06/16/who-says-net-cant-be-fun/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Essential Tools</title>
		<link>http://chillijam.co.uk/2009/05/19/essential-tools/</link>
		<comments>http://chillijam.co.uk/2009/05/19/essential-tools/#comments</comments>
		<pubDate>Tue, 19 May 2009 10:59:10 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[new machine]]></category>
		<category><![CDATA[productivity]]></category>

		<guid isPermaLink="false">http://chillijam.co.uk/?p=261</guid>
		<description><![CDATA[Insipired by Scott Hanselman&#8217;s blog post on the subject, I&#8217;ve decided to compile a lit of the tools I&#8217;ve added to my new developer machine.  Most of these are producivity enhancements, but some are just for fun. These are just &#8230; <a href="http://chillijam.co.uk/2009/05/19/essential-tools/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Insipired by <a href="http://www.hanselman.com/blog/PavingMyMachineForAFresh2009FirstPassMustHaves.aspx" target="_blank">Scott Hanselman&#8217;s blog post on the subject</a>, I&#8217;ve decided to compile a lit of the tools I&#8217;ve added to my new developer machine.  Most of these are producivity enhancements, but some are just for fun.</p>
<p>These are just the Windows apps.  I use a MacBook at home, but haven&#8217;t got around to compiling a list of utilities I use there.  Maybe some day&#8230;</p>
<p><strong>Productivity tools</strong></p>
<ul>
<li><a href="http://www.getpaint.net/">Paint.Net </a>- .Net based image manipulation package.</li>
<li><a href="http://www.7-zip.org/download.html">7-Zip</a> &#8211; Archive management utility</li>
<li><a href="http://www.flos-freeware.ch/notepad2.html">NotePad 2</a> &#8211; Fully featured text editor, with (some) syntax highlighting.</li>
<li><a href="http://www.wingrep.com/">Windows Grep</a> &#8211; I do a lot of work with text files, and missed the Unix Grep command.  Here&#8217;s an alternative for Windows.</li>
<li><a href="http://tailforwin32.sourceforge.net/">Tail for Windows </a>- Another unix utility port for Windows.</li>
<li><a href="http://devexpress.com/Products/Visual_Studio_Add-in/Coding_Assistance/">CodeRush</a> &amp; <a href="http://devexpress.com/Products/Visual_Studio_Add-in/Refactoring/">Refactor! </a>- Arguably, this should have been top of my list, but since they are paid-for software I&#8217;ll leave them languishing down here.  They get used every time I&#8217;m in Visual Studio, though.</li>
<li><a href="http://www.sliver.com/dotnet/SnippetCompiler/">Snippet Compiler </a>- Great for very small proof-of-concept testing.</li>
<li>Lutz Roeder&#8217;s .Net Reflector &#8211; Not going to link to this since it is now full of advertising and other nastiness. The original is out there &#8211; check through Google.</li>
</ul>
<p><strong>Fun Stuff</strong></p>
<ul>
<li><a href="http://google.com/chrome">http://google.com/chrome</a>- very nice web browser</li>
<li><a href="http://www.twhirl.org/">Twhirl</a> &#8211; Twitter client.</li>
<li><a href="http://toolbar.google.com/toolbar/gmail-helper/">GMail Notifier</a> &#8211; Taskbar notification of new GMail items.</li>
</ul>
<p>I&#8217;m sure there are many more that I&#8217;ve missed, but I&#8217;ll add them when I remember about them. <img src='http://chillijam.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2009/05/19/essential-tools/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ASP.NET MVC &#8211; Helpers</title>
		<link>http://chillijam.co.uk/2009/05/11/aspnet-mvc-helpers/</link>
		<comments>http://chillijam.co.uk/2009/05/11/aspnet-mvc-helpers/#comments</comments>
		<pubDate>Mon, 11 May 2009 14:11:53 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chillijam.co.uk/?p=246</guid>
		<description><![CDATA[This is the third in a series of posts about things I found out while learning ASP.NET MVC. Today : Helpers. Helpers are, as their name suggests, helpful things. If, for example, you want to add the current assembly version &#8230; <a href="http://chillijam.co.uk/2009/05/11/aspnet-mvc-helpers/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is the third in a series of posts about things I found out while learning ASP.NET MVC. Today : Helpers.</p>
<p>Helpers are, as their name suggests, helpful things.  If, for example, you want to add the current assembly version information into a page, you are likely to run into a problem or two.  ASP.NET MVC doesn&#8217;t create code-behind pages for you to do this kind of useful operation in.  Instead, you have to fall back to the old <em>Classic</em> ASP technique of coding directly into the view page.  That is far from ideal.  For one thing, the following code snippet doesn&#8217;t produce the correct reult directly from a page.</p>
<pre class="brush: csharp;">&lt;%= System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); %&gt;</pre>
<p>My experience of that was that it would, if you were very luck, print &#8220;0.0.0.0&#8243; rather than the current version. </p>
<p>So, how did I achieve it?  I created a helper.  Basically a helper is a static class, containing static methods (including extension methods)</p>
<p>Here&#8217;s an example of my SiteWideHelper.cs file</p>
<pre class="brush: csharp;">using stuff;

namespace Helpers
{
    public class SiteWideHelpers
    {
        public static string SiteVersion()
        {
            return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
        }

        public static string CurrentController(this HtmlHelper helper)
        {
            return (string)helper.ViewContext.RouteData.Values[&quot;controller&quot;];
        }
    }
}</pre>
<p>The helper class contains one &#8220;vanilla&#8221; method and one extension method to the HtmlHelper class.  The first method, SiteVersion, simply treturns a string of the current assembly version.  The second method, CurrentController, returns the name of the current controller by querying the extended HtmlHelper class.</p>
<p>Both of these methods may now be called, and their output rendered directly to the page.  (Actually, I use the Currentcontroller method to determine which bits of sub-navigation are displayed on the master page.</p>
<pre class="brush: csharp;">&lt;span&gt;Web site version: &lt;%= Html.Encode(SiteWideHelpers.SiteVersion()) %&gt;&lt;/span&gt;</pre>
<p>Don&#8217;t forget, instead of haveing to reference the fully qualified name of your method / class, you can import the namespace into your view</p>
<pre class="brush: csharp;">&lt;%@ Import Namespace=&quot;Helpers&quot; %&gt;</pre>
<p>I&#8217;m sure I&#8217;m missing some concepts here that would make development so much simpler, but for astarting point, this is working for me</p>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2009/05/11/aspnet-mvc-helpers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Moving to a new PC &#8211; Migration checklist</title>
		<link>http://chillijam.co.uk/2009/04/24/moving-to-a-new-pc-migration-checklist/</link>
		<comments>http://chillijam.co.uk/2009/04/24/moving-to-a-new-pc-migration-checklist/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 10:40:06 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chillijam.co.uk/?p=234</guid>
		<description><![CDATA[OK, so I have been given a new machine at work (more RAM, faster processor, more disk space) and I&#8217;m in the middle of migrating all my old data to the new box. I&#8217;m the kind of person that will &#8230; <a href="http://chillijam.co.uk/2009/04/24/moving-to-a-new-pc-migration-checklist/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>OK, so I have been given a new machine at work (more RAM, faster processor, more disk space) and I&#8217;m in the middle of migrating all my old data to the new box.</p>
<p>I&#8217;m the kind of person that will forget to move something across before blowing an old PC away, only to remember it about 30 minutes after losing it forever.  For this reason, I&#8217;m putting together a list of the important things that one should copy over.</p>
<p>So far, I&#8217;ve copied the obvious* :</p>
<ul>
<li>My Documents</li>
<li>IE, Chrome and FireFox bookmarks</li>
<li>Local MSDN image files</li>
<li>Drive-level data folders (e.g. c:\ImportantStuffForProcessXYZ)</li>
</ul>
<p>But I was hoping someone else could suggest anything else I may have missed.  Either leave a comment here, or <a href="http://twitter.com/zombiesheep">send me a tweet</a> and I&#8217;ll update the post for future reference.</p>
<p>* This is not an exhaustive list &#8211; nobody really want to hear about an obscure folder that contains my todo list, do they?</p>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2009/04/24/moving-to-a-new-pc-migration-checklist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Found the first thing in Refactor! that I don&#8217;t like</title>
		<link>http://chillijam.co.uk/2009/04/08/found-the-first-thing-in-refactor-that-i-dont-like/</link>
		<comments>http://chillijam.co.uk/2009/04/08/found-the-first-thing-in-refactor-that-i-dont-like/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 14:59:41 +0000</pubDate>
		<dc:creator>Marc</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chillijam.co.uk/?p=230</guid>
		<description><![CDATA[So far, the latest versions of CodeRush and Refactor! have been pretty impressive.  Unfortunately, I&#8217;ve just found the first bit of behaviour that I&#8217;m not too keen on.  Take the following snippet&#8230; foreach (MyProvider provider in lps) {  Console.WriteLine(provider.AccountStatus); } &#8230; <a href="http://chillijam.co.uk/2009/04/08/found-the-first-thing-in-refactor-that-i-dont-like/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So far, the latest versions of CodeRush and Refactor! have been pretty impressive.  Unfortunately, I&#8217;ve just found the first bit of behaviour that I&#8217;m not too keen on.  Take the following snippet&#8230;</p>
<pre class="brush: csharp;">
foreach (MyProvider provider in lps)
{
  Console.WriteLine(provider.AccountStatus);
}
</pre>
<p>  <br />
Fair enough.  Old Skool way to write a loop, but nothing too extreme.  Refactor! prompted me that I may like to &#8220;Introduce ForEach Action&#8221;.  I decided to take its advice, and it turned the routine into</p>
<pre class="brush: csharp;">
Array.ForEach(lps,
delegate(MyProvider provider)
{
  Console.WriteLine(provider.AccountStatus);
});
</pre>
<p> <br />
OK, still does the same thing, but I hate the way it looks.  It&#8217;s kind of a half-way house between old-skool and lambda.  This was even pointed out by Refactor! &#8211; it suggested that I &#8220;Compress to Lambda Expression&#8221;.</p>
<p>So I did.  The result was much more pleasing.</p>
<pre class="brush: csharp;">
Array.ForEach(lps, provider =&gt; Console.WriteLine(provider.AccountStatus));
</pre>
<p>Lovely.</p>
<p>All I&#8217;d like to see in Refactor! is the ability to go from the first snippet the the last without having to take a detour through Uglytown.  Is that too much to ask?</p>
]]></content:encoded>
			<wfw:commentRss>http://chillijam.co.uk/2009/04/08/found-the-first-thing-in-refactor-that-i-dont-like/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
