<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Aliens ate my GUI</title>
	<atom:link href="http://davebrooks.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://davebrooks.wordpress.com</link>
	<description>Dave Brooks' blog</description>
	<lastBuildDate>Mon, 13 May 2013 12:13:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='davebrooks.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Aliens ate my GUI</title>
		<link>http://davebrooks.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://davebrooks.wordpress.com/osd.xml" title="Aliens ate my GUI" />
	<atom:link rel='hub' href='http://davebrooks.wordpress.com/?pushpress=hub'/>
		<item>
		<title>No Files Were Found To Look In. Find Was Stopped In Progress. Visual Studio gone mad!</title>
		<link>http://davebrooks.wordpress.com/2011/10/05/no-files-were-found-to-look-in-find-was-stopped-in-progress-visual-studio-gone-mad/</link>
		<comments>http://davebrooks.wordpress.com/2011/10/05/no-files-were-found-to-look-in-find-was-stopped-in-progress-visual-studio-gone-mad/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 14:48:30 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[biscuits]]></category>
		<category><![CDATA[scroll lock]]></category>
		<category><![CDATA[tea.cake]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://davebrooks.wordpress.com/?p=117</guid>
		<description><![CDATA[Much as I&#8217;ll admit to some spittle-flecked indignation when it comes to Visual Studio 20-anything, it has largely been the development tool that has paid my mortgage and allowed me to eat biscuits and cake. But this one takes the biscuit, cake, mug of tea and plate. I&#8217;m happily working away, writing code when suddenly [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=117&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Much as I&#8217;ll admit to some spittle-flecked indignation when it comes to Visual Studio 20-anything, it has largely been the development tool that has paid my mortgage and allowed me to eat biscuits and cake. But this one takes the biscuit, cake, mug of tea and plate.</p>
<p>I&#8217;m happily working away, writing code when suddenly find in files stops working with the wonderful message &#8220;<em>No Files Were Found To Look In. Find Was Stopped</em> In Progress&#8221; Ah it&#8217;s simple. I&#8217;ve obviously fiddled with the search options and not selected the file types to search in or something similar. Nope &#8211;  everything looks just fine.</p>
<p>Ah I know. Close devenv and start again. Nope &#8211; exactly the same.</p>
<p>So, off for a coffee and moan and someone says: <em>&#8220;Press Ctrl+Scroll Lock a few times and it&#8217;ll be fine&#8221;</em>. This sounds a bit <a href="http://en.wikipedia.org/wiki/Mornington_Crescent_(game)" target="_blank">Mornington Crecsent</a> to me, but it worked.</p>
<p>Sometimes I wonder if I should just go back to using notepad.exe</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davebrooks.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davebrooks.wordpress.com/117/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=117&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://davebrooks.wordpress.com/2011/10/05/no-files-were-found-to-look-in-find-was-stopped-in-progress-visual-studio-gone-mad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/117da7f90c08bf838e629e3f1cc4c1e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Wing Commander Dave</media:title>
		</media:content>
	</item>
		<item>
		<title>Convert URL text to a link</title>
		<link>http://davebrooks.wordpress.com/2011/03/31/convert-url-text-to-a-link/</link>
		<comments>http://davebrooks.wordpress.com/2011/03/31/convert-url-text-to-a-link/#comments</comments>
		<pubDate>Thu, 31 Mar 2011 12:27:36 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Web suff]]></category>

		<guid isPermaLink="false">http://davebrooks.wordpress.com/?p=114</guid>
		<description><![CDATA[Today seems to be the day for posting useful stuff on the blog. Actually, it&#8217;s just so I can quickly useful find bits of code I might need again. So I&#8217;ve a got a web page that displays some text a user has entered that may contain URLs and I&#8217;d like them to be displayed [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=114&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Today seems to be the day for posting useful stuff on the blog. Actually, it&#8217;s just so I can quickly useful find bits of code I might need again.</p>
<p>So I&#8217;ve a got a web page that displays some text a user has entered that may contain URLs and I&#8217;d like them to be displayed as actual hyperlinks.</p>
<p>&nbsp;</p>
<p><code> </code></p>
<p><code> public string ConvertUrlsToLinks(string msg)<br />
{<br />
string regex = @"((www\.|(http|https|ftp|news|file)+\:\/\/)[_.a-z0-9-]+\.[a-z0-9\/_:@=.+?,##%&amp;~-]*[^.|\'|\# |!|\(|?|,| |&gt;|&lt;|;|\)])";<br />
Regex r = new Regex(regex, RegexOptions.IgnoreCase);<br />
return r.Replace(msg, "<a title="\&quot;Click" href="\&quot;$1\&quot;" target="\&quot;_blank\&quot;">$1</a>").Replace("href=\"www", "href=\"http://www");<br />
}<br />
</code></p>
<p>&nbsp;</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davebrooks.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davebrooks.wordpress.com/114/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=114&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://davebrooks.wordpress.com/2011/03/31/convert-url-text-to-a-link/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/117da7f90c08bf838e629e3f1cc4c1e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Wing Commander Dave</media:title>
		</media:content>
	</item>
		<item>
		<title>A poor man&#8217;s keyword and tag generator</title>
		<link>http://davebrooks.wordpress.com/2011/03/31/keyword-tag-generator/</link>
		<comments>http://davebrooks.wordpress.com/2011/03/31/keyword-tag-generator/#comments</comments>
		<pubDate>Thu, 31 Mar 2011 12:18:52 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Web suff]]></category>
		<category><![CDATA[dave]]></category>
		<category><![CDATA[keywords]]></category>
		<category><![CDATA[minimum]]></category>
		<category><![CDATA[tags]]></category>
		<category><![CDATA[word]]></category>

		<guid isPermaLink="false">http://davebrooks.wordpress.com/?p=109</guid>
		<description><![CDATA[Not that this is is going to compete with a full blown keyword or tag service like Google offer, but I needed a very quick way to suggest keywords and tags as users filled out a blog form. There&#8217;s no fancy thesaurus or library of data, but it gives surprisingly good results. At least, it [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=109&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Not that this is is going to compete with a full blown keyword or tag service like Google offer, but I needed a very quick way to suggest keywords and tags as users filled out a blog form. There&#8217;s no fancy thesaurus or library of data, but it gives surprisingly good results. At least, it gives the user a few hints and ideas about what they should put in as a keywords.</p>
<p><code>public string GetKeywords(string text, int minCount, int minLength, string additionalWords)</code></p>
<p><code>{</p>
<p>string keywords = "";</p>
<p>Dictionary dict = getKeywords(text, minCount, minLength);</p>
<p>foreach (var entry in dict)</p>
<p></code></p>
<p>&nbsp;</p>
<p><code>keywords += entry.Key + ",";</code></p>
<p><code>if (additionalWords.Length &gt; 0)</code></p>
<p><code>keywords += additionalWords;</code></p>
<p><code>return keywords.Trim(',');</p>
<p>}</p>
<p>private  Dictionary getKeywords(string text, int minCount, int minLength)</p>
<p>{</p>
<p>text = StripHTML(text);</p>
<p>text = StripCrap(text);</p>
<p>text = text.ToLower();</p>
<p>var stopWords = new string[] {"about","above","across","after","again","against","all","almost","alone","along","already","also","although","always","among","an","and","another","any","anybody","anyone","anything","anywhere","are","area","areas","around","as","ask","asked","asking","asks","at","away","back","backed","backing","backs","be","became","because","become","becomes","been","before","began","behind","being","beings","best","better","between","big","both","but","by","came","can","cannot","case","cases","certain","certainly","clear","clearly","come","could","did","differ","different","differently","do","does","done","down","down","downed","downing","downs","during","each","early","either","end","ended","ending","ends","enough","even","evenly","ever","every","everybody","everyone","everything","everywhere","face","faces","fact","facts","far","felt","few","find","finds","first","for","four","from","full","fully","further","furthered","furthering","furthers","gave","general","generally","get","gets","give","given","gives","go","going","good","goods","got","great","greater","greatest","group","grouped","grouping","groups","had","has","have","having","he","her","here","herself","high","high","high","higher","highest","him","himself","his","how","however","if","important","in","interest","interested","interesting","interests","into","is","it","its","itself","just","keep","keeps","kind","knew","know","known","knows","large","largely","last","later","latest","least","less","let","lets","like","likely","long","longer","longest","made","make","making","man","many","may","me","member","members","men","might","more","most","mostly","mr","mrs","much","must","my","myself","necessary","need","needed","needing","needs","never","new","new","newer","newest","next","no","nobody","non","noone","not","nothing","now","nowhere","number","numbers","of","off","often","old","older","oldest","on","once","one","only","open","opened","opening","opens","or","order","ordered","ordering","orders","other","others","our","out","over","part","parted","parting","parts","per","perhaps","place","places","point","pointed","pointing","points","possible","present","presented","presenting","presents","problem","problems","put","puts","quite","rather","really","right","right","room","rooms","said","same","saw","say","says","second","seconds","see","seem","seemed","seeming","seems","sees","several","shall","she","should","show","showed","showing","shows","side","sides","since","small","smaller","smallest","so","some","somebody","someone","something","somewhere","state","states","still","still","such","sure","take","taken","than","that","the","their","them","then","there","therefore","these","they","thing","things","think","thinks","this","those","though","thought","thoughts","three","through","thus","to","today","together","too","took","toward","turn","turned","turning","turns","two","under","until","up","upon","us","use","used","uses","very","want","wanted","wanting","wants","was","way","ways","we","well","wells","went","were","what","when","where","whether","which","while","who","whole","whose","why","will","with","within","without","work","worked","working","works","would","year","years","yet","you","young","younger","youngest","your","yours"};</p>
<p>var words = Regex.Replace(text, @"[,.?\/;:\(\)]", string.Empty).Split(' ');</p>
<p>var occurrences = words.Distinct().Except(stopWords).Select(w =&gt;</p>
<p>new { Word = w, Count = words.Count(s =&gt; s == w) });</p>
<p>return occurrences.Where(wo =&gt; wo.Count &gt;= minCount &amp;&amp; wo.Word.Length &gt;= minLength)</p>
<p>.ToDictionary(wo =&gt; wo.Word, wo =&gt; wo.Count);</p>
<p>}</p>
<p></code></p>
<p>&nbsp;</p>
<p>minCount the minimum number of duplicate words to catch<br />
minLength the minimum length of word to word on<br />
additionalWords is a set of comma separated word you want tagged(!) to the end of the string. I just use this to force certain keywords and tags</p>
<p>So taking the content of this page (less the code snippet) like this:</p>
<p><code> string tags = GetKeywords(articletext, 2, 4, "dave");<br />
</code></p>
<p>results in:</p>
<p>&#8220;keywords,tags,minimum,word,dave&#8221; which isn&#8217;t a lot different from what WordPress generated for me automatically, so I used it for my post tags.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davebrooks.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davebrooks.wordpress.com/109/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=109&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://davebrooks.wordpress.com/2011/03/31/keyword-tag-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/117da7f90c08bf838e629e3f1cc4c1e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Wing Commander Dave</media:title>
		</media:content>
	</item>
		<item>
		<title>The Case of the Unpeelable Banana</title>
		<link>http://davebrooks.wordpress.com/2010/04/19/the-case-of-the-unpeelable-banana/</link>
		<comments>http://davebrooks.wordpress.com/2010/04/19/the-case-of-the-unpeelable-banana/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 15:10:29 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Off topic]]></category>

		<guid isPermaLink="false">http://davebrooks.wordpress.com/?p=102</guid>
		<description><![CDATA[I had cause to visit my good friend, Mr Sherlock Holmes, one day last month to discuss a number of matters. Mrs Hudson let me in, took my hat and coat and ushered me to the library where I found Holmes deep in conversation around the table with a rather tall, bearded gentleman with a [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=102&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I had cause to visit my good friend, Mr Sherlock Holmes, one day last month to discuss a number of matters. Mrs Hudson let me in, took my hat and coat and ushered me to the library where I found Holmes deep in conversation around the table with a rather tall, bearded gentleman with a very shiny hat and oppressively respectable frock-coat. They were studying a large pile of manuscripts. I was about to withdraw, but Holmes quickly beckoned me in, indicating he wanted the door closed.</p>
<p> “My dear Watson, you couldn’t have come at a better time”, he said cordially.</p>
<p>“You looked otherwise engaged”.</p>
<p>“Very much so”, he replied. “But I should like you to meet Colonel Kerr”. The tall man turned, walked towards me, gave a bob of a greeting and offered his hand.</p>
<p>“Colonel Kerr, this gentleman has been my partner and helper in many of my successful cases and I’m sure will be able to offer some assistance. Colonel Kerr, please meet my good friend Dr Watson”.</p>
<p>We shook hands, he gave a quick little glance from his small, piercing eyes and returned to the table to resumed his studies.</p>
<p>“Watson, I just need to quickly conclude a few matters with Colonel Kerr before he leaves. He has to catch his sailing to South Africa that departs from Southampton this afternoon. Once he has gone, I will explain everything. I know you share my enthusiasm for the bizarre and unconventional puzzles and this promises to be a very interesting one.”</p>
<p>Holmes’s quick eye noticed my questioning glances and gestured towards the side cabinet. “Help yourself to some fruit. Colonel Kerr was kind enough to bring fresh supplies from his travels when he arrived this morning.”</p>
<p>Holmes joined the Colonel at the table and they resumed their study of the manuscript with whispered excitement.</p>
<p>I inspected the large bowl of fruit on the side cabinet with interest. It was well stocked and it had been a while since I had eaten bananas. I’ve always had the suspicion the banana exporting countries conspire to make bananas increasingly difficult to peel. The banana tops refuse to snap open like they used to and one has to resort to a knife. And these bananas were no different. I had the devil of a job with each banana I tried, so decided to abandon my attempts.</p>
<p>“Watson. I’ve decided to accompany the Colonel to the station. We have some more business to complete and the Colonel is late for his train”. Holmes and the Colonel had gathered their papers and were rushing out of the library. “Mrs Hudson will see you out. Meet me here tomorrow at 2pm”.</p>
<p>I heard the gathering of coats, the front door shutting and all was quiet. A sudden still hit the room. Again, Holmes had left me very much in the dark with the promise of revealing all. As I turned to leave, I noticed something on the table. A small pile of banana skins that had been obscured by the mountain of manuscripts was clearly visible. I wandered over to examine the evidence. How on earth had they been peeled?</p>
<p>The banana skins had been torn into many pieces, so it was impossible to fathom any clues. I decided to wait until tomorrow and left Holmes a short note.</p>
<p>It was a quarter-past one when I started from home the following day. I made my way across the park, and so through Oxford Street to Baker Street. I climbed the stairs to the door, knocked and was greeted by Mrs Hudson.</p>
<p>“Sir is in the library,” she said while taking my coat.</p>
<p>“Ah Watson”. Holmes was clearly brimming with self satisfaction as he always did when he’d solved a mystery. “Your note and the pile of banana skins deprived me of sleep last night,” he said buttoning up his pea jacket and taking his heavy hunting crop from the rack. “We’ve solved many mysteries together. Most of them seemingly unsolvable, some impossibly so. However, I confess I had to resort to outside help on this one”.</p>
<p>Holmes pulled a crumpled telegram from the inside pocket of his pea jacket, tapping it with his crop.</p>
<p>“It seems Watson, we need to observe the animal world more closely. This telegram from Colonel Kerr I received this very morning, has made me realize that sometimes we are not as intelligent as we think we are”.</p>
<p>He continued to tap the telegram with his crop with each syllable, so emphasizing his point.</p>
<p>“Colonel Kerr simply peeled those bananas by watching how monkeys do it. No matter how un-ripe a banana is, a monkey will always successfully peel it from the wrong end.”</p>
<p>Holmes obviously took a certain relief from explaining this and shrugged his shoulders.</p>
<p>“So, remember to always peel bananas from the wrong end,” he retorted.</p>
<p>“Nice retorting!” I retorted.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davebrooks.wordpress.com/102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davebrooks.wordpress.com/102/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=102&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://davebrooks.wordpress.com/2010/04/19/the-case-of-the-unpeelable-banana/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/117da7f90c08bf838e629e3f1cc4c1e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Wing Commander Dave</media:title>
		</media:content>
	</item>
		<item>
		<title>C# switch on type &#8211; you&#8217;re not my type!</title>
		<link>http://davebrooks.wordpress.com/2010/04/06/c-switch-on-type-youre-not-my-type/</link>
		<comments>http://davebrooks.wordpress.com/2010/04/06/c-switch-on-type-youre-not-my-type/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 13:17:00 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://davebrooks.wordpress.com/?p=87</guid>
		<description><![CDATA[OO purists have long argued that switching on the type of an object by using some conjured up member enum is wrong. And I agree. Fundamentally, it&#8217;s nasty and you can satisfyingly waggle your finger at poor OO design. However, sometimes things aren&#8217;t so easy and straightforward. I&#8217;m currently working with a complex financial trade class hierarchy [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=87&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>OO purists have long argued that switching on the type of an object by using some conjured up member enum is wrong. And I agree. Fundamentally, it&#8217;s nasty and you can satisfyingly waggle your finger at poor OO design.</p>
<p>However, sometimes things aren&#8217;t so easy and straightforward. I&#8217;m currently working with a complex financial trade class hierarchy that simply can&#8217;t be changed &#8211; it just wouldn&#8217;t be practical. I needed some new functionality that switched on an instance of the base class of the hierarchy. Ok, so it breaks all the rules, but at least it&#8217;s switching on a common base type and not completely unrelated types. <a href="http://blogs.msdn.com/peterhal/archive/2005/07/05/435760.aspx" target="_blank">Peter Hallam&#8217;s article</a> describes the problems with a generalised type switch built into the language and why it&#8217;s not practical.</p>
<p>So what follows is stream of software design consciousness that touches on the relative casting performance of C# as vs. is, lambda functions, generics and fluent interfaces (method chaining) that achieves a solution.</p>
<p>Lets assume we have some simple class hierarchy. These classes do nothing, but demonstrate the principles involved. We&#8217;ll use these throughout the examples.</p>
<pre><span style="color:#0000ff;">
// Our base class
public class Trade
{
    public void TradeMethod()
    {
    }
}

public class GenericTrade : Trade
{
    public void GenericTradeMethod()
    {
    }
}

public class SwapTrade : Trade
{
    public void SwapTradeMethod()
    {
    }
}

public class SpotTrade : Trade
{
    public void SpotTradeMethod()
    {
    }
}
</span></pre>
<p>A first stab at switching on type might be like this:</p>
<pre><span style="color:#0000ff;">
public void doSomething(Trade trade)
{
    if (trade is GenericTrade)
    {
        GenericTrade genericTrade = trade as GenericTrade;
        genericTrade.GenericTradeMethod();
        // ....
        // ....
    }
    else
        if (trade is SwapTrade)
        {
            SwapTrade swapTrade = trade as SwapTrade;
            swapTrade.SwapTradeMethod();
            // ....
            // ....
        }
        else
            if (trade is SpotTrade)
            {
                SpotTrade spotTrade = trade as SpotTrade;
                spotTrade.SpotTradeMethod();
                // ....
                // ....
            }
            else
            {
                // Default actions
                // ....
                // ....
            }
}
</span></pre>
<p>Well it works, but it has a couple of problems.</p>
<ul>
<li>C# offers the syntactically concise way to upcast and downcast using as and is. Unfortunately as <a href="http://www.codeproject.com/KB/cs/csharpcasts.aspx" target="_blank">Emilio Guijarro shows</a>, the relative performance of &#8216;<em>as&#8217;</em> vs &#8216;<em>is&#8217;</em> when typecasting means &#8216;<em>is</em>&#8216; is pretty slow.</li>
<li>Somehow, the if…else.. If …else structure seams very clunky when there&#8217;s more than a few types.</li>
</ul>
<p>To get around using the slow &#8216;<em>is</em>&#8216; is easy.</p>
<pre><span style="color:#0000ff;">
public void doSomethingElse(Trade trade)
{
    GenericTrade genericTrade = new GenericTrade();
    SwapTrade swapTrade = new SwapTrade();
    SpotTrade spotTrade = new SpotTrade();

    if (genericTrade as GenericTrade != null)
    {
        genericTrade.GenericTradeMethod();
        // ....
        // ....
    }
    else
        if (swapTrade as SwapTrade != null)
        {
            swapTrade.SwapTradeMethod();
            // ....
            // ....
        }
        else
            if (genericTrade as GenericTrade != null)
            {
                genericTrade.GenericTradeMethod();
                // ....
                // ....
            }
            else
            {
                // Default actions
                // ....
                // ....
            }
}</span></pre>
<p>This requires an instance of each type, but the structure is even more horrible than before. So abandon that way of doing it. What we really need is something that is readable. Something like this would be ideal:</p>
<pre><span style="color:#0000ff;">
public void doSomething(Trade trade)
{
    switch (trade)
   {
      case GenericTrade:
            // ...
            // ...
            break;
      case SwapTrade:
            // ...
            // ...
            break;
       case SpotTrade:
            // ...
            // ...
            break;
        default:
            // ...
            // ...
            break;
      }
}
</span></pre>
<p><a href="http://bartdesmet.net/blogs/bart/archive/2008/03/30/a-functional-c-type-switch.aspx" target="_blank">Bart De Swet&#8217;s article</a> that describes a solution that yields a similar code structure. This is implemented using method extensions which is unnecessarily complicated, so I devised a similar solution using instance methods.</p>
<p>So here&#8217;s my take on a switch class &#8211; I&#8217;ve called it SwitchOnType for clarity:</p>
<pre><span style="color:#0000ff;">
public class SwitchOnType&lt;T1&gt;
{
    bool _break = false;
    private T1 _object;

    public SwitchOnType(T1 obj)
    {
        _object = obj;
    }

    public SwitchOnType&lt;T1&gt; Case&lt;T2&gt;(Action&lt;T2&gt; action) where T2 : class
    {
        if (_break == false)
        {
            T2 t = _object as T2;
            if (t != null)
            {
                action(t);
                _break = true;
            }
        }
        return this as SwitchOnType&lt;T1&gt;;
    }
    public void Default&lt;T2&gt;(Action&lt;T2&gt; action) where T2 : class
    {
        if (_break == false)
        {
            T2 t = _object as T2;
            if (t != null)
                action(t);
        }
    }
}
</span></pre>
<p>And here&#8217;s how it&#8217;s used with our class hierarchy example:</p>
<pre><span style="color:#0000ff;">
public void doSomething(Trade trade)
{
    new SwitchOnType&lt;Trade&gt;(trade)
        .Case&lt;GenericTrade&gt;(genericTrade =&gt;
        {
            // It's a GenericTrade
            genericTrade.GenericTradeMethod();
            // ...
            // ...
        })
        .Case&lt;SwapTrade&gt;(swapTrade =&gt;
        {
            // It's a SwapTrade
            swapTrade.SwapTradeMethod();
            // ...
            // ...
        })
        .Case&lt;SpotTrade&gt;(spotTrade =&gt;
        {
            // It's a SpotTrade
            spotTrade.SpotTradeMethod();
            // ...
            // ...
        })
        .Default&lt;Trade&gt;(t =&gt;
        {
            // Default actions
            t.TradeMethod();
        });
}
</span></pre>
<p>Although there&#8217;s a few extra {&#8216;s and )&#8217;s, the structure is close to the ideal. This is mainly possible using method chaining (also known as fluent interfaces), by returning this (well a genericized this) in the case method and passing the code to be executed if the case test succeeds as a lambda function. Note if none of the Case methods succeeds, the Default method will get called. If you want to know more about fluent interfaces read <a href="http://martinfowler.com/dslwip/MethodChaining.html" target="_blank">Martin Fowler&#8217;s article</a>.</p>
<p>So just accept that sometimes you have no choice and have to accept that it&#8217;s right to do what&#8217;s wrong &#8211; is that software or life. Or both.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davebrooks.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davebrooks.wordpress.com/87/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=87&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://davebrooks.wordpress.com/2010/04/06/c-switch-on-type-youre-not-my-type/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/117da7f90c08bf838e629e3f1cc4c1e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Wing Commander Dave</media:title>
		</media:content>
	</item>
		<item>
		<title>You say URL, I say URI &#8230;.</title>
		<link>http://davebrooks.wordpress.com/2010/03/18/you-say-url-i-say-uri/</link>
		<comments>http://davebrooks.wordpress.com/2010/03/18/you-say-url-i-say-uri/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 15:25:46 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Web suff]]></category>

		<guid isPermaLink="false">http://davebrooks.wordpress.com/?p=80</guid>
		<description><![CDATA[&#8220;Is a URL a URI?&#8221; &#8220;Is a URI a URL?&#8221; &#8220;What does URL stand for?&#8221; &#8220;What does URI stand for?&#8221; &#8220;What does URL mean?&#8221; I&#8217;ve been asked so many times I&#8217;ve lost count and for the sake of my sanity, I&#8217;ve decided to explain their distinquishing marks. URL  &#8211; Uniform Resource Locator URI &#8211; Uniform [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=80&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><em>&#8220;Is a URL a URI?&#8221;<br />
&#8220;Is a URI a URL?&#8221;<br />
&#8220;What does URL stand for?&#8221;<br />
&#8220;What does URI stand for?&#8221;<br />
&#8220;What does URL mean?&#8221;</em></p>
<p>I&#8217;ve been asked so many times I&#8217;ve lost count and for the sake of my sanity, I&#8217;ve decided to explain their distinquishing marks.</p>
<p>URL  &#8211; Uniform Resource Locator<br />
URI &#8211; Uniform Resource Identifier</p>
<p>Sometimes these achronyms are used interchangably which is almost entirely wrong. Basically a URL is a specific type of URI because it uses specific protocols like http:  ftp: and mailto: URI defines a larger, more generalized superset.</p>
<p>Effectively, URL is no longer a valid in technical conversations or documents and you should use URI regardless of how big a pedant you are. A URI describes both the way you access something and it&#8217;s designated location.</p>
<p>You may see some explainations where U is defined as Universal. This is wrong and the author is just confused.</p>
<p>So, let&#8217;s call the whole thing off.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davebrooks.wordpress.com/80/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davebrooks.wordpress.com/80/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=80&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://davebrooks.wordpress.com/2010/03/18/you-say-url-i-say-uri/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/117da7f90c08bf838e629e3f1cc4c1e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Wing Commander Dave</media:title>
		</media:content>
	</item>
		<item>
		<title>WindowsFormsSynchronizationContext &#8211; it&#8217;s all smoke, mirrors and PostMessage</title>
		<link>http://davebrooks.wordpress.com/2010/03/11/windowsformssynchronizationcontext-its-all-smoke-mirrors-and-postmessage/</link>
		<comments>http://davebrooks.wordpress.com/2010/03/11/windowsformssynchronizationcontext-its-all-smoke-mirrors-and-postmessage/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 15:11:07 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Threading]]></category>

		<guid isPermaLink="false">http://davebrooks.wordpress.com/?p=76</guid>
		<description><![CDATA[Intrigue is curious thing, much as curiosity is intriguing. What drives it? Mostly just needing to know something for no other reason than wanting to know itself &#8211; curious indeed.  So why would I really be bothered to know what WindowsFormsSyncronizationContext does under the hood? Well dear bleader (if someone who write blogs is a blogger, [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=76&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Intrigue is curious thing, much as curiosity is intriguing. What drives it? Mostly just needing to know something for no other reason than wanting to know itself &#8211; curious indeed. </p>
<p>So why would I really be bothered to know what WindowsFormsSyncronizationContext does under the hood? Well dear bleader (if someone who write blogs is a blogger, maybe someone who reads blogs is a bleader) I had my suspicions, but I just needed to find out.</p>
<p>SynchronizationContext and it&#8217;s derivatives was introduced in .NET 2.0 as simple .NET language construct to allow a non-GUI thread to call methods on a GUI control. Previously, code had to be written to perform the InvokeRequired, BeginInvoke, Invoke dance and <a href="http://www.ikriv.com/en/prog/info/dotnet/MysteriousHang.html" target="_blank">as has been discovered</a>, this has problems and  can have you chasing nasty bugs.</p>
<p>In <a href="http://davebrooks.wordpress.com/2007/02/12/begininvoke-the-land-of-confusion/">http://davebrooks.wordpress.com/2007/02/12/begininvoke-the-land-of-confusion/</a> I discussed BeginInvoke for delegates and controls, some issues and how they worked under the hood.</p>
<p>As I said before, I was suspicious that WindowsFormsSynchronizationContext worked pretty much the same way. And Lo, with a bit of windows message spying on a simple test app, my suspicions were confirmed. WindowsFormsSynchronizationContext.Post() and .Send() end up using PostMessage with registered windows messages, presumably using BeginInvoke and Invoke respectively to push the control method call onto the main GUI thread.  However, it does make the code earlier to write and as we all know, less code means less bugs.</p>
<p>Now to find out what happens in the Freemasons. I&#8217;m just curious you understand.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davebrooks.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davebrooks.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=76&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://davebrooks.wordpress.com/2010/03/11/windowsformssynchronizationcontext-its-all-smoke-mirrors-and-postmessage/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/117da7f90c08bf838e629e3f1cc4c1e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Wing Commander Dave</media:title>
		</media:content>
	</item>
		<item>
		<title>Breaking the itch/scratch cycle of managing multi project App.config files in c#</title>
		<link>http://davebrooks.wordpress.com/2010/02/26/breaking-the-itchscratch-cycle-of-managing-multi-project-app-config-files-in-c/</link>
		<comments>http://davebrooks.wordpress.com/2010/02/26/breaking-the-itchscratch-cycle-of-managing-multi-project-app-config-files-in-c/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 15:53:49 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://davebrooks.wordpress.com/?p=70</guid>
		<description><![CDATA[I&#8217;ve been meaning to get around to sorting out the plethora of App.config in a large, multi project C# solution, but it wasn&#8217;t anywhere near the top of the pile of problems that needed solving. I just keep hacking values into the *.exe.config file after the build to make things work. In a spare (and [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=70&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been meaning to get around to sorting out the plethora of App.config in a large, multi project C# solution, but it wasn&#8217;t anywhere near the top of the pile of problems that needed solving. I just keep hacking values into the *.exe.config file after the build to make things work.</p>
<p>In a spare (and rare) 20 minutes, while drinking a coffee, I thought I&#8217;d have a quick look and discovered a really simple solution. For some reason this technique had completely passed me by. Imagine you&#8217;ve got a C# solution made up of 3 projects which build into 3 separate executables, each requiring a common config file. If you have simply added a config file to each project and try to keep them in sync you quickly end up in config hell. So rather that add a new config file to each project, simply create one in one of the projects and then link it in the others.</p>
<p>Here&#8217;s how, in our imaginary 3 project solution</p>
<p><strong>Solution<br />
     Project1<br />
     Project2<br />
     Project3</strong></p>
<ul>
<li>Right click on Project1 and select <em>Add-&gt;New Item-&gt;Application Configuration File</em> and it will create a the file App.config in Project1.</li>
<li>Right click on Project2 and select <em>Add-&gt;Existing Item</em> and browse to Project1&#8242;s App.config file, but don&#8217;t hit the Add button. Select the <em>Add button drop down</em> and select Add as link.</li>
<li>Repeat for Project3</li>
</ul>
<p>So now when you open any of the projects App.config files you will be using the same file. More importantly, when you build the solution, each projects bin/Debug (Release) directory will have it&#8217;s own, but identical copy of the config file (Project*.exe.config) leaving you the freedom to deploy the executables with their own or a common config file. Essentially, building the solution duplicates the config files from a single master version.</p>
<p>Itch successfully scratched.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davebrooks.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davebrooks.wordpress.com/70/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=70&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://davebrooks.wordpress.com/2010/02/26/breaking-the-itchscratch-cycle-of-managing-multi-project-app-config-files-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/117da7f90c08bf838e629e3f1cc4c1e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Wing Commander Dave</media:title>
		</media:content>
	</item>
		<item>
		<title>The terminal server has exceeded the maximum number of allowed connections &#8211; in other words, the keys are locked in the safe!</title>
		<link>http://davebrooks.wordpress.com/2010/02/15/the-terminal-server-has-exceeded-the-maximum-number-of-allowed-connections-in-other-words-the-keys-are-locked-in-the-safe/</link>
		<comments>http://davebrooks.wordpress.com/2010/02/15/the-terminal-server-has-exceeded-the-maximum-number-of-allowed-connections-in-other-words-the-keys-are-locked-in-the-safe/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 12:20:56 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Rants]]></category>

		<guid isPermaLink="false">http://davebrooks.wordpress.com/?p=65</guid>
		<description><![CDATA[Ever had this problem trying to remote desktop (RDP) to a Windows Server 2003? I got very frustrated by this today. All the Administrator group sessions had been used up, the selfish remoters had gone home and left themselves logged in, so I wasn&#8217;t able to admin the server. Arrrrggg! Yes, all I needed to [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=65&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Ever had this problem trying to remote desktop (RDP) to a Windows Server 2003? I got very frustrated by this today. All the Administrator group sessions had been used up, the selfish remoters had gone home and left themselves logged in, so I wasn&#8217;t able to admin the server. Arrrrggg!</p>
<p>Yes, all I needed to do was to be able to get to the Terminal Services Manager and forcably terminate their sessions, but I couldn&#8217;t get in &#8211; the keys were effectively locked in the safe. The server I was trying to admin had a limit of 2 admin RDP sessions &#8211; the default limit for Server 2003 I think.</p>
<p>It turns out there is a simple answer to get around this (aren&#8217;t they all simple when you know them). The number of sessions on the server is calculated on the RDP client admin sessions, but console connections aren&#8217;t included. So the work around is;</p>
<p>Run a cmd session on your client machine and start a console based terminal service to the machine you want to connect to.</p>
<p><strong>mstsc /v:xxx.xxx.xxx.xxx /f -console</strong></p>
<p>where xxx.xxx.xxx.xxx is the IP or resolvable server name</p>
<p>You can then use Control Panel-&gt;Administrative Tools-&gt;Terminal Services Manager to disconnect the selfish remoters and connect with the RDP client as normal.</p>
<p>Don&#8217;t forget to logoff yourself when you&#8217;ve finished though.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davebrooks.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davebrooks.wordpress.com/65/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=65&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://davebrooks.wordpress.com/2010/02/15/the-terminal-server-has-exceeded-the-maximum-number-of-allowed-connections-in-other-words-the-keys-are-locked-in-the-safe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/117da7f90c08bf838e629e3f1cc4c1e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Wing Commander Dave</media:title>
		</media:content>
	</item>
		<item>
		<title>Linux makes my fingers hurt</title>
		<link>http://davebrooks.wordpress.com/2009/05/01/linux-makes-my-fingers-hurt/</link>
		<comments>http://davebrooks.wordpress.com/2009/05/01/linux-makes-my-fingers-hurt/#comments</comments>
		<pubDate>Fri, 01 May 2009 11:00:40 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Web suff]]></category>

		<guid isPermaLink="false">http://davebrooks.wordpress.com/?p=62</guid>
		<description><![CDATA[Yesterday I was mainly deploying a new release of php code to a Linux server.  Not that it&#8217;s a problem, but I normally develop php web application on IIS running on Windows Server just because I know where all the knobs and switches are.  VS.PHP from jcx.software is a great add-in for Visual Studio and [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=62&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Yesterday I was mainly deploying a new release of php code to a Linux server.  Not that it&#8217;s a problem, but I normally develop php web application on IIS running on Windows Server just because I know where all the knobs and switches are.  <a href="http://www.jcxsoftware.com/vs.php" target="_blank">VS.PHP</a> from jcx.software is a great add-in for Visual Studio and with the <a href="http://www.zend.com" target="_blank">Zend</a> server side debugger it makes an awesome development environment. Sure I could use <a href="http://www.eclipse.org/pdt/">Eclipse PDT</a> in a similar way for free, but &#8216;m more productive using Visual Studio; rightly or wrongly, the keyboard shortcuts are now part of my DNA.</p>
<p>I never quite feel comforable using Linux and I&#8217;m not sure why. Clearly it&#8217;s an excellent OS and I have  several embedded boxes which have been running Linux that I&#8217;ve never had to reboot. My <a href="http://en.wikipedia.org/wiki/Linksys_WRT54G_series" target="_blank">WRT54G</a> and <a href="http://en.wikipedia.org/wiki/NSLU2" target="_blank">NSLU2</a> always perform flawlessly. However, while on my journey home last night I realised what the problem might be. Linux makes my fingers hurt with all the typing I have to do!</p>
<p>Anyway, tip of the day for me was this little gem. I needed to copy the (massive) previous releases directory into my deployment working area and was happily using</p>
<pre>cp -r blah blah</pre>
<p>Then I started worrying about whether the permissions were being copied. (Ok so I&#8217;m happy to admit my perpetual virgin status when it comes to Linux). It was then pointed out to me buried in the directory structure were a raft of symbolic links and using cp would do a deep copy and fill up my server disc space pretty quickly. &#8220;Use tar to copy from the current directory to the new one like this&#8221;, they said.</p>
<pre>tar cBf -.|(cd new_directory &amp;&amp; tar xvBf -)</pre>
<p>It worked a treat, I feel less like a Linux virgin, but my fingers still hurt.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/davebrooks.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/davebrooks.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=davebrooks.wordpress.com&#038;blog=739452&#038;post=62&#038;subd=davebrooks&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://davebrooks.wordpress.com/2009/05/01/linux-makes-my-fingers-hurt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/117da7f90c08bf838e629e3f1cc4c1e3?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Wing Commander Dave</media:title>
		</media:content>
	</item>
	</channel>
</rss>
