<?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:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Simon's Software Stuff</title><link>http://harriyott.com/index.aspx</link><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/harriyott/simonssoftwarestuff" /><description>Tech blog about C#, ASP.NET, MVC, N2, NHibernate, SQL Server, freelancing and contracting</description><language>en</language><image><link>http://harriyott.com/</link><url>http://harriyott.com/images/SimonPhoto.jpg</url><title>Simon's Software Stuff</title></image><managingEditor>blog@harriyott.com</managingEditor><lastBuildDate>Sun, 27 May 2012 08:50:57 PDT</lastBuildDate><generator>Simon Harriyott's very own code</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/harriyott/simonssoftwarestuff" /><feedburner:info uri="harriyott/simonssoftwarestuff" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/2.0/</creativeCommons:license><feedburner:emailServiceId>harriyott/simonssoftwarestuff</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><feedburner:browserFriendly>(Enter a personal message you would like to have appear at the top of your feed.)</feedburner:browserFriendly><item><title>Yahoo YUI compressor and .Less with Visual Studio</title><link>http://feedproxy.google.com/~r/harriyott/simonssoftwarestuff/~3/0IVgcJLUVyI/yahoo-yui-compressor-less-with-visual-studio.aspx</link><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Simon Harriyott</dc:creator><pubDate>Tue, 05 Jul 2011 02:50:30 PDT</pubDate><description>&lt;p&gt;CSS is great and everything, but it isn't that &lt;em&gt;programmery&lt;/em&gt;. Less, and the .NET port, &lt;a href="http://www.dotlesscss.org/"&gt;.Less&lt;/a&gt; add some useful things, like variables, operations, functions and mixins.&lt;/p&gt;



&lt;p&gt;The basic workflow in Visual Studio is to edit the .less file, run it through the parser in the post-compile step, and include the generated CSS output in your HTML head as normal. More on this later.&lt;/p&gt;

&lt;p&gt;There's a bit of an art deciding when to use these features and when to use CSS properly, so I've been using them cautiously at first. Variables are great for colours, as you can give them readable names; I for one can't tell what colour &lt;span style="background-color:#BAD455"&gt;#BAD455&lt;/span&gt; is without seeing the output.  Ah, it's a sludgy colour. I can call my variable 'sludge' and use it throughout my stylesheet.&lt;/p&gt;

&lt;p&gt;Mixins are super handy for the HTML5 / CSS3 items with multiple browser prefixes:&lt;/p&gt;
&lt;pre&gt;.box_shadow(@params){
	-webkit-box-shadow: @params;
	-moz-box-shadow: @params;
	-o-box-shadow: @params;
	box-shadow: @params;
}&lt;/pre&gt;
&lt;p&gt;This can then be used anywhere you want a box shadow:&lt;/p&gt;
&lt;pre&gt;header, footer, #main {
	.box_shadow(0px 3px 5px #888);
}
&lt;/pre&gt;
&lt;h3&gt;Minification&lt;/h3&gt;
&lt;p&gt;Javascript and CSS minification is all the rage, and is quite simple to do in .NET, thanks to the YUI compressor for .NET. It can be found with NuGet, as YUICompressor.NET. The &lt;a href="http://yuicompressor.codeplex.com/"&gt;setup details are on codeplex&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The idea is that the .js and .css files are compressed as a post-build step, with the files to be compressed listed in YuiCompression.targets, which is an MSBuild script included in your main .csproj file, thus:&lt;/p&gt;
&lt;pre&gt;
  &amp;lt;Import Project="YuiCompression.targets" /&amp;gt;
  &amp;lt;UsingTask TaskName="CompressorTask" AssemblyFile="$(OutputPath)Yahoo.Yui.Compressor.dll" /&amp;gt;
&lt;/pre&gt;
&lt;p&gt;And in YuiCompression.targets:
&lt;pre&gt;
  &amp;lt;Target Name="CompressorTask" AfterTargets="AfterBuild"&amp;gt;
    &amp;lt;ItemGroup&amp;gt;
      &amp;lt;CssFiles Include="$(ProjectDir)Content\site.css" /&amp;gt;
      ...
      &amp;lt;JavaScriptFiles Include="$(ProjectDir)Scripts\MyApp.js" /&amp;gt;
      ...
    &amp;lt;/ItemGroup&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Any files listed in the item group will be squished together and minified into a single .js and a .css file, which can then be included in your HTML.&lt;/p&gt;
&lt;p&gt;It can be a nuisance trying to debug compressed Javascript / CSS in development, so in my master page, I conditionally include the originals for debugging, and the compressed file for release versions:&lt;/p&gt;
&lt;pre&gt;@if (HttpContext.Current.IsDebuggingEnabled){
  &amp;lt;link href="@Url.Content("~/Content/style.css")" type="text/css" rel="stylesheet" /&amp;gt;
  &amp;lt;link href="@Url.Content("~/Content/fonts.css")" type="text/css" rel="stylesheet" /&amp;gt;
  &amp;lt;link href="@Url.Content("~/Content/layout.css")" type="text/css" rel="stylesheet" /&amp;gt;
  &amp;lt;link href="@Url.Content("~/Content/site.css")" type="text/css" rel="stylesheet" /&amp;gt;
} else {
  &amp;lt;link href="@Url.Content("~/Content/final.css")" type="text/css" rel="stylesheet" /&amp;gt;
}

// do the same for javascript at the end of the file&lt;/pre&gt;

&lt;p&gt;Also a nuisance is editing .Less files. With plain CSS, I would edit the file, save it, and press F5 in the browser. With .Less, the CSS file must be regenerated. Rebuilding the whole Visual Studio solution is so much slower, but fortunately unecessary. &lt;a href="http://haacked.com/archive/2009/12/02/t4-template-for-less-css.aspx"&gt;Phil Haack's T4 script&lt;/a&gt; rebuilds just the .Less file. The cunning bit is how, when run, the file marks itself as unsaved. T4 scripts are run when saved, so every time the file is saved, .Less generates the CSS files again.&lt;/p&gt;
&lt;p&gt;Using that feature, you can open T4CSS.tt in Visual Studio along with the .less file you're editing, and leave it open. Now, when saving the .less file, instead of pressing Ctrl-S, press Ctrl-Shft-S, which is saves all open files. This will save the T4 script (thus regenerating the CSS), and the changes will appear when you refresh the browser. Once setup, the only change to the edit / save / view cycle is pressing Shift when saving.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/MLX_NDSVHs6GvMeLRwrfp-Ab52g/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MLX_NDSVHs6GvMeLRwrfp-Ab52g/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/MLX_NDSVHs6GvMeLRwrfp-Ab52g/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/MLX_NDSVHs6GvMeLRwrfp-Ab52g/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=0IVgcJLUVyI:YyinARYsh0w:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=0IVgcJLUVyI:YyinARYsh0w:4PU86EYFyYg"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=4PU86EYFyYg" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harriyott/simonssoftwarestuff/~4/0IVgcJLUVyI" height="1" width="1"/&gt;</description><feedburner:origLink>http://harriyott.com/2011/07/yahoo-yui-compressor-less-with-visual-studio.aspx</feedburner:origLink></item><item><title>New industry standard for naming oojits</title><link>http://feedproxy.google.com/~r/harriyott/simonssoftwarestuff/~3/6xOYDZBFJ4E/new-industry-standard-for-naming-oojits.aspx</link><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Simon Harriyott</dc:creator><pubDate>Thu, 10 Feb 2011 05:37:00 PST</pubDate><description>&lt;p&gt;I'm working on a domain model at the moment, and I'm struggling to name a thing. A piece of text data can be one of three types; a label, a code or a group. The (C#) class to represent this is simple&lt;/p&gt;

&lt;pre&gt;public class TextData
{
    public string Data {get; set;}
    public TypeOfData DataType {get; set;}
}&lt;/pre&gt;

&lt;p&gt;Only thing is, I dislike the name of the second property. I named it badly for emphasis, but there are two problems:&lt;/p&gt;

&lt;p&gt;Firstly, it isn't a data type, because data type means int or double or string or other such thing. Secondly, just calling something a type makes it sound like a .NET Type, so it is automatically ambiguous when coding, even if it is in the domain model.&lt;/p&gt;

&lt;p&gt;So if we can't call anything a &amp;lsquo;type&amp;rsquo;, how about a &amp;lsquo;sort&amp;rsquo;. As in, &amp;ldquo;what sort of data is it?&amp;rdquo; Fairly obviously, sort usually means to arrange things in sequential order. What about &amp;lsquo;class&amp;rsquo;? Ahem.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://thesaurus.com/browse/type"&gt;Thesaurus&lt;/a&gt; &lt;a href="http://thesaurus.com/browse/sort"&gt;time&lt;/a&gt;.  Classification? Too long; too pompous. Breed? To animalish. Category? Hmm. Not sure why not, other than it sounds too &lt;em&gt;big&lt;/em&gt; for this purpose. Genre? Also too big. Genus? Species? Again, animals. Kind?&lt;/p&gt;

&lt;p&gt;Kind. I like that. It doesn't mean anything else in code. DataKind. That could work. Well, perhaps it wouldn't on a dating website, as it would also be an attribute of a potential date. Well, for me it would. Wouldn't want to date anyone &lt;em&gt;un&lt;/em&gt;kind.&lt;/p&gt;

&lt;p&gt;What else is there? Ilk. That's a nice word. Ilk. Yes, I like ilk. It &lt;a href="http://dictionary.reference.com/browse/ilk"&gt;isn't ambiguous&lt;/a&gt; in any way. It definitely &lt;a href="http://goo.gl/LCwdI"&gt;means&lt;/a&gt; what I think it does. I don't often hear it used, and when I do, it generally pertains to people (men of that ilk). It sounds a bit odd, but I think that's good. It will stand out as meaning the type of thing, the sort of thing, the class of thing, the kind of thing, but without the ambiguity.&lt;/p&gt;

&lt;p&gt;So, I propose &lt;strong&gt;Ilk&lt;/strong&gt; as the new industry standard for the name of an informal classification of things. It may not sit well with you now, but if we start using it regularly and it becomes ubiquitous, then it will sound no less out of place than dongle, widget, mash-up, tweet, blogosphere and other words of that ilk.&lt;/p&gt;

&lt;p&gt;Oh alright, so not blogosphere.&lt;/p&gt;

&lt;p&gt;[Lively discussion encouraged]&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/DYp7uVA6ZzBwDWn0i12ZES8_Jmk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/DYp7uVA6ZzBwDWn0i12ZES8_Jmk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/DYp7uVA6ZzBwDWn0i12ZES8_Jmk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/DYp7uVA6ZzBwDWn0i12ZES8_Jmk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=6xOYDZBFJ4E:CMAq5UVc7fg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=6xOYDZBFJ4E:CMAq5UVc7fg:4PU86EYFyYg"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=4PU86EYFyYg" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harriyott/simonssoftwarestuff/~4/6xOYDZBFJ4E" height="1" width="1"/&gt;</description><feedburner:origLink>http://harriyott.com/2011/02/new-industry-standard-for-naming-oojits.aspx</feedburner:origLink></item><item><title>Error starting site in IIS</title><link>http://feedproxy.google.com/~r/harriyott/simonssoftwarestuff/~3/mrsibKXNvDU/error-starting-site-in-iis.aspx</link><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Simon Harriyott</dc:creator><pubDate>Wed, 04 Aug 2010 03:40:23 PDT</pubDate><description>&lt;p&gt;I got the following error message when trying to start a site on port 80 in IIS&lt;/p&gt;
&lt;pre&gt;Internet Information Services (IIS) Manager

The process cannot access the file because it is being used by
another process. (Exception from HRESULT: 0x80070020)&lt;/pre&gt;

&lt;p&gt;Following the instructions &lt;a href="http://support.microsoft.com/kb/973094"&gt;here&lt;/a&gt;, I:
&lt;ol&gt;
&lt;li&gt;Ran &lt;code&gt;netstat -aon | find ":80"&lt;/code&gt; from a command prompt&lt;/li&gt;
&lt;li&gt;Found the PID for the process using port 80&lt;/li&gt;
&lt;li&gt;Used Task Manager to find out what program owned this process. It turned out to be Skype.&lt;/li&gt;
&lt;li&gt;Closed Skype. Lo, I can now start the site in IIS&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/TlDwSmkO5ztg8i45wvfnfA1I3IQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TlDwSmkO5ztg8i45wvfnfA1I3IQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/TlDwSmkO5ztg8i45wvfnfA1I3IQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/TlDwSmkO5ztg8i45wvfnfA1I3IQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=mrsibKXNvDU:D2-tg3Hk86U:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=mrsibKXNvDU:D2-tg3Hk86U:4PU86EYFyYg"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=4PU86EYFyYg" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harriyott/simonssoftwarestuff/~4/mrsibKXNvDU" height="1" width="1"/&gt;</description><feedburner:origLink>http://harriyott.com/2010/08/error-starting-site-in-iis.aspx</feedburner:origLink></item><item><title>Strange, kind of sad, big old error.</title><link>http://feedproxy.google.com/~r/harriyott/simonssoftwarestuff/~3/7py3KRlpOS0/strange-kind-of-sad-big-old-error.aspx</link><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Simon Harriyott</dc:creator><pubDate>Thu, 29 Jul 2010 03:29:46 PDT</pubDate><description>&lt;p&gt;Strange Visual Studio 2010 error message today, with absolutely nothing on Google.
&lt;/p&gt;
&lt;blockquote&gt;VsTextViewAdapter initialization failure: Trying to create a text view without an available text buffer, current state:Sited&lt;/blockquote&gt;
&lt;p&gt;
The project is ASP.NET MVC 2.0, and any views that were open when the project was closed are being reopened, but nothing is being rendered, even in code view. 

Trying to open a C# file produced this error:

&lt;/p&gt;&lt;blockquote&gt;Internal error occurred. Additional information: ''.&lt;/blockquote&gt;
&lt;p&gt;
Thanks for that. Pressing F5 to run the solution in debug mode just crashes VS without any error.
&lt;/p&gt;
&lt;p&gt;After trying a few other files and projects, I rebooted, and it was all fine.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.flickr.com/photos/adambowie/3387667672/"&gt;&lt;img src="http://farm4.static.flickr.com/3602/3387667672_d9a9f7597b.jpg"height="300" alt="Keep calm and turn it off and on again by Adam Bowie" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/tWM6drBzzK9RJ9R8zohy2sJtivw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tWM6drBzzK9RJ9R8zohy2sJtivw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/tWM6drBzzK9RJ9R8zohy2sJtivw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tWM6drBzzK9RJ9R8zohy2sJtivw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=7py3KRlpOS0:qJOs5ZoIMuw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=7py3KRlpOS0:qJOs5ZoIMuw:4PU86EYFyYg"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=4PU86EYFyYg" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harriyott/simonssoftwarestuff/~4/7py3KRlpOS0" height="1" width="1"/&gt;</description><feedburner:origLink>http://harriyott.com/2010/07/strange-kind-of-sad-big-old-error.aspx</feedburner:origLink></item><item><title>Dynamic numbered map pins with ASP.NET MVC</title><link>http://feedproxy.google.com/~r/harriyott/simonssoftwarestuff/~3/PGbg2cFNyGk/dynamic-numbered-map-pins-with-aspnet-mvc.aspx</link><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Simon Harriyott</dc:creator><pubDate>Wed, 02 Jun 2010 07:42:00 PDT</pubDate><description>&lt;p&gt;A mapping project I've recently been working on needed to have coloured, numbered pins to correspond to the numbered items shown in the list below the map, e.g. &lt;br /&gt;
&lt;img alt="Green 23 marker" src="http://harriyott.com/images/blog/23.png" /&gt;&lt;/p&gt;

&lt;p&gt;I wanted the images to be created dynamically, as the numbers could reach into the hundreds, and I didn't fancy spending several days with Photoshop. I started with empty pin images (red, green, blue and black).&lt;br /&gt;
&lt;img alt="Empty marker" src="http://harriyott.com/images/blog/marker_green.png" /&gt;
&lt;/p&gt;

&lt;p&gt;To improve performance, I decided to write the image to disk once I'd generated it, which I could just return in future calls. I also wanted to cache the image path, so I wouldn't have to access the disk to see if the image had been created already.&lt;/p&gt;

&lt;p&gt;I added an ImageController class, and an Index action that took the colour as a string and the number as an integer:&lt;/p&gt;

&lt;code&gt;public ActionResult Index(string colour, int number)&lt;/code&gt;

&lt;p&gt;This would correspond to the url http://domain.com/image/green/23.png. I put the png extension so everything would know it was a png file. So after checking that an existing image for the colour and number didn't exist, one needed to be generated. I've not used the graphics classes in .NET before, so I was super excited about it. The first step was to load the correctly coloured image:&lt;/p&gt;

&lt;code&gt;using (var stream = new FileStream(imageRoot + colour + ".png") {&lt;br /&gt;
 &amp;nbsp; image = Image.FromStream(stream);&lt;br /&gt;
}&lt;/code&gt;

&lt;p&gt;Now to draw the number on top of the image:&lt;/p&gt;

&lt;code&gt;
var g = Graphics.FromImage(image);&lt;br /&gt;
g.TextRenderingHint = TextRenderingHint.AntiAlias;&lt;br /&gt;
var stringFormat = new StringFormat&lt;br /&gt;
&amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; Alignment = StringAlignment.Center,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; LineAlignment = StringAlignment.Center&lt;br /&gt;
&amp;nbsp; };&lt;br /&gt;
g.DrawString(&lt;br /&gt;
&amp;nbsp; number.ToString(),&lt;br /&gt;
&amp;nbsp; SystemFonts.DefaultFont,&lt;br /&gt;
&amp;nbsp; Brushes.Black,&lt;br /&gt;
&amp;nbsp; new RectangleF(0f, 0f, image.Width, 33f),&lt;br /&gt;
&amp;nbsp; stringFormat);&lt;br /&gt;
&lt;/code&gt;

&lt;p&gt;This is just setting up the text style, defining a rectangle in the right place, then drawing the string into the rectangle.  (I still can't help thinking of Speedos.) Then it was a simple case of saving the image for next time and returning it as a &lt;code&gt;FilePathResult&lt;/code&gt;:&lt;/p&gt;

&lt;code&gt;image.Save(imagePath, ImageFormat.Png);&lt;br /&gt;
return File(imageUrl, "image/png");&lt;/code&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/HWAvisBLv0-EKPLRHhlfVKsB6ZY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HWAvisBLv0-EKPLRHhlfVKsB6ZY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/HWAvisBLv0-EKPLRHhlfVKsB6ZY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HWAvisBLv0-EKPLRHhlfVKsB6ZY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=PGbg2cFNyGk:FCbM4ubIN_0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=PGbg2cFNyGk:FCbM4ubIN_0:4PU86EYFyYg"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=4PU86EYFyYg" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harriyott/simonssoftwarestuff/~4/PGbg2cFNyGk" height="1" width="1"/&gt;</description><feedburner:origLink>http://harriyott.com/2010/06/dynamic-numbered-map-pins-with-aspnet-mvc.aspx</feedburner:origLink></item><item><title>New blog platform</title><link>http://feedproxy.google.com/~r/harriyott/simonssoftwarestuff/~3/tlFPJ-OjaXw/new-blog-platform.aspx</link><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Simon Harriyott</dc:creator><pubDate>Tue, 25 May 2010 14:12:33 PDT</pubDate><description>&lt;p&gt;Due to blogger.com discontinuing FTP publishing support for domains (thanks Google), I couldn't update my blog. Not only that, nobody could post a comment either.&lt;/p&gt;

&lt;p&gt;Blogger.com has server me well for nearly 7 years (84 in internet years), so there's bound to be a suitable .NET blog platform to suit my basic needs, i.e. no database (as my cheapo host doesn't support SQL Server and I don't want to change host &lt;em&gt;as well&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;It turns out that there wasn't a .NET blog platform to suit my needs, so I'm writing one. This is the first post with it, and very happy I am with it too.  Each blog post is stored as an XML file in &lt;a href="http://blogml.codeplex.com/"&gt;blogml&lt;/a&gt; format.  I'm using &lt;a href="http://disqus.com"&gt;disqus&lt;/a&gt; for the comments&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ogk5wtCDt6SvKpPDMnFPSg4XWbc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ogk5wtCDt6SvKpPDMnFPSg4XWbc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ogk5wtCDt6SvKpPDMnFPSg4XWbc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ogk5wtCDt6SvKpPDMnFPSg4XWbc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=tlFPJ-OjaXw:ewOWd6-AIe8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=tlFPJ-OjaXw:ewOWd6-AIe8:4PU86EYFyYg"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=4PU86EYFyYg" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harriyott/simonssoftwarestuff/~4/tlFPJ-OjaXw" height="1" width="1"/&gt;</description><feedburner:origLink>http://harriyott.com/2010/05/new-blog-platform.aspx</feedburner:origLink></item><item><title>Adding SEO fields to N2 MVC example</title><link>http://feedproxy.google.com/~r/harriyott/simonssoftwarestuff/~3/XAn9FKa73ZE/adding-seo-fields-to-n2-mvc-example.aspx</link><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Simon Harriyott</dc:creator><pubDate>Wed, 13 Jan 2010 06:43:00 PST</pubDate><description>I've been using (a copy of) the MVC example from the N2 trunk. By default, there is no SEO tab. To add this, copy SEODefinitionAppender.cs and TitleAndMetaTagApplyer.cs from the N2.Templates.Mvc project (Services folder) to the example project. Then add the line&lt;br /&gt;&lt;pre&gt;engine.AddComponent("n2.templates.seo.definitions",&lt;br /&gt;   typeof(SEODefinitionAppender));&lt;/pre&gt;to the end of Application_Start in global.asax.cs.&lt;br /&gt;The SEO tab and fields should now appear on the edit page.&lt;br /&gt;&lt;br /&gt;The next step is to get the SEO fields into the master page. If there's no code-behind class for the master page, then add one, and derive the class like so:&lt;br /&gt;&lt;pre&gt;Site : ViewMasterPage&amp;lt;IItemContainer&amp;gt;, IItemContainer&amp;lt;ContentItem&amp;gt;&lt;/pre&gt;&lt;br /&gt;Add the following to the class:&lt;br /&gt;&lt;pre&gt;protected override void OnInit(EventArgs e)&lt;br /&gt;{&lt;br /&gt; _titleApplyer = new TitleAndMetaTagApplyer(this.Page, Model.CurrentItem);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public ContentItem CurrentItem&lt;br /&gt;{&lt;br /&gt; get&lt;br /&gt; {&lt;br /&gt;  return Model.CurrentItem;&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;Derive AbstractPage from IItemContainer, and implement the CurrentItem getter by returning "this". Make sure all view pages' view data is derived from AbstractPage or IItemContainer.
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/hpy3weFwLvmeTPUNID4Mv5-evZc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hpy3weFwLvmeTPUNID4Mv5-evZc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/hpy3weFwLvmeTPUNID4Mv5-evZc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hpy3weFwLvmeTPUNID4Mv5-evZc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=XAn9FKa73ZE:erY675AHx-A:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=XAn9FKa73ZE:erY675AHx-A:4PU86EYFyYg"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=4PU86EYFyYg" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harriyott/simonssoftwarestuff/~4/XAn9FKa73ZE" height="1" width="1"/&gt;</description><feedburner:origLink>http://harriyott.com/2010/01/adding-seo-fields-to-n2-mvc-example.aspx</feedburner:origLink></item><item><title>Setting up N2, the open source, ASP.NET (with optional MVC) CMS</title><link>http://feedproxy.google.com/~r/harriyott/simonssoftwarestuff/~3/vtEkTR-YWIQ/setting-up-n2-open-source-aspnet-with.aspx</link><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Simon Harriyott</dc:creator><pubDate>Wed, 06 Jan 2010 01:51:00 PST</pubDate><description>Here's what I did to get started with N2, the best CMS I've used to date. I've not set up one of these for a while, so I thought I'd document the process:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Check out the latest source from the subversion trunk - &lt;a href="http://code.google.com/p/n2cms/source/checkout"&gt;http://code.google.com/p/n2cms/source/checkout&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Ran Prepare_Dependencies-vs2008.bat in the root folder&lt;/li&gt;&lt;li&gt;Ran Build_Everything-vs2008.bat, also in the root&lt;/li&gt;&lt;li&gt;Made a copy of examples/Mvc to use as a new project&lt;/li&gt;&lt;li&gt;Loaded the solution in VS2008&lt;/li&gt;&lt;li&gt;Created the database, and &lt;a href="http://www.n2cms.com/Upload/Documentation/database/optimized.install.sqlserver2005.sql"&gt;ran the script&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Built and ran the project&lt;/li&gt;&lt;li&gt;Navigated to /edit/install to see how I was doing&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;br /&gt;Not very well. I got a &lt;span class="code"&gt;"No component for supporting the service N2.Web.Mvc.IControllerMapper was found"&lt;/span&gt; error. Google told me very little, except that someone else had the same problem and &lt;a href="http://n2cms.codeplex.com/Thread/View.aspx?ThreadId=71405"&gt;posted it on the forum&lt;/a&gt;. I posted too, and within half an hour, &lt;a href="http://twitter.com/spmason"&gt;Steve Mason&lt;/a&gt; (who I worked with at Cubeworks, and is a contributor to N2) had replied asking for a stack trace. I provided one, and Steve provided the fix. Back on track.&lt;br /&gt;&lt;br /&gt;I then checked /edit/install again, which prompted me to upgrade to version 2 of the database, by simply clicking a button. It then told me to add a root page, which I did. Now I'm up and running.&lt;br /&gt;&lt;br /&gt;After copying a page or two, I kept getting a StackOverflowException thrown. Thanks to Joel and Jeff, these are harder to google for, but eventually I worked out that I needed to override TemplateUrl in the Model class (derived from AbstractPage).
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/NRfGG36pMzdDppSdDo5PmyhkmcU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/NRfGG36pMzdDppSdDo5PmyhkmcU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/NRfGG36pMzdDppSdDo5PmyhkmcU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/NRfGG36pMzdDppSdDo5PmyhkmcU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=vtEkTR-YWIQ:O_76jrlQWYs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=vtEkTR-YWIQ:O_76jrlQWYs:4PU86EYFyYg"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=4PU86EYFyYg" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harriyott/simonssoftwarestuff/~4/vtEkTR-YWIQ" height="1" width="1"/&gt;</description><feedburner:origLink>http://harriyott.com/2010/01/setting-up-n2-open-source-aspnet-with.aspx</feedburner:origLink></item><item><title>NHibernate.MappingException</title><link>http://feedproxy.google.com/~r/harriyott/simonssoftwarestuff/~3/QYWwwqbVWTc/nhibernatemappingexception.aspx</link><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Simon Harriyott</dc:creator><pubDate>Tue, 03 Nov 2009 14:57:00 PST</pubDate><description>Just got this error message and had no relevant results on Google:&lt;br /&gt;&lt;br /&gt;System.TypeInitializationException : The type initializer for 'MyApp.Repositories.NHibernateHelper' threw an exception.&lt;br /&gt;  ----&gt; NHibernate.MappingException : An association from the table MyTable refers to an unmapped class: MyApp.Domain.MyClass&lt;br /&gt;&lt;br /&gt;Schoolboy error; I'd forgotten to mark the hbm.xml files as embedded resources.
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/1tA5wpgghvLBcAi5HFbqA1hNqKo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1tA5wpgghvLBcAi5HFbqA1hNqKo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/1tA5wpgghvLBcAi5HFbqA1hNqKo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1tA5wpgghvLBcAi5HFbqA1hNqKo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=QYWwwqbVWTc:wuWE625pxeg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=QYWwwqbVWTc:wuWE625pxeg:4PU86EYFyYg"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=4PU86EYFyYg" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harriyott/simonssoftwarestuff/~4/QYWwwqbVWTc" height="1" width="1"/&gt;</description><feedburner:origLink>http://harriyott.com/2009/11/nhibernatemappingexception.aspx</feedburner:origLink></item><item><title>Windows Installer 4.5 Installation Error on XP</title><link>http://feedproxy.google.com/~r/harriyott/simonssoftwarestuff/~3/DW-wlib3gCE/windows-installer-45-installation-error.aspx</link><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Simon Harriyott</dc:creator><pubDate>Mon, 02 Nov 2009 11:41:00 PST</pubDate><description>While attempting to install &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=5A58B56F-60B6-4412-95B9-54D056D6F9F4&amp;displaylang=en"&gt;Windows Installer 4.5&lt;/a&gt; from the WindowsXP-KB942288-v3-x86.exe file, an error occurred prompting me to select a debugger.  The error was to do with update.exe.&lt;br /&gt;&lt;br /&gt;After a couple of attempts, I realised that it was still at the unzipping stage of the install, so I loaded up WindowsXP-KB942288-v3-x86.exe in 7-zip and extracted the files.  I was then able to run the installer from the extraction.
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/hh8UQFo7dclmtml-tQinGQUJjZ8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hh8UQFo7dclmtml-tQinGQUJjZ8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/hh8UQFo7dclmtml-tQinGQUJjZ8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hh8UQFo7dclmtml-tQinGQUJjZ8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=DW-wlib3gCE:pTJMmPNrHzo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?a=DW-wlib3gCE:pTJMmPNrHzo:4PU86EYFyYg"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harriyott/simonssoftwarestuff?d=4PU86EYFyYg" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harriyott/simonssoftwarestuff/~4/DW-wlib3gCE" height="1" width="1"/&gt;</description><feedburner:origLink>http://harriyott.com/2009/11/windows-installer-45-installation-error.aspx</feedburner:origLink></item></channel></rss>

