<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" version="2.0">

<channel>
	<title>GrumpyDev</title>
	
	<link>http://www.grumpydev.com</link>
	<description>The Technical Jibber Jabber of Steven Robbins</description>
	<lastBuildDate>Wed, 28 Apr 2010 05:48:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/GrumpyDev" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="grumpydev" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by/3.0/</creativeCommons:license><item>
		<title>Silverlight Masterclass – Discounts for NxtGenUG Members</title>
		<link>http://www.grumpydev.com/2010/04/28/silverlight-masterclass-discounts-for-nxtgenug-members/</link>
		<comments>http://www.grumpydev.com/2010/04/28/silverlight-masterclass-discounts-for-nxtgenug-members/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 05:44:22 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[competition]]></category>
		<category><![CDATA[masterclass]]></category>
		<category><![CDATA[NxtGenUG]]></category>
		<category><![CDATA[silverlight tour]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=354</guid>
		<description><![CDATA[Introduction Shawn Wildermuth’s “Silverlight Tour” is coming to the UK, in the guise of the Silverlight Masterclass, and NxtGenUG members can receive £50 off the course price (in addition to the current “early bird” offer if you qualify for that). The 3 day developer course looks quite comprehensive, starting with Silverlight, XAML and Blend basics [...]]]></description>
			<content:encoded><![CDATA[<h2></h2>
<h2>Introduction</h2>
<p><a href="http://wildermuth.com/" target="_blank">Shawn Wildermuth</a>’s “Silverlight Tour” is coming to the UK, in the guise of the <a href="http://silverlightmasterclass.net/" target="_blank">Silverlight Masterclass</a>, and <a href="http://nxtgenug.net/Region.aspx?RegionID=11" target="_blank">NxtGenUG</a> members can receive £50 off the course price (in addition to the current “early bird” offer if you qualify for that). </p>
<p>The <a href="http://silverlightmasterclass.net/Home/Developers" target="_blank">3 day developer course</a> looks quite comprehensive, starting with Silverlight, XAML and Blend basics on day one, working with data on day two, and finishing off with more advanced topics like MVVM, MEF and PRISM on day three. It’s great to see some patterns and practices coverage in a Silverlight course, especially given my recent experience trying to recruit Silverlight developers!</p>
<p>In addition to the discounts you can also win a free ticket to one of the courses by blogging about it yourself using the text from the “pitch” below. For more details on the competition take a look at <a href="http://silverlightforbusiness.net/2010/04/27/bloggers-win-a-free-place-to-the-silverlight-masterclass-worth/" target="_blank">Ian Blackburn’s blog entry</a>.</p>
<h2>The Pitch</h2>
<p>The Silverlight Tour comes to the UK – and it’s called the Masterclass!</p>
<p>This 3 day hands-on training with both designer and developer tracks looks awesome and (uniquely) has <strong>two </strong>expert trainers per course. </p>
<p>Currently scheduled in London, Manchester, and the Midlands for June, all courses also come with the chance to win an xbox 360, and Silverlight Spy licences!</p>
<p>Early bird discount of £100 if you book in May, and if you are a member of #SLUGUK or #<a href="http://www.nxtgenug.net/">nxtgenug</a> there are additional discounts to be had.</p>
<p>Full Details are here: <a href="http://silverlightmasterclass.net">http://silverlightmasterclass.net</a></p>
<p>In addition bbits are holding a raffle for a free ticket for the masterclass. To be eligible to win the ticket (worth £1095!) you MUST paste this text, including all links, into your blog and email <a href="mailto:Ian@bbits.co.uk">Ian@bbits.co.uk</a> with the url to the blog entry.&#160; The draw will be made on June 1st and the winner informed by email and on <a href="http://silverlightmasterclass.net">http://silverlightmasterclass.net</a></p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Silverlight%20Masterclass%20%26ndash%3B%20Discounts%20for%20NxtGenUG%20Members%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F28%2Fsilverlight-masterclass-discounts-for-nxtgenug-members%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F28%2Fsilverlight-masterclass-discounts-for-nxtgenug-members%2F&amp;title=Silverlight%20Masterclass%20%26ndash%3B%20Discounts%20for%20NxtGenUG%20Members" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F28%2Fsilverlight-masterclass-discounts-for-nxtgenug-members%2F&amp;title=Silverlight%20Masterclass%20%26ndash%3B%20Discounts%20for%20NxtGenUG%20Members&amp;annotation=%20%20Introduction%20%20Shawn%20Wildermuth%E2%80%99s%20%E2%80%9CSilverlight%20Tour%E2%80%9D%20is%20coming%20to%20the%20UK%2C%20in%20the%20guise%20of%20the%20Silverlight%20Masterclass%2C%20and%20NxtGenUG%20members%20can%20receive%20%C2%A350%20off%20the%20course%20price%20%28in%20addition%20to%20the%20current%20%E2%80%9Cearly%20bird%E2%80%9D%20offer%20if%20you%20qualify" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F28%2Fsilverlight-masterclass-discounts-for-nxtgenug-members%2F&amp;title=Silverlight%20Masterclass%20%26ndash%3B%20Discounts%20for%20NxtGenUG%20Members&amp;bodytext=%20%20Introduction%20%20Shawn%20Wildermuth%E2%80%99s%20%E2%80%9CSilverlight%20Tour%E2%80%9D%20is%20coming%20to%20the%20UK%2C%20in%20the%20guise%20of%20the%20Silverlight%20Masterclass%2C%20and%20NxtGenUG%20members%20can%20receive%20%C2%A350%20off%20the%20course%20price%20%28in%20addition%20to%20the%20current%20%E2%80%9Cearly%20bird%E2%80%9D%20offer%20if%20you%20qualify" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F28%2Fsilverlight-masterclass-discounts-for-nxtgenug-members%2F&amp;title=Silverlight%20Masterclass%20%26ndash%3B%20Discounts%20for%20NxtGenUG%20Members&amp;notes=%20%20Introduction%20%20Shawn%20Wildermuth%E2%80%99s%20%E2%80%9CSilverlight%20Tour%E2%80%9D%20is%20coming%20to%20the%20UK%2C%20in%20the%20guise%20of%20the%20Silverlight%20Masterclass%2C%20and%20NxtGenUG%20members%20can%20receive%20%C2%A350%20off%20the%20course%20price%20%28in%20addition%20to%20the%20current%20%E2%80%9Cearly%20bird%E2%80%9D%20offer%20if%20you%20qualify" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F28%2Fsilverlight-masterclass-discounts-for-nxtgenug-members%2F&amp;title=Silverlight%20Masterclass%20%26ndash%3B%20Discounts%20for%20NxtGenUG%20Members" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F28%2Fsilverlight-masterclass-discounts-for-nxtgenug-members%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F28%2Fsilverlight-masterclass-discounts-for-nxtgenug-members%2F&amp;title=Silverlight%20Masterclass%20%26ndash%3B%20Discounts%20for%20NxtGenUG%20Members" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Silverlight%20Masterclass%20%26ndash%3B%20Discounts%20for%20NxtGenUG%20Members&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F28%2Fsilverlight-masterclass-discounts-for-nxtgenug-members%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Silverlight%20Masterclass%20%26ndash%3B%20Discounts%20for%20NxtGenUG%20Members&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F28%2Fsilverlight-masterclass-discounts-for-nxtgenug-members%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F28%2Fsilverlight-masterclass-discounts-for-nxtgenug-members%2F&amp;title=Silverlight%20Masterclass%20%26ndash%3B%20Discounts%20for%20NxtGenUG%20Members&amp;body=%20%20Introduction%20%20Shawn%20Wildermuth%E2%80%99s%20%E2%80%9CSilverlight%20Tour%E2%80%9D%20is%20coming%20to%20the%20UK%2C%20in%20the%20guise%20of%20the%20Silverlight%20Masterclass%2C%20and%20NxtGenUG%20members%20can%20receive%20%C2%A350%20off%20the%20course%20price%20%28in%20addition%20to%20the%20current%20%E2%80%9Cearly%20bird%E2%80%9D%20offer%20if%20you%20qualify" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F28%2Fsilverlight-masterclass-discounts-for-nxtgenug-members%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F28%2Fsilverlight-masterclass-discounts-for-nxtgenug-members%2F&amp;title=Silverlight%20Masterclass%20%26ndash%3B%20Discounts%20for%20NxtGenUG%20Members" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/competition' rel='tag' target='_blank'>competition</a>, <a class='technorati-link' href='http://technorati.com/tag/masterclass' rel='tag' target='_blank'>masterclass</a>, <a class='technorati-link' href='http://technorati.com/tag/NxtGenUG' rel='tag' target='_blank'>NxtGenUG</a>, <a class='technorati-link' href='http://technorati.com/tag/Silverlight' rel='tag' target='_blank'>Silverlight</a>, <a class='technorati-link' href='http://technorati.com/tag/silverlight+tour' rel='tag' target='_blank'>silverlight tour</a>, <a class='technorati-link' href='http://technorati.com/tag/training' rel='tag' target='_blank'>training</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2010/04/28/silverlight-masterclass-discounts-for-nxtgenug-members/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Optional Parameters in C#4, C#3 and VB.Net, With a Side Order of IL Quirks</title>
		<link>http://www.grumpydev.com/2010/04/19/optional-parameters-in-c4-c3-and-vb-net-with-a-side-order-of-il-quirks/</link>
		<comments>http://www.grumpydev.com/2010/04/19/optional-parameters-in-c4-c3-and-vb-net-with-a-side-order-of-il-quirks/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 07:30:57 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[c#4]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[csharp4]]></category>
		<category><![CDATA[il]]></category>
		<category><![CDATA[ildasm]]></category>
		<category><![CDATA[named parameters]]></category>
		<category><![CDATA[optional parameters]]></category>
		<category><![CDATA[quirks]]></category>
		<category><![CDATA[vs2010]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=338</guid>
		<description><![CDATA[Introduction One of the features C# has gained in it’s latest V4 incarnation is the ability to work with optional parameters. Now VB.Net (and the underlying IL) has had this ability for sometime, but as it’s new to C# folks, and causing a little confusion; I’m going to attempt to explain how it works, when [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>One of the features C# has gained in it’s latest V4 incarnation is the ability to work with optional parameters. Now VB.Net (and the underlying IL) has had this ability for sometime, but as it’s new to C# folks, and causing a little confusion; I’m going to attempt to explain how it works, when it works and the potential gotchas. I’ll also cover a strange inconsistency between the the VB and C# compilers when it comes to named parameters.</p>
<p><strong>Warning:</strong> This post contains <a href="http://en.wikipedia.org/wiki/Common_Intermediate_Language" target="_blank">IL</a>, but don’t let that put you off – you don’t actually need to understand it to get the point of the post!</p>
<h2></h2>
<h2>So It’s C#4 Only, Right?</h2>
<p>Sort of <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Just to confuse things, optional parameters, from both a definition and consumption perspective, are really the concern of the compiler. As <a href="http://www.humblecoder.co.uk/?p=137" target="_blank">other posts</a> have correctly pointed out, as long as you’re using Visual Studio 2010 you can define and consume optional parameters while targeting an older framework version:</p>
<pre class="brush: csharp; toolbar: false;">public void DoThings(int intParameter = 22, string stringParameter = &quot;Default&quot;)
{
    // Do things
}

// ...

DoThings(); // Uses the default values</pre>
<p>This will work whether you’re in the same assembly, or consuming a library that already exposes methods with optional parameters.</p>
<p>You can also happily consume C# libraries containing optional parameters with VB.Net; even if the VB.Net project is still running under VS2008. The reason this works it that the IL that the new C# compiler is emitting is nothing new, and VB.Net has been able to define and consume optional parameters for some time. You can see the IL that is generated for the above method in the ILDASM output below (interesting parts highlighted in yellow):</p>
<p><a href="http://www.grumpydev.com/wp-content/uploads/2010/04/OptionalParamsIL.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="OptionalParamsIL" border="0" alt="OptionalParamsIL" src="http://www.grumpydev.com/wp-content/uploads/2010/04/OptionalParamsIL_thumb.png" width="454" height="176" /></a></p>
<p>The one thing you <strong>*cannot*</strong> do is consume optional parameters using C# in Visual Studio 2008; even if you’ve built the library in VS2010 and targeted the older framework. The C#3 compiler just doesn’t understand (or more to the point doesn’t care about) optional parameters. If you try and build the code above using Visual Studio 2008 you will get the following error:</p>
<p><a href="http://www.grumpydev.com/wp-content/uploads/2010/04/OptionalParameters2008.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="OptionalParameters2008" border="0" alt="OptionalParameters2008" src="http://www.grumpydev.com/wp-content/uploads/2010/04/OptionalParameters2008_thumb.png" width="454" height="147" /></a></p>
<p>Definitely something for library authors to consider – we’re not quite out of “overload hell” yet unfortunately.</p>
<h2>Gotchas?</h2>
<p>Now you may well think that when you consume an optional parameter, the compiler is emitting code that pulls the default value from the method information at runtime &#8211; but that isn’t the case. In a similar fashion to the way the compiler handles consuming consts, the default values are “baked into” the calling code. This is true whether the calling code is in the same assembly as the definition, or a separate assembly . The following ILDASM screenshot shows the IL generated for the DoThings() call above (interesting parts highlighted in yellow again):</p>
<p><a href="http://www.grumpydev.com/wp-content/uploads/2010/04/CallingOptionalIL.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="CallingOptionalIL" border="0" alt="CallingOptionalIL" src="http://www.grumpydev.com/wp-content/uploads/2010/04/CallingOptionalIL_thumb.png" width="454" height="116" /></a></p>
<p>Even if you don’t fully understand the IL you can clearly see the constant values in the code are “baked into” the TestStuff() method.</p>
<p>The issue this can cause is the same for exposing public consts – if you change the default values in a library, but don’t recompile the calling code,<strong><em> then the calling code will still call your method(s) with the old default values</em></strong>. This is definitely something you need to consider when designing APIs using optional parameters. </p>
<p>One potential way to “work around” this issue and avoid “locking yourself in” to a particular set of defaults would be to follow the following pattern:</p>
<pre class="brush: csharp; toolbar: false;">public void DoThings(int? intParameter = null, string stringParameter = null)
{
    if (intParameter == null)
        intParameter = 22;

    if (stringParameter == null)
        stringParameter = &quot;Default&quot;;

    // Do Stuff
}</pre>
<p>In the code above we still get the benefits of having optional parameters; but because we use “marker” values for defaults (nulls in this case), and set the *real* defaults inside the method, we are free to change the real defaults at a later date. This technique does require more code, and doesn’t look quite as elegant as the previous example, but in my opinion the benefits outweigh the drawbacks, especially for public APIs.</p>
<h2>A VB/C# Named Parameters Quirk</h2>
<p>As I was pulling together the IL for this post I discovered a small “quirk” when comparing the IL output by the VB.Net compiler to the output of the C&#8217;# compiler when dealing with named parameters. If we call the DoThings() method above and specify just the stringParameter the IL produced by the VB.Net compiler looks as I would expect:</p>
<p><a href="http://www.grumpydev.com/wp-content/uploads/2010/04/vbnamed.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="vb-named" border="0" alt="vb-named" src="http://www.grumpydev.com/wp-content/uploads/2010/04/vbnamed_thumb.png" width="454" height="49" /></a></p>
<p>The default value for the intParameter is pushed onto the stack, followed by our “Nondefault” string value and the method is called. The IL produced by the C# compiler is slightly different though, as shown by the highlighted sections below:</p>
<p><a href="http://www.grumpydev.com/wp-content/uploads/2010/04/csnamed.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="cs-named" border="0" alt="cs-named" src="http://www.grumpydev.com/wp-content/uploads/2010/04/csnamed_thumb.png" width="454" height="62" /></a></p>
<p>In the C# version the “Nondefault” string is pushed onto the stack *first*, then pops it off into a local variable (stloc.3), the default value for intParameter is then pushed, followed by the contents of the local variable (ldloc.3).</p>
<p>Not a massive difference, and I’m sure there’s a good reason for it, but the C# version does look decidedly “odd” to me. I’m no expert in IL performance, but this may be conclusive proof that VB is faster than C# <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  <strong>*</strong></p>
<p><strong>Update: </strong><a href="http://marcgravell.blogspot.com/" target="_blank">Marc Gravell</a> was kind enough to review this post for me and correctly pointed out that I should really be comparing IL for *optimised* builds, not debug builds (which have optimisation turned off). Marc has done this for himself and confirmed the stloc and ldloc are still present, so my point is still valid (*phew*)</p>
<p><strong><em>* Note: This is a joke.. I got some abuse on Twitter for “VB bashing” recently, hopefully this will appease the VB heads! <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </em></strong></p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Optional%20Parameters%20in%20C%234%2C%20C%233%20and%20VB.Net%2C%20With%20a%20Side%20Order%20of%20IL%20Quirks%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F19%2Foptional-parameters-in-c4-c3-and-vb-net-with-a-side-order-of-il-quirks%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F19%2Foptional-parameters-in-c4-c3-and-vb-net-with-a-side-order-of-il-quirks%2F&amp;title=Optional%20Parameters%20in%20C%234%2C%20C%233%20and%20VB.Net%2C%20With%20a%20Side%20Order%20of%20IL%20Quirks" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F19%2Foptional-parameters-in-c4-c3-and-vb-net-with-a-side-order-of-il-quirks%2F&amp;title=Optional%20Parameters%20in%20C%234%2C%20C%233%20and%20VB.Net%2C%20With%20a%20Side%20Order%20of%20IL%20Quirks&amp;annotation=Introduction%20%20One%20of%20the%20features%20C%23%20has%20gained%20in%20it%E2%80%99s%20latest%20V4%20incarnation%20is%20the%20ability%20to%20work%20with%20optional%20parameters.%20Now%20VB.Net%20%28and%20the%20underlying%20IL%29%20has%20had%20this%20ability%20for%20sometime%2C%20but%20as%20it%E2%80%99s%20new%20to%20C%23%20folks%2C%20and%20causing%20a%20little" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F19%2Foptional-parameters-in-c4-c3-and-vb-net-with-a-side-order-of-il-quirks%2F&amp;title=Optional%20Parameters%20in%20C%234%2C%20C%233%20and%20VB.Net%2C%20With%20a%20Side%20Order%20of%20IL%20Quirks&amp;bodytext=Introduction%20%20One%20of%20the%20features%20C%23%20has%20gained%20in%20it%E2%80%99s%20latest%20V4%20incarnation%20is%20the%20ability%20to%20work%20with%20optional%20parameters.%20Now%20VB.Net%20%28and%20the%20underlying%20IL%29%20has%20had%20this%20ability%20for%20sometime%2C%20but%20as%20it%E2%80%99s%20new%20to%20C%23%20folks%2C%20and%20causing%20a%20little" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F19%2Foptional-parameters-in-c4-c3-and-vb-net-with-a-side-order-of-il-quirks%2F&amp;title=Optional%20Parameters%20in%20C%234%2C%20C%233%20and%20VB.Net%2C%20With%20a%20Side%20Order%20of%20IL%20Quirks&amp;notes=Introduction%20%20One%20of%20the%20features%20C%23%20has%20gained%20in%20it%E2%80%99s%20latest%20V4%20incarnation%20is%20the%20ability%20to%20work%20with%20optional%20parameters.%20Now%20VB.Net%20%28and%20the%20underlying%20IL%29%20has%20had%20this%20ability%20for%20sometime%2C%20but%20as%20it%E2%80%99s%20new%20to%20C%23%20folks%2C%20and%20causing%20a%20little" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F19%2Foptional-parameters-in-c4-c3-and-vb-net-with-a-side-order-of-il-quirks%2F&amp;title=Optional%20Parameters%20in%20C%234%2C%20C%233%20and%20VB.Net%2C%20With%20a%20Side%20Order%20of%20IL%20Quirks" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F19%2Foptional-parameters-in-c4-c3-and-vb-net-with-a-side-order-of-il-quirks%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F19%2Foptional-parameters-in-c4-c3-and-vb-net-with-a-side-order-of-il-quirks%2F&amp;title=Optional%20Parameters%20in%20C%234%2C%20C%233%20and%20VB.Net%2C%20With%20a%20Side%20Order%20of%20IL%20Quirks" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Optional%20Parameters%20in%20C%234%2C%20C%233%20and%20VB.Net%2C%20With%20a%20Side%20Order%20of%20IL%20Quirks&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F19%2Foptional-parameters-in-c4-c3-and-vb-net-with-a-side-order-of-il-quirks%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Optional%20Parameters%20in%20C%234%2C%20C%233%20and%20VB.Net%2C%20With%20a%20Side%20Order%20of%20IL%20Quirks&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F19%2Foptional-parameters-in-c4-c3-and-vb-net-with-a-side-order-of-il-quirks%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F19%2Foptional-parameters-in-c4-c3-and-vb-net-with-a-side-order-of-il-quirks%2F&amp;title=Optional%20Parameters%20in%20C%234%2C%20C%233%20and%20VB.Net%2C%20With%20a%20Side%20Order%20of%20IL%20Quirks&amp;body=Introduction%20%20One%20of%20the%20features%20C%23%20has%20gained%20in%20it%E2%80%99s%20latest%20V4%20incarnation%20is%20the%20ability%20to%20work%20with%20optional%20parameters.%20Now%20VB.Net%20%28and%20the%20underlying%20IL%29%20has%20had%20this%20ability%20for%20sometime%2C%20but%20as%20it%E2%80%99s%20new%20to%20C%23%20folks%2C%20and%20causing%20a%20little" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F19%2Foptional-parameters-in-c4-c3-and-vb-net-with-a-side-order-of-il-quirks%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F04%2F19%2Foptional-parameters-in-c4-c3-and-vb-net-with-a-side-order-of-il-quirks%2F&amp;title=Optional%20Parameters%20in%20C%234%2C%20C%233%20and%20VB.Net%2C%20With%20a%20Side%20Order%20of%20IL%20Quirks" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/c%23' rel='tag' target='_blank'>c#</a>, <a class='technorati-link' href='http://technorati.com/tag/c%234' rel='tag' target='_blank'>c#4</a>, <a class='technorati-link' href='http://technorati.com/tag/csharp' rel='tag' target='_blank'>csharp</a>, <a class='technorati-link' href='http://technorati.com/tag/csharp4' rel='tag' target='_blank'>csharp4</a>, <a class='technorati-link' href='http://technorati.com/tag/il' rel='tag' target='_blank'>il</a>, <a class='technorati-link' href='http://technorati.com/tag/ildasm' rel='tag' target='_blank'>ildasm</a>, <a class='technorati-link' href='http://technorati.com/tag/named+parameters' rel='tag' target='_blank'>named parameters</a>, <a class='technorati-link' href='http://technorati.com/tag/optional+parameters' rel='tag' target='_blank'>optional parameters</a>, <a class='technorati-link' href='http://technorati.com/tag/quirks' rel='tag' target='_blank'>quirks</a>, <a class='technorati-link' href='http://technorati.com/tag/vs2010' rel='tag' target='_blank'>vs2010</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2010/04/19/optional-parameters-in-c4-c3-and-vb-net-with-a-side-order-of-il-quirks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Locating Network Services on the iPhone/iPad with MonoTouch</title>
		<link>http://www.grumpydev.com/2010/03/27/locating-network-services-on-the-iphoneipad-with-monotouch/</link>
		<comments>http://www.grumpydev.com/2010/03/27/locating-network-services-on-the-iphoneipad-with-monotouch/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 12:14:18 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[MonoTouch]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[service location]]></category>
		<category><![CDATA[sockets]]></category>
		<category><![CDATA[udp]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=322</guid>
		<description><![CDATA[Introduction For one of the little iPhone projects I’m working I need to communicate with with a server on the local network. That all sounds very simple, but what I *really* want to be able to do is detect all instances of this service on the local network, and give the user the option of [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>For one of the little iPhone projects I’m working I need to communicate with with a server on the local network. That all sounds very simple, but what I *really* want to be able to do is detect all instances of this service on the local network, and give the user the option of which one to connect to at runtime.</p>
<p>In WCF land we could leverage <a href="http://msdn.microsoft.com/en-us/library/dd456782(VS.100).aspx" target="_blank">WCF Discovery</a>, but in the world of MonoTouch, and even in .NET 3.5, we don’t have that luxury, so it’s time to roll our own service discovery!</p>
<h2>Ping! Pong!</h2>
<p>To build our service discovery system we will be dropping down to the socket level; but don’t worry! We’re only using sockets to discover the services – after that you are free to use your normal HttpClient to actually access them <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>The basic idea is our client will send out a “ping” containing the IP and port to respond back on. Each server that picks up the ping will send a response back containing some metadata (in this instance a “service name” and a “service endpoint address”). The two classes we will use as “payload” are as follows:</p>
<pre class="brush: csharp; toolbar: false;">[Serializable]
/// &lt;summary&gt;
/// Our initial ping &quot;payload&quot;
/// &lt;/summary&gt;
public class ServiceClientInfo
{
    /// &lt;summary&gt;
    /// IP address of the client that sent the ping
    /// &lt;/summary&gt;
    public string IPAddress { get; private set; }

    /// &lt;summary&gt;
    /// UDP port to send a response to
    /// &lt;/summary&gt;
    public int Port { get; private set; }

    public ServiceClientInfo(string iPAddress, int port)
    {
        IPAddress = iPAddress;
        Port = port;
    }
}

[Serializable]
/// &lt;summary&gt;
/// Server response &quot;payload&quot; - could be anything
/// &lt;/summary&gt;
public class ServiceInfo
{
    /// &lt;summary&gt;
    /// Standard port servers listen on
    /// &lt;/summary&gt;
    public static readonly int UDPPort = 3512;

    /// &lt;summary&gt;
    /// Name of the service
    /// &lt;/summary&gt;
    public string ServiceName { get; private set; }

    /// &lt;summary&gt;
    /// Endpoint address
    /// &lt;/summary&gt;
    public string EndpointAddress { get; private set; }

    public ServiceInfo(string serviceName, string endpointAddress)
    {
        ServiceName = serviceName;
        EndpointAddress = endpointAddress;
    }
}</pre>
<p>For our test app we will have a simple UITableView to display server responses, and a single button for sending our out ping. It looks a little something like this:</p>
<p><a href="http://www.grumpydev.com/wp-content/uploads/2010/03/iPhoneServiceLocatorSS.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="iPhoneServiceLocatorSS" border="0" alt="iPhoneServiceLocatorSS" src="http://www.grumpydev.com/wp-content/uploads/2010/03/iPhoneServiceLocatorSS_thumb.png" width="190" height="362" /></a> </p>
<p>We will also verify that we have a working WiFi connection before we do anything. We do this using <a href="http://github.com/migueldeicaza/monotouch-samples/blob/master/reachability/reachability.cs" target="_blank">Miguel’s MonoTouch “reachability” sample code</a>. </p>
<h2>Step 1 – Firing the Ping from the iPhone</h2>
<p>First things first, we need to fire off the initial ping from our phone by sending a <a href="http://en.wikipedia.org/wiki/User_Datagram_Protocol" target="_blank">UDP</a> <a href="http://en.wikipedia.org/wiki/Broadcasting_(networks)" target="_blank">broadcast</a> containing our “payload”. UDP is ideal for our application as it gives us a lightweight, connectionless transmission model which allows us to send a single message to every machine on the network using a broadcast. UDP is considered an “unreliable” protocol (i.e. it has no guarantees of delivery), but for our purposes that isn’t a problem. For more information on TCP/UDP and broadcasting you can take a look at the wikipedia pages: <a href="http://en.wikipedia.org/wiki/Transmission_Control_Protocol" target="_blank">TCP</a>, <a href="http://en.wikipedia.org/wiki/User_Datagram_Protocol" target="_blank">UDP</a>, <a href="http://en.wikipedia.org/wiki/Broadcasting_(networks)" target="_blank">Broadcasting</a>.</p>
<p>From a .NET code point of view this is pretty straightforward. We create an IPv4 UDP <a href="http://msdn.microsoft.com/en-us/library/system.net.sockets.socket.aspx" target="_blank">Socket</a>, a UDP broadcast <a href="http://msdn.microsoft.com/en-us/library/system.net.ipendpoint.aspx" target="_blank">IPEndPoint</a>, set some options and then use our Socket to send a serialised version of our “payload” to the network. </p>
<p>In this instance we are using the <a href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.formatters.binary.binaryformatter.aspx" target="_blank">BinaryFormatter</a> to serialise our payload (using a generic helper class in Helpers.cs), but you could serialise using any mechanism you like. </p>
<p>The code for this is as follows:</p>
<pre class="brush: csharp; toolbar: false;">/// &lt;summary&gt;
/// Send our our server ping
/// &lt;/summary&gt;
private void SendServerPing ()
{
    // Create a socket udp ipv4 socket
    using (Socket sock = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)) {
        // Create our endpoint using the IP broadcast address and our port
        IPEndPoint endPoint = new IPEndPoint (IPAddress.Broadcast, Discovery.Core.ServiceInfo.UDPPort);

        // Serialize our ping &quot;payload&quot;
        byte[] data = Discovery.Core.Helpers.SerializeObject&lt;ServiceClientInfo&gt; (new ServiceClientInfo (GetCurrentIPAddress ().ToString (), 8762));

        // Tell our socket to reuse the address so we can send and
        // receive on the same port.
        sock.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);

        // Tell the socket we want to broadcast - if we don't do this it
        // won't let us send.
        sock.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Broadcast, true);

        // Send the ping and close the socket.
        sock.SendTo (data, endPoint);
        sock.Close ();
    }
}</pre>
<h2>Step 2 – Listening for Responses</h2>
<p>Next up we need to listen for server responses. We actually start listening *before* we send the ping (to make sure we don’t miss anything), but it makes more sense to think of it as a second step. </p>
<p>There are two ways to listen to responses: synchronously, where we sit there and wait for a response to come back, or asynchronously, where we provide a callback method that will respond to data as it comes in. We obviously don’t want our UI to stop responding while we’re waiting, and we certainly don’t want the iPhone to kill our application for being unresponsive, so we will opt for the asynchronous model.</p>
<p>The steps for setting up a listener are, again, very simple. We first create an <a href="http://msdn.microsoft.com/en-us/library/system.net.ipendpoint.aspx" target="_blank">IPEndpoint</a>, this time using the IP address and port we included in our initial ping, and create a <a href="http://msdn.microsoft.com/en-us/library/system.net.sockets.udpclient.aspx" target="_blank">UDPClient</a> bound to it. Finally we call <a href="http://msdn.microsoft.com/en-us/library/system.net.sockets.udpclient.beginreceive.aspx" target="_blank">BeginReceive</a> to tell the client we want to receive data asynchronously, providing our callback method, and start a timer to stop listening after 2 seconds. We pass in a simple “state” object to our callback, so it has access to our endpoint and client, but you could also store those as fields if you prefer.</p>
<p>While we are listening for responses we also disable our Ping button and re-enable it again, making sure to do so on the UI thread, once the timer has elapsed:</p>
<pre class="brush: csharp; toolbar: false;">private void StartListeningForServerPingBacks ()
{
    // Disable our ping button
    PingButton.Enabled = false;

    // Listen on our IP addresses on our port
    // In a real scenario you'd probably want to make sure the port
    // was available and fallback to an alternative if not.
    var endPoint = new IPEndPoint (GetCurrentIPAddress(), 8762);

    // Make sure we don't grab exclusive &quot;rights&quot; to our address
    // so we can use the same port for send and receive.
    var udpClient = new UdpClient ();
    udpClient.Client.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
    udpClient.ExclusiveAddressUse = false;
    udpClient.Client.Bind (endPoint);

    // Setup our &quot;state&quot; object so the callback has access to the client and endpoint
    UdpState state = new UdpState (endPoint, udpClient);

    // Setup our async receive
    // Our callback will be called if and when data comes in
    udpClient.BeginReceive (new AsyncCallback (this.ReceiveServerPingCallback), state);

    // Setup a timeout timer.
    // When the timer elapses we enable our ping button again and
    // close our udpclient.
    var enableTimer = new Timer (2000);
    enableTimer.AutoReset = false;
    enableTimer.Elapsed += delegate(object sender, ElapsedEventArgs e) {
        InvokeOnMainThread (delegate { PingButton.Enabled = true; });
        udpClient.Close ();
    };
    enableTimer.Enabled = true;
}</pre>
<h2>Step 3 – The Callback</h2>
<p>Our callback method is rather simple (are you seeing a trend? <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ). We first grab the state object, call <a href="http://msdn.microsoft.com/en-us/library/system.net.sockets.udpclient.endreceive.aspx" target="_blank">EndReceive</a> to grab the data, deserialise it to our ServiceInfo object, add it to the UITableView, and then call <a href="http://msdn.microsoft.com/en-us/library/system.net.sockets.udpclient.beginreceive.aspx" target="_blank">BeginReceive</a> again. That last part is the most important &#8211; every call to BeginReceive, which starts an asynchronous receive, must match a call to EndReceive, which ends the asynchronous receive. If we didn’t call BeginReceive at the end of our callback we would only ever get one server response – which obviously isn’t what we want!</p>
<p>As our timer may close the connection, and because we may get bad data sent to our listening port, we wrap the whole callback in a try/catch to make sure we don’t crash the app:</p>
<pre class="brush: csharp; toolbar: false;">/// &lt;summary&gt;
/// Our callback that receives the pings back from the server(s)
/// &lt;/summary&gt;
private void ReceiveServerPingCallback (IAsyncResult ar)
{
    try {
        // Grab the state object and split it up
        UdpState state = (UdpState)(ar.AsyncState);
        UdpClient client = state.client;
        IPEndPoint endPoint = state.endPoint;

        // Grab all the data we received
        Byte[] receiveBytes = client.EndReceive (ar, ref endPoint);

        // Deserialize it to our ServiceInfo object
        var data = Discovery.Core.Helpers.DeserializeObject&lt;ServiceInfo&gt; (receiveBytes);

        // Using the UI thread, update the server list
        InvokeOnMainThread (delegate { AddItemToList (String.Format (&quot;Name: {0} Endpoint: {1}&quot;, data.ServiceName, data.EndpointAddress)); });

        // Start listening again
        client.BeginReceive (new AsyncCallback (this.ReceiveServerPingCallback), state);
    } catch (Exception) {
        // Just in case we have any network issues, or we've closed the socket, we catch everything.
        // Rather a horrible catch all than an app crash in this instance.
    }
}</pre>
<h2>The Code</h2>
<p>And that’s that. The full application source is available below. The solution contains the iPhone app, a WinForms “server” that you can run multiple times on your Mac/PC, and a shared library with the common data types in.</p>
<p>I’ve successfully tested this code with 10 servers, spread across multiple machines, without any issues but if your app needs responses from a large amount of servers then your mileage may vary <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href="/wp-content/uploads/2010/03/ServiceLocation.zip">ServiceLocation.zip</a></p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Locating%20Network%20Services%20on%20the%20iPhone%2FiPad%20with%20MonoTouch%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F27%2Flocating-network-services-on-the-iphoneipad-with-monotouch%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F27%2Flocating-network-services-on-the-iphoneipad-with-monotouch%2F&amp;title=Locating%20Network%20Services%20on%20the%20iPhone%2FiPad%20with%20MonoTouch" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F27%2Flocating-network-services-on-the-iphoneipad-with-monotouch%2F&amp;title=Locating%20Network%20Services%20on%20the%20iPhone%2FiPad%20with%20MonoTouch&amp;annotation=Introduction%20%20For%20one%20of%20the%20little%20iPhone%20projects%20I%E2%80%99m%20working%20I%20need%20to%20communicate%20with%20with%20a%20server%20on%20the%20local%20network.%20That%20all%20sounds%20very%20simple%2C%20but%20what%20I%20%2Areally%2A%20want%20to%20be%20able%20to%20do%20is%20detect%20all%20instances%20of%20this%20service%20on%20the%20loc" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F27%2Flocating-network-services-on-the-iphoneipad-with-monotouch%2F&amp;title=Locating%20Network%20Services%20on%20the%20iPhone%2FiPad%20with%20MonoTouch&amp;bodytext=Introduction%20%20For%20one%20of%20the%20little%20iPhone%20projects%20I%E2%80%99m%20working%20I%20need%20to%20communicate%20with%20with%20a%20server%20on%20the%20local%20network.%20That%20all%20sounds%20very%20simple%2C%20but%20what%20I%20%2Areally%2A%20want%20to%20be%20able%20to%20do%20is%20detect%20all%20instances%20of%20this%20service%20on%20the%20loc" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F27%2Flocating-network-services-on-the-iphoneipad-with-monotouch%2F&amp;title=Locating%20Network%20Services%20on%20the%20iPhone%2FiPad%20with%20MonoTouch&amp;notes=Introduction%20%20For%20one%20of%20the%20little%20iPhone%20projects%20I%E2%80%99m%20working%20I%20need%20to%20communicate%20with%20with%20a%20server%20on%20the%20local%20network.%20That%20all%20sounds%20very%20simple%2C%20but%20what%20I%20%2Areally%2A%20want%20to%20be%20able%20to%20do%20is%20detect%20all%20instances%20of%20this%20service%20on%20the%20loc" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F27%2Flocating-network-services-on-the-iphoneipad-with-monotouch%2F&amp;title=Locating%20Network%20Services%20on%20the%20iPhone%2FiPad%20with%20MonoTouch" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F27%2Flocating-network-services-on-the-iphoneipad-with-monotouch%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F27%2Flocating-network-services-on-the-iphoneipad-with-monotouch%2F&amp;title=Locating%20Network%20Services%20on%20the%20iPhone%2FiPad%20with%20MonoTouch" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Locating%20Network%20Services%20on%20the%20iPhone%2FiPad%20with%20MonoTouch&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F27%2Flocating-network-services-on-the-iphoneipad-with-monotouch%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Locating%20Network%20Services%20on%20the%20iPhone%2FiPad%20with%20MonoTouch&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F27%2Flocating-network-services-on-the-iphoneipad-with-monotouch%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F27%2Flocating-network-services-on-the-iphoneipad-with-monotouch%2F&amp;title=Locating%20Network%20Services%20on%20the%20iPhone%2FiPad%20with%20MonoTouch&amp;body=Introduction%20%20For%20one%20of%20the%20little%20iPhone%20projects%20I%E2%80%99m%20working%20I%20need%20to%20communicate%20with%20with%20a%20server%20on%20the%20local%20network.%20That%20all%20sounds%20very%20simple%2C%20but%20what%20I%20%2Areally%2A%20want%20to%20be%20able%20to%20do%20is%20detect%20all%20instances%20of%20this%20service%20on%20the%20loc" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F27%2Flocating-network-services-on-the-iphoneipad-with-monotouch%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F27%2Flocating-network-services-on-the-iphoneipad-with-monotouch%2F&amp;title=Locating%20Network%20Services%20on%20the%20iPhone%2FiPad%20with%20MonoTouch" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/iPhone' rel='tag' target='_blank'>iPhone</a>, <a class='technorati-link' href='http://technorati.com/tag/MonoTouch' rel='tag' target='_blank'>MonoTouch</a>, <a class='technorati-link' href='http://technorati.com/tag/service+location' rel='tag' target='_blank'>service location</a>, <a class='technorati-link' href='http://technorati.com/tag/sockets' rel='tag' target='_blank'>sockets</a>, <a class='technorati-link' href='http://technorati.com/tag/udp' rel='tag' target='_blank'>udp</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2010/03/27/locating-network-services-on-the-iphoneipad-with-monotouch/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Announcing: TinyMessenger</title>
		<link>http://www.grumpydev.com/2010/03/22/announcing-tinymessenger/</link>
		<comments>http://www.grumpydev.com/2010/03/22/announcing-tinymessenger/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 08:35:29 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[TinyIoC]]></category>
		<category><![CDATA[TinyMessenger]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[event aggregator]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=315</guid>
		<description><![CDATA[Introduction Just a small post to announce I have added, and finally documented, TinyMessenger to the TinyIoC project. Tiny What-Now? TinyMessenger provides an event aggregator/messenger for loosely coupled communication. Some scenarios where this may prove useful : Communication between Controllers/ViewModels. Service classes raising “events”. Removing responsibilities from classes that receive external events (such as the [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Just a small post to announce I have added, and finally documented, TinyMessenger to the TinyIoC project.</p>
<h2>Tiny What-Now?</h2>
<p>TinyMessenger provides an event aggregator/messenger for loosely coupled communication. Some scenarios where this may prove useful :</p>
<ul>
<li>Communication between Controllers/ViewModels. </li>
<li>Service classes raising “events”. </li>
<li>Removing responsibilities from classes that receive external events (such as the AppDelegate in an iPhone application). </li>
<li>Decoupling communication between classes. </li>
</ul>
<p>TinyMessenger uses a Publish/Subscribe model and is orderless, so you can subscribe to a message even if there&#8217;s nobody publishing, and you can publish one even if nobody is subscribed. It is also loosely coupled in that the publisher and subscriber know nothing of each other, all they both care about is the message itself. Some of the key features are:</p>
<ul>
<li>Simple and orderless Publish/Subscribe API. </li>
<li>Messages either need to implement a simple “marker” interface, or they can build on the “base” classes that are in the box (TinyMessageBase and GenericTinyMessage&lt;TContent&gt;. </li>
<li>Subscriptions can supply an optional filter – only message that “pass” the filter are delivered. </li>
<li>Subscriptions can supply an optional “proxy”. A proxy can be used for marshalling to the ui thread, logging or many other purposes. </li>
<li>Subscriptions use weak references by default, but strong references can be specified if required. </li>
</ul>
<p><a href="http://hg.grumpydev.com/tinyioc/wiki/TinyMessenger" target="_blank">TinyMessenger</a> is part of the <a href="http://hg.grumpydev.com/tinyioc" target="_blank">TinyIoC</a> project, but it can be used completely independently – for more information take a look at the <a href="http://hg.grumpydev.com/tinyioc/wiki/TinyMessenger" target="_blank">TinyMessenger Wiki page</a> on the main <a href="http://hg.grumpydev.com/tinyioc" target="_blank">TinyIoC site</a>.</p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Announcing%3A%20TinyMessenger%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F22%2Fannouncing-tinymessenger%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F22%2Fannouncing-tinymessenger%2F&amp;title=Announcing%3A%20TinyMessenger" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F22%2Fannouncing-tinymessenger%2F&amp;title=Announcing%3A%20TinyMessenger&amp;annotation=Introduction%20%20Just%20a%20small%20post%20to%20announce%20I%20have%20added%2C%20and%20finally%20documented%2C%20TinyMessenger%20to%20the%20TinyIoC%20project.%20%20Tiny%20What-Now%3F%20%20TinyMessenger%20provides%20an%20event%20aggregator%2Fmessenger%20for%20loosely%20coupled%20communication.%20Some%20scenarios%20where%20this" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F22%2Fannouncing-tinymessenger%2F&amp;title=Announcing%3A%20TinyMessenger&amp;bodytext=Introduction%20%20Just%20a%20small%20post%20to%20announce%20I%20have%20added%2C%20and%20finally%20documented%2C%20TinyMessenger%20to%20the%20TinyIoC%20project.%20%20Tiny%20What-Now%3F%20%20TinyMessenger%20provides%20an%20event%20aggregator%2Fmessenger%20for%20loosely%20coupled%20communication.%20Some%20scenarios%20where%20this" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F22%2Fannouncing-tinymessenger%2F&amp;title=Announcing%3A%20TinyMessenger&amp;notes=Introduction%20%20Just%20a%20small%20post%20to%20announce%20I%20have%20added%2C%20and%20finally%20documented%2C%20TinyMessenger%20to%20the%20TinyIoC%20project.%20%20Tiny%20What-Now%3F%20%20TinyMessenger%20provides%20an%20event%20aggregator%2Fmessenger%20for%20loosely%20coupled%20communication.%20Some%20scenarios%20where%20this" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F22%2Fannouncing-tinymessenger%2F&amp;title=Announcing%3A%20TinyMessenger" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F22%2Fannouncing-tinymessenger%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F22%2Fannouncing-tinymessenger%2F&amp;title=Announcing%3A%20TinyMessenger" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Announcing%3A%20TinyMessenger&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F22%2Fannouncing-tinymessenger%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Announcing%3A%20TinyMessenger&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F22%2Fannouncing-tinymessenger%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F22%2Fannouncing-tinymessenger%2F&amp;title=Announcing%3A%20TinyMessenger&amp;body=Introduction%20%20Just%20a%20small%20post%20to%20announce%20I%20have%20added%2C%20and%20finally%20documented%2C%20TinyMessenger%20to%20the%20TinyIoC%20project.%20%20Tiny%20What-Now%3F%20%20TinyMessenger%20provides%20an%20event%20aggregator%2Fmessenger%20for%20loosely%20coupled%20communication.%20Some%20scenarios%20where%20this" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F22%2Fannouncing-tinymessenger%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F22%2Fannouncing-tinymessenger%2F&amp;title=Announcing%3A%20TinyMessenger" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/csharp' rel='tag' target='_blank'>csharp</a>, <a class='technorati-link' href='http://technorati.com/tag/event+aggregator' rel='tag' target='_blank'>event aggregator</a>, <a class='technorati-link' href='http://technorati.com/tag/TinyIoC' rel='tag' target='_blank'>TinyIoC</a>, <a class='technorati-link' href='http://technorati.com/tag/TinyMessenger' rel='tag' target='_blank'>TinyMessenger</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2010/03/22/announcing-tinymessenger/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Why is Add Reference Still Horribly Broken in VS2010?</title>
		<link>http://www.grumpydev.com/2010/03/19/why-is-add-reference-still-horribly-broken-in-vs2010/</link>
		<comments>http://www.grumpydev.com/2010/03/19/why-is-add-reference-still-horribly-broken-in-vs2010/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 13:49:10 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[Rambling]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[add reference dialog]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[vs2010]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=306</guid>
		<description><![CDATA[Introduction We all know Add Reference is horribly broken in VS2008. We’ve all clicked it and had our hearts sink as we realised it was time to make a brew, grab lunch or take a weekend mini-break before even attempting to use Visual Studio again. Now VS2010 is in Release Candidate it’s obviously been fixed.. [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>We all know Add Reference is horribly broken in VS2008. We’ve all clicked it and had our hearts sink as we realised it was time to make a brew, grab lunch or take a weekend mini-break before even attempting to use Visual Studio again. Now VS2010 is in <a href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx" target="_blank">Release Candidate</a> it’s obviously been fixed.. hasn’t it?!</p>
<h2>Not All Change Is For the Better</h2>
<p>The main issue with the VS2008 Add Reference dialog was that it took an age to load, mostly due to it enumerating all of the assemblies available to populate the .NET tab. If all  you wanted to do was add a project or file reference you still had to wait for it to finish building the .NET tab. Not good. In an attempt to fix the problem Microsoft has made two major changes to the dialog for VS2010:</p>
<ul>
<li>The dialog now defaults to the Projects tab.</li>
<li>The .NET tab is now multi-threaded i.e. it loads types in the background.</li>
</ul>
<p>The first of the two fixes is an excellent idea. If you want to use the Projects, Browse or Recent tabs then you don’t even need to look at that snail-paced .NET tab.</p>
<p>The second of the two fixes is horrible. Truly horrible. I’d even go as far as to say that if you actually want to use the .NET tab to add a reference then it’s actually <strong>*more broken than Visual Studio 2008*</strong>. Yes, I did say that. And I&#8217;ll say it again:</p>
<blockquote><p>“If you actually want to use the .NET tab to add a reference then it’s actually <strong>more broken than Visual Studio 2008</strong>.”</p></blockquote>
<p>To illustrate the point, lets say we want to add MEF, which sits in System.ComponentModel.Composition to our application, we’d probably do something similar to the following:</p>
<ol>
<li>Click Add Reference.</li>
<li>Marvel at how quickly Add Reference Loaded.</li>
<li>Click the .NET tab.</li>
<li>Watch the first few items start to load up.</li>
<li>Type “Sys” to jump down to System in the list.</li>
<li>Go to select System.ComponentModel.Compo..oh no.. it’s moved.</li>
<li>Scroll down, go to select Sys.. nope.. it’s moved again.</li>
<li>Scroll down a bit more, click on.. nope, gone again.</li>
<li>Swear.</li>
<li>Wait until the thing has fully finished loading and then select what we want.</li>
</ol>
<p>So what we have there is the same delay as it would have taken with VS2008, but with the added “fun” of playing a game of “chase the reference down the listbox” in a vain attempt to save yourself a few seconds.</p>
<h2>Could It Be Done Better?</h2>
<p>Now I’m no User Experience expert, or an Interface Designer with a fancy job title, but couldn’t this be improved immeasurably with a simple filter box?</p>
<p>Perhaps I work in a strange way, but I never start searching for a reference using the mouse &#8211; I *always* type the first few letters to skip to roughly where I want to go. If we had a simple filter box at the top of the dialog then the “chase the reference” game would be massively reduced, and probably eliminated all together if you’d typed in enough of the namespace name:</p>
<p><a href="http://www.grumpydev.com/wp-content/uploads/2010/03/AddReference.png"><img style="display: inline; border-width: 0px;" title="AddReference" src="http://www.grumpydev.com/wp-content/uploads/2010/03/AddReference_thumb.png" border="0" alt="AddReference" width="473" height="353" /></a></p>
<p>Now we could get super fancy and support CamelCaseSearching like the <a href="http://www.devexpress.com/Products/Visual_Studio_Add-in/Coding_Assistance/Navigation.xml" target="_blank">QuickNav</a> dialog in <a href="http://www.devexpress.com/Coderush" target="_blank">CodeRush</a>, but I’d be quite happy with a basic filter.</p>
<p>Maybe I’m just picky.</p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Why%20is%20Add%20Reference%20Still%20Horribly%20Broken%20in%20VS2010%3F%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F19%2Fwhy-is-add-reference-still-horribly-broken-in-vs2010%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F19%2Fwhy-is-add-reference-still-horribly-broken-in-vs2010%2F&amp;title=Why%20is%20Add%20Reference%20Still%20Horribly%20Broken%20in%20VS2010%3F" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F19%2Fwhy-is-add-reference-still-horribly-broken-in-vs2010%2F&amp;title=Why%20is%20Add%20Reference%20Still%20Horribly%20Broken%20in%20VS2010%3F&amp;annotation=Introduction%0D%0AWe%20all%20know%20Add%20Reference%20is%20horribly%20broken%20in%20VS2008.%20We%E2%80%99ve%20all%20clicked%20it%20and%20had%20our%20hearts%20sink%20as%20we%20realised%20it%20was%20time%20to%20make%20a%20brew%2C%20grab%20lunch%20or%20take%20a%20weekend%20mini-break%20before%20even%20attempting%20to%20use%20Visual%20Studio%20again." title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F19%2Fwhy-is-add-reference-still-horribly-broken-in-vs2010%2F&amp;title=Why%20is%20Add%20Reference%20Still%20Horribly%20Broken%20in%20VS2010%3F&amp;bodytext=Introduction%0D%0AWe%20all%20know%20Add%20Reference%20is%20horribly%20broken%20in%20VS2008.%20We%E2%80%99ve%20all%20clicked%20it%20and%20had%20our%20hearts%20sink%20as%20we%20realised%20it%20was%20time%20to%20make%20a%20brew%2C%20grab%20lunch%20or%20take%20a%20weekend%20mini-break%20before%20even%20attempting%20to%20use%20Visual%20Studio%20again." title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F19%2Fwhy-is-add-reference-still-horribly-broken-in-vs2010%2F&amp;title=Why%20is%20Add%20Reference%20Still%20Horribly%20Broken%20in%20VS2010%3F&amp;notes=Introduction%0D%0AWe%20all%20know%20Add%20Reference%20is%20horribly%20broken%20in%20VS2008.%20We%E2%80%99ve%20all%20clicked%20it%20and%20had%20our%20hearts%20sink%20as%20we%20realised%20it%20was%20time%20to%20make%20a%20brew%2C%20grab%20lunch%20or%20take%20a%20weekend%20mini-break%20before%20even%20attempting%20to%20use%20Visual%20Studio%20again." title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F19%2Fwhy-is-add-reference-still-horribly-broken-in-vs2010%2F&amp;title=Why%20is%20Add%20Reference%20Still%20Horribly%20Broken%20in%20VS2010%3F" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F19%2Fwhy-is-add-reference-still-horribly-broken-in-vs2010%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F19%2Fwhy-is-add-reference-still-horribly-broken-in-vs2010%2F&amp;title=Why%20is%20Add%20Reference%20Still%20Horribly%20Broken%20in%20VS2010%3F" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Why%20is%20Add%20Reference%20Still%20Horribly%20Broken%20in%20VS2010%3F&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F19%2Fwhy-is-add-reference-still-horribly-broken-in-vs2010%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Why%20is%20Add%20Reference%20Still%20Horribly%20Broken%20in%20VS2010%3F&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F19%2Fwhy-is-add-reference-still-horribly-broken-in-vs2010%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F19%2Fwhy-is-add-reference-still-horribly-broken-in-vs2010%2F&amp;title=Why%20is%20Add%20Reference%20Still%20Horribly%20Broken%20in%20VS2010%3F&amp;body=Introduction%0D%0AWe%20all%20know%20Add%20Reference%20is%20horribly%20broken%20in%20VS2008.%20We%E2%80%99ve%20all%20clicked%20it%20and%20had%20our%20hearts%20sink%20as%20we%20realised%20it%20was%20time%20to%20make%20a%20brew%2C%20grab%20lunch%20or%20take%20a%20weekend%20mini-break%20before%20even%20attempting%20to%20use%20Visual%20Studio%20again." title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F19%2Fwhy-is-add-reference-still-horribly-broken-in-vs2010%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F19%2Fwhy-is-add-reference-still-horribly-broken-in-vs2010%2F&amp;title=Why%20is%20Add%20Reference%20Still%20Horribly%20Broken%20in%20VS2010%3F" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/add+reference+dialog' rel='tag' target='_blank'>add reference dialog</a>, <a class='technorati-link' href='http://technorati.com/tag/rant' rel='tag' target='_blank'>rant</a>, <a class='technorati-link' href='http://technorati.com/tag/Visual+Studio' rel='tag' target='_blank'>Visual Studio</a>, <a class='technorati-link' href='http://technorati.com/tag/vs2010' rel='tag' target='_blank'>vs2010</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2010/03/19/why-is-add-reference-still-horribly-broken-in-vs2010/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Automated “Unit” Testing – It’s Not Just for TDD, It’s for Bug Fixing Too!</title>
		<link>http://www.grumpydev.com/2010/03/09/automated-unit-testing-its-not-just-for-tdd-its-for-bug-fixing-too/</link>
		<comments>http://www.grumpydev.com/2010/03/09/automated-unit-testing-its-not-just-for-tdd-its-for-bug-fixing-too/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 13:00:32 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[MonoTouch]]></category>
		<category><![CDATA[Rambling]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[TinyIoC]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[unit testing]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=293</guid>
		<description><![CDATA[Disclaimer – What I’m discussing here isn’t unit testing (hence the quotes), it’s more functional or integration testing; but as the term “Unit Testing” is often “abused” to mean “anything that uses a (unit) testing framework” so I’ve included it in the title to avoid confusion. Introduction I’m currently using TinyIoC in my first forays [...]]]></description>
			<content:encoded><![CDATA[<p><strong><em>Disclaimer – What I’m discussing here isn’t unit testing (hence the quotes), it’s more functional or integration testing; but as the term “Unit Testing” is often “abused” to mean “anything that uses a (unit) testing framework” so I’ve included it in the title to avoid confusion.</em></strong></p>
<h2>Introduction</h2>
<p>I’m currently using <a href="http://hg.grumpydev.com/tinyioc" target="_blank">TinyIoC</a> in my first forays into <a href="http://monotouch.net/" target="_blank">MonoTouch</a> development, and my initialisation code was throwing a resolution error on starup:</p>
<pre class="brush: csharp; toolbar: false;">var container = TinyIoCContainer.Current();
var mainView = new MainView();
container.Register&lt;IViewManager&gt;(mainView);
container.Register&lt;IView, MainView&gt;(mainView, "MainView");
container.Register&lt;IView, SplashView&gt;("SplashView").UsingConstructor(() =&gt; new SplashView());
container.Resolve&lt;IView&gt;("MainView");
container.Register&lt;IStateManager, StateManager&gt;();
// Code was blowing up here..
var stateManager = container.Resolve&lt;IStateManager&gt;();
stateManager.Init();</pre>
<p>The Exception that was given was that IStateManager could not be resolved, which was odd given that the StateManager was registered against IStateManager, and everything in its constructor was also registered:</p>
<pre class="brush: csharp; toolbar: false;">public StateManager(IViewManager viewManager, Func&lt;string, IView&gt; viewFactory)</pre>
<h2>To The Debugger.. Right?!</h2>
<p>So at this point your immediate reaction may be to fire up the debugger, trace into the code and start hacking around, debugging and hacking around some more until it works. Sure, that’s an approach, and one I’m sure we’ve all used in the past; but as I was pretty sure the issue was in TinyIoC itself I took a slightly different tack.</p>
<h2>To The Test Runner!</h2>
<p>With the approach above I would have to build and run my app every time I wanted to check if my “fix” had actually worked – and even if it had, how would I know it hadn’t broken something else? The solution is quite simple – recreate the conditions of the bug in a unit test, using stubs/mocks to replace your real classes, and make sure it fails in the same way:</p>
<pre class="brush: csharp; toolbar: false;">[TestMethod]
public void Dependency_Hierarchy_With_Named_Factories_Resolves_All_Correctly()
{
    var container = UtilityMethods.GetContainer();
    var mainView = new MainView();
    container.Register&lt;IViewManager&gt;(mainView);
    container.Register&lt;IView, MainView&gt;(mainView, "MainView");
    container.Register&lt;IView, SplashView&gt;("SplashView").UsingConstructor(() =&gt; new SplashView());
    container.Resolve&lt;IView&gt;("MainView");
    container.Register&lt;IStateManager, StateManager&gt;();
    var stateManager = container.Resolve&lt;IStateManager&gt;();
    stateManager.Init();

    Assert.IsInstanceOfType(mainView.LoadedView, typeof(SplashView));
}</pre>
<p>I&#8217;ve added an Assert to show what behaviour I think it *should* have. It’s a pretty horrible looking test, but it accurately represents what my failing code was doing, and the test fails as I expected it to. Now I can attach the debugger and find out what’s going on, safe in the knowledge I have a fast executing test available to verify my fix, and the rest of my test suite there to ensure I haven’t broken anything else.</p>
<p>After a very brief investigation it turned out that there was a bug in registration when *just* an Interface type was registered with an concrete instance (the IViewManager registration above). The “InstanceFactory” it was using hadn’t set the “AssumeResolves” flag, so TinyIoC was actually trying to find a valid constructor for IViewManager – which obviously wasn’t going to succeed. It&#8217;s a scenario I probably should have factored into my Unit Tests, but hey, nobody is perfect <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h2>Conclusion</h2>
<p>This post is aimed at covering two points:</p>
<ol>
<li>Test aren’t just for TDD. If you find a bug, isolate it with a test and you have a quick and easy way to verify a fix, and verify you haven’t broken anything else.</li>
<li>Code Coverage isn’t everything. Apart from a few “defensive coding” null checks, the core of TinyIoC has pretty much 100% code coverage with its tests, but it didn’t help me with this issue. Although the code path was covered, the exact input (Interface type, concrete instance) wasn’t in my unit tests, so don’t assume 100% code coverage means 0 bugs in the code, there may well be a scenario you missed!</li>
</ol>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Automated%20%26ldquo%3BUnit%26rdquo%3B%20Testing%20%26ndash%3B%20It%26rsquo%3Bs%20Not%20Just%20for%20TDD%2C%20It%26rsquo%3Bs%20for%20Bug%20Fixing%20Too%21%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F09%2Fautomated-unit-testing-its-not-just-for-tdd-its-for-bug-fixing-too%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F09%2Fautomated-unit-testing-its-not-just-for-tdd-its-for-bug-fixing-too%2F&amp;title=Automated%20%26ldquo%3BUnit%26rdquo%3B%20Testing%20%26ndash%3B%20It%26rsquo%3Bs%20Not%20Just%20for%20TDD%2C%20It%26rsquo%3Bs%20for%20Bug%20Fixing%20Too%21" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F09%2Fautomated-unit-testing-its-not-just-for-tdd-its-for-bug-fixing-too%2F&amp;title=Automated%20%26ldquo%3BUnit%26rdquo%3B%20Testing%20%26ndash%3B%20It%26rsquo%3Bs%20Not%20Just%20for%20TDD%2C%20It%26rsquo%3Bs%20for%20Bug%20Fixing%20Too%21&amp;annotation=Disclaimer%20%E2%80%93%20What%20I%E2%80%99m%20discussing%20here%20isn%E2%80%99t%20unit%20testing%20%28hence%20the%20quotes%29%2C%20it%E2%80%99s%20more%20functional%20or%20integration%20testing%3B%20but%20as%20the%20term%20%E2%80%9CUnit%20Testing%E2%80%9D%20is%20often%20%E2%80%9Cabused%E2%80%9D%20to%20mean%20%E2%80%9Canything%20that%20uses%20a%20%28unit%29%20testing%20framework%E2%80%9D%20so%20" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F09%2Fautomated-unit-testing-its-not-just-for-tdd-its-for-bug-fixing-too%2F&amp;title=Automated%20%26ldquo%3BUnit%26rdquo%3B%20Testing%20%26ndash%3B%20It%26rsquo%3Bs%20Not%20Just%20for%20TDD%2C%20It%26rsquo%3Bs%20for%20Bug%20Fixing%20Too%21&amp;bodytext=Disclaimer%20%E2%80%93%20What%20I%E2%80%99m%20discussing%20here%20isn%E2%80%99t%20unit%20testing%20%28hence%20the%20quotes%29%2C%20it%E2%80%99s%20more%20functional%20or%20integration%20testing%3B%20but%20as%20the%20term%20%E2%80%9CUnit%20Testing%E2%80%9D%20is%20often%20%E2%80%9Cabused%E2%80%9D%20to%20mean%20%E2%80%9Canything%20that%20uses%20a%20%28unit%29%20testing%20framework%E2%80%9D%20so%20" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F09%2Fautomated-unit-testing-its-not-just-for-tdd-its-for-bug-fixing-too%2F&amp;title=Automated%20%26ldquo%3BUnit%26rdquo%3B%20Testing%20%26ndash%3B%20It%26rsquo%3Bs%20Not%20Just%20for%20TDD%2C%20It%26rsquo%3Bs%20for%20Bug%20Fixing%20Too%21&amp;notes=Disclaimer%20%E2%80%93%20What%20I%E2%80%99m%20discussing%20here%20isn%E2%80%99t%20unit%20testing%20%28hence%20the%20quotes%29%2C%20it%E2%80%99s%20more%20functional%20or%20integration%20testing%3B%20but%20as%20the%20term%20%E2%80%9CUnit%20Testing%E2%80%9D%20is%20often%20%E2%80%9Cabused%E2%80%9D%20to%20mean%20%E2%80%9Canything%20that%20uses%20a%20%28unit%29%20testing%20framework%E2%80%9D%20so%20" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F09%2Fautomated-unit-testing-its-not-just-for-tdd-its-for-bug-fixing-too%2F&amp;title=Automated%20%26ldquo%3BUnit%26rdquo%3B%20Testing%20%26ndash%3B%20It%26rsquo%3Bs%20Not%20Just%20for%20TDD%2C%20It%26rsquo%3Bs%20for%20Bug%20Fixing%20Too%21" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F09%2Fautomated-unit-testing-its-not-just-for-tdd-its-for-bug-fixing-too%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F09%2Fautomated-unit-testing-its-not-just-for-tdd-its-for-bug-fixing-too%2F&amp;title=Automated%20%26ldquo%3BUnit%26rdquo%3B%20Testing%20%26ndash%3B%20It%26rsquo%3Bs%20Not%20Just%20for%20TDD%2C%20It%26rsquo%3Bs%20for%20Bug%20Fixing%20Too%21" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Automated%20%26ldquo%3BUnit%26rdquo%3B%20Testing%20%26ndash%3B%20It%26rsquo%3Bs%20Not%20Just%20for%20TDD%2C%20It%26rsquo%3Bs%20for%20Bug%20Fixing%20Too%21&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F09%2Fautomated-unit-testing-its-not-just-for-tdd-its-for-bug-fixing-too%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Automated%20%26ldquo%3BUnit%26rdquo%3B%20Testing%20%26ndash%3B%20It%26rsquo%3Bs%20Not%20Just%20for%20TDD%2C%20It%26rsquo%3Bs%20for%20Bug%20Fixing%20Too%21&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F09%2Fautomated-unit-testing-its-not-just-for-tdd-its-for-bug-fixing-too%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F09%2Fautomated-unit-testing-its-not-just-for-tdd-its-for-bug-fixing-too%2F&amp;title=Automated%20%26ldquo%3BUnit%26rdquo%3B%20Testing%20%26ndash%3B%20It%26rsquo%3Bs%20Not%20Just%20for%20TDD%2C%20It%26rsquo%3Bs%20for%20Bug%20Fixing%20Too%21&amp;body=Disclaimer%20%E2%80%93%20What%20I%E2%80%99m%20discussing%20here%20isn%E2%80%99t%20unit%20testing%20%28hence%20the%20quotes%29%2C%20it%E2%80%99s%20more%20functional%20or%20integration%20testing%3B%20but%20as%20the%20term%20%E2%80%9CUnit%20Testing%E2%80%9D%20is%20often%20%E2%80%9Cabused%E2%80%9D%20to%20mean%20%E2%80%9Canything%20that%20uses%20a%20%28unit%29%20testing%20framework%E2%80%9D%20so%20" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F09%2Fautomated-unit-testing-its-not-just-for-tdd-its-for-bug-fixing-too%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F09%2Fautomated-unit-testing-its-not-just-for-tdd-its-for-bug-fixing-too%2F&amp;title=Automated%20%26ldquo%3BUnit%26rdquo%3B%20Testing%20%26ndash%3B%20It%26rsquo%3Bs%20Not%20Just%20for%20TDD%2C%20It%26rsquo%3Bs%20for%20Bug%20Fixing%20Too%21" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/csharp' rel='tag' target='_blank'>csharp</a>, <a class='technorati-link' href='http://technorati.com/tag/debugging' rel='tag' target='_blank'>debugging</a>, <a class='technorati-link' href='http://technorati.com/tag/MonoTouch' rel='tag' target='_blank'>MonoTouch</a>, <a class='technorati-link' href='http://technorati.com/tag/testing' rel='tag' target='_blank'>testing</a>, <a class='technorati-link' href='http://technorati.com/tag/TinyIoC' rel='tag' target='_blank'>TinyIoC</a>, <a class='technorati-link' href='http://technorati.com/tag/unit+testing' rel='tag' target='_blank'>unit testing</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2010/03/09/automated-unit-testing-its-not-just-for-tdd-its-for-bug-fixing-too/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Announcing: TinyIoC – An Easy to Use, Hassle Free, Inversion of Control Container</title>
		<link>http://www.grumpydev.com/2010/03/02/announcing-tinyioc-an-easy-to-use-hassle-free-inversion-of-control-container/</link>
		<comments>http://www.grumpydev.com/2010/03/02/announcing-tinyioc-an-easy-to-use-hassle-free-inversion-of-control-container/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 06:56:15 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[TinyIoC]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[dependency injection]]></category>
		<category><![CDATA[di]]></category>
		<category><![CDATA[inversion of control]]></category>
		<category><![CDATA[ioc]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=288</guid>
		<description><![CDATA[Introduction Whenever I start a new “pet” project I usually *want* to use IoC, but I don’t really want the hassle of taking a dependency on a container, or adding another binary to my project. Usually this leaves me using “poor man’s IoC”, whereby I define dependencies in my constructors, but I pass them in [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Whenever I start a new “pet” project I usually *want* to use IoC, but I don’t really want the hassle of taking a dependency on a container, or adding another binary to my project. Usually this leaves me using “poor man’s IoC”, whereby I define dependencies in my constructors, but I pass them in manually or construct them using <a href="http://www.csharp411.com/constructor-chaining/" target="_blank">constructor chaining</a>.</p>
<p>I’ve thought for some time that it would be useful to put together a container that fits the bill for that scenario, but also attempts to “lower the barrier of entry” for developers that are new to IoC, and may be scared off by the “big boys”. A couple of weeks ago <a href="http://twitter.com/dotnetwill" target="_blank">@DotNetWill</a> posted his <a href="http://www.humblecoder.co.uk/?p=102" target="_blank">simplified container</a>, and that gave me the kick up the backside I needed to create my own <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h2>Introducing TinyIoC</h2>
<p>Now you might ask “do we really need *another* IoC container?” – and it’s a reasonable question. We already have <a href="http://www.codeplex.com/unity" target="_blank">Unity</a>, <a href="http://ninject.org/" target="_blank">Ninject</a>, <a href="http://structuremap.sourceforge.net/" target="_blank">StructureMap</a>, <a href="http://code.google.com/p/autofac/" target="_blank">AutoFac</a>.. the list goes on. <a href="http://hg.grumpydev.com/tinyioc" target="_blank">TinyIoC</a> makes no attempt to go “head to head” with any of these other containers, instead <a href="http://hg.grumpydev.com/tinyioc" target="_blank">TinyIoC</a> has been designed to fulfil a single key requirement:</p>
<blockquote><p><strong>To lower the &#8220;level of entry&#8221; for using an IoC container; both for small projects, and developers who are new to IoC.</strong></p></blockquote>
<p>To that end, <a href="http://hg.grumpydev.com/tinyioc" target="_blank">TinyIoC</a> attempts to stick the following core principals:</p>
<ul>
<li><strong>Simplified Inclusion.</strong> No assembly to reference, no binary to worry about, just a single cs file you can include in your project and you&#8217;re good to go. It also works on <a href="http://www.mono-project.com/" target="_blank">Mono</a>, and on <a href="http://monotouch.net/" target="_blank">MonoTouch</a> for the iPhone / iPad.</li>
<li><strong>Simplified Setup. </strong>With auto-resolving of concrete types and an &#8220;auto registration&#8221; option for interfaces, setup is a piece of cake. It can be reduced to 0 lines for concrete types, or 1 line if you have any interface dependencies.</li>
<li><strong>Simple, &#8220;Fluent&#8221; API. </strong>Just because it&#8217;s Tiny, doesn&#8217;t mean it has no features. A simple &#8220;fluent&#8221; API gives you access to the more advanced features, like specifying singleton/multi-instance, strong or weak references or forcing a particular constructor.</li>
</ul>
<p>The following snippet gives an example of the simplified setup:</p>
<pre class="brush: csharp; toolbar: false;">// TinyIoC provides a lazyily constructed singleton
// version of itself if you want to use it.
var container = TinyIoCContainer.Current;

// By default we can resolve concrete types without
// registration
var instance = container.Resolve&lt;MyConcreteType&gt;();

// We can automatically register all concrete types
// and interfaces with a single call.
container.AutoRegister();
var implementation = container.Resolve&lt;IMyInterface&gt;();</pre>
<h2>So Where Now?</h2>
<p>If you want to grab the source, read the tests, or take a look at some more complex examples of the API, wander on over to the <a href="http://hg.grumpydev.com/tinyioc" target="_blank">homepage</a> on <a href="http://hg.grumpydev.com/tinyioc" target="_blank">bitbucket</a>. I’m happy to take comments and suggestions – just grab me on <a href="http://twitter.com/grumpydev" target="_blank">Twitter</a> or ping me an email from the <a href="http://www.grumpydev.com/contact/" target="_blank">contact form</a>.</p>
<p>Over the next few weeks I will be posting a series of “beginners” articles on the hows and whys of IoC. I will be using <a href="http://hg.grumpydev.com/tinyioc" target="_blank">TinyIoC</a> specifically, but the majority of concepts and content can equally apply to other containers. I may even do a “File, New” screencast to show how “un-scary” this stuff is, and how it doesn’t really add any extra development effort,</p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Announcing%3A%20TinyIoC%20%26ndash%3B%20An%20Easy%20to%20Use%2C%20Hassle%20Free%2C%20Inversion%20of%20Control%20Container%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F02%2Fannouncing-tinyioc-an-easy-to-use-hassle-free-inversion-of-control-container%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F02%2Fannouncing-tinyioc-an-easy-to-use-hassle-free-inversion-of-control-container%2F&amp;title=Announcing%3A%20TinyIoC%20%26ndash%3B%20An%20Easy%20to%20Use%2C%20Hassle%20Free%2C%20Inversion%20of%20Control%20Container" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F02%2Fannouncing-tinyioc-an-easy-to-use-hassle-free-inversion-of-control-container%2F&amp;title=Announcing%3A%20TinyIoC%20%26ndash%3B%20An%20Easy%20to%20Use%2C%20Hassle%20Free%2C%20Inversion%20of%20Control%20Container&amp;annotation=Introduction%0D%0AWhenever%20I%20start%20a%20new%20%E2%80%9Cpet%E2%80%9D%20project%20I%20usually%20%2Awant%2A%20to%20use%20IoC%2C%20but%20I%20don%E2%80%99t%20really%20want%20the%20hassle%20of%20taking%20a%20dependency%20on%20a%20container%2C%20or%20adding%20another%20binary%20to%20my%20project.%20Usually%20this%20leaves%20me%20using%20%E2%80%9Cpoor%20man%E2%80%99s%20IoC%E2%80" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F02%2Fannouncing-tinyioc-an-easy-to-use-hassle-free-inversion-of-control-container%2F&amp;title=Announcing%3A%20TinyIoC%20%26ndash%3B%20An%20Easy%20to%20Use%2C%20Hassle%20Free%2C%20Inversion%20of%20Control%20Container&amp;bodytext=Introduction%0D%0AWhenever%20I%20start%20a%20new%20%E2%80%9Cpet%E2%80%9D%20project%20I%20usually%20%2Awant%2A%20to%20use%20IoC%2C%20but%20I%20don%E2%80%99t%20really%20want%20the%20hassle%20of%20taking%20a%20dependency%20on%20a%20container%2C%20or%20adding%20another%20binary%20to%20my%20project.%20Usually%20this%20leaves%20me%20using%20%E2%80%9Cpoor%20man%E2%80%99s%20IoC%E2%80" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F02%2Fannouncing-tinyioc-an-easy-to-use-hassle-free-inversion-of-control-container%2F&amp;title=Announcing%3A%20TinyIoC%20%26ndash%3B%20An%20Easy%20to%20Use%2C%20Hassle%20Free%2C%20Inversion%20of%20Control%20Container&amp;notes=Introduction%0D%0AWhenever%20I%20start%20a%20new%20%E2%80%9Cpet%E2%80%9D%20project%20I%20usually%20%2Awant%2A%20to%20use%20IoC%2C%20but%20I%20don%E2%80%99t%20really%20want%20the%20hassle%20of%20taking%20a%20dependency%20on%20a%20container%2C%20or%20adding%20another%20binary%20to%20my%20project.%20Usually%20this%20leaves%20me%20using%20%E2%80%9Cpoor%20man%E2%80%99s%20IoC%E2%80" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F02%2Fannouncing-tinyioc-an-easy-to-use-hassle-free-inversion-of-control-container%2F&amp;title=Announcing%3A%20TinyIoC%20%26ndash%3B%20An%20Easy%20to%20Use%2C%20Hassle%20Free%2C%20Inversion%20of%20Control%20Container" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F02%2Fannouncing-tinyioc-an-easy-to-use-hassle-free-inversion-of-control-container%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F02%2Fannouncing-tinyioc-an-easy-to-use-hassle-free-inversion-of-control-container%2F&amp;title=Announcing%3A%20TinyIoC%20%26ndash%3B%20An%20Easy%20to%20Use%2C%20Hassle%20Free%2C%20Inversion%20of%20Control%20Container" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Announcing%3A%20TinyIoC%20%26ndash%3B%20An%20Easy%20to%20Use%2C%20Hassle%20Free%2C%20Inversion%20of%20Control%20Container&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F02%2Fannouncing-tinyioc-an-easy-to-use-hassle-free-inversion-of-control-container%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Announcing%3A%20TinyIoC%20%26ndash%3B%20An%20Easy%20to%20Use%2C%20Hassle%20Free%2C%20Inversion%20of%20Control%20Container&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F02%2Fannouncing-tinyioc-an-easy-to-use-hassle-free-inversion-of-control-container%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F02%2Fannouncing-tinyioc-an-easy-to-use-hassle-free-inversion-of-control-container%2F&amp;title=Announcing%3A%20TinyIoC%20%26ndash%3B%20An%20Easy%20to%20Use%2C%20Hassle%20Free%2C%20Inversion%20of%20Control%20Container&amp;body=Introduction%0D%0AWhenever%20I%20start%20a%20new%20%E2%80%9Cpet%E2%80%9D%20project%20I%20usually%20%2Awant%2A%20to%20use%20IoC%2C%20but%20I%20don%E2%80%99t%20really%20want%20the%20hassle%20of%20taking%20a%20dependency%20on%20a%20container%2C%20or%20adding%20another%20binary%20to%20my%20project.%20Usually%20this%20leaves%20me%20using%20%E2%80%9Cpoor%20man%E2%80%99s%20IoC%E2%80" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F02%2Fannouncing-tinyioc-an-easy-to-use-hassle-free-inversion-of-control-container%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F02%2Fannouncing-tinyioc-an-easy-to-use-hassle-free-inversion-of-control-container%2F&amp;title=Announcing%3A%20TinyIoC%20%26ndash%3B%20An%20Easy%20to%20Use%2C%20Hassle%20Free%2C%20Inversion%20of%20Control%20Container" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/csharp' rel='tag' target='_blank'>csharp</a>, <a class='technorati-link' href='http://technorati.com/tag/dependency+injection' rel='tag' target='_blank'>dependency injection</a>, <a class='technorati-link' href='http://technorati.com/tag/di' rel='tag' target='_blank'>di</a>, <a class='technorati-link' href='http://technorati.com/tag/inversion+of+control' rel='tag' target='_blank'>inversion of control</a>, <a class='technorati-link' href='http://technorati.com/tag/ioc' rel='tag' target='_blank'>ioc</a>, <a class='technorati-link' href='http://technorati.com/tag/TinyIoC' rel='tag' target='_blank'>TinyIoC</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2010/03/02/announcing-tinyioc-an-easy-to-use-hassle-free-inversion-of-control-container/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Moving a Repository from SVN to Mercurial With Full History</title>
		<link>http://www.grumpydev.com/2010/03/01/moving-a-repository-from-svn-to-mercurial-with-full-history/</link>
		<comments>http://www.grumpydev.com/2010/03/01/moving-a-repository-from-svn-to-mercurial-with-full-history/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 13:58:30 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Mercurial]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[hg]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=284</guid>
		<description><![CDATA[Disclaimer Let me start with a disclaimer. I’ve only been using Mercurial for 2 days so my nomenclature may be completely wide of the mark. Hopefully this post will help other hgnewbies with what is probably a common requirement. Introduction I keep all of my pet projects in my own Subversion repository but I’ve recently [...]]]></description>
			<content:encoded><![CDATA[<h2>Disclaimer</h2>
<p>Let me start with a disclaimer. I’ve only been using Mercurial for 2 days so my nomenclature may be completely wide of the mark. Hopefully this post will help other hgnewbies with what is probably a common requirement.</p>
<h2>Introduction</h2>
<p>I keep all of my pet projects in my own Subversion repository but I’ve recently decided to give this distributed version control shenanigans a whirl. I ummed and arred about Git or Mercurial, but in the end I plumped for Mercurial, with a <a href="http://bitbucket.org/" target="_blank">bitbucket</a> account, as it seems to have more ubiquitous support. I’m about to release a project I’ve been working on for the last week or so and thought it would be nice to release it via bitbucket – complete with the version history I’d build up in Subversion.</p>
<p>Turns out, it’s really rather easy!</p>
<h2>I’m Converted!</h2>
<p>I’m assuming at this point you have the commandline version of Mercurial (hg) installed and working. If you don’t then you should probably go and do that first <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  I’ve also assumed you’ve already created a mercurial repository (bitbucket or elsewhere) called “<strong>myproject</strong>”.</p>
<p><em>In my scenario I was converting a single project with no trunk, branch or tag directories. The convert command is capable of handling much more advanced scenarios – take a look at the </em><a href="http://mercurial.selenic.com/wiki/ConvertExtension" target="_blank"><em>documentation</em></a><em> for more infomation.</em></p>
<p>First things first you need to edit your Mercurial settings (.hgrc for *nix, Mercurial.ini in your user dir for Windows) and add the following lines:</p>
<blockquote><p>[extensions]<br />
hgext.convert=</p></blockquote>
<p>This will add the “convert” command extension to our client. Next up we clone our repository and use the new convert command to add the SVN changesets into it:</p>
<blockquote><p>hg clone <a href="https://bitbucket.org/myuser/myproject">https://bitbucket.org/myuser/myproject</a></p>
<p>hg convert <a href="http://mysvn.server.com/svn/myproject/">http://mysvn.server.com/svn/myproject/</a> myproject</p></blockquote>
<p>The convert command will now start counting down the revisions and adding each one to our local hg repository. This may well take some time <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><strong>Potential gotcha: it <a href="http://mercurial.selenic.com/bts/issue1783" target="_blank">appears</a> that the convert extension <a href="http://mercurial.selenic.com/bts/issue1783" target="_blank">doesn’t work properly with Subversion repositories over http that require authentication</a>. If you get multiple “http authorization required” messages and prompts for your username/password then you have a problem. The only solution I found was to temporarily disable authentication while I did the conversion <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </strong></p>
<p>Once the conversion had finished we push our changes back:</p>
<blockquote><p>cd myproject</p>
<p>hg push</p></blockquote>
<p>Now at this point for me the push worked fine but my local repository had no files in it – despite insisting it was up to date. This may be my lack of knowledge on Mercurial, or it might be a bug, but deleting the myproject directory locally and cloning the remote repo again sorted things out.</p>
<h2>Conclusion</h2>
<p>All in all a pretty trivial task, albeit one that takes a while with a large repository. The only big issue is the authentication one I mention above – this may well be a showstopper for you if you can’t control the ACL on your Subversion repository.</p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Moving%20a%20Repository%20from%20SVN%20to%20Mercurial%20With%20Full%20History%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F01%2Fmoving-a-repository-from-svn-to-mercurial-with-full-history%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F01%2Fmoving-a-repository-from-svn-to-mercurial-with-full-history%2F&amp;title=Moving%20a%20Repository%20from%20SVN%20to%20Mercurial%20With%20Full%20History" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F01%2Fmoving-a-repository-from-svn-to-mercurial-with-full-history%2F&amp;title=Moving%20a%20Repository%20from%20SVN%20to%20Mercurial%20With%20Full%20History&amp;annotation=Disclaimer%0D%0ALet%20me%20start%20with%20a%20disclaimer.%20I%E2%80%99ve%20only%20been%20using%20Mercurial%20for%202%20days%20so%20my%20nomenclature%20may%20be%20completely%20wide%20of%20the%20mark.%20Hopefully%20this%20post%20will%20help%20other%20hgnewbies%20with%20what%20is%20probably%20a%20common%20requirement.%0D%0AIntroduction%0D%0AI%20" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F01%2Fmoving-a-repository-from-svn-to-mercurial-with-full-history%2F&amp;title=Moving%20a%20Repository%20from%20SVN%20to%20Mercurial%20With%20Full%20History&amp;bodytext=Disclaimer%0D%0ALet%20me%20start%20with%20a%20disclaimer.%20I%E2%80%99ve%20only%20been%20using%20Mercurial%20for%202%20days%20so%20my%20nomenclature%20may%20be%20completely%20wide%20of%20the%20mark.%20Hopefully%20this%20post%20will%20help%20other%20hgnewbies%20with%20what%20is%20probably%20a%20common%20requirement.%0D%0AIntroduction%0D%0AI%20" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F01%2Fmoving-a-repository-from-svn-to-mercurial-with-full-history%2F&amp;title=Moving%20a%20Repository%20from%20SVN%20to%20Mercurial%20With%20Full%20History&amp;notes=Disclaimer%0D%0ALet%20me%20start%20with%20a%20disclaimer.%20I%E2%80%99ve%20only%20been%20using%20Mercurial%20for%202%20days%20so%20my%20nomenclature%20may%20be%20completely%20wide%20of%20the%20mark.%20Hopefully%20this%20post%20will%20help%20other%20hgnewbies%20with%20what%20is%20probably%20a%20common%20requirement.%0D%0AIntroduction%0D%0AI%20" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F01%2Fmoving-a-repository-from-svn-to-mercurial-with-full-history%2F&amp;title=Moving%20a%20Repository%20from%20SVN%20to%20Mercurial%20With%20Full%20History" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F01%2Fmoving-a-repository-from-svn-to-mercurial-with-full-history%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F01%2Fmoving-a-repository-from-svn-to-mercurial-with-full-history%2F&amp;title=Moving%20a%20Repository%20from%20SVN%20to%20Mercurial%20With%20Full%20History" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Moving%20a%20Repository%20from%20SVN%20to%20Mercurial%20With%20Full%20History&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F01%2Fmoving-a-repository-from-svn-to-mercurial-with-full-history%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Moving%20a%20Repository%20from%20SVN%20to%20Mercurial%20With%20Full%20History&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F01%2Fmoving-a-repository-from-svn-to-mercurial-with-full-history%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F01%2Fmoving-a-repository-from-svn-to-mercurial-with-full-history%2F&amp;title=Moving%20a%20Repository%20from%20SVN%20to%20Mercurial%20With%20Full%20History&amp;body=Disclaimer%0D%0ALet%20me%20start%20with%20a%20disclaimer.%20I%E2%80%99ve%20only%20been%20using%20Mercurial%20for%202%20days%20so%20my%20nomenclature%20may%20be%20completely%20wide%20of%20the%20mark.%20Hopefully%20this%20post%20will%20help%20other%20hgnewbies%20with%20what%20is%20probably%20a%20common%20requirement.%0D%0AIntroduction%0D%0AI%20" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F01%2Fmoving-a-repository-from-svn-to-mercurial-with-full-history%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F03%2F01%2Fmoving-a-repository-from-svn-to-mercurial-with-full-history%2F&amp;title=Moving%20a%20Repository%20from%20SVN%20to%20Mercurial%20With%20Full%20History" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/convert' rel='tag' target='_blank'>convert</a>, <a class='technorati-link' href='http://technorati.com/tag/hg' rel='tag' target='_blank'>hg</a>, <a class='technorati-link' href='http://technorati.com/tag/history' rel='tag' target='_blank'>history</a>, <a class='technorati-link' href='http://technorati.com/tag/Mercurial' rel='tag' target='_blank'>Mercurial</a>, <a class='technorati-link' href='http://technorati.com/tag/subversion' rel='tag' target='_blank'>subversion</a>, <a class='technorati-link' href='http://technorati.com/tag/svn' rel='tag' target='_blank'>svn</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2010/03/01/moving-a-repository-from-svn-to-mercurial-with-full-history/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>So What Is This “Thread Safe” Thing Anyway?</title>
		<link>http://www.grumpydev.com/2010/02/26/so-what-is-this-thread-safe-thing-anyway/</link>
		<comments>http://www.grumpydev.com/2010/02/26/so-what-is-this-thread-safe-thing-anyway/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 10:10:18 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[concurrency]]></category>
		<category><![CDATA[concurrentdictionary]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[dictionary]]></category>
		<category><![CDATA[locks]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=273</guid>
		<description><![CDATA[Introduction Following on from my previous post about a “Thread Safe” Dictionary, and the subsequent comment from Rajeesh, made me think that perhaps a general post on “thread safety” was in order. Stop With the Quotes Already! The astute amongst you may notice I always try and put the phrase “thread safe” in quotes; and [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Following on from my previous post about a <a href="http://www.grumpydev.com/?p=264" target="_blank">“Thread Safe” Dictionary</a>, and the subsequent comment from Rajeesh, made me think that perhaps a general post on “thread safety” was in order.</p>
<h2>Stop With the Quotes Already!</h2>
<p>The astute amongst you may notice I always try and put the phrase “thread safe” in quotes; and there is a good reason for that! “Thread safe” is a pretty horrible term (although I can&#8217;t think of a better one) that doesn’t really give enough detail for what exactly we mean when we express that a class is “thread safe”. As far as I’m concerned, my “library” classes are thread safe if:</p>
<blockquote><p>“All public static and instance methods and properties on the class are safe to be called concurrently from multiple threads.”</p></blockquote>
<p>What this certainly does <strong>*not*</strong> mean is:</p>
<blockquote><p>“You do not have to consider thread safety or concurrency issues in your own code that uses this class.”</p></blockquote>
<p>So in the instance of our dictionary if you get/set a value and then in subsequent lines of code you <strong>*assume that the value you got or set hasn’t changed*</strong> then you have a concurrency issue in <strong>*your*</strong> code and you will <strong>*need to address it, likely using the same </strong><a href="http://msdn.microsoft.com/en-us/library/ms228964(VS.95).aspx" target="_blank"><strong>synchronisation primitives</strong></a><strong> we used internally in our SafeDictionary class.*</strong></p>
<h2>Some Examples</h2>
<p>As an example we can take similar code to the snippet that Rajeesh posted:</p>
<pre class="brush: csharp; toolbar: false;">// Check the item exists and process
// if it does
if (mySafeDictionary["Testing"] != null)
{
    // Process element
    ProcessElement(mySafeDictionary["Testing"]);
}</pre>
<p>Although each of those calls to the SafeDictionary are themselves threadsafe, we are making an assumption in *our code* that those value won’t change between the “if” statement and our call to ProcessElement. This particular scenario is one reason why we should always try to use TryGetValue, rather than the “if it exists do this with it” approach above. To this end we should probably alter our SafeDictionary to explicitly deny gets:</p>
<pre class="brush: csharp; toolbar: false;">public class SafeDictionary&lt;TKey, TValue&gt;
{
    private readonly object _Padlock = new object();
    private readonly Dictionary&lt;TKey, TValue&gt; _Dictionary = new Dictionary&lt;TKey, TValue&gt;();

    public TValue this[TKey key]
    {
        set
        {
            lock (_Padlock)
            {
                _Dictionary[key] = value;
            }
        }
    }

    public bool TryGetValue(TKey key, out TValue value)
    {
        lock (_Padlock)
        {
            return _Dictionary.TryGetValue(key, out value);
        }
    }
}</pre>
<p>If you now try and access a member using the array syntax, rather than through TryGetValue you will get a compile time error like:</p>
<blockquote><p>The property or indexer &#8216;Variabler.this[string]&#8216; cannot be used in this context because it lacks the get accessor.</p></blockquote>
<p>From that simple example you may think that TryGetValue solves all our problems; but unfortunately it still isn’t able to save your from yourself! To reiterate what I said earlier, you need to consider concurrency yourself if you <strong>*assume that the value you got or set hasn’t changed*</strong>. Assuming we expand our SafeDictionary to include all of the options that the normal Dictionary supports, take the following horribly contrived example:</p>
<pre class="brush: csharp; toolbar: false;">public List&lt;String&gt; GetKeysToProcess()
{
    object myObject;
    List&lt;String&gt; keysToProcess = new List&lt;String&gt;();

    // Check to see if the type is valid for
    // processing
    foreach (var currentKey in myDictionary.Keys)
    {
        if (myDictionary.TryGetValue(currentKey, out myObject))
        {
            if (myObject.GetType() == typeof(ProcessorClass))
                keysToProcess.Add(currentKey);
        }
    }

    return keysToProcess;
}</pre>
<p>Now there’s a chance that a key might have been removed between the start of the foreach and us actually using it; but as we use TryGetValue that doesn’t matter – the value just won’t resolve. The key here (pardon the pun) is that we are building and returning a list that <strong>*makes assumptions about the contents of the dictionary*</strong>. Even if in our consuming code we stick to TryGetValue to handle items being deleted, there’s nothing in this example preventing another thread changing any of the items to be a different type – effectively rendering our List of “Keys to process” completely invalid.</p>
<h2>Conclusion</h2>
<p>The examples above are very contrived, and I’d hope nobody would ever write those exact pieces of code; but hopefully it illustrates the point that <strong>*just because you are working with a “Thread safe” object doesn’t mean you can ignore thread safety concerns in your own code*.</strong></p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=So%20What%20Is%20This%20%26ldquo%3BThread%20Safe%26rdquo%3B%20Thing%20Anyway%3F%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F26%2Fso-what-is-this-thread-safe-thing-anyway%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F26%2Fso-what-is-this-thread-safe-thing-anyway%2F&amp;title=So%20What%20Is%20This%20%26ldquo%3BThread%20Safe%26rdquo%3B%20Thing%20Anyway%3F" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F26%2Fso-what-is-this-thread-safe-thing-anyway%2F&amp;title=So%20What%20Is%20This%20%26ldquo%3BThread%20Safe%26rdquo%3B%20Thing%20Anyway%3F&amp;annotation=Introduction%0D%0AFollowing%20on%20from%20my%20previous%20post%20about%20a%20%E2%80%9CThread%20Safe%E2%80%9D%20Dictionary%2C%20and%20the%20subsequent%20comment%20from%20Rajeesh%2C%20made%20me%20think%20that%20perhaps%20a%20general%20post%20on%20%E2%80%9Cthread%20safety%E2%80%9D%20was%20in%20order.%0D%0AStop%20With%20the%20Quotes%20Already%21%0D%0AThe%20astute%20" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F26%2Fso-what-is-this-thread-safe-thing-anyway%2F&amp;title=So%20What%20Is%20This%20%26ldquo%3BThread%20Safe%26rdquo%3B%20Thing%20Anyway%3F&amp;bodytext=Introduction%0D%0AFollowing%20on%20from%20my%20previous%20post%20about%20a%20%E2%80%9CThread%20Safe%E2%80%9D%20Dictionary%2C%20and%20the%20subsequent%20comment%20from%20Rajeesh%2C%20made%20me%20think%20that%20perhaps%20a%20general%20post%20on%20%E2%80%9Cthread%20safety%E2%80%9D%20was%20in%20order.%0D%0AStop%20With%20the%20Quotes%20Already%21%0D%0AThe%20astute%20" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F26%2Fso-what-is-this-thread-safe-thing-anyway%2F&amp;title=So%20What%20Is%20This%20%26ldquo%3BThread%20Safe%26rdquo%3B%20Thing%20Anyway%3F&amp;notes=Introduction%0D%0AFollowing%20on%20from%20my%20previous%20post%20about%20a%20%E2%80%9CThread%20Safe%E2%80%9D%20Dictionary%2C%20and%20the%20subsequent%20comment%20from%20Rajeesh%2C%20made%20me%20think%20that%20perhaps%20a%20general%20post%20on%20%E2%80%9Cthread%20safety%E2%80%9D%20was%20in%20order.%0D%0AStop%20With%20the%20Quotes%20Already%21%0D%0AThe%20astute%20" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F26%2Fso-what-is-this-thread-safe-thing-anyway%2F&amp;title=So%20What%20Is%20This%20%26ldquo%3BThread%20Safe%26rdquo%3B%20Thing%20Anyway%3F" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F26%2Fso-what-is-this-thread-safe-thing-anyway%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F26%2Fso-what-is-this-thread-safe-thing-anyway%2F&amp;title=So%20What%20Is%20This%20%26ldquo%3BThread%20Safe%26rdquo%3B%20Thing%20Anyway%3F" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=So%20What%20Is%20This%20%26ldquo%3BThread%20Safe%26rdquo%3B%20Thing%20Anyway%3F&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F26%2Fso-what-is-this-thread-safe-thing-anyway%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=So%20What%20Is%20This%20%26ldquo%3BThread%20Safe%26rdquo%3B%20Thing%20Anyway%3F&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F26%2Fso-what-is-this-thread-safe-thing-anyway%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F26%2Fso-what-is-this-thread-safe-thing-anyway%2F&amp;title=So%20What%20Is%20This%20%26ldquo%3BThread%20Safe%26rdquo%3B%20Thing%20Anyway%3F&amp;body=Introduction%0D%0AFollowing%20on%20from%20my%20previous%20post%20about%20a%20%E2%80%9CThread%20Safe%E2%80%9D%20Dictionary%2C%20and%20the%20subsequent%20comment%20from%20Rajeesh%2C%20made%20me%20think%20that%20perhaps%20a%20general%20post%20on%20%E2%80%9Cthread%20safety%E2%80%9D%20was%20in%20order.%0D%0AStop%20With%20the%20Quotes%20Already%21%0D%0AThe%20astute%20" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F26%2Fso-what-is-this-thread-safe-thing-anyway%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F26%2Fso-what-is-this-thread-safe-thing-anyway%2F&amp;title=So%20What%20Is%20This%20%26ldquo%3BThread%20Safe%26rdquo%3B%20Thing%20Anyway%3F" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/concurrency' rel='tag' target='_blank'>concurrency</a>, <a class='technorati-link' href='http://technorati.com/tag/concurrentdictionary' rel='tag' target='_blank'>concurrentdictionary</a>, <a class='technorati-link' href='http://technorati.com/tag/csharp' rel='tag' target='_blank'>csharp</a>, <a class='technorati-link' href='http://technorati.com/tag/dictionary' rel='tag' target='_blank'>dictionary</a>, <a class='technorati-link' href='http://technorati.com/tag/locks' rel='tag' target='_blank'>locks</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2010/02/26/so-what-is-this-thread-safe-thing-anyway/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>“Thread safe” Dictionary(TKey,TValue)</title>
		<link>http://www.grumpydev.com/2010/02/25/thread-safe-dictionarytkeytvalue/</link>
		<comments>http://www.grumpydev.com/2010/02/25/thread-safe-dictionarytkeytvalue/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 18:56:58 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[concurrency]]></category>
		<category><![CDATA[concurrentdictionary]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[dictionary]]></category>
		<category><![CDATA[locks]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=264</guid>
		<description><![CDATA[Update : Based on a comment on this post I&#8217;ve added a follow up post that covers the question: What is This &#8220;Thread Safe&#8221; Thing Anyway? Introduction A pet project I’m currently working on requires the use of an internal Dictionary to store “registered” data, which is a pretty common requirement. For this particular project [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update : Based on a comment on this post I&#8217;ve added a follow up post that covers the question: <a href="http://www.grumpydev.com/2010/02/26/so-what-is-this-thread-safe-thing-anyway/" target="_blank">What is This &#8220;Thread Safe&#8221; Thing Anyway?</a></strong></p>
<h2>Introduction</h2>
<p>A pet project I’m currently working on requires the use of an internal Dictionary to store “registered” data, which is a pretty common requirement. For this particular project I’d like to at least *attempt* to make it “thread safe” on .NET 3.5, with an eye to moving it to the <a href="http://msdn.microsoft.com/en-us/library/dd287191(VS.100).aspx" target="_blank">ConcurrentDictionary</a> in .NET 4 which promises not only thread safety, but more granular locking to increase multi-threaded performance.</p>
<p>A simple enough task, but one that I’ve seen many people make mistakes implementing.</p>
<h2>Just Locking Writes?</h2>
<p>It’s obvious we need to do some kind of <a href="http://msdn.microsoft.com/en-us/library/ms228964(VS.95).aspx" target="_blank">syncronisation primitive</a> around our writes, but first impressions might make you think that read should be ok &#8211; especially if we stick to the preferred <a href="http://msdn.microsoft.com/en-us/library/zkw5c9ak(VS.85,classic).aspx" target="_blank">TryGetValue</a> pattern instead of “if it exists then get the value”:</p>
<pre class="brush: csharp; toolbar: false;">object myValue;

// This is obviously not thread safe.
// Something else can alter the collection
// between ContainsKey and reading the
// value.
if (dictionary.ContainsKey("Testing"))
{     myValue = dictionary["Testing"];
}

// Using TryGetValue looks safe though?
// Doesn't it?!
if (!dictionary.TryGetValue("Testing", out myValue))     throw new KeyNotFoundException();</pre>
<p>Unfortunately if we fire up <a href="http://www.red-gate.com/products/reflector/" target="_blank">Reflector</a>, and take a look at how TryGetValue is implemented, it’s pretty obvious it has exactly the same concurrency problem as the first method above:</p>
<pre class="brush: csharp; toolbar: false;">public bool TryGetValue(TKey key, out TValue value)
{
    int index = this.FindEntry(key);
    if (index &gt;= 0)
    {
        value = this.entries[index].value;
        return true;
    }
    value = default(TValue);
    return false;
}</pre>
<h2>Ok, So I Will Lock Reads and Writes?</h2>
<p>The next obvious approach would be to find everywhere in our code where we access the Dictionary, for either reading or writing, and use a <a href="http://msdn.microsoft.com/en-us/library/ms228964(VS.95).aspx" target="_blank">syncronisation primitive</a>, such as <a href="http://msdn.microsoft.com/en-us/library/c5kehkcz(VS.71).aspx" target="_blank">lock</a>, to ensure we’re only accessing it from a single thread at any one time:</p>
<pre class="brush: csharp; toolbar: false;">private readonly object padlock = new object();
private readonly Dictionary&lt;string, object&gt; dictionary = new Dictionary&lt;string, object&gt;();

private void Test()
{
    object myValue;

    // Now we lock before we do anything
    lock (padlock)
    {
        if (dictionary.ContainsKey("Testing"))
        {
            myValue = dictionary["Testing"];
        }
    }

    lock (padlock)
    {
        if (!dictionary.TryGetValue("Testing", out myValue))
            throw new KeyNotFoundException();
    }
}</pre>
<p>Simple enough, but you’re relying on locking around every access, which is not only ugly, but also potentially prone to errors if you miss one. Also, once we move our code to .NET 4, and the new ConcurrentDictionary, we will have to go through the code and remove each lock in turn – pretty laborious!</p>
<h2>Composition, Composition, Composition!</h2>
<p>In this approach we wrap our nasty non-thread safe dictionary in our own class, expose the methods we want to use, and take any locks accordingly. This class only implements “array” access and TryGetValue, but is sufficient to show the approach:</p>
<pre class="brush: csharp; toolbar: false;">public class SafeDictionary&lt;TKey, TValue&gt;
{
    private readonly object _Padlock = new object();
    private readonly Dictionary&lt;TKey, TValue&gt; _Dictionary = new Dictionary&lt;TKey, TValue&gt;();

    public TValue this[TKey key]
    {
        get
        {
            lock (_Padlock)
            {
                return _Dictionary[key];
            }
        }
        set
        {
            lock (_Padlock)
            {
                _Dictionary[key] = value;
            }
        }
    }

    public bool TryGetValue(TKey key, out TValue value)
    {
        lock (_Padlock)
        {
            return _Dictionary.TryGetValue(key, out value);
        }
    }
}</pre>
<p>As we prevent any direct access to the Dictionary, and use our lock internally whenever we need to access it, we can now use our SafeDictionary in code without worrying about concurrency issues – both for reading and for writing!</p>
<h2>To .Net 4 ?</h2>
<p>As I mentioned earlier .Net 4 will be shipping with several “thread safe” collections, including a dictionary, in the new <a href="http://msdn.microsoft.com/en-us/library/system.collections.concurrent(VS.100).aspx" target="_blank">System.Collections.Concurrent namespace</a>. As we have our own SafeDictionary implementation we have a few options here:</p>
<ul>
<li>We could go through our code and replace all references to SafeDictionary with ConcurrentDictionary. We don’t have any locks in our main code so we could do this with a direct replacement.</li>
<li>We could alter our SafeDictionary to use a ConcurrentDictionary internally, and remove all of our internal locks.</li>
<li>If we don’t mind exposing extra methods we can remove all of the implementation from SafeDictionary and just derive it from ConcurrentDictionary:</li>
</ul>
<pre class="brush: csharp; toolbar: false;">public class SafeDictionary&lt;Tkey, TValue&gt; : ConcurrentDictionary&lt;Tkey, TValue&gt;
{
}</pre>
<h2>Conclusion</h2>
<p>Quite a long blog post for quite a simple issue, but even simple concurrency can be the source of mistakes and headaches. Once .NET 4 arrives with its <a href="http://msdn.microsoft.com/en-us/library/system.collections.concurrent(VS.100).aspx" target="_blank">concurrent collections</a>, <a href="http://www.microsoft.com/uk/msdn/nuggets/nugget/290/Intro-to-Parallel-Extensions-to-the-NET-Framework.aspx" target="_blank">parallel extensions</a> and <a href="http://www.danielmoth.com/Blog/2009/05/parallel-tasks-new-visual-studio-2010.html" target="_blank">parallel debugging options</a> hopefully at least *some* of this headache will go away.</p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=%E2%80%9CThread%20safe%E2%80%9D%20Dictionary%28TKey%2CTValue%29%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F25%2Fthread-safe-dictionarytkeytvalue%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F25%2Fthread-safe-dictionarytkeytvalue%2F&amp;title=%E2%80%9CThread%20safe%E2%80%9D%20Dictionary%28TKey%2CTValue%29" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F25%2Fthread-safe-dictionarytkeytvalue%2F&amp;title=%E2%80%9CThread%20safe%E2%80%9D%20Dictionary%28TKey%2CTValue%29&amp;annotation=Update%20%3A%20Based%20on%20a%20comment%20on%20this%20post%20I%27ve%20added%20a%20follow%20up%20post%20that%20covers%20the%20question%3A%20What%20is%20This%20%22Thread%20Safe%22%20Thing%20Anyway%3F%0D%0AIntroduction%0D%0AA%20pet%20project%20I%E2%80%99m%20currently%20working%20on%20requires%20the%20use%20of%20an%20internal%20Dictionary%20to%20store%20%E2%80%9Creg" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F25%2Fthread-safe-dictionarytkeytvalue%2F&amp;title=%E2%80%9CThread%20safe%E2%80%9D%20Dictionary%28TKey%2CTValue%29&amp;bodytext=Update%20%3A%20Based%20on%20a%20comment%20on%20this%20post%20I%27ve%20added%20a%20follow%20up%20post%20that%20covers%20the%20question%3A%20What%20is%20This%20%22Thread%20Safe%22%20Thing%20Anyway%3F%0D%0AIntroduction%0D%0AA%20pet%20project%20I%E2%80%99m%20currently%20working%20on%20requires%20the%20use%20of%20an%20internal%20Dictionary%20to%20store%20%E2%80%9Creg" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F25%2Fthread-safe-dictionarytkeytvalue%2F&amp;title=%E2%80%9CThread%20safe%E2%80%9D%20Dictionary%28TKey%2CTValue%29&amp;notes=Update%20%3A%20Based%20on%20a%20comment%20on%20this%20post%20I%27ve%20added%20a%20follow%20up%20post%20that%20covers%20the%20question%3A%20What%20is%20This%20%22Thread%20Safe%22%20Thing%20Anyway%3F%0D%0AIntroduction%0D%0AA%20pet%20project%20I%E2%80%99m%20currently%20working%20on%20requires%20the%20use%20of%20an%20internal%20Dictionary%20to%20store%20%E2%80%9Creg" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F25%2Fthread-safe-dictionarytkeytvalue%2F&amp;title=%E2%80%9CThread%20safe%E2%80%9D%20Dictionary%28TKey%2CTValue%29" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F25%2Fthread-safe-dictionarytkeytvalue%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F25%2Fthread-safe-dictionarytkeytvalue%2F&amp;title=%E2%80%9CThread%20safe%E2%80%9D%20Dictionary%28TKey%2CTValue%29" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=%E2%80%9CThread%20safe%E2%80%9D%20Dictionary%28TKey%2CTValue%29&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F25%2Fthread-safe-dictionarytkeytvalue%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=%E2%80%9CThread%20safe%E2%80%9D%20Dictionary%28TKey%2CTValue%29&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F25%2Fthread-safe-dictionarytkeytvalue%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F25%2Fthread-safe-dictionarytkeytvalue%2F&amp;title=%E2%80%9CThread%20safe%E2%80%9D%20Dictionary%28TKey%2CTValue%29&amp;body=Update%20%3A%20Based%20on%20a%20comment%20on%20this%20post%20I%27ve%20added%20a%20follow%20up%20post%20that%20covers%20the%20question%3A%20What%20is%20This%20%22Thread%20Safe%22%20Thing%20Anyway%3F%0D%0AIntroduction%0D%0AA%20pet%20project%20I%E2%80%99m%20currently%20working%20on%20requires%20the%20use%20of%20an%20internal%20Dictionary%20to%20store%20%E2%80%9Creg" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F25%2Fthread-safe-dictionarytkeytvalue%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2010%2F02%2F25%2Fthread-safe-dictionarytkeytvalue%2F&amp;title=%E2%80%9CThread%20safe%E2%80%9D%20Dictionary%28TKey%2CTValue%29" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/concurrency' rel='tag' target='_blank'>concurrency</a>, <a class='technorati-link' href='http://technorati.com/tag/concurrentdictionary' rel='tag' target='_blank'>concurrentdictionary</a>, <a class='technorati-link' href='http://technorati.com/tag/csharp' rel='tag' target='_blank'>csharp</a>, <a class='technorati-link' href='http://technorati.com/tag/dictionary' rel='tag' target='_blank'>dictionary</a>, <a class='technorati-link' href='http://technorati.com/tag/locks' rel='tag' target='_blank'>locks</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2010/02/25/thread-safe-dictionarytkeytvalue/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Hotwire – A Remote Control Quick Launch Utility for LogMeIn</title>
		<link>http://www.grumpydev.com/2009/12/27/hotwire-a-remote-control-quick-launch-utility-for-logmein/</link>
		<comments>http://www.grumpydev.com/2009/12/27/hotwire-a-remote-control-quick-launch-utility-for-logmein/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 08:05:20 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[Hotwire]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[googlecode]]></category>
		<category><![CDATA[logmein]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=258</guid>
		<description><![CDATA[Introduction Hotwire is a project I started some time ago but never completed. It was designed to be a “quick launch” utility for remote controlling machines using the excellent LogMeIn service. While the better half was “enjoying” the Boxing Day sales I took it upon myself to finish the project. And by finish, I obviously [...]]]></description>
			<content:encoded><![CDATA[<h1><a href="http://www.grumpydev.com/wp-content/uploads/2009/12/hotwiresmall.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="hotwire-small" border="0" alt="hotwire-small" src="http://www.grumpydev.com/wp-content/uploads/2009/12/hotwiresmall_thumb.png" width="240" height="72" /></a> </h1>
<h2>Introduction</h2>
<p>Hotwire is a project I started <a href="http://www.grumpydev.com/2009/03/08/wpf-bootstrapping-notifyicon-shutdownmode-and-the-mysterious-vanishing-application/" target="_blank">some time ago</a> but never completed. It was designed to be a “quick launch” utility for remote controlling machines using the excellent <a href="http://www.logmein.com/" target="_blank">LogMeIn</a> service. While the better half was “enjoying” the Boxing Day sales I took it upon myself to finish the project. And by finish, I obviously mean a complete rewrite <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h2>What does it do?</h2>
<p>I’ve used LogMeIn for quite a while now, and it’s an excellent service, but 99% of the time I just want to get straight to the desktop of the machine I’m connecting to and Hotwire is designed to let me do just that.</p>
<p>The application itself is written using WPF and consists of two parts; the launcher, which sits in the task tray, and the main application. The launcher provides machine configuration and quick launch options for connecting to remote machines. The main application is just a single window (containing a WPF <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.aspx" target="_blank">WebBrowser</a> control) that connects to LogMeIn and does some jiggery pokery to get you directly to your machine desktop.</p>
<h2>More Information</h2>
<p>The project is up on Google Code at <a href="http://code.google.com/p/hotwire/">http://code.google.com/p/hotwire/</a> – I normally prefer to use CodePlex, but the Hotwire name was already taken <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' />  The Google code site contains a downloadable installer, and the source code should anyone be interested.</p>
<h2>Screenshots</h2>
<p><a href="http://www.grumpydev.com/wp-content/uploads/2009/12/Tray.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Tray" border="0" alt="Tray" src="http://www.grumpydev.com/wp-content/uploads/2009/12/Tray_thumb.png" width="244" height="133" /></a> </p>
<p><a href="http://www.grumpydev.com/wp-content/uploads/2009/12/Configuration.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Configuration" border="0" alt="Configuration" src="http://www.grumpydev.com/wp-content/uploads/2009/12/Configuration_thumb.png" width="404" height="404" /></a></p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Hotwire%20%26ndash%3B%20A%20Remote%20Control%20Quick%20Launch%20Utility%20for%20LogMeIn%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2009%2F12%2F27%2Fhotwire-a-remote-control-quick-launch-utility-for-logmein%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F12%2F27%2Fhotwire-a-remote-control-quick-launch-utility-for-logmein%2F&amp;title=Hotwire%20%26ndash%3B%20A%20Remote%20Control%20Quick%20Launch%20Utility%20for%20LogMeIn" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F12%2F27%2Fhotwire-a-remote-control-quick-launch-utility-for-logmein%2F&amp;title=Hotwire%20%26ndash%3B%20A%20Remote%20Control%20Quick%20Launch%20Utility%20for%20LogMeIn&amp;annotation=%20%20%20Introduction%20%20Hotwire%20is%20a%20project%20I%20started%20some%20time%20ago%20but%20never%20completed.%20It%20was%20designed%20to%20be%20a%20%E2%80%9Cquick%20launch%E2%80%9D%20utility%20for%20remote%20controlling%20machines%20using%20the%20excellent%20LogMeIn%20service.%20While%20the%20better%20half%20was%20%E2%80%9Cenjoying%E2%80%9D%20the%20Bo" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F12%2F27%2Fhotwire-a-remote-control-quick-launch-utility-for-logmein%2F&amp;title=Hotwire%20%26ndash%3B%20A%20Remote%20Control%20Quick%20Launch%20Utility%20for%20LogMeIn&amp;bodytext=%20%20%20Introduction%20%20Hotwire%20is%20a%20project%20I%20started%20some%20time%20ago%20but%20never%20completed.%20It%20was%20designed%20to%20be%20a%20%E2%80%9Cquick%20launch%E2%80%9D%20utility%20for%20remote%20controlling%20machines%20using%20the%20excellent%20LogMeIn%20service.%20While%20the%20better%20half%20was%20%E2%80%9Cenjoying%E2%80%9D%20the%20Bo" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F12%2F27%2Fhotwire-a-remote-control-quick-launch-utility-for-logmein%2F&amp;title=Hotwire%20%26ndash%3B%20A%20Remote%20Control%20Quick%20Launch%20Utility%20for%20LogMeIn&amp;notes=%20%20%20Introduction%20%20Hotwire%20is%20a%20project%20I%20started%20some%20time%20ago%20but%20never%20completed.%20It%20was%20designed%20to%20be%20a%20%E2%80%9Cquick%20launch%E2%80%9D%20utility%20for%20remote%20controlling%20machines%20using%20the%20excellent%20LogMeIn%20service.%20While%20the%20better%20half%20was%20%E2%80%9Cenjoying%E2%80%9D%20the%20Bo" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F12%2F27%2Fhotwire-a-remote-control-quick-launch-utility-for-logmein%2F&amp;title=Hotwire%20%26ndash%3B%20A%20Remote%20Control%20Quick%20Launch%20Utility%20for%20LogMeIn" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F12%2F27%2Fhotwire-a-remote-control-quick-launch-utility-for-logmein%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F12%2F27%2Fhotwire-a-remote-control-quick-launch-utility-for-logmein%2F&amp;title=Hotwire%20%26ndash%3B%20A%20Remote%20Control%20Quick%20Launch%20Utility%20for%20LogMeIn" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Hotwire%20%26ndash%3B%20A%20Remote%20Control%20Quick%20Launch%20Utility%20for%20LogMeIn&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F12%2F27%2Fhotwire-a-remote-control-quick-launch-utility-for-logmein%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Hotwire%20%26ndash%3B%20A%20Remote%20Control%20Quick%20Launch%20Utility%20for%20LogMeIn&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F12%2F27%2Fhotwire-a-remote-control-quick-launch-utility-for-logmein%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F12%2F27%2Fhotwire-a-remote-control-quick-launch-utility-for-logmein%2F&amp;title=Hotwire%20%26ndash%3B%20A%20Remote%20Control%20Quick%20Launch%20Utility%20for%20LogMeIn&amp;body=%20%20%20Introduction%20%20Hotwire%20is%20a%20project%20I%20started%20some%20time%20ago%20but%20never%20completed.%20It%20was%20designed%20to%20be%20a%20%E2%80%9Cquick%20launch%E2%80%9D%20utility%20for%20remote%20controlling%20machines%20using%20the%20excellent%20LogMeIn%20service.%20While%20the%20better%20half%20was%20%E2%80%9Cenjoying%E2%80%9D%20the%20Bo" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F12%2F27%2Fhotwire-a-remote-control-quick-launch-utility-for-logmein%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F12%2F27%2Fhotwire-a-remote-control-quick-launch-utility-for-logmein%2F&amp;title=Hotwire%20%26ndash%3B%20A%20Remote%20Control%20Quick%20Launch%20Utility%20for%20LogMeIn" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/googlecode' rel='tag' target='_blank'>googlecode</a>, <a class='technorati-link' href='http://technorati.com/tag/Hotwire' rel='tag' target='_blank'>Hotwire</a>, <a class='technorati-link' href='http://technorati.com/tag/logmein' rel='tag' target='_blank'>logmein</a>, <a class='technorati-link' href='http://technorati.com/tag/WPF' rel='tag' target='_blank'>WPF</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2009/12/27/hotwire-a-remote-control-quick-launch-utility-for-logmein/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WPF RichTextBox Subscript and Superscript Without Font Restrictions</title>
		<link>http://www.grumpydev.com/2009/11/05/wpf-richtextbox-subscript-and-superscript-without-font-restrictions/</link>
		<comments>http://www.grumpydev.com/2009/11/05/wpf-richtextbox-subscript-and-superscript-without-font-restrictions/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 21:30:39 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[opentype]]></category>
		<category><![CDATA[richtextbox]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=248</guid>
		<description><![CDATA[Introduction One of the most bizarre limitation of the WPF RichTextBox is its hit and miss support for subscript and superscript in text. Although you can set the style quite easily using appropriate command, in order for this property to actually alter the appearance of the text the font needs to be OpenType, and come [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>One of the most bizarre limitation of the WPF <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.richtextbox.aspx" target="_blank">RichTextBox</a> is its hit and miss support for subscript and superscript in text. Although you can set the style quite easily using <a href="http://msdn.microsoft.com/en-us/library/system.windows.documents.editingcommands.togglesuperscript.aspx" target="_blank">appropriate command</a>, in order for this property to actually alter the appearance of the text the font needs to be OpenType, and <a href="http://msdn.microsoft.com/en-us/library/ms745109.aspx#variants" target="_blank">come with a Subscript/Superscript variant</a>, which the vast majority of fonts do not. Obviously in a control that’s designed for user input, restricting what fonts can be used in this way is far from ideal.</p>
<h2>An Alternative Approach</h2>
<p>Having spent some time poking around inside <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.richtextbox.aspx" target="_blank">RichTextBox</a> I would strongly recommend that you don’t. Seriously. The code may well make you physically sick. In the past I have tried to use <a href="http://msdn.microsoft.com/en-us/library/system.windows.documents.textrange.applypropertyvalue.aspx" target="_blank">TextRange.ApplyPropertyValue</a>, which takes a normal DependencyProperty, to attach my own property to a piece of text. You’d imagine this would be pretty straightforward, especially as attaching properties to other types is a fairly fundamental part of WPF, but unfortunately there’s a particularly <em>lovely</em> piece of code that checks to see if the DependencyProperty is on a predefined “allowed” list, and thows an exception if it isn’t. While this chunk of code scuppered my ideas in the past, it did provide a useful place to look for an alternative way to create Subscript and Superscript text.</p>
<p>One of the properties that we are “allowed” to apply to text is <a href="http://msdn.microsoft.com/en-us/library/system.windows.documents.inline.baselinealignment.aspx" target="_blank">Inline.BaselineAlignmentProperty</a> which takes its values from the <a href="http://msdn.microsoft.com/en-us/library/system.windows.baselinealignment.aspx" target="_blank">BaselineAlignment enumeration</a> which includes the following values:</p>
<ul>
<li><strong>Top</strong>       <br />A baseline that is aligned to the upper edge of the containing box. </li>
<li><strong>Center</strong>       <br />A baseline that is aligned to the center of the containing box. </li>
<li><strong>Bottom</strong>       <br />A baseline that is aligned at the lower edge of the containing box. </li>
<li><strong>Baseline</strong>       <br />A baseline that is aligned at the actual baseline of the containing box. </li>
<li><strong>TextTop</strong>       <br />A baseline that is aligned at the upper edge of the text baseline. </li>
<li><strong>TextBottom</strong>       <br />A baseline that is aligned at the lower edge of the text baseline. </li>
<li><strong>Subscript</strong>       <br />A baseline that is aligned at the subscript position of the containing box. </li>
<li><strong>Superscript</strong>       <br />A baseline that is aligned at the superscript position of the containing box. </li>
</ul>
<p>Subscript and Superscript look exactly like what we want, and amazingly, they actually work <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  To demonstrate the technique I’ve created two simple extension methods that toggle either Sub or Superscript on the selected text:</p>
<pre class="c#:nocontrols" name="code">/// &lt;summary&gt;
/// Toggle Superscript for the currently selected text in a RichTextBox. Does not require the font to be OpenType or have a Superscript font style.
///
/// Doesn't attempt to change/restore the size of the font, just moves the baseline.
/// &lt;/summary&gt;
/// &lt;param name=&quot;richTextBox&quot;&gt;RichTextBox with selected text&lt;/param&gt;
public static void ToggleSelectionSuperscript(this RichTextBox richTextBox)
{
    var currentAlignment = richTextBox.Selection.GetPropertyValue(Inline.BaselineAlignmentProperty);

    BaselineAlignment newAlignment = ((BaselineAlignment)currentAlignment == BaselineAlignment.Superscript) ? BaselineAlignment.Baseline : BaselineAlignment.Superscript;
    richTextBox.Selection.ApplyPropertyValue(Inline.BaselineAlignmentProperty, newAlignment);
}</pre>
<p>The code checks the current value of the BaselineAlignmentProperty and toggles the value as appropriate. I’ve made no attempt to adjust font size, or do anything clever, so it does look a <em>little</em> goofy, but it proves the concept. The demo application also includes the XAML content of the RichTextBox document so you can see exactly what content it’s producing:</p>
<p><a href="http://www.grumpydev.com/wp-content/uploads/2009/11/RichTextBoxSubSuperscriptScreenshot.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="RichTextBoxSubSuperscriptScreenshot" border="0" alt="RichTextBoxSubSuperscriptScreenshot" src="http://www.grumpydev.com/wp-content/uploads/2009/11/RichTextBoxSubSuperscriptScreenshot_thumb.png" width="244" height="173" /></a> </p>
<p>And that’s that, hope it helps someone out <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  You can grab the sample demo from the link below:</p>
<p><a href="http://www.grumpydev.com/wp-content/uploads/2009/11/RichTextBoxSubSuperscript.zip" target="_blank">RichTextBoxSubSuperscript.zip</a></p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=WPF%20RichTextBox%20Subscript%20and%20Superscript%20Without%20Font%20Restrictions%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2009%2F11%2F05%2Fwpf-richtextbox-subscript-and-superscript-without-font-restrictions%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F11%2F05%2Fwpf-richtextbox-subscript-and-superscript-without-font-restrictions%2F&amp;title=WPF%20RichTextBox%20Subscript%20and%20Superscript%20Without%20Font%20Restrictions" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F11%2F05%2Fwpf-richtextbox-subscript-and-superscript-without-font-restrictions%2F&amp;title=WPF%20RichTextBox%20Subscript%20and%20Superscript%20Without%20Font%20Restrictions&amp;annotation=Introduction%20%20One%20of%20the%20most%20bizarre%20limitation%20of%20the%20WPF%20RichTextBox%20is%20its%20hit%20and%20miss%20support%20for%20subscript%20and%20superscript%20in%20text.%20Although%20you%20can%20set%20the%20style%20quite%20easily%20using%20appropriate%20command%2C%20in%20order%20for%20this%20property%20to%20actually%20a" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F11%2F05%2Fwpf-richtextbox-subscript-and-superscript-without-font-restrictions%2F&amp;title=WPF%20RichTextBox%20Subscript%20and%20Superscript%20Without%20Font%20Restrictions&amp;bodytext=Introduction%20%20One%20of%20the%20most%20bizarre%20limitation%20of%20the%20WPF%20RichTextBox%20is%20its%20hit%20and%20miss%20support%20for%20subscript%20and%20superscript%20in%20text.%20Although%20you%20can%20set%20the%20style%20quite%20easily%20using%20appropriate%20command%2C%20in%20order%20for%20this%20property%20to%20actually%20a" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F11%2F05%2Fwpf-richtextbox-subscript-and-superscript-without-font-restrictions%2F&amp;title=WPF%20RichTextBox%20Subscript%20and%20Superscript%20Without%20Font%20Restrictions&amp;notes=Introduction%20%20One%20of%20the%20most%20bizarre%20limitation%20of%20the%20WPF%20RichTextBox%20is%20its%20hit%20and%20miss%20support%20for%20subscript%20and%20superscript%20in%20text.%20Although%20you%20can%20set%20the%20style%20quite%20easily%20using%20appropriate%20command%2C%20in%20order%20for%20this%20property%20to%20actually%20a" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F11%2F05%2Fwpf-richtextbox-subscript-and-superscript-without-font-restrictions%2F&amp;title=WPF%20RichTextBox%20Subscript%20and%20Superscript%20Without%20Font%20Restrictions" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F11%2F05%2Fwpf-richtextbox-subscript-and-superscript-without-font-restrictions%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F11%2F05%2Fwpf-richtextbox-subscript-and-superscript-without-font-restrictions%2F&amp;title=WPF%20RichTextBox%20Subscript%20and%20Superscript%20Without%20Font%20Restrictions" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=WPF%20RichTextBox%20Subscript%20and%20Superscript%20Without%20Font%20Restrictions&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F11%2F05%2Fwpf-richtextbox-subscript-and-superscript-without-font-restrictions%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=WPF%20RichTextBox%20Subscript%20and%20Superscript%20Without%20Font%20Restrictions&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F11%2F05%2Fwpf-richtextbox-subscript-and-superscript-without-font-restrictions%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F11%2F05%2Fwpf-richtextbox-subscript-and-superscript-without-font-restrictions%2F&amp;title=WPF%20RichTextBox%20Subscript%20and%20Superscript%20Without%20Font%20Restrictions&amp;body=Introduction%20%20One%20of%20the%20most%20bizarre%20limitation%20of%20the%20WPF%20RichTextBox%20is%20its%20hit%20and%20miss%20support%20for%20subscript%20and%20superscript%20in%20text.%20Although%20you%20can%20set%20the%20style%20quite%20easily%20using%20appropriate%20command%2C%20in%20order%20for%20this%20property%20to%20actually%20a" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F11%2F05%2Fwpf-richtextbox-subscript-and-superscript-without-font-restrictions%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F11%2F05%2Fwpf-richtextbox-subscript-and-superscript-without-font-restrictions%2F&amp;title=WPF%20RichTextBox%20Subscript%20and%20Superscript%20Without%20Font%20Restrictions" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/opentype' rel='tag' target='_blank'>opentype</a>, <a class='technorati-link' href='http://technorati.com/tag/richtextbox' rel='tag' target='_blank'>richtextbox</a>, <a class='technorati-link' href='http://technorati.com/tag/workaround' rel='tag' target='_blank'>workaround</a>, <a class='technorati-link' href='http://technorati.com/tag/WPF' rel='tag' target='_blank'>WPF</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2009/11/05/wpf-richtextbox-subscript-and-superscript-without-font-restrictions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Localising WPF Applications Using RESX Files and Standard Data Binding (Without a MarkupExtension)</title>
		<link>http://www.grumpydev.com/2009/09/08/localising-wpf-applications-using-resx-files-and-standard-data-binding-without-a-markupextension/</link>
		<comments>http://www.grumpydev.com/2009/09/08/localising-wpf-applications-using-resx-files-and-standard-data-binding-without-a-markupextension/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 20:04:01 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[localisation]]></category>
		<category><![CDATA[localization]]></category>
		<category><![CDATA[resourcemanager]]></category>
		<category><![CDATA[resx]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=239</guid>
		<description><![CDATA[Introduction Localisation is something everyone should really care about. Creating your applications, or websites, in a manner that can be easily localised for different languages and cultures is not only “good practice”, but it may also provide additional opportunities. Luckily the .NET framework, and WPF, has rich support for localisation, with WPF even having “baked [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Localisation is something everyone should really care about. Creating your applications, or websites, in a manner that can be easily localised for different languages and cultures is not only “good practice”, but it may also provide additional opportunities.</p>
<p>Luckily the .NET framework, and WPF, has rich support for localisation, with WPF even having “baked in” support for switching flow direction for <a href="http://en.wikipedia.org/wiki/Bi-directional_text" target="_blank">right to left languages</a>. On top of that <a href="http://www.west-wind.com/weblog/" target="_blank">Rick Strahl</a> and <a href="http://www.dasblonde.net/" target="_blank">Michele Leroux Bustamante</a> compiled an excellent guidance document detailing several technique for localising WPF applications. The documentation, along with sample code, can be found in the <a href="http://wpflocalization.codeplex.com/" target="_blank">WPF Localisation Guidance</a> project on CodePlex.</p>
<p>The document discusses several techniques for localising applications using RESX (resource) files, which is my preferred approach; but each of the techniques has its drawbacks:</p>
<ul>
<li><strong>Static Binding</strong>. Simple and easy, but lacks support for dynamically switching culture. </li>
<li><strong>Attached Properties</strong>. Look powerful, but lacks support for value convertors and it’s a bit inefficient. </li>
<li><strong>Markup Extension</strong>. A new instance of the helper (complete with event wireup for locale switching) is created for every control, which doesn’t sound ideal and may lead to memory leaks. </li>
</ul>
<p>All of the techniques are perfectly workable solutions, but with Binding and INotifyPropertyChanged WPF already contains a powerful mechanism for mapping and automatically updating UI elements with data; surely there’s some way we can leverage those? My goal was to attempt to find a way to localise an application with the following criteria:</p>
<ul>
<li>Use the standard Binding syntax so we can support value convertors. </li>
<li>No complicated markup extensions. </li>
<li>Provide a mechanism for code to “register” resources that can be consumed anywhere in the application, even from other PRISM modules. </li>
<li>Be able to cleanly switch locales, without restarting the application or closing/reopening screens. </li>
<li>Support the design experience with a minimum of fall back values when in design mode. </li>
</ul>
<h2>The Result – Localisation Using Binding</h2>
<p>If you just want to see the code, there’s a basic implementation, and a <a href="http://msdn.microsoft.com/en-us/library/dd458809.aspx" target="_blank">PRISM</a> demonstration, at the end of the article. Both implementations use the same basic “moving parts”:</p>
<h3></h3>
<h3>LocalisationHelper</h3>
<p>In essence this is our ViewModel. There are two key pieces of code here, first being:</p>
<pre class="c#:nocontrols" name="code">public string this[string Key]
{
    get
    {
        if (!validKey(Key))
            throw new ArgumentException(@&quot;Key is not in the valid [ManagerName].[ResourceKey] format&quot;);

        if (DesignHelpers.IsInDesignModeStatic)
            throw new Exception(&quot;Design mode is not supported&quot;);

        return _resourceManager.GetResourceString(GetManagerKey(Key), GetResourceKey(Key));
    }
}</pre>
<p>This allows us to bind elements to the LocalisationHelper and provide a “key” which will be used to lookup the correct resource manager and resource string. Our binding uses a little known syntax that looks like this (take note of the initial “.”):</p>
<pre>{Binding Path=.[MyResourceManager.MyResourceString]}</pre>
<p>To provide design support we throw an exception if we detect design mode (using code from Laurent Bugnion’s <a href="http://www.galasoft.ch/mvvm/getstarted/" target="_blank">MVVM Light Toolkit</a>) so the FallbackValue can be used instead. I’m not too keep on throwing an exception, but I couldn’t see a cleaner way to “fail” the binding.</p>
<p>The other important code hooks an event that fires when the locale changes, and fires a NotifyPropertyChangedEvent with an empty property string. This triggers a refresh for all controls that have bindings to the LocalisationHelper.</p>
<h3>ResourceManagerService</h3>
<p>The ResourceManagerService provides several functions:</p>
<ul>
<li>The ability to register <a href="http://msdn.microsoft.com/en-us/library/system.resources.resourcemanager.aspx" target="_blank">ResourceManagers</a> – these are automatically generated by Visual Studio when you create RESX files and are used to load the locale specific strings. </li>
<li>Retrieve a resource string from a given <a href="http://msdn.microsoft.com/en-us/library/system.resources.resourcemanager.aspx" target="_blank">ResourceManager</a>. </li>
<li>Get and set the current locale. A locale consists of an IETF language tag (such as en-GB) and a boolean to indicate whether the locale uses a <a href="http://en.wikipedia.org/wiki/Bi-directional_text" target="_blank">right to left flow direction</a>. </li>
<li>A event that is fired when the locale changes. This is hooked by the LocalisationHelper, for firing <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.propertychanged.aspx" target="_blank">PropertyChanged</a> events, and also by the main Window which uses the right to left flag to set the flow direction. </li>
</ul>
<h2>Give Me The Code Already!</h2>
<p>There are two samples attached. The first is a simple application that uses a static ResourceManagerService that shows the basic implementation. The second is a <a href="http://msdn.microsoft.com/en-us/library/dd458809.aspx" target="_blank">PRISM</a> based application that uses the container/service locator, EventAggregator, weak references, and several different modules to give a more “advanced” example.</p>
<p><a href="http://www.grumpydev.com/wp-content/uploads/2009/09/ResourceTest.zip" target="_blank">ResourceTest.zip</a></p>
<p><a href="http://www.grumpydev.com/wp-content/uploads/2009/09/PRISMResourceTest.zip" target="_blank">PRISMResourceTest.zip</a></p>
<h2>Conclusion</h2>
<p>I haven’t yet used this solution in anger, but it certainly seems to “tick all the boxes” from my initial requirements. Comments, suggestions, criticisms and flames are welcomed <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Localising%20WPF%20Applications%20Using%20RESX%20Files%20and%20Standard%20Data%20Binding%20%28Without%20a%20MarkupExtension%29%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F08%2Flocalising-wpf-applications-using-resx-files-and-standard-data-binding-without-a-markupextension%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F08%2Flocalising-wpf-applications-using-resx-files-and-standard-data-binding-without-a-markupextension%2F&amp;title=Localising%20WPF%20Applications%20Using%20RESX%20Files%20and%20Standard%20Data%20Binding%20%28Without%20a%20MarkupExtension%29" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F08%2Flocalising-wpf-applications-using-resx-files-and-standard-data-binding-without-a-markupextension%2F&amp;title=Localising%20WPF%20Applications%20Using%20RESX%20Files%20and%20Standard%20Data%20Binding%20%28Without%20a%20MarkupExtension%29&amp;annotation=Introduction%20%20Localisation%20is%20something%20everyone%20should%20really%20care%20about.%20Creating%20your%20applications%2C%20or%20websites%2C%20in%20a%20manner%20that%20can%20be%20easily%20localised%20for%20different%20languages%20and%20cultures%20is%20not%20only%20%E2%80%9Cgood%20practice%E2%80%9D%2C%20but%20it%20may%20also%20provide" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F08%2Flocalising-wpf-applications-using-resx-files-and-standard-data-binding-without-a-markupextension%2F&amp;title=Localising%20WPF%20Applications%20Using%20RESX%20Files%20and%20Standard%20Data%20Binding%20%28Without%20a%20MarkupExtension%29&amp;bodytext=Introduction%20%20Localisation%20is%20something%20everyone%20should%20really%20care%20about.%20Creating%20your%20applications%2C%20or%20websites%2C%20in%20a%20manner%20that%20can%20be%20easily%20localised%20for%20different%20languages%20and%20cultures%20is%20not%20only%20%E2%80%9Cgood%20practice%E2%80%9D%2C%20but%20it%20may%20also%20provide" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F08%2Flocalising-wpf-applications-using-resx-files-and-standard-data-binding-without-a-markupextension%2F&amp;title=Localising%20WPF%20Applications%20Using%20RESX%20Files%20and%20Standard%20Data%20Binding%20%28Without%20a%20MarkupExtension%29&amp;notes=Introduction%20%20Localisation%20is%20something%20everyone%20should%20really%20care%20about.%20Creating%20your%20applications%2C%20or%20websites%2C%20in%20a%20manner%20that%20can%20be%20easily%20localised%20for%20different%20languages%20and%20cultures%20is%20not%20only%20%E2%80%9Cgood%20practice%E2%80%9D%2C%20but%20it%20may%20also%20provide" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F08%2Flocalising-wpf-applications-using-resx-files-and-standard-data-binding-without-a-markupextension%2F&amp;title=Localising%20WPF%20Applications%20Using%20RESX%20Files%20and%20Standard%20Data%20Binding%20%28Without%20a%20MarkupExtension%29" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F08%2Flocalising-wpf-applications-using-resx-files-and-standard-data-binding-without-a-markupextension%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F08%2Flocalising-wpf-applications-using-resx-files-and-standard-data-binding-without-a-markupextension%2F&amp;title=Localising%20WPF%20Applications%20Using%20RESX%20Files%20and%20Standard%20Data%20Binding%20%28Without%20a%20MarkupExtension%29" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Localising%20WPF%20Applications%20Using%20RESX%20Files%20and%20Standard%20Data%20Binding%20%28Without%20a%20MarkupExtension%29&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F08%2Flocalising-wpf-applications-using-resx-files-and-standard-data-binding-without-a-markupextension%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Localising%20WPF%20Applications%20Using%20RESX%20Files%20and%20Standard%20Data%20Binding%20%28Without%20a%20MarkupExtension%29&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F08%2Flocalising-wpf-applications-using-resx-files-and-standard-data-binding-without-a-markupextension%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F08%2Flocalising-wpf-applications-using-resx-files-and-standard-data-binding-without-a-markupextension%2F&amp;title=Localising%20WPF%20Applications%20Using%20RESX%20Files%20and%20Standard%20Data%20Binding%20%28Without%20a%20MarkupExtension%29&amp;body=Introduction%20%20Localisation%20is%20something%20everyone%20should%20really%20care%20about.%20Creating%20your%20applications%2C%20or%20websites%2C%20in%20a%20manner%20that%20can%20be%20easily%20localised%20for%20different%20languages%20and%20cultures%20is%20not%20only%20%E2%80%9Cgood%20practice%E2%80%9D%2C%20but%20it%20may%20also%20provide" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F08%2Flocalising-wpf-applications-using-resx-files-and-standard-data-binding-without-a-markupextension%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F08%2Flocalising-wpf-applications-using-resx-files-and-standard-data-binding-without-a-markupextension%2F&amp;title=Localising%20WPF%20Applications%20Using%20RESX%20Files%20and%20Standard%20Data%20Binding%20%28Without%20a%20MarkupExtension%29" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/localisation' rel='tag' target='_blank'>localisation</a>, <a class='technorati-link' href='http://technorati.com/tag/localization' rel='tag' target='_blank'>localization</a>, <a class='technorati-link' href='http://technorati.com/tag/resourcemanager' rel='tag' target='_blank'>resourcemanager</a>, <a class='technorati-link' href='http://technorati.com/tag/resx' rel='tag' target='_blank'>resx</a>, <a class='technorati-link' href='http://technorati.com/tag/WPF' rel='tag' target='_blank'>WPF</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2009/09/08/localising-wpf-applications-using-resx-files-and-standard-data-binding-without-a-markupextension/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>System.OutOfMemoryException Gotcha Using Clipboard.GetData in WPF</title>
		<link>http://www.grumpydev.com/2009/09/05/system-outofmemoryexception-gotcha-using-clipboard-getdata-in-wpf/</link>
		<comments>http://www.grumpydev.com/2009/09/05/system-outofmemoryexception-gotcha-using-clipboard-getdata-in-wpf/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 16:07:08 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[Rambling]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[clipboard]]></category>
		<category><![CDATA[OutOfMemoryException]]></category>
		<category><![CDATA[System.OutOfMemoryException]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=229</guid>
		<description><![CDATA[Introduction Consider the following simple class for managing storage and retrieval of custom classes in the Windows Clipboard using WPF: using System; using System.Windows; namespace ClipboardTest.Services { public class ClipboardService : IClipboardService { public bool ContainsData&#60;T&#62;() where T:class { return Clipboard.ContainsData(typeof(T).ToString()); } public void SetData&#60;T&#62;(T data) where T:class { Clipboard.SetData(typeof(T).ToString(), data); } public T GetData&#60;T&#62;() [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Consider the following simple class for managing storage and retrieval of custom classes in the Windows Clipboard using WPF:</p>
<pre class="c#:nocontrols" name="code">using System;
using System.Windows;

namespace ClipboardTest.Services
{
    public class ClipboardService : IClipboardService
    {
        public bool ContainsData&lt;T&gt;() where T:class
        {
            return Clipboard.ContainsData(typeof(T).ToString());
        }

        public void SetData&lt;T&gt;(T data) where T:class
        {
            Clipboard.SetData(typeof(T).ToString(), data);
        }

        public T GetData&lt;T&gt;() where T : class
        {
            return Clipboard.GetData(typeof(T).ToString()) as T;
        }
    }
}</pre>
<p>Simple stuff, but it lets me abstract the clipboard away and remove the usual “magic string” approach for clipboard types.</p>
<p>Now consider the following basic tests:</p>
<pre class="c#:nocontrols" name="code">using ClipboardTest.Services;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace ClipboardTest.Test.Services
{
    public class TestPayload
    {
        public string Data { get; set; }
    }

    [TestClass]
    public class ClipboardServiceTests
    {
        [TestMethod]
        public void SetData_CustomClass_ClipboardContainsInstanceOfClass()
        {
            string data = @&quot;More Cowbell&quot;;
            var clipboardService = new ClipboardService();

            clipboardService.SetData&lt;TestPayload&gt;(new TestPayload() { Data = data });

            Assert.IsTrue(clipboardService.ContainsData&lt;TestPayload&gt;());
        }

        [TestMethod]
        public void SetDataGetData_CustomClass_ReturnsEquivilantClass()
        {
            string data = @&quot;More Cowbell&quot;;
            var clipboardService = new ClipboardService();

            clipboardService.SetData&lt;TestPayload&gt;(new TestPayload() { Data = data });
            var output = clipboardService.GetData&lt;TestPayload&gt;();

            Assert.IsNotNull(output);
            Assert.AreEqual(data, output.Data);
        }
    }
}</pre>
<p>Again, all very simple. The first test checks to make sure that the class gets stored onto the clipboard, and the second checks to see if the class we get back off the clipboard is the same as the one we put in.</p>
<p>The more astute among you have probably spotted the problem in the test code already, but the resultant symptoms are a little confusing.</p>
<h2>System.OutOfMemoryException?</h2>
<p>When we run the tests the first test runs absolutely fine, but the second test crashes out with a <a href="http://msdn.microsoft.com/en-us/library/system.outofmemoryexception.aspx" target="_blank">System.OutOfMemoryException</a>. A bit more digging showed that storing and retrieving standard types such as strings, ints etc all worked fine, but my own class was throwing an exception.</p>
<p>Checking good old MSDN threw up the following statement:</p>
<blockquote>
<p>An object must be serializable for it to be put on the Clipboard.</p>
</blockquote>
<p>Seeing as I had stupidly forgotten to add the <a href="http://msdn.microsoft.com/en-us/library/system.serializableattribute.aspx" target="_blank">SerializableAttribute</a> to the TestPayload class that definitely explained why things weren’t working as I expected; but it didn’t really explain the actual behaviour I was seeing. Another quote from MSDN, but from the WinForms documentation, stated:</p>
<blockquote>
<p>If you pass a non-serializable object to a Clipboard method, the method will fail without throwing an exception.</p>
</blockquote>
<p>So from that I would expect SetData to silently fail, and for nothing to be on the clipboard. However the first test above clearly shows that the clipboard at least <em>thinks</em> that <strong>something</strong> of our specified type has been added to the clipboard – it just throws an exception when we try and retrieve it again. Marking the payload class as serializable did fix the issue, but the behaviour I was seeing certainly didn’t make that obvious!</p>
<p>Just out of interest I tested the same code using the WinForms Clipboard class, which looks to all intents and purposes exactly the same as the WPF one, and that did fail silently and returned <em>null</em> from GetData.</p>
<h2>Conclusion</h2>
<p>So, after all that rambling, the conclusion is that if you are working with the Clipboard in WPF and you are getting <a href="http://msdn.microsoft.com/en-us/library/system.outofmemoryexception.aspx" target="_blank">System.OutOfMemoryException</a>s that don’t seem to make any sense, then you’ve probably forgotten to add the <a href="http://msdn.microsoft.com/en-us/library/system.serializableattribute.aspx" target="_blank">SerializableAttribute</a> to whatever class you placed on the Clipboard.</p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=System.OutOfMemoryException%20Gotcha%20Using%20Clipboard.GetData%20in%20WPF%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F05%2Fsystem-outofmemoryexception-gotcha-using-clipboard-getdata-in-wpf%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F05%2Fsystem-outofmemoryexception-gotcha-using-clipboard-getdata-in-wpf%2F&amp;title=System.OutOfMemoryException%20Gotcha%20Using%20Clipboard.GetData%20in%20WPF" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F05%2Fsystem-outofmemoryexception-gotcha-using-clipboard-getdata-in-wpf%2F&amp;title=System.OutOfMemoryException%20Gotcha%20Using%20Clipboard.GetData%20in%20WPF&amp;annotation=Introduction%20%20Consider%20the%20following%20simple%20class%20for%20managing%20storage%20and%20retrieval%20of%20custom%20classes%20in%20the%20Windows%20Clipboard%20using%20WPF%3A%20%20using%20System%3B%0D%0Ausing%20System.Windows%3B%0D%0A%0D%0Anamespace%20ClipboardTest.Services%0D%0A%7B%0D%0A%20%20%20%20public%20class%20ClipboardService" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F05%2Fsystem-outofmemoryexception-gotcha-using-clipboard-getdata-in-wpf%2F&amp;title=System.OutOfMemoryException%20Gotcha%20Using%20Clipboard.GetData%20in%20WPF&amp;bodytext=Introduction%20%20Consider%20the%20following%20simple%20class%20for%20managing%20storage%20and%20retrieval%20of%20custom%20classes%20in%20the%20Windows%20Clipboard%20using%20WPF%3A%20%20using%20System%3B%0D%0Ausing%20System.Windows%3B%0D%0A%0D%0Anamespace%20ClipboardTest.Services%0D%0A%7B%0D%0A%20%20%20%20public%20class%20ClipboardService" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F05%2Fsystem-outofmemoryexception-gotcha-using-clipboard-getdata-in-wpf%2F&amp;title=System.OutOfMemoryException%20Gotcha%20Using%20Clipboard.GetData%20in%20WPF&amp;notes=Introduction%20%20Consider%20the%20following%20simple%20class%20for%20managing%20storage%20and%20retrieval%20of%20custom%20classes%20in%20the%20Windows%20Clipboard%20using%20WPF%3A%20%20using%20System%3B%0D%0Ausing%20System.Windows%3B%0D%0A%0D%0Anamespace%20ClipboardTest.Services%0D%0A%7B%0D%0A%20%20%20%20public%20class%20ClipboardService" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F05%2Fsystem-outofmemoryexception-gotcha-using-clipboard-getdata-in-wpf%2F&amp;title=System.OutOfMemoryException%20Gotcha%20Using%20Clipboard.GetData%20in%20WPF" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F05%2Fsystem-outofmemoryexception-gotcha-using-clipboard-getdata-in-wpf%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F05%2Fsystem-outofmemoryexception-gotcha-using-clipboard-getdata-in-wpf%2F&amp;title=System.OutOfMemoryException%20Gotcha%20Using%20Clipboard.GetData%20in%20WPF" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=System.OutOfMemoryException%20Gotcha%20Using%20Clipboard.GetData%20in%20WPF&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F05%2Fsystem-outofmemoryexception-gotcha-using-clipboard-getdata-in-wpf%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=System.OutOfMemoryException%20Gotcha%20Using%20Clipboard.GetData%20in%20WPF&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F05%2Fsystem-outofmemoryexception-gotcha-using-clipboard-getdata-in-wpf%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F05%2Fsystem-outofmemoryexception-gotcha-using-clipboard-getdata-in-wpf%2F&amp;title=System.OutOfMemoryException%20Gotcha%20Using%20Clipboard.GetData%20in%20WPF&amp;body=Introduction%20%20Consider%20the%20following%20simple%20class%20for%20managing%20storage%20and%20retrieval%20of%20custom%20classes%20in%20the%20Windows%20Clipboard%20using%20WPF%3A%20%20using%20System%3B%0D%0Ausing%20System.Windows%3B%0D%0A%0D%0Anamespace%20ClipboardTest.Services%0D%0A%7B%0D%0A%20%20%20%20public%20class%20ClipboardService" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F05%2Fsystem-outofmemoryexception-gotcha-using-clipboard-getdata-in-wpf%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F09%2F05%2Fsystem-outofmemoryexception-gotcha-using-clipboard-getdata-in-wpf%2F&amp;title=System.OutOfMemoryException%20Gotcha%20Using%20Clipboard.GetData%20in%20WPF" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/clipboard' rel='tag' target='_blank'>clipboard</a>, <a class='technorati-link' href='http://technorati.com/tag/OutOfMemoryException' rel='tag' target='_blank'>OutOfMemoryException</a>, <a class='technorati-link' href='http://technorati.com/tag/System.OutOfMemoryException' rel='tag' target='_blank'>System.OutOfMemoryException</a>, <a class='technorati-link' href='http://technorati.com/tag/WPF' rel='tag' target='_blank'>WPF</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2009/09/05/system-outofmemoryexception-gotcha-using-clipboard-getdata-in-wpf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bindings Not Updating in WPF / Silverlight? Common Mistakes</title>
		<link>http://www.grumpydev.com/2009/08/26/bindings-not-updating-in-wpf-silverlight-common-mistakes/</link>
		<comments>http://www.grumpydev.com/2009/08/26/bindings-not-updating-in-wpf-silverlight-common-mistakes/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 07:07:39 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[binding]]></category>
		<category><![CDATA[inotifypropertychanged]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=225</guid>
		<description><![CDATA[Introduction Yesterday I was working on a small prototype, which I will be blogging about shortly, and ran across the common problem of my bindings not updating. A very common problem, and one that’s usually a very simple fix once you’ve tracked it down. Yes, I’m an Idiot! Normally my ViewModels inherit from my ViewModelBase [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Yesterday I was working on a small prototype, which I will be blogging about shortly, and ran across the common problem of my bindings not updating. A very common problem, and one that’s usually a very simple fix once you’ve tracked it down.</p>
<h2>Yes, I’m an Idiot!</h2>
<p>Normally my ViewModels inherit from my ViewModelBase base class, which provides a RaisePropertyChanged method and, when in debug mode, uses reflection to check if the property name is valid. Now I’d recently refactored the code so this particular ViewModel wasn’t using the base class, so my first instinct was that I’d simply mistyped the property name magic string in the event – but that was all fine.</p>
<p>I threw in a few breakpoints and I could see my ViewModel was changing, I could see the OnPropertyChanged method being hit, but there didn’t seem to be any listeners and as a result my UI was just ignoring the changes.</p>
<p>After a few minutes of head scratching I noticed that although my class was firing the <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.propertychanged.aspx" target="_blank">PropertyChanged</a> event correctly, I hadn’t added <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx" target="_blank">INotifyPropertyChanged</a> to my class declaration when I removed the base class! So although I was firing an event that <strong>looked</strong> like <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.propertychanged.aspx" target="_blank">INotifyPropertyChanged.PropertyChanged</a>, I was actually just firing my own event with the same name <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h2>Conclusion</h2>
<p>So there you have it, I’m an idiot <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  The moral of the story is, when your bindings aren’t working check the obvious:</p>
<ol>
<li>The property name is correct. A base class that checks this in debug mode can be useful, or failing that, watch the Output window.</li>
<li>Check you are actually implementing <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx" target="_blank">INotifyPropertyChanged</a> and not just firing events that happen to have the same name <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
</ol>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Bindings%20Not%20Updating%20in%20WPF%20%2F%20Silverlight%3F%20Common%20Mistakes%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2009%2F08%2F26%2Fbindings-not-updating-in-wpf-silverlight-common-mistakes%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F08%2F26%2Fbindings-not-updating-in-wpf-silverlight-common-mistakes%2F&amp;title=Bindings%20Not%20Updating%20in%20WPF%20%2F%20Silverlight%3F%20Common%20Mistakes" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F08%2F26%2Fbindings-not-updating-in-wpf-silverlight-common-mistakes%2F&amp;title=Bindings%20Not%20Updating%20in%20WPF%20%2F%20Silverlight%3F%20Common%20Mistakes&amp;annotation=Introduction%20%20Yesterday%20I%20was%20working%20on%20a%20small%20prototype%2C%20which%20I%20will%20be%20blogging%20about%20shortly%2C%20and%20ran%20across%20the%20common%20problem%20of%20my%20bindings%20not%20updating.%20A%20very%20common%20problem%2C%20and%20one%20that%E2%80%99s%20usually%20a%20very%20simple%20fix%20once%20you%E2%80%99ve%20tracked" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F08%2F26%2Fbindings-not-updating-in-wpf-silverlight-common-mistakes%2F&amp;title=Bindings%20Not%20Updating%20in%20WPF%20%2F%20Silverlight%3F%20Common%20Mistakes&amp;bodytext=Introduction%20%20Yesterday%20I%20was%20working%20on%20a%20small%20prototype%2C%20which%20I%20will%20be%20blogging%20about%20shortly%2C%20and%20ran%20across%20the%20common%20problem%20of%20my%20bindings%20not%20updating.%20A%20very%20common%20problem%2C%20and%20one%20that%E2%80%99s%20usually%20a%20very%20simple%20fix%20once%20you%E2%80%99ve%20tracked" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F08%2F26%2Fbindings-not-updating-in-wpf-silverlight-common-mistakes%2F&amp;title=Bindings%20Not%20Updating%20in%20WPF%20%2F%20Silverlight%3F%20Common%20Mistakes&amp;notes=Introduction%20%20Yesterday%20I%20was%20working%20on%20a%20small%20prototype%2C%20which%20I%20will%20be%20blogging%20about%20shortly%2C%20and%20ran%20across%20the%20common%20problem%20of%20my%20bindings%20not%20updating.%20A%20very%20common%20problem%2C%20and%20one%20that%E2%80%99s%20usually%20a%20very%20simple%20fix%20once%20you%E2%80%99ve%20tracked" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F08%2F26%2Fbindings-not-updating-in-wpf-silverlight-common-mistakes%2F&amp;title=Bindings%20Not%20Updating%20in%20WPF%20%2F%20Silverlight%3F%20Common%20Mistakes" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F08%2F26%2Fbindings-not-updating-in-wpf-silverlight-common-mistakes%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F08%2F26%2Fbindings-not-updating-in-wpf-silverlight-common-mistakes%2F&amp;title=Bindings%20Not%20Updating%20in%20WPF%20%2F%20Silverlight%3F%20Common%20Mistakes" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Bindings%20Not%20Updating%20in%20WPF%20%2F%20Silverlight%3F%20Common%20Mistakes&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F08%2F26%2Fbindings-not-updating-in-wpf-silverlight-common-mistakes%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Bindings%20Not%20Updating%20in%20WPF%20%2F%20Silverlight%3F%20Common%20Mistakes&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F08%2F26%2Fbindings-not-updating-in-wpf-silverlight-common-mistakes%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F08%2F26%2Fbindings-not-updating-in-wpf-silverlight-common-mistakes%2F&amp;title=Bindings%20Not%20Updating%20in%20WPF%20%2F%20Silverlight%3F%20Common%20Mistakes&amp;body=Introduction%20%20Yesterday%20I%20was%20working%20on%20a%20small%20prototype%2C%20which%20I%20will%20be%20blogging%20about%20shortly%2C%20and%20ran%20across%20the%20common%20problem%20of%20my%20bindings%20not%20updating.%20A%20very%20common%20problem%2C%20and%20one%20that%E2%80%99s%20usually%20a%20very%20simple%20fix%20once%20you%E2%80%99ve%20tracked" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F08%2F26%2Fbindings-not-updating-in-wpf-silverlight-common-mistakes%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F08%2F26%2Fbindings-not-updating-in-wpf-silverlight-common-mistakes%2F&amp;title=Bindings%20Not%20Updating%20in%20WPF%20%2F%20Silverlight%3F%20Common%20Mistakes" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/binding' rel='tag' target='_blank'>binding</a>, <a class='technorati-link' href='http://technorati.com/tag/inotifypropertychanged' rel='tag' target='_blank'>inotifypropertychanged</a>, <a class='technorati-link' href='http://technorati.com/tag/Silverlight' rel='tag' target='_blank'>Silverlight</a>, <a class='technorati-link' href='http://technorati.com/tag/WPF' rel='tag' target='_blank'>WPF</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2009/08/26/bindings-not-updating-in-wpf-silverlight-common-mistakes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stack Overflow – Share Your Flair – Now in PNG!</title>
		<link>http://www.grumpydev.com/2009/07/11/stack-overflow-share-your-flair-now-in-png/</link>
		<comments>http://www.grumpydev.com/2009/07/11/stack-overflow-share-your-flair-now-in-png/#comments</comments>
		<pubDate>Sat, 11 Jul 2009 21:01:09 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[flair]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[stack overflow]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=210</guid>
		<description><![CDATA[Introduction This morning I was taking a look at the new (ish) meta stackoverflow site, and noticed a thread asking “Can we get flare as an image?”. It seemed like a good idea, especially for forum signatures and the like, so I thought that seeing as I’d recently updated the WordPress widget, that I’d try [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>This morning I was taking a look at the new (ish) <a href="http://meta.stackoverflow.com" target="_blank">meta stackoverflow</a> site, and noticed a thread asking “<a href="http://meta.stackoverflow.com/questions/1475/can-we-get-flair-as-an-image" target="_blank">Can we get flare as an image?”</a>. It seemed like a good idea, especially for forum signatures and the like, so I thought that seeing as I’d recently <a href="http://www.grumpydev.com/2009/07/09/updated-stack-overflow-wordpress-widget/" target="_blank">updated the WordPress widget</a>, that I’d try and put something together.</p>
<h2></h2>
<h2>Pretty as a Picture (or not)</h2>
<p>As C# is generally my weapon of choice these days, I was originally going to knock something together in ASP.Net. I was thinking something along the lines of rending a WPF control to a bitmap, and emitting that as an image. I decided against that approach because:</p>
<ol>
<li>ASP.Net hosting is <em>generally</em> more expensive – most people I know seem to stick to *nix hosting. </li>
<li>Rendering WPF to a bitmap doesn’t work in partial trust scenarios; so it might not even work on ASP.Net hosting anyway. </li>
</ol>
<p>So, feeling in a masochistic mood, I thought I’d knock something together in lovely old PHP; the results of which look something like this:</p>
<p><img border="0" alt="Steve Robbins&#39; StackOverflow Profile" src="http://www.grumpydev.com/imageFlair/imageFlair.php" /></p>
<p>Or, by passing in a userid on the querystring:</p>
<p><img border="0" alt="Marc Gravell&#39;s StackOverflow Profile" src="http://www.grumpydev.com/imageFlair/imageFlair.php?userid=23354" /></p>
<p>You can test&#160; it with your own details by changing the userid on the following url:</p>
<p><a href="http://www.grumpydev.com/imageFlair/imageFlair.php?userid=1">http://www.grumpydev.com/imageFlair/imageFlair.php?userid=1</a></p>
<p>Images are cached (for 30minutes by default) and all of the StackOverflow data is taken from the JSON feed, so the strain on SO should be fairly minimal.</p>
<h2>The Code</h2>
<p>You can use the script hosted on here if you want (although I might have to change my mind on that if the load gets too high), or you can download the code and run it on your own box:</p>
<p><a title="http://www.grumpydev.com/imageFlair.zip" href="http://www.grumpydev.com/imageFlair.zip">http://www.grumpydev.com/imageFlair.zip</a></p>
<p>Although it will run just fine “out of the box”, the code is pretty flexible; with plenty of configurable options for fonts, colours, positioning, background images, caching time etc. Take a look in config.php and you’ll hopefully find you can change everything you want to without having to delve into the main code.</p>
<p>Bear in mind that I am far from a PHP expert, and this was put together in a few hours, so please don’t laugh too much if you do take a peek at the source <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h2></h2>
<h2>Font Support / Licensing</h2>
<p>The text is rendered to the bitmap using a TrueType font of your choosing, which gives us some nice flexibility. Unfortunately though, none of the fonts that we generally take for granted, such as Arial, Verdana etc. come with any distribution rights; so I can’t include any in the source archive. This might not be a problem if you already have your favourite TrueType fonts installed; but if you don’t you can get a “free” version of several core fonts from <a title="http://sourceforge.net/projects/corefonts" href="http://sourceforge.net/projects/corefonts">http://sourceforge.net/projects/corefonts</a>. You just need to extract the archives using <a href="http://www.rarlab.com/" target="_blank">WinRAR</a>, or <a href="http://www.7-zip.org/" target="_blank">7zip</a>, or something of that ilk; then just drop the TTF file into the source code directory.</p>
<p>That&#8217;s it &#8211; hope someone finds it useful <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h2>Update – Bug Fixes and Pretty URLs</h2>
<p>After some feedback from the meta question I’ve fixed a stupid bug in the gravatar code, so now it should work for people who have a 1 in their gravatar hash (don’t ask! <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ).</p>
<p>I’ve also enabled “pretty urls” on the hosted version, so now you can go to a url like:</p>
<p><a title="http://www.grumpydev.com/imageFlair/658.png" href="http://www.grumpydev.com/imageFlair/658.png">http://www.grumpydev.com/imageFlair/658.png</a></p>
<p>And you’ll get the PNG for the corresponding userid. I do intend to expand it to include Flair for the other sites in the “Stack Overflow” family, but I haven’t had chance yet.</p>
<p>For those that are interested, this is the .htaccess file that enables the pretty urls, and also reduces the cache time on pngs to 1 second:</p>
<pre class="xml:nocontrols" name="code">&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On
RewriteRule ^(.*)\.png$ imageFlair.php?userid=$1 [L]
&lt;/IfModule&gt;

&lt;IfModule mod_expires.c&gt;
ExpiresActive On
ExpiresByType image/png &quot;access plus 1 seconds&quot;
&lt;/IfModule&gt;</pre>
<h2>Update 2 – Supporting the Whole Family</h2>
<p>I’ve added an optional parameter to specify which site’s information to display. The “pretty” url format now looks like this:</p>
<p>http://[ur]/[mode]/[id].png</p>
<p>Where [mode] is one of:</p>
<ul>
<ul>
<li>so &#8211; <a href="http://www.stackoverflow.com/" target="_blank">Stack Overflow</a> </li>
<li>meta &#8211; <a href="http://meta.stackoverflow.com/" target="_blank">Meta Stack Overflow</a> </li>
<li>sf &#8211; <a href="http://serverfault.com" target="_blank">Server Fault</a> </li>
<li>su &#8211; <a href="http://superuser.com/" target="_blank">Super User</a> (although this isn&#8217;t live yet) </li>
</ul>
</ul>
<p>So for Jeff (id number 1 everywhere is easy <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ) we end up with:</p>
<p><img alt="Stack Overflow" src="http://www.grumpydev.com/imageFlair/so/1.png" /> <img alt="Meta" src="http://www.grumpydev.com/imageFlair/meta/1.png" /> <img alt="Server Fault" src="http://www.grumpydev.com/imageFlair/sf/1.png" /></p>
<p>The htaccess file now looks like this:</p>
<pre class="xml:nocontrols" name="code">&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On
RewriteRule ^(.*)/(.*)\.png imageFlair.php?mode=$1&amp;userid=$2 [L]
RewriteRule ^(.*)\.png$ imageFlair.php?userid=$1 [L]
&lt;/IfModule&gt;

&lt;IfModule mod_expires.c&gt;
ExpiresActive On
ExpiresByType image/png &quot;access plus 1 seconds&quot;
&lt;/IfModule&gt;</pre>
<p>Source ZIP is updated with all the latest changes. Hopefully that will be it for the time being! <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Stack%20Overflow%20%26ndash%3B%20Share%20Your%20Flair%20%26ndash%3B%20Now%20in%20PNG%21%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F11%2Fstack-overflow-share-your-flair-now-in-png%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F11%2Fstack-overflow-share-your-flair-now-in-png%2F&amp;title=Stack%20Overflow%20%26ndash%3B%20Share%20Your%20Flair%20%26ndash%3B%20Now%20in%20PNG%21" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F11%2Fstack-overflow-share-your-flair-now-in-png%2F&amp;title=Stack%20Overflow%20%26ndash%3B%20Share%20Your%20Flair%20%26ndash%3B%20Now%20in%20PNG%21&amp;annotation=Introduction%20%20This%20morning%20I%20was%20taking%20a%20look%20at%20the%20new%20%28ish%29%20meta%20stackoverflow%20site%2C%20and%20noticed%20a%20thread%20asking%20%E2%80%9CCan%20we%20get%20flare%20as%20an%20image%3F%E2%80%9D.%20It%20seemed%20like%20a%20good%20idea%2C%20especially%20for%20forum%20signatures%20and%20the%20like%2C%20so%20I%20thought%20that%20seei" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F11%2Fstack-overflow-share-your-flair-now-in-png%2F&amp;title=Stack%20Overflow%20%26ndash%3B%20Share%20Your%20Flair%20%26ndash%3B%20Now%20in%20PNG%21&amp;bodytext=Introduction%20%20This%20morning%20I%20was%20taking%20a%20look%20at%20the%20new%20%28ish%29%20meta%20stackoverflow%20site%2C%20and%20noticed%20a%20thread%20asking%20%E2%80%9CCan%20we%20get%20flare%20as%20an%20image%3F%E2%80%9D.%20It%20seemed%20like%20a%20good%20idea%2C%20especially%20for%20forum%20signatures%20and%20the%20like%2C%20so%20I%20thought%20that%20seei" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F11%2Fstack-overflow-share-your-flair-now-in-png%2F&amp;title=Stack%20Overflow%20%26ndash%3B%20Share%20Your%20Flair%20%26ndash%3B%20Now%20in%20PNG%21&amp;notes=Introduction%20%20This%20morning%20I%20was%20taking%20a%20look%20at%20the%20new%20%28ish%29%20meta%20stackoverflow%20site%2C%20and%20noticed%20a%20thread%20asking%20%E2%80%9CCan%20we%20get%20flare%20as%20an%20image%3F%E2%80%9D.%20It%20seemed%20like%20a%20good%20idea%2C%20especially%20for%20forum%20signatures%20and%20the%20like%2C%20so%20I%20thought%20that%20seei" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F11%2Fstack-overflow-share-your-flair-now-in-png%2F&amp;title=Stack%20Overflow%20%26ndash%3B%20Share%20Your%20Flair%20%26ndash%3B%20Now%20in%20PNG%21" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F11%2Fstack-overflow-share-your-flair-now-in-png%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F11%2Fstack-overflow-share-your-flair-now-in-png%2F&amp;title=Stack%20Overflow%20%26ndash%3B%20Share%20Your%20Flair%20%26ndash%3B%20Now%20in%20PNG%21" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Stack%20Overflow%20%26ndash%3B%20Share%20Your%20Flair%20%26ndash%3B%20Now%20in%20PNG%21&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F11%2Fstack-overflow-share-your-flair-now-in-png%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Stack%20Overflow%20%26ndash%3B%20Share%20Your%20Flair%20%26ndash%3B%20Now%20in%20PNG%21&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F11%2Fstack-overflow-share-your-flair-now-in-png%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F11%2Fstack-overflow-share-your-flair-now-in-png%2F&amp;title=Stack%20Overflow%20%26ndash%3B%20Share%20Your%20Flair%20%26ndash%3B%20Now%20in%20PNG%21&amp;body=Introduction%20%20This%20morning%20I%20was%20taking%20a%20look%20at%20the%20new%20%28ish%29%20meta%20stackoverflow%20site%2C%20and%20noticed%20a%20thread%20asking%20%E2%80%9CCan%20we%20get%20flare%20as%20an%20image%3F%E2%80%9D.%20It%20seemed%20like%20a%20good%20idea%2C%20especially%20for%20forum%20signatures%20and%20the%20like%2C%20so%20I%20thought%20that%20seei" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F11%2Fstack-overflow-share-your-flair-now-in-png%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F11%2Fstack-overflow-share-your-flair-now-in-png%2F&amp;title=Stack%20Overflow%20%26ndash%3B%20Share%20Your%20Flair%20%26ndash%3B%20Now%20in%20PNG%21" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/flair' rel='tag' target='_blank'>flair</a>, <a class='technorati-link' href='http://technorati.com/tag/php' rel='tag' target='_blank'>php</a>, <a class='technorati-link' href='http://technorati.com/tag/stack+overflow' rel='tag' target='_blank'>stack overflow</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2009/07/11/stack-overflow-share-your-flair-now-in-png/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Updated: Stack Overflow WordPress Widget</title>
		<link>http://www.grumpydev.com/2009/07/09/updated-stack-overflow-wordpress-widget/</link>
		<comments>http://www.grumpydev.com/2009/07/09/updated-stack-overflow-wordpress-widget/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 19:19:14 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[stack overflow]]></category>
		<category><![CDATA[widget]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/2009/07/09/updated-stack-overflow-wordpress-widget/</guid>
		<description><![CDATA[Introduction Just a quick post to say I’ve updated my Stack Overflow WordPress Widget to implement some basic caching. I’m still in the process of converting it to the new JSON service that SO have provided; but in the meantime this should cut down on the amount of traffic it uses. You should be able [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Just a quick post to say I’ve updated my <a href="http://www.stackoverflow.com/" target="_blank">Stack Overflow</a> WordPress Widget to implement some basic caching. I’m still in the process of converting it to the new JSON service that SO have provided; but in the meantime this should cut down on the amount of traffic it uses.</p>
<p>You should be able to upgrade straight from the admin section of your blog; but you can also grab it from the <a href="http://wordpress.org/extend/plugins/stack-overflow-gamertag-widget/" target="_blank">WordPress Plugin Directory</a>.</p>
<p>The cache time is configurable in the widget settings, and defaults to 30minutes. It attempts to locate your temp directory, then creates a unique filename cache in there; so there’s no need to chmod a cache file to get it to work.</p>
<p>I’ll hopefully get a JSON version working in the next few days, but if anyone has any problems feel free to give me a shout from the <a href="http://www.grumpydev.com/contact/" target="_blank">contact page</a>.</p>
<p><strong>Update:</strong> It seems the JSON version was easier than I thought <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  I’ve uploaded v2.0.0 that still includes the caching changes, but also uses the “official” JSON feed. If you have already used the cached version you might might need to delete the cache file to make it re-download the raw data.</p>
<p>The only “downside” to the JSON version is it requires <a href="http://uk.php.net/json_decode" target="_blank">json_decode</a>, so you must have PHP 5.2.0 or above. If you can’t satisfy this requirement then you’ll be better off with the previous version.</p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Updated%3A%20Stack%20Overflow%20Wordpress%20Widget%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F09%2Fupdated-stack-overflow-wordpress-widget%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F09%2Fupdated-stack-overflow-wordpress-widget%2F&amp;title=Updated%3A%20Stack%20Overflow%20Wordpress%20Widget" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F09%2Fupdated-stack-overflow-wordpress-widget%2F&amp;title=Updated%3A%20Stack%20Overflow%20Wordpress%20Widget&amp;annotation=Introduction%20%20Just%20a%20quick%20post%20to%20say%20I%E2%80%99ve%20updated%20my%20Stack%20Overflow%20Wordpress%20Widget%20to%20implement%20some%20basic%20caching.%20I%E2%80%99m%20still%20in%20the%20process%20of%20converting%20it%20to%20the%20new%20JSON%20service%20that%20SO%20have%20provided%3B%20but%20in%20the%20meantime%20this%20should%20cut%20d" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F09%2Fupdated-stack-overflow-wordpress-widget%2F&amp;title=Updated%3A%20Stack%20Overflow%20Wordpress%20Widget&amp;bodytext=Introduction%20%20Just%20a%20quick%20post%20to%20say%20I%E2%80%99ve%20updated%20my%20Stack%20Overflow%20Wordpress%20Widget%20to%20implement%20some%20basic%20caching.%20I%E2%80%99m%20still%20in%20the%20process%20of%20converting%20it%20to%20the%20new%20JSON%20service%20that%20SO%20have%20provided%3B%20but%20in%20the%20meantime%20this%20should%20cut%20d" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F09%2Fupdated-stack-overflow-wordpress-widget%2F&amp;title=Updated%3A%20Stack%20Overflow%20Wordpress%20Widget&amp;notes=Introduction%20%20Just%20a%20quick%20post%20to%20say%20I%E2%80%99ve%20updated%20my%20Stack%20Overflow%20Wordpress%20Widget%20to%20implement%20some%20basic%20caching.%20I%E2%80%99m%20still%20in%20the%20process%20of%20converting%20it%20to%20the%20new%20JSON%20service%20that%20SO%20have%20provided%3B%20but%20in%20the%20meantime%20this%20should%20cut%20d" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F09%2Fupdated-stack-overflow-wordpress-widget%2F&amp;title=Updated%3A%20Stack%20Overflow%20Wordpress%20Widget" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F09%2Fupdated-stack-overflow-wordpress-widget%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F09%2Fupdated-stack-overflow-wordpress-widget%2F&amp;title=Updated%3A%20Stack%20Overflow%20Wordpress%20Widget" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Updated%3A%20Stack%20Overflow%20Wordpress%20Widget&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F09%2Fupdated-stack-overflow-wordpress-widget%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Updated%3A%20Stack%20Overflow%20Wordpress%20Widget&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F09%2Fupdated-stack-overflow-wordpress-widget%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F09%2Fupdated-stack-overflow-wordpress-widget%2F&amp;title=Updated%3A%20Stack%20Overflow%20Wordpress%20Widget&amp;body=Introduction%20%20Just%20a%20quick%20post%20to%20say%20I%E2%80%99ve%20updated%20my%20Stack%20Overflow%20Wordpress%20Widget%20to%20implement%20some%20basic%20caching.%20I%E2%80%99m%20still%20in%20the%20process%20of%20converting%20it%20to%20the%20new%20JSON%20service%20that%20SO%20have%20provided%3B%20but%20in%20the%20meantime%20this%20should%20cut%20d" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F09%2Fupdated-stack-overflow-wordpress-widget%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F09%2Fupdated-stack-overflow-wordpress-widget%2F&amp;title=Updated%3A%20Stack%20Overflow%20Wordpress%20Widget" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/stack+overflow' rel='tag' target='_blank'>stack overflow</a>, <a class='technorati-link' href='http://technorati.com/tag/widget' rel='tag' target='_blank'>widget</a>, <a class='technorati-link' href='http://technorati.com/tag/wordpress' rel='tag' target='_blank'>wordpress</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2009/07/09/updated-stack-overflow-wordpress-widget/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Why Shouldn’t I use PRISM?</title>
		<link>http://www.grumpydev.com/2009/07/04/why-shouldn%e2%80%99t-i-use-prism/</link>
		<comments>http://www.grumpydev.com/2009/07/04/why-shouldn%e2%80%99t-i-use-prism/#comments</comments>
		<pubDate>Sat, 04 Jul 2009 18:39:46 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Composite Application Guidance]]></category>
		<category><![CDATA[Composite Application Library]]></category>
		<category><![CDATA[PRISM]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=201</guid>
		<description><![CDATA[Introduction PRISM, or Composite Application Guidance/Library for WPF/Silverlight, is a library and a corresponding guidance document that helps you to build loosely coupled “composite” WPF and Silverlight applications. The library itself “sits on top” of an Inversion of Control Container (Unity by default), and provides facilities for modularising your application, composing your UI from components, [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>PRISM, or Composite Application Guidance/Library for WPF/Silverlight, is a library and a corresponding guidance document that helps you to build loosely coupled “composite” WPF and Silverlight applications.</p>
<p>The library itself “sits on top” of an <a href="http://martinfowler.com/articles/injection.html" target="_blank">Inversion of Control Container</a> (Unity by default), and provides facilities for modularising your application, composing your UI from components, loosely coupling events and, in Silverlight’s case, only downloading parts of your application as and when they’re required.</p>
<p>Sounds great doesn’t it?</p>
<h2>So, There Must Be Something Wrong With It.. Right?</h2>
<p>Plenty has been written about PRISM, its benefits, and how to get started; but very little on why you <em>wouldn’t</em> use it on your next WPF/Silverlight project. I’ve put together some concerns, based both on criticisms I’ve read, and supposition on my part; and some commentary about whether I believe those concerns are well founded or not.</p>
<h3>“I’m Only Doing a Small Project!”</h3>
<p>Granted, PRISM is rather overkill for “toy” applications; but are you sure your application is always going to stay that small and simple? One of the big advantages of the modular nature of a PRISM app is being able to add and test new features with relative ease. I’m sure we’ve all started projects that started off as a simple little toy app, but have since grown organically into something rather more complex – possibly ending up with some pretty kludgey code at the end of it.</p>
<h3>“It’s Complicated!”</h3>
<p>No; it’s not. Really. There’s nothing particularly complex in PRISM, either conceptually or in the code you have to write. Once you understand the structure of a PRISM project, you’ll probably find that your code is actually easier to follow, as it is separated into clearly defined parts.</p>
<p>If you want an easy to follow tutorial that takes you from File.. New, through to a working application, then take a look at the excellent screencasts from <a href="http://blogs.msdn.com/blaine/" target="_blank">Blaine Wastell’s blog</a>.</p>
<h3>“It Takes Too Long To Use! There’s Too Much Overhead!”</h3>
<p>If you’ve watched some of the initial screencasts about PRISM, or had a peak at some sample code, you might be thinking that the overhead of creating all these “extra” classes and projects is just too much. While it certainly is more work than just File.. New and throwing controls on a page; once your initial project structure and bootstrapper is setup, adding new modules is no more time consuming than adding a normal User Control.</p>
<p>Separating your view from it’s logic; whether it be with ViewModels, the Presentation Model, or any other pattern, is going to be slightly more work; but the testability and data binding benefits far outweigh any slight increase in typing!</p>
<h3>“It Will Add Bloat to My Silverlight App!”</h3>
<p>The PRISM binaries, including Unity, weigh in at around 270k; and squeeze down to approximately 100k when zipped. Not exactly tiny, but not exactly Bloaty McBloater. In fact, if you take advantage of PRISM’s ability to bundle parts of your Silverlight application into different XAP files, and only load them when needed, you may find your initial payload is actually <em>smaller</em> than it would be without PRISM.</p>
<h3>“You Have To Use Unity! I Don’t Want That Dependency!”</h3>
<p>I’ve seen this repeated several times, but it’s simply not true. Although PRISM “out of the box” uses <a href="http://www.codeplex.com/unity" target="_blank">Unity</a>, and comes with a Unity <a href="http://msdn.microsoft.com/en-us/library/cc707847.aspx" target="_blank">Bootstrapper</a>; you can plug in your own IoC container without too much trouble. At the time of writing I believe there are alternatives for Spring.Net, Castle Windsor and StructureMap already written for you.</p>
<h3>“I Want Control Over *ALL* My Damn Code!”</h3>
<p>Firstly, if you’re writing a .Net application then chances are you are calling at least one library that you didn’t write <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Secondly, PRISM is very “lightweight”. It’s a helping hand at your disposal, rather than a monolithic framework that takes over your whole application and forces you to work in a certain way. Thirdly, you can just pick and choose which parts of PRISM you want to use, it’s not an “all or nothing” proposition. Don’t like the view composition? Then don’t use it! And finally, it’s all open source, so if you don’t like the way something works – change it! <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h3>“It’s From MS – So It Sucks!”</h3>
<p>Unfortunately if someone holds this view, then there’s probably nothing anyone can say to change their mind. While everything that comes out of Microsoft isn’t perfect, far from it, it most certainly doesn’t all suck <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>With PRISM, the exceedingly smart guys from the <a href="http://msdn.microsoft.com/en-gb/practices/default.aspx" target="_blank">Patterns and Practices</a> team have created an excellent set of tools and guidance to help solve some very common problems; without producing a heavy, complicated framework in the process (<a href="http://msdn.microsoft.com/en-us/library/aa480450.aspx" target="_blank">CAB</a> anyone? <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  )</p>
<h3>“I Can’t Frikkin’ Find It!”</h3>
<p>Ok, I admit it, you’ve got me on this one! <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  Is it on MSDN? Is it on CodePlex? Both?! Is it called PRISM? The Composite Application Library (CAL)? Or maybe Composite Application Guidance for WPF and Silverlight (CAG)?</p>
<p>Now CAL obviously refers to the library, CAG to the guidance, and I believe PRISM is an umbrella term for the whole project, but the naming is certainly confusing, and searching for PRISM takes you to CodePlex then MSDN and back again, so it’s very easy to get confused! In fact, finding, downloading and building the library is actually MORE confusing than using the damn thing! There is actually a whole article on Sparking Client on <a href="http://www.sparklingclient.com/downloading-and-building-prism/" target="_blank">How to Find, Download and Build Prism for Silverlight</a>, which speaks volumes <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>I really don’t see what’s wrong with calling the whole thing PRISM and leaving it at that. If I say&#160; “.Net Framework”, then most developers would know what I mean. There’s certainly no need for me to call it the “Microsoft Framework for Building Managed Applications Targeting the Windows Platform (MFBMATWP)” <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<h2>Tell Me More!</h2>
<p>If you want to know more about PRISM, or if you want some walkthroughs and examples of how to use it, then here’s some links that should float your boat:</p>
<ul>
<li>The <a href="http://msdn.microsoft.com/en-us/library/dd458809.aspx" target="_blank">MSDN section</a> covers the goals and architecture of PRISM, along with some hands on examples and labs. </li>
<li>Shawn Wildermuth’s recent article from MSDN Magazine, entitled <a href="http://msdn.microsoft.com/en-us/magazine/dd943055.aspx" target="_blank">Composite Web Apps With Prism</a>, contains a good intro to Prism, and a walkthrough on putting together a Composite Silverlight app. </li>
<li><a href="http://blogs.msdn.com/blaine/" target="_blank">Blaine Wastell</a> has plenty of PRISM resources on <a href="http://blogs.msdn.com/blaine/" target="_blank">his blog</a>, including links to the excellent “getting started” screencasts from Channel 9. </li>
<li><a href="http://neverindoubtnet.blogspot.com/" target="_blank">Ward Bell</a> did an excellent video introduction to PRISM at Tech-Ed and it’s available from <a href="http://www.ideablade.com/DevforceSilverlight/Videos/TechEd_PrismExplorer/TechEd_BuildingModularApps_PrismExplorer.html" target="_blank">IdeaBlade</a>. </li>
<li><a href="http://briannoyes.net/" target="_blank">Brian Noyes</a> did some <a href="http://www.dnrtv.com/" target="_blank">DNRTV</a> episodes showing <a href="http://www.dnrtv.com/default.aspx?showNum=124" target="_blank">PRISM basics</a>, and <a href="http://www.dnrtv.com/default.aspx?showNum=132" target="_blank">PRISM Events and Commands</a> </li>
<li>There’s some good introductory information on the <a href="http://www.sparklingclient.com/" target="_blank">Sparkling Client</a> blog, including how to download and install it <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </li>
<li>There are some interesting additions to PRISM on the <a href="http://compositewpfcontrib.codeplex.com/" target="_blank">contrib Codeplex site</a>. </li>
<li>Ward Bell has an interesting article on his blog, in a similar vein to this one, where he asks <a href="http://neverindoubtnet.blogspot.com/2009/05/are-we-overselling-prism.html" target="_blank">Are We Overselling Prism?</a> </li>
<li>There’s a list of <a href="http://www.sparklingclient.com/prism-silverlight/" target="_blank">10 Things To Know About Silverlight Prism</a> on the Sparkling Client blog.</li>
</ul>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Why%20Shouldn%26rsquo%3Bt%20I%20use%20PRISM%3F%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F04%2Fwhy-shouldn%25e2%2580%2599t-i-use-prism%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F04%2Fwhy-shouldn%25e2%2580%2599t-i-use-prism%2F&amp;title=Why%20Shouldn%26rsquo%3Bt%20I%20use%20PRISM%3F" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F04%2Fwhy-shouldn%25e2%2580%2599t-i-use-prism%2F&amp;title=Why%20Shouldn%26rsquo%3Bt%20I%20use%20PRISM%3F&amp;annotation=Introduction%20%20PRISM%2C%20or%20Composite%20Application%20Guidance%2FLibrary%20for%20WPF%2FSilverlight%2C%20is%20a%20library%20and%20a%20corresponding%20guidance%20document%20that%20helps%20you%20to%20build%20loosely%20coupled%20%E2%80%9Ccomposite%E2%80%9D%20WPF%20and%20Silverlight%20applications.%20%20The%20library%20itself%20%E2%80%9Csi" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F04%2Fwhy-shouldn%25e2%2580%2599t-i-use-prism%2F&amp;title=Why%20Shouldn%26rsquo%3Bt%20I%20use%20PRISM%3F&amp;bodytext=Introduction%20%20PRISM%2C%20or%20Composite%20Application%20Guidance%2FLibrary%20for%20WPF%2FSilverlight%2C%20is%20a%20library%20and%20a%20corresponding%20guidance%20document%20that%20helps%20you%20to%20build%20loosely%20coupled%20%E2%80%9Ccomposite%E2%80%9D%20WPF%20and%20Silverlight%20applications.%20%20The%20library%20itself%20%E2%80%9Csi" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F04%2Fwhy-shouldn%25e2%2580%2599t-i-use-prism%2F&amp;title=Why%20Shouldn%26rsquo%3Bt%20I%20use%20PRISM%3F&amp;notes=Introduction%20%20PRISM%2C%20or%20Composite%20Application%20Guidance%2FLibrary%20for%20WPF%2FSilverlight%2C%20is%20a%20library%20and%20a%20corresponding%20guidance%20document%20that%20helps%20you%20to%20build%20loosely%20coupled%20%E2%80%9Ccomposite%E2%80%9D%20WPF%20and%20Silverlight%20applications.%20%20The%20library%20itself%20%E2%80%9Csi" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F04%2Fwhy-shouldn%25e2%2580%2599t-i-use-prism%2F&amp;title=Why%20Shouldn%26rsquo%3Bt%20I%20use%20PRISM%3F" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F04%2Fwhy-shouldn%25e2%2580%2599t-i-use-prism%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F04%2Fwhy-shouldn%25e2%2580%2599t-i-use-prism%2F&amp;title=Why%20Shouldn%26rsquo%3Bt%20I%20use%20PRISM%3F" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Why%20Shouldn%26rsquo%3Bt%20I%20use%20PRISM%3F&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F04%2Fwhy-shouldn%25e2%2580%2599t-i-use-prism%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Why%20Shouldn%26rsquo%3Bt%20I%20use%20PRISM%3F&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F04%2Fwhy-shouldn%25e2%2580%2599t-i-use-prism%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F04%2Fwhy-shouldn%25e2%2580%2599t-i-use-prism%2F&amp;title=Why%20Shouldn%26rsquo%3Bt%20I%20use%20PRISM%3F&amp;body=Introduction%20%20PRISM%2C%20or%20Composite%20Application%20Guidance%2FLibrary%20for%20WPF%2FSilverlight%2C%20is%20a%20library%20and%20a%20corresponding%20guidance%20document%20that%20helps%20you%20to%20build%20loosely%20coupled%20%E2%80%9Ccomposite%E2%80%9D%20WPF%20and%20Silverlight%20applications.%20%20The%20library%20itself%20%E2%80%9Csi" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F04%2Fwhy-shouldn%25e2%2580%2599t-i-use-prism%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F07%2F04%2Fwhy-shouldn%25e2%2580%2599t-i-use-prism%2F&amp;title=Why%20Shouldn%26rsquo%3Bt%20I%20use%20PRISM%3F" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Composite+Application+Guidance' rel='tag' target='_blank'>Composite Application Guidance</a>, <a class='technorati-link' href='http://technorati.com/tag/Composite+Application+Library' rel='tag' target='_blank'>Composite Application Library</a>, <a class='technorati-link' href='http://technorati.com/tag/PRISM' rel='tag' target='_blank'>PRISM</a>, <a class='technorati-link' href='http://technorati.com/tag/Silverlight' rel='tag' target='_blank'>Silverlight</a>, <a class='technorati-link' href='http://technorati.com/tag/WPF' rel='tag' target='_blank'>WPF</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2009/07/04/why-shouldn%e2%80%99t-i-use-prism/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Sync Your Google Calendar with Your iPhone Using CalDAV</title>
		<link>http://www.grumpydev.com/2009/06/21/sync-your-google-calendar-with-your-iphone-using-caldav/</link>
		<comments>http://www.grumpydev.com/2009/06/21/sync-your-google-calendar-with-your-iphone-using-caldav/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 20:08:25 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[iPhone]]></category>
		<category><![CDATA[caldav]]></category>
		<category><![CDATA[google calendar]]></category>
		<category><![CDATA[sync]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=192</guid>
		<description><![CDATA[Introduction Although you’ve been able to sync your Google Calendar with your iPhone for some time using ActiveSync, there is a limitation whereby you can only add a single ActiveSync account at one time. This isn’t a problem for most people, but if you happen to use ActiveSync for your work email, then it becomes [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Although you’ve been able to sync your <a href="http://www.google.com/calendar" target="_blank">Google Calendar</a> with your iPhone for some time using <a href="http://support.apple.com/kb/HT2480" target="_blank">ActiveSync</a>, there is a limitation whereby you can only add a single ActiveSync account at one time. This isn’t a problem for most people, but if you happen to use ActiveSync for your work email, then it becomes a bit of an issue.</p>
<h2>Enter CalDAV</h2>
<p>One of the new features of the <a href="http://www.apple.com/iphone/softwareupdate/" target="_blank">3.0 firmware</a> is the ability to add a <a href="http://www.google.com/support/calendar/bin/answer.py?answer=99357" target="_blank">CalDAV</a> calendar, which it just so happens that Google Calendar <a href="http://www.google.com/support/calendar/bin/answer.py?answer=99357" target="_blank">also supports</a>.</p>
<p>Adding your calendar to the phone is very simple:</p>
<ol>
<li>Go into “<strong>Settings</strong>”, “<strong>Mail, Contacts, Calendars</strong>”</li>
<li>Choose “<strong>Add Account…</strong>”</li>
<li>Select “<strong>Other</strong>” for the account type</li>
<li>Under “<strong>Calendars</strong>” choose “<strong>Add CalDAV Account</strong>”</li>
<li>For “Server” you need to put “<strong>https://www.google.com/calendar/dav/YOUREMAIL@DOMAIN.COM/user</strong>” (obviously replacing the <strong>YOUREMAIL@DOMAIN.COM</strong>!)</li>
<li>“<strong>Username</strong>” and “<strong>Password</strong>” are your normal Google account details and “<strong>Description</strong>” is whatever you want it to be.</li>
<li>Press Next, you will see an error stating that the CalDAV account could not be verified, but this doesn’t appear to actually be a problem.</li>
<li>All done!</li>
</ol>
<p>Now you should see your Google calendar in the Calendar app on the iPhone, and you should see it as an option when creating a new appointment. If you go back into “Settings”, “Mail, Contacts, Calendars” you can also set the Google calendar to be your default.</p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Sync%20Your%20Google%20Calendar%20with%20Your%20iPhone%20Using%20CalDAV%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2009%2F06%2F21%2Fsync-your-google-calendar-with-your-iphone-using-caldav%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F06%2F21%2Fsync-your-google-calendar-with-your-iphone-using-caldav%2F&amp;title=Sync%20Your%20Google%20Calendar%20with%20Your%20iPhone%20Using%20CalDAV" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F06%2F21%2Fsync-your-google-calendar-with-your-iphone-using-caldav%2F&amp;title=Sync%20Your%20Google%20Calendar%20with%20Your%20iPhone%20Using%20CalDAV&amp;annotation=Introduction%0D%0AAlthough%20you%E2%80%99ve%20been%20able%20to%20sync%20your%20Google%20Calendar%20with%20your%20iPhone%20for%20some%20time%20using%20ActiveSync%2C%20there%20is%20a%20limitation%20whereby%20you%20can%20only%20add%20a%20single%20ActiveSync%20account%20at%20one%20time.%20This%20isn%E2%80%99t%20a%20problem%20for%20most%20people%2C%20bu" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F06%2F21%2Fsync-your-google-calendar-with-your-iphone-using-caldav%2F&amp;title=Sync%20Your%20Google%20Calendar%20with%20Your%20iPhone%20Using%20CalDAV&amp;bodytext=Introduction%0D%0AAlthough%20you%E2%80%99ve%20been%20able%20to%20sync%20your%20Google%20Calendar%20with%20your%20iPhone%20for%20some%20time%20using%20ActiveSync%2C%20there%20is%20a%20limitation%20whereby%20you%20can%20only%20add%20a%20single%20ActiveSync%20account%20at%20one%20time.%20This%20isn%E2%80%99t%20a%20problem%20for%20most%20people%2C%20bu" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F06%2F21%2Fsync-your-google-calendar-with-your-iphone-using-caldav%2F&amp;title=Sync%20Your%20Google%20Calendar%20with%20Your%20iPhone%20Using%20CalDAV&amp;notes=Introduction%0D%0AAlthough%20you%E2%80%99ve%20been%20able%20to%20sync%20your%20Google%20Calendar%20with%20your%20iPhone%20for%20some%20time%20using%20ActiveSync%2C%20there%20is%20a%20limitation%20whereby%20you%20can%20only%20add%20a%20single%20ActiveSync%20account%20at%20one%20time.%20This%20isn%E2%80%99t%20a%20problem%20for%20most%20people%2C%20bu" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F06%2F21%2Fsync-your-google-calendar-with-your-iphone-using-caldav%2F&amp;title=Sync%20Your%20Google%20Calendar%20with%20Your%20iPhone%20Using%20CalDAV" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F06%2F21%2Fsync-your-google-calendar-with-your-iphone-using-caldav%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F06%2F21%2Fsync-your-google-calendar-with-your-iphone-using-caldav%2F&amp;title=Sync%20Your%20Google%20Calendar%20with%20Your%20iPhone%20Using%20CalDAV" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Sync%20Your%20Google%20Calendar%20with%20Your%20iPhone%20Using%20CalDAV&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F06%2F21%2Fsync-your-google-calendar-with-your-iphone-using-caldav%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Sync%20Your%20Google%20Calendar%20with%20Your%20iPhone%20Using%20CalDAV&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F06%2F21%2Fsync-your-google-calendar-with-your-iphone-using-caldav%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F06%2F21%2Fsync-your-google-calendar-with-your-iphone-using-caldav%2F&amp;title=Sync%20Your%20Google%20Calendar%20with%20Your%20iPhone%20Using%20CalDAV&amp;body=Introduction%0D%0AAlthough%20you%E2%80%99ve%20been%20able%20to%20sync%20your%20Google%20Calendar%20with%20your%20iPhone%20for%20some%20time%20using%20ActiveSync%2C%20there%20is%20a%20limitation%20whereby%20you%20can%20only%20add%20a%20single%20ActiveSync%20account%20at%20one%20time.%20This%20isn%E2%80%99t%20a%20problem%20for%20most%20people%2C%20bu" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F06%2F21%2Fsync-your-google-calendar-with-your-iphone-using-caldav%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F06%2F21%2Fsync-your-google-calendar-with-your-iphone-using-caldav%2F&amp;title=Sync%20Your%20Google%20Calendar%20with%20Your%20iPhone%20Using%20CalDAV" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/caldav' rel='tag' target='_blank'>caldav</a>, <a class='technorati-link' href='http://technorati.com/tag/google+calendar' rel='tag' target='_blank'>google calendar</a>, <a class='technorati-link' href='http://technorati.com/tag/iPhone' rel='tag' target='_blank'>iPhone</a>, <a class='technorati-link' href='http://technorati.com/tag/sync' rel='tag' target='_blank'>sync</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2009/06/21/sync-your-google-calendar-with-your-iphone-using-caldav/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Surface SDK SP1 on Vista and Win7 x64</title>
		<link>http://www.grumpydev.com/2009/05/17/surface-sdk-sp1-on-vista-and-win7-x64/</link>
		<comments>http://www.grumpydev.com/2009/05/17/surface-sdk-sp1-on-vista-and-win7-x64/#comments</comments>
		<pubDate>Sun, 17 May 2009 17:32:21 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[Surface]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[vista]]></category>
		<category><![CDATA[Win7]]></category>
		<category><![CDATA[Windows 7]]></category>
		<category><![CDATA[workaround]]></category>
		<category><![CDATA[x64]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=182</guid>
		<description><![CDATA[Introduction This is a follow up post to Surface SDK on Vista x64 where we got the original Surface SDK working on the unsupported Vista X64. Last week Microsoft released Service Pack 1 of the SDK and there is an additional tweak that we need to get it going. The original post was split into [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>This is a follow up post to <a href="http://www.grumpydev.com/2008/12/26/surface-sdk-on-vista-x64/" target="_blank">Surface SDK on Vista x64</a> where we got the original Surface SDK working on the unsupported Vista X64. Last week Microsoft released Service Pack 1 of the SDK and there is an additional tweak that we need to get it going.</p>
<p>The original post was split into 3 sections:</p>
<ol>
<li>Patch the MSI and install</li>
<li>Patch the Simulator and other files</li>
<li>Configure our projects</li>
</ol>
<p>Steps 2 and 3 haven’t changed with SP1 (we don&#8217;t need to &#8220;corflags&#8221; the new &#8220;stress&#8221; tool as it connects to the simulator rather than launching it), so jump over to the <a href="http://www.grumpydev.com/2008/12/26/surface-sdk-on-vista-x64/" target="_blank">original post</a> when you’ve got the SDK installed.</p>
<h2>Prerequisites</h2>
<ul>
<li>Surface SDK SP1 (duh!)</li>
<li>Visual Studio 2008 (for corflags)</li>
<li>Orca (part of the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=4377F86D-C913-4B5C-B87E-EF72E5B4E065&amp;displaylang=en" target="_blank">Windows SDK</a> or just <a href="http://www.google.co.uk/search?q=orca+msi&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla:en-GB:official&amp;client=firefox-a" target="_blank">search for it</a>)</li>
<li>Administrator access to the Vista or Win7 box you’re installing onto.</li>
</ul>
<h2>Step 1 – The MSI</h2>
<p>Firstly we need to use Orca to tweak the launch conditions of the MSI. Make sure you&#8217;ve installed all of the SDK pre-requisites first, then walk through the following:</p>
<ol>
<li>Install Orca (link above, or just search for it).</li>
<li>Copy the SurfaceSDKWE.msi to somewhere on your hard disk, and make sure that it&#8217;s not Read Only.</li>
<li>Right click on the MSI and choose Edit with Orca. This will trigger a UAC, but it&#8217;s software from Microsoft, so you should be ok to trust it <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
<li>Select &#8220;LaunchCondition&#8221; in the left hand list, then select &#8220;Install OR NOT VersionNT64&#8243; in the right hand list (see below).<br />
<a href="http://www.grumpydev.com/wp-content/uploads/2009/05/surfacesp1removelc.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Remove Launch Condition" src="http://www.grumpydev.com/wp-content/uploads/2009/05/surfacesp1removelc-thumb.jpg" border="0" alt="Remove Launch Condition" width="244" height="185" /></a></li>
<li>Press delete and click OK when asked to confirm the row delete.</li>
</ol>
<p>This is where we got to with the original SDK, but the SP1 install will still fail if we leave it like that. As part of SP1 Microsoft has added automatic updates and <a href="http://technet.microsoft.com/en-us/library/cc766486.aspx" target="_blank">automatic error reporting</a>. Unfortunately the exe they call as a custom action doesn’t work on x64 (it looks like it puts registry entries in the wrong place), which causes the install to fail. We could extract the MSI, patch the custom exe with corflags and then run setup, but we won’t do that because:</p>
<p><strong>a)</strong> We don’t want automatic updates as they will overwrite our nicely patched exes, and<br />
<strong>b)</strong> x64 is not a supported platform, so I’m sure Microsoft aren’t particularly interested in error reports!</p>
<p>Instead of that we can just continue with Orca to remove those commands from the installer:</p>
<ol>
<li>From Orca, select “InstallExecuteSequence” in the list on the left and remove SetCreateSqmMachineGuid and CreateSqmMachineGuid as before:<a href="http://www.grumpydev.com/wp-content/uploads/2009/05/surfacesp1removesqm.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Remove Sqm" src="http://www.grumpydev.com/wp-content/uploads/2009/05/surfacesp1removesqm-thumb.jpg" border="0" alt="Remove Sqm" width="244" height="186" /></a></li>
<li>Click Save on the toolbar</li>
</ol>
<p>Now you can quit Orca and run the msi, which should install just fine. Make sure you also switch off automatic updates and error reporting as follows:</p>
<p><a href="http://www.grumpydev.com/wp-content/uploads/2009/05/surfacesp1wiz1.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Surface SDK SP1 Wizard 1" src="http://www.grumpydev.com/wp-content/uploads/2009/05/surfacesp1wiz1-thumb.jpg" border="0" alt="Surface SDK SP1 Wizard 1" width="244" height="192" /></a> <a href="http://www.grumpydev.com/wp-content/uploads/2009/05/surfacesp1wiz2.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Surface SDK SP1 Wizard 2" src="http://www.grumpydev.com/wp-content/uploads/2009/05/surfacesp1wiz2-thumb.jpg" border="0" alt="Surface SDK SP1 Wizard 2" width="244" height="192" /></a><a href="http://www.grumpydev.com/wp-content/uploads/2009/05/surfacesp1wiz3.jpg"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Surface SDK SP1 Wizard 3" src="http://www.grumpydev.com/wp-content/uploads/2009/05/surfacesp1wiz3-thumb.jpg" border="0" alt="Surface SDK SP1 Wizard 3" width="244" height="192" /></a></p>
<p>Now the SDK is installed, head over to the <a href="http://www.grumpydev.com/2008/12/26/surface-sdk-on-vista-x64/" target="_blank">original post</a> and follow steps 2 and 3 and you’re all done.</p>
<p>Thanks to <a href="http://www.grumpydev.com/2008/12/26/surface-sdk-on-vista-x64/comment-page-1/#comment-90" target="_blank">JamesK</a> for his workaround comment on the original post.</p>
<p><b>Update:</b> thanks to <a href="http://www.studentguru.gr/blogs/jupiter">Michael Zervos</a> for letting me know that the academic version of the SDK comes in EXE, rather than MSI form. As he <a href="http://www.studentguru.gr/blogs/jupiter/archive/2009/10/07/surface-sdk-on-vista-windows-7-x64.aspx">points out on his blog</a>, if you keep an eye on your %temp% directory when you run the EXE it will extract the MSI for you to copy and patch.</p>
<p><b>Update again:</b> Thanks to <a href="http://www.grumpydev.com/2008/12/26/surface-sdk-on-vista-x64/comment-page-1/#comment-156">Robin Sanner</a> for providing details on getting the samples to work:</p>
<p>To get the samples to build and install correctly do the following:</p>
<p>- Edit the configuration properties for the sample solution and create an x86 platform for all projects.<br />
- Edit InstallSamples.bat<br />
- Comment out the lines on either side of the set as follows:</p>
<p>::FOR /F “eol=H tokens=2*” %%A IN (‘REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Surface\v1.0 /v IsLogicalSurfaceUnit’) DO SET LogicalTableValue=%%B<br />
SET InstallingOnTable=false<br />
::IF %LogicalTableValue%==0×1 SET InstallingOnTable=true</p>
<p>- Change the MSBuildParameters to reference the x86 PlatformName as follows:</p>
<p>SET MSBuildParameters=/p:Configuration=Release;PlatformName=x86 /noconsolelogger /fl /fileLoggerParameters:LogFile=%LogFile%;Append /nologo</p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Surface%20SDK%20SP1%20on%20Vista%20and%20Win7%20x64%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2009%2F05%2F17%2Fsurface-sdk-sp1-on-vista-and-win7-x64%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F05%2F17%2Fsurface-sdk-sp1-on-vista-and-win7-x64%2F&amp;title=Surface%20SDK%20SP1%20on%20Vista%20and%20Win7%20x64" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F05%2F17%2Fsurface-sdk-sp1-on-vista-and-win7-x64%2F&amp;title=Surface%20SDK%20SP1%20on%20Vista%20and%20Win7%20x64&amp;annotation=Introduction%0D%0AThis%20is%20a%20follow%20up%20post%20to%20Surface%20SDK%20on%20Vista%20x64%20where%20we%20got%20the%20original%20Surface%20SDK%20working%20on%20the%20unsupported%20Vista%20X64.%20Last%20week%20Microsoft%20released%20Service%20Pack%201%20of%20the%20SDK%20and%20there%20is%20an%20additional%20tweak%20that%20we%20need%20to%20get" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F05%2F17%2Fsurface-sdk-sp1-on-vista-and-win7-x64%2F&amp;title=Surface%20SDK%20SP1%20on%20Vista%20and%20Win7%20x64&amp;bodytext=Introduction%0D%0AThis%20is%20a%20follow%20up%20post%20to%20Surface%20SDK%20on%20Vista%20x64%20where%20we%20got%20the%20original%20Surface%20SDK%20working%20on%20the%20unsupported%20Vista%20X64.%20Last%20week%20Microsoft%20released%20Service%20Pack%201%20of%20the%20SDK%20and%20there%20is%20an%20additional%20tweak%20that%20we%20need%20to%20get" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F05%2F17%2Fsurface-sdk-sp1-on-vista-and-win7-x64%2F&amp;title=Surface%20SDK%20SP1%20on%20Vista%20and%20Win7%20x64&amp;notes=Introduction%0D%0AThis%20is%20a%20follow%20up%20post%20to%20Surface%20SDK%20on%20Vista%20x64%20where%20we%20got%20the%20original%20Surface%20SDK%20working%20on%20the%20unsupported%20Vista%20X64.%20Last%20week%20Microsoft%20released%20Service%20Pack%201%20of%20the%20SDK%20and%20there%20is%20an%20additional%20tweak%20that%20we%20need%20to%20get" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F05%2F17%2Fsurface-sdk-sp1-on-vista-and-win7-x64%2F&amp;title=Surface%20SDK%20SP1%20on%20Vista%20and%20Win7%20x64" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F05%2F17%2Fsurface-sdk-sp1-on-vista-and-win7-x64%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F05%2F17%2Fsurface-sdk-sp1-on-vista-and-win7-x64%2F&amp;title=Surface%20SDK%20SP1%20on%20Vista%20and%20Win7%20x64" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Surface%20SDK%20SP1%20on%20Vista%20and%20Win7%20x64&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F05%2F17%2Fsurface-sdk-sp1-on-vista-and-win7-x64%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Surface%20SDK%20SP1%20on%20Vista%20and%20Win7%20x64&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F05%2F17%2Fsurface-sdk-sp1-on-vista-and-win7-x64%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F05%2F17%2Fsurface-sdk-sp1-on-vista-and-win7-x64%2F&amp;title=Surface%20SDK%20SP1%20on%20Vista%20and%20Win7%20x64&amp;body=Introduction%0D%0AThis%20is%20a%20follow%20up%20post%20to%20Surface%20SDK%20on%20Vista%20x64%20where%20we%20got%20the%20original%20Surface%20SDK%20working%20on%20the%20unsupported%20Vista%20X64.%20Last%20week%20Microsoft%20released%20Service%20Pack%201%20of%20the%20SDK%20and%20there%20is%20an%20additional%20tweak%20that%20we%20need%20to%20get" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F05%2F17%2Fsurface-sdk-sp1-on-vista-and-win7-x64%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F05%2F17%2Fsurface-sdk-sp1-on-vista-and-win7-x64%2F&amp;title=Surface%20SDK%20SP1%20on%20Vista%20and%20Win7%20x64" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/sdk' rel='tag' target='_blank'>sdk</a>, <a class='technorati-link' href='http://technorati.com/tag/Surface' rel='tag' target='_blank'>Surface</a>, <a class='technorati-link' href='http://technorati.com/tag/vista' rel='tag' target='_blank'>vista</a>, <a class='technorati-link' href='http://technorati.com/tag/Win7' rel='tag' target='_blank'>Win7</a>, <a class='technorati-link' href='http://technorati.com/tag/Windows+7' rel='tag' target='_blank'>Windows 7</a>, <a class='technorati-link' href='http://technorati.com/tag/workaround' rel='tag' target='_blank'>workaround</a>, <a class='technorati-link' href='http://technorati.com/tag/x64' rel='tag' target='_blank'>x64</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2009/05/17/surface-sdk-sp1-on-vista-and-win7-x64/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Sync Live Writer Local Drafts Across Multiple Machines with DropBox</title>
		<link>http://www.grumpydev.com/2009/04/26/sync-live-writer-local-drafts-across-multiple-machines-with-dropbox/</link>
		<comments>http://www.grumpydev.com/2009/04/26/sync-live-writer-local-drafts-across-multiple-machines-with-dropbox/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 16:31:24 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[Rambling]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[drafts]]></category>
		<category><![CDATA[dropbox]]></category>
		<category><![CDATA[live writer]]></category>
		<category><![CDATA[sync]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=169</guid>
		<description><![CDATA[Introduction Anyone that blogs should be using Live Writer, end of discussion. It’s brilliant in its own right (and surprisingly doesn’t just support Windows Live blogs!) and its various plugins just make life so much better for bloggers. One of the features it has, which I’ve always found a little limiting, is the ability to [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>Anyone that blogs should be using <a href="http://download.live.com/writer" target="_blank">Live Writer</a>, end of discussion. It’s brilliant in its own right (and surprisingly doesn’t just support Windows Live blogs!) and its various plugins just make life so much better for bloggers.</p>
<p>One of the features it has, which I’ve always found a little limiting, is the ability to save local drafts. These drafts are saved into your local Documents folder, which is fine if you blog from a single machine, but if you chop and change machines as often as you change your socks like I do, then it’s not a whole lot of use. Admittedly it does give you the option of saving drafts to your blog (with WordPress at least), but I don’t particularly want ALL my inane nonsense cluttering my blog drafts <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h2>Asking The Question</h2>
<p>I asked <a href="http://jcheng.wordpress.com/" target="_blank">Joe Cheng</a>, one of the Live Writer developers, on Twitter about whether changing the default location was possible. Unfortunately it’s one of those features that’s “on the list” for the next major version, but not implemented this release. <a href="http://www.philoking.com/2009/04/23/using-windows-live-mesh-to-share-windows-live-writer-drafts-between-computers/" target="_blank">Jason Burns</a> was kind enough to point out a solution using Live Mesh, which works a treat; but <a href="http://www.getdropbox.com/" target="_blank">DropBox</a> is my “cloud storage of choice”, and one of the first things I install on any machine, so I hacked together my own solution.</p>
<h2>The Solution / Workaround / Bodge</h2>
<p>One of features of NTFS, which isn’t widely used, is the ability to create “<a href="http://en.wikipedia.org/wiki/NTFS_junction_point" target="_blank">junction points</a>”. <a href="http://en.wikipedia.org/wiki/NTFS_junction_point" target="_blank">Junction Points</a> are very similar to symbolic links in the UNIX world – they create a file or folder that “maps” to another file or folder; so when I go to c:\myfakefolder I can actually be looking at files in c:\myrealfolder. They’re not used all that often because Shortcuts generally do a good enough job for linking one place to another; but in this scenario Shortcuts don’t cut the mustard (Live Writer will just ignore it and create its folder again), so a junction point it is!</p>
<p>First things first we need to copy or create the “My Weblog Posts” directory in our Dropbox, which you can just do with Explorer, then delete the original from our Document folder. You might want to back it up in case this goes horribly wrong <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Next we need to create our junction point, which is easy in Vista and Win7, as they both come with utilities to manage them, but for XP or Windows 2000 you will have to download a SysInternals utility called <a href="http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx" target="_blank">Junction</a> from <a href="http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx" target="_blank">Technet</a>. The syntax for the two methods is slightly different, but the basic concept is the same. We tell the utility the location of the link we want to create (which will be &lt;your documents directory&gt;\My Weblog Posts) and where to point it to (which will be &lt;your dropbox directory&gt;\My Weblog Posts). E.g.:</p>
<p><strong>Vista / Win7</strong></p>
<pre>mklink /D &quot;%UserProfile%\Documents\My Weblog Posts&quot; &quot;%UserProfile%\Documents\My Dropbox\My Weblog Posts&quot;</pre>
<p>
  <br /><strong>WinXP / Win2k</strong></p>
<p></p>
<pre>junction &quot;%UserProfile%\My Documents\My Weblog Posts&quot; &quot;%UserProfile%\My Documents\My Dropbox\My Weblog Posts&quot;</pre>
<p>And that should be that. If you copied existing drafts to your Dropbox you should be able to see them from the Open dialog. There does appear to be a small bug in Live Writer whereby it doesn’t show you the drafts in the shortcut list on the right hand side until you’ve actually saved a draft; but you can access them just fine from the Open menu, and they’ll magically appear once you’ve saved a draft for the first time.</p>
<p>I worked on this post using this workaround on two different machines, so it does seem to work nicely; but as with all workarounds, please make sure you back everything up just in case!</p>
<h2>*Update*</h2>
<p>If you don’t want to type these commands in manually then <a href="http://www.humblecoder.co.uk/" target="_blank">Will Charles</a> has created a useful little GUI utility to take some of the pain away. You can grab it over on <a href="http://www.humblecoder.co.uk/?p=50" target="_blank">his blog</a>.</p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Sync%20Live%20Writer%20Local%20Drafts%20Across%20Multiple%20Machines%20with%20DropBox%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F26%2Fsync-live-writer-local-drafts-across-multiple-machines-with-dropbox%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F26%2Fsync-live-writer-local-drafts-across-multiple-machines-with-dropbox%2F&amp;title=Sync%20Live%20Writer%20Local%20Drafts%20Across%20Multiple%20Machines%20with%20DropBox" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F26%2Fsync-live-writer-local-drafts-across-multiple-machines-with-dropbox%2F&amp;title=Sync%20Live%20Writer%20Local%20Drafts%20Across%20Multiple%20Machines%20with%20DropBox&amp;annotation=Introduction%20%20Anyone%20that%20blogs%20should%20be%20using%20Live%20Writer%2C%20end%20of%20discussion.%20It%E2%80%99s%20brilliant%20in%20its%20own%20right%20%28and%20surprisingly%20doesn%E2%80%99t%20just%20support%20Windows%20Live%20blogs%21%29%20and%20its%20various%20plugins%20just%20make%20life%20so%20much%20better%20for%20bloggers.%20%20One%20o" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F26%2Fsync-live-writer-local-drafts-across-multiple-machines-with-dropbox%2F&amp;title=Sync%20Live%20Writer%20Local%20Drafts%20Across%20Multiple%20Machines%20with%20DropBox&amp;bodytext=Introduction%20%20Anyone%20that%20blogs%20should%20be%20using%20Live%20Writer%2C%20end%20of%20discussion.%20It%E2%80%99s%20brilliant%20in%20its%20own%20right%20%28and%20surprisingly%20doesn%E2%80%99t%20just%20support%20Windows%20Live%20blogs%21%29%20and%20its%20various%20plugins%20just%20make%20life%20so%20much%20better%20for%20bloggers.%20%20One%20o" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F26%2Fsync-live-writer-local-drafts-across-multiple-machines-with-dropbox%2F&amp;title=Sync%20Live%20Writer%20Local%20Drafts%20Across%20Multiple%20Machines%20with%20DropBox&amp;notes=Introduction%20%20Anyone%20that%20blogs%20should%20be%20using%20Live%20Writer%2C%20end%20of%20discussion.%20It%E2%80%99s%20brilliant%20in%20its%20own%20right%20%28and%20surprisingly%20doesn%E2%80%99t%20just%20support%20Windows%20Live%20blogs%21%29%20and%20its%20various%20plugins%20just%20make%20life%20so%20much%20better%20for%20bloggers.%20%20One%20o" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F26%2Fsync-live-writer-local-drafts-across-multiple-machines-with-dropbox%2F&amp;title=Sync%20Live%20Writer%20Local%20Drafts%20Across%20Multiple%20Machines%20with%20DropBox" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F26%2Fsync-live-writer-local-drafts-across-multiple-machines-with-dropbox%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F26%2Fsync-live-writer-local-drafts-across-multiple-machines-with-dropbox%2F&amp;title=Sync%20Live%20Writer%20Local%20Drafts%20Across%20Multiple%20Machines%20with%20DropBox" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Sync%20Live%20Writer%20Local%20Drafts%20Across%20Multiple%20Machines%20with%20DropBox&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F26%2Fsync-live-writer-local-drafts-across-multiple-machines-with-dropbox%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Sync%20Live%20Writer%20Local%20Drafts%20Across%20Multiple%20Machines%20with%20DropBox&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F26%2Fsync-live-writer-local-drafts-across-multiple-machines-with-dropbox%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F26%2Fsync-live-writer-local-drafts-across-multiple-machines-with-dropbox%2F&amp;title=Sync%20Live%20Writer%20Local%20Drafts%20Across%20Multiple%20Machines%20with%20DropBox&amp;body=Introduction%20%20Anyone%20that%20blogs%20should%20be%20using%20Live%20Writer%2C%20end%20of%20discussion.%20It%E2%80%99s%20brilliant%20in%20its%20own%20right%20%28and%20surprisingly%20doesn%E2%80%99t%20just%20support%20Windows%20Live%20blogs%21%29%20and%20its%20various%20plugins%20just%20make%20life%20so%20much%20better%20for%20bloggers.%20%20One%20o" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F26%2Fsync-live-writer-local-drafts-across-multiple-machines-with-dropbox%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F26%2Fsync-live-writer-local-drafts-across-multiple-machines-with-dropbox%2F&amp;title=Sync%20Live%20Writer%20Local%20Drafts%20Across%20Multiple%20Machines%20with%20DropBox" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/drafts' rel='tag' target='_blank'>drafts</a>, <a class='technorati-link' href='http://technorati.com/tag/dropbox' rel='tag' target='_blank'>dropbox</a>, <a class='technorati-link' href='http://technorati.com/tag/live+writer' rel='tag' target='_blank'>live writer</a>, <a class='technorati-link' href='http://technorati.com/tag/sync' rel='tag' target='_blank'>sync</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2009/04/26/sync-live-writer-local-drafts-across-multiple-machines-with-dropbox/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>NxtGenUG Manchester .Net User Group – All Systems Go!</title>
		<link>http://www.grumpydev.com/2009/04/01/nxtgenug-manchester-net-user-group-%e2%80%93-all-systems-go/</link>
		<comments>http://www.grumpydev.com/2009/04/01/nxtgenug-manchester-net-user-group-%e2%80%93-all-systems-go/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 07:34:22 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[NxtGenUG]]></category>
		<category><![CDATA[Rambling]]></category>
		<category><![CDATA[manchester]]></category>
		<category><![CDATA[user group]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=162</guid>
		<description><![CDATA[Introduction I’ve been chatting to the guys that run the NxtGenUG .Net user group for a few months about the possibility of giving some “NxtGen love” to “us northerners”, and as of this morning Manchester is now officially the 7th region! In the words of El Presidente Richard Costall: &#8220;NxtGenUG is about bridging the gap [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>I’ve been chatting to the guys that run the <a href="http://www.nxtgenug.net/Default.aspx">NxtGenUG</a> .Net user group for a few months about the possibility of giving some “NxtGen love” to “us northerners”, and as of this morning <a href="http://www.nxtgenug.net/Region.aspx?RegionID=11">Manchester</a> is now officially the <a href="http://www.nxtgenug.net/Region.aspx?RegionID=11">7th region</a>!</p>
<p>In the words of El Presidente Richard Costall:</p>
<blockquote><p><strong><em>&#8220;NxtGenUG is about bridging the gap between Microsoft and the developer. The waves of technology emerging from Microsoft is relentless, developers are under more pressure to deliver software and also understand these new technologies.”</em></strong></p></blockquote>
<p>We’ll be kicking off in May with a main speaker still to be confirmed, so if you’re in the area then please feel free to sign up, or spread the word to anyone you think might be interested. There will be an event running on the 3rd Wednesday of each month, diaries permitting, keep an eye on the main <a href="http://www.nxtgenug.net/Default.aspx">NxtGenUG</a> page for more news.</p>
<p>Big thanks to Dave McMahon, Richard Costall and John Price for their invaluable help in getting this off the ground, and no, despite the date, this <strong>isn&#8217;t</strong> an April Fool! <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=NxtGenUG%20Manchester%20.Net%20User%20Group%20%E2%80%93%20All%20Systems%20Go%21%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F01%2Fnxtgenug-manchester-net-user-group-%25e2%2580%2593-all-systems-go%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F01%2Fnxtgenug-manchester-net-user-group-%25e2%2580%2593-all-systems-go%2F&amp;title=NxtGenUG%20Manchester%20.Net%20User%20Group%20%E2%80%93%20All%20Systems%20Go%21" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F01%2Fnxtgenug-manchester-net-user-group-%25e2%2580%2593-all-systems-go%2F&amp;title=NxtGenUG%20Manchester%20.Net%20User%20Group%20%E2%80%93%20All%20Systems%20Go%21&amp;annotation=Introduction%0D%0AI%E2%80%99ve%20been%20chatting%20to%20the%20guys%20that%20run%20the%20NxtGenUG%20.Net%20user%20group%20for%20a%20few%20months%20about%20the%20possibility%20of%20giving%20some%20%E2%80%9CNxtGen%20love%E2%80%9D%20to%20%E2%80%9Cus%20northerners%E2%80%9D%2C%20and%20as%20of%20this%20morning%20Manchester%20is%20now%20officially%20the%207th%20region%21%0D" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F01%2Fnxtgenug-manchester-net-user-group-%25e2%2580%2593-all-systems-go%2F&amp;title=NxtGenUG%20Manchester%20.Net%20User%20Group%20%E2%80%93%20All%20Systems%20Go%21&amp;bodytext=Introduction%0D%0AI%E2%80%99ve%20been%20chatting%20to%20the%20guys%20that%20run%20the%20NxtGenUG%20.Net%20user%20group%20for%20a%20few%20months%20about%20the%20possibility%20of%20giving%20some%20%E2%80%9CNxtGen%20love%E2%80%9D%20to%20%E2%80%9Cus%20northerners%E2%80%9D%2C%20and%20as%20of%20this%20morning%20Manchester%20is%20now%20officially%20the%207th%20region%21%0D" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F01%2Fnxtgenug-manchester-net-user-group-%25e2%2580%2593-all-systems-go%2F&amp;title=NxtGenUG%20Manchester%20.Net%20User%20Group%20%E2%80%93%20All%20Systems%20Go%21&amp;notes=Introduction%0D%0AI%E2%80%99ve%20been%20chatting%20to%20the%20guys%20that%20run%20the%20NxtGenUG%20.Net%20user%20group%20for%20a%20few%20months%20about%20the%20possibility%20of%20giving%20some%20%E2%80%9CNxtGen%20love%E2%80%9D%20to%20%E2%80%9Cus%20northerners%E2%80%9D%2C%20and%20as%20of%20this%20morning%20Manchester%20is%20now%20officially%20the%207th%20region%21%0D" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F01%2Fnxtgenug-manchester-net-user-group-%25e2%2580%2593-all-systems-go%2F&amp;title=NxtGenUG%20Manchester%20.Net%20User%20Group%20%E2%80%93%20All%20Systems%20Go%21" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F01%2Fnxtgenug-manchester-net-user-group-%25e2%2580%2593-all-systems-go%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F01%2Fnxtgenug-manchester-net-user-group-%25e2%2580%2593-all-systems-go%2F&amp;title=NxtGenUG%20Manchester%20.Net%20User%20Group%20%E2%80%93%20All%20Systems%20Go%21" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=NxtGenUG%20Manchester%20.Net%20User%20Group%20%E2%80%93%20All%20Systems%20Go%21&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F01%2Fnxtgenug-manchester-net-user-group-%25e2%2580%2593-all-systems-go%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=NxtGenUG%20Manchester%20.Net%20User%20Group%20%E2%80%93%20All%20Systems%20Go%21&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F01%2Fnxtgenug-manchester-net-user-group-%25e2%2580%2593-all-systems-go%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F01%2Fnxtgenug-manchester-net-user-group-%25e2%2580%2593-all-systems-go%2F&amp;title=NxtGenUG%20Manchester%20.Net%20User%20Group%20%E2%80%93%20All%20Systems%20Go%21&amp;body=Introduction%0D%0AI%E2%80%99ve%20been%20chatting%20to%20the%20guys%20that%20run%20the%20NxtGenUG%20.Net%20user%20group%20for%20a%20few%20months%20about%20the%20possibility%20of%20giving%20some%20%E2%80%9CNxtGen%20love%E2%80%9D%20to%20%E2%80%9Cus%20northerners%E2%80%9D%2C%20and%20as%20of%20this%20morning%20Manchester%20is%20now%20officially%20the%207th%20region%21%0D" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F01%2Fnxtgenug-manchester-net-user-group-%25e2%2580%2593-all-systems-go%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F04%2F01%2Fnxtgenug-manchester-net-user-group-%25e2%2580%2593-all-systems-go%2F&amp;title=NxtGenUG%20Manchester%20.Net%20User%20Group%20%E2%80%93%20All%20Systems%20Go%21" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/manchester' rel='tag' target='_blank'>manchester</a>, <a class='technorati-link' href='http://technorati.com/tag/NxtGenUG' rel='tag' target='_blank'>NxtGenUG</a>, <a class='technorati-link' href='http://technorati.com/tag/user+group' rel='tag' target='_blank'>user group</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2009/04/01/nxtgenug-manchester-net-user-group-%e2%80%93-all-systems-go/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Finguistics – Behind the Scenes Video!</title>
		<link>http://www.grumpydev.com/2009/03/18/finguistics-%e2%80%93-behind-the-scenes-video/</link>
		<comments>http://www.grumpydev.com/2009/03/18/finguistics-%e2%80%93-behind-the-scenes-video/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 08:11:33 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[Surface]]></category>
		<category><![CDATA[Finguistics]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[youtube]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=155</guid>
		<description><![CDATA[Introduction While we were putting together Finguistics down at Microsoft in Reading, Nick Page was filming mini-interviews about the project, the process and Surface development in general; the result of which has just been released on YouTube. The Video The video has a definite “design” slant, so isn’t very technical, which is understandable given the [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>While we were putting together <a href="http://www.grumpydev.com/2009/01/18/surface-at-bett-finguistics/">Finguistics</a> down at Microsoft in Reading, Nick Page was filming mini-interviews about the project, the process and Surface development in general; the result of which has just been released on YouTube.</p>
<h2>The Video</h2>
<p>The video has a definite “design” slant, so isn’t very technical, which is understandable given the nature of Surface development (designing the apps and the user interaction is FAR harder than actually coding them). Myself, <a href="http://marcgravell.blogspot.com/">Marc</a> and the other techies do try to throw some technical jibber jabber in there to counter act all the design speak though, so it’s not all crayons and paintbrushes!</p>
<p> <object width="425" height="344" data="http://www.youtube.com/v/vJ5PUxp1ujA&amp;hl=en&amp;fs=1&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999" type="application/x-shockwave-flash"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/vJ5PUxp1ujA&amp;hl=en&amp;fs=1&amp;rel=0&amp;color1=0x3a3a3a&amp;color2=0x999999" /><param name="allowfullscreen" value="true" /></object><br />
<h6><em><em>I&#8217;d like to also point out that I wasn’t told we were going to be filmed, so I didn’t get chance to do my hair OR my makeup, and I had been eating on expenses for 3 weeks at this point, and the camera adds a least half a stone.. and.. and.. <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </em></em></h6>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Finguistics%20%26ndash%3B%20Behind%20the%20Scenes%20Video%21%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F18%2Ffinguistics-%25e2%2580%2593-behind-the-scenes-video%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F18%2Ffinguistics-%25e2%2580%2593-behind-the-scenes-video%2F&amp;title=Finguistics%20%26ndash%3B%20Behind%20the%20Scenes%20Video%21" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F18%2Ffinguistics-%25e2%2580%2593-behind-the-scenes-video%2F&amp;title=Finguistics%20%26ndash%3B%20Behind%20the%20Scenes%20Video%21&amp;annotation=Introduction%20%20While%20we%20were%20putting%20together%20Finguistics%20down%20at%20Microsoft%20in%20Reading%2C%20Nick%20Page%20was%20filming%20mini-interviews%20about%20the%20project%2C%20the%20process%20and%20Surface%20development%20in%20general%3B%20the%20result%20of%20which%20has%20just%20been%20released%20on%20YouTube.%20%20Th" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F18%2Ffinguistics-%25e2%2580%2593-behind-the-scenes-video%2F&amp;title=Finguistics%20%26ndash%3B%20Behind%20the%20Scenes%20Video%21&amp;bodytext=Introduction%20%20While%20we%20were%20putting%20together%20Finguistics%20down%20at%20Microsoft%20in%20Reading%2C%20Nick%20Page%20was%20filming%20mini-interviews%20about%20the%20project%2C%20the%20process%20and%20Surface%20development%20in%20general%3B%20the%20result%20of%20which%20has%20just%20been%20released%20on%20YouTube.%20%20Th" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F18%2Ffinguistics-%25e2%2580%2593-behind-the-scenes-video%2F&amp;title=Finguistics%20%26ndash%3B%20Behind%20the%20Scenes%20Video%21&amp;notes=Introduction%20%20While%20we%20were%20putting%20together%20Finguistics%20down%20at%20Microsoft%20in%20Reading%2C%20Nick%20Page%20was%20filming%20mini-interviews%20about%20the%20project%2C%20the%20process%20and%20Surface%20development%20in%20general%3B%20the%20result%20of%20which%20has%20just%20been%20released%20on%20YouTube.%20%20Th" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F18%2Ffinguistics-%25e2%2580%2593-behind-the-scenes-video%2F&amp;title=Finguistics%20%26ndash%3B%20Behind%20the%20Scenes%20Video%21" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F18%2Ffinguistics-%25e2%2580%2593-behind-the-scenes-video%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F18%2Ffinguistics-%25e2%2580%2593-behind-the-scenes-video%2F&amp;title=Finguistics%20%26ndash%3B%20Behind%20the%20Scenes%20Video%21" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Finguistics%20%26ndash%3B%20Behind%20the%20Scenes%20Video%21&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F18%2Ffinguistics-%25e2%2580%2593-behind-the-scenes-video%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Finguistics%20%26ndash%3B%20Behind%20the%20Scenes%20Video%21&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F18%2Ffinguistics-%25e2%2580%2593-behind-the-scenes-video%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F18%2Ffinguistics-%25e2%2580%2593-behind-the-scenes-video%2F&amp;title=Finguistics%20%26ndash%3B%20Behind%20the%20Scenes%20Video%21&amp;body=Introduction%20%20While%20we%20were%20putting%20together%20Finguistics%20down%20at%20Microsoft%20in%20Reading%2C%20Nick%20Page%20was%20filming%20mini-interviews%20about%20the%20project%2C%20the%20process%20and%20Surface%20development%20in%20general%3B%20the%20result%20of%20which%20has%20just%20been%20released%20on%20YouTube.%20%20Th" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F18%2Ffinguistics-%25e2%2580%2593-behind-the-scenes-video%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F18%2Ffinguistics-%25e2%2580%2593-behind-the-scenes-video%2F&amp;title=Finguistics%20%26ndash%3B%20Behind%20the%20Scenes%20Video%21" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/Finguistics' rel='tag' target='_blank'>Finguistics</a>, <a class='technorati-link' href='http://technorati.com/tag/Surface' rel='tag' target='_blank'>Surface</a>, <a class='technorati-link' href='http://technorati.com/tag/video' rel='tag' target='_blank'>video</a>, <a class='technorati-link' href='http://technorati.com/tag/youtube' rel='tag' target='_blank'>youtube</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2009/03/18/finguistics-%e2%80%93-behind-the-scenes-video/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Substitute – Variable Substitution Utility for Config Management (FinalBuilder etc.)</title>
		<link>http://www.grumpydev.com/2009/03/16/substitute-%e2%80%93-variable-substitution-utility-for-config-management-finalbuilder-etc/</link>
		<comments>http://www.grumpydev.com/2009/03/16/substitute-%e2%80%93-variable-substitution-utility-for-config-management-finalbuilder-etc/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 20:09:39 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[Substitute]]></category>
		<category><![CDATA[codeplex]]></category>
		<category><![CDATA[configuration management]]></category>
		<category><![CDATA[finalbuilder]]></category>
		<category><![CDATA[subtitute]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/?p=152</guid>
		<description><![CDATA[Introduction At Lightbox we use an excellent program called FinalBuilder for automating all of our builds, and managing the configuration for the various environments we build to (system test, user acceptance testing, production etc.) It’s a very powerful tool and our “scripts” allow us to produce and deploy a build from a particular branch/tag in [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>At <a href="http://www.lightbox-ed.com/" target="_blank">Lightbox</a> we use an excellent program called <a href="http://www.finalbuilder.com/" target="_blank">FinalBuilder</a> for automating all of our builds, and managing the configuration for the various environments we build to (system test, user acceptance testing, production etc.) It’s a very powerful tool and our “scripts” allow us to produce and deploy a build from a particular branch/tag in Subversion, targeting a particular configuration, with the touch of a button.</p>
<p>Once you get used to putting the projects together, using FinalBuilder is a huge time saver. One of the features it gives you is the ability to substitute “tags” in a file with the corresponding value from a project variable; so for example you could substitute %ServerName% for the variable called ServerName in the project. While this is very useful, it does require several steps to set it up each variable:</p>
<ul>
<li>Create the configuration file (or template) containing the %VARIABLE% tag. </li>
<li>Add the corresponding variable name to an INI file (FinalBuilder had native support for INI files). </li>
<li>Add the variable to the project. </li>
<li>Configure the project to load that variable from the INI file. </li>
<li>Add the build command to do the substitution (obviously you will usually do this once for all the variables). </li>
</ul>
<p>While none of those tasks are particularly onerous, it is quite error prone when you are relying on your developers to perform each task, and does make writing “generic” scripts quite tricky. You may not even want your developers meddling with your build process in the first place!</p>
<h2>Substitute Utility</h2>
<p>As an attempt to get the same level of functionality as the FinalBuilder substitution, but without the extra steps, I put together a small utility that takes an input file, a “substitute” file to be processed and a series of “sections” to use to perform the replacement. So for example, if you had the following INI file:</p>
<pre>[MAIN]
SVNServer=MySvnServer
SVNPort=80

[INT]
Server=IntServer
Username=IntUser
Password=Password

[SYS]
Server=SysServer
Username=SysUser
Password=Password</pre>
<p>And a “substitute” file as follows (this obviously isn’t a configuration file, it’s purely a very basic sample <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  ):</p>
<pre>Subversion Server: %SVNServer%:%SVNPort%

Server: %Server%
Details : %Username% / %Password%</pre>
<p>Running it through the utility and specifying the MAIN and INT sections (I generally use a “global” section, then configuration specific sections) would give us:</p>
<pre>Subversion Server: MySvnServer:80

Server: IntServer
Details : IntUser / Password</pre>
<h2></h2>
<h2>More Information</h2>
<p>So there you go, it’s a very, very simple utility, and indeed very little code; but I thought it might be of use to people who might be using FinalBuilder, or even people doing “manual” configuration management. It currently only supports INI files, but adding support for other file format is just a case of creating a new VariableReader implementation and decorating it with a ReaderHandles attribute to signify what “mode” you want it to handle.</p>
<p>I’ve uploaded it onto <a href="http://substitute.codeplex.com/" target="_blank">CodePlex</a> at <a title="http://substitute.codeplex.com/" href="http://substitute.codeplex.com/">http://substitute.codeplex.com/</a>, so feel free to grab it, play with it, edit it or criticise it to your hearts content.</p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Substitute%20%E2%80%93%20Variable%20Substitution%20Utility%20for%20Config%20Management%20%28FinalBuilder%20etc.%29%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F16%2Fsubstitute-%25e2%2580%2593-variable-substitution-utility-for-config-management-finalbuilder-etc%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F16%2Fsubstitute-%25e2%2580%2593-variable-substitution-utility-for-config-management-finalbuilder-etc%2F&amp;title=Substitute%20%E2%80%93%20Variable%20Substitution%20Utility%20for%20Config%20Management%20%28FinalBuilder%20etc.%29" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F16%2Fsubstitute-%25e2%2580%2593-variable-substitution-utility-for-config-management-finalbuilder-etc%2F&amp;title=Substitute%20%E2%80%93%20Variable%20Substitution%20Utility%20for%20Config%20Management%20%28FinalBuilder%20etc.%29&amp;annotation=Introduction%20%20At%20Lightbox%20we%20use%20an%20excellent%20program%20called%20FinalBuilder%20for%20automating%20all%20of%20our%20builds%2C%20and%20managing%20the%20configuration%20for%20the%20various%20environments%20we%20build%20to%20%28system%20test%2C%20user%20acceptance%20testing%2C%20production%20etc.%29%20It%E2%80%99s%20a%20very%20" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F16%2Fsubstitute-%25e2%2580%2593-variable-substitution-utility-for-config-management-finalbuilder-etc%2F&amp;title=Substitute%20%E2%80%93%20Variable%20Substitution%20Utility%20for%20Config%20Management%20%28FinalBuilder%20etc.%29&amp;bodytext=Introduction%20%20At%20Lightbox%20we%20use%20an%20excellent%20program%20called%20FinalBuilder%20for%20automating%20all%20of%20our%20builds%2C%20and%20managing%20the%20configuration%20for%20the%20various%20environments%20we%20build%20to%20%28system%20test%2C%20user%20acceptance%20testing%2C%20production%20etc.%29%20It%E2%80%99s%20a%20very%20" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F16%2Fsubstitute-%25e2%2580%2593-variable-substitution-utility-for-config-management-finalbuilder-etc%2F&amp;title=Substitute%20%E2%80%93%20Variable%20Substitution%20Utility%20for%20Config%20Management%20%28FinalBuilder%20etc.%29&amp;notes=Introduction%20%20At%20Lightbox%20we%20use%20an%20excellent%20program%20called%20FinalBuilder%20for%20automating%20all%20of%20our%20builds%2C%20and%20managing%20the%20configuration%20for%20the%20various%20environments%20we%20build%20to%20%28system%20test%2C%20user%20acceptance%20testing%2C%20production%20etc.%29%20It%E2%80%99s%20a%20very%20" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F16%2Fsubstitute-%25e2%2580%2593-variable-substitution-utility-for-config-management-finalbuilder-etc%2F&amp;title=Substitute%20%E2%80%93%20Variable%20Substitution%20Utility%20for%20Config%20Management%20%28FinalBuilder%20etc.%29" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F16%2Fsubstitute-%25e2%2580%2593-variable-substitution-utility-for-config-management-finalbuilder-etc%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F16%2Fsubstitute-%25e2%2580%2593-variable-substitution-utility-for-config-management-finalbuilder-etc%2F&amp;title=Substitute%20%E2%80%93%20Variable%20Substitution%20Utility%20for%20Config%20Management%20%28FinalBuilder%20etc.%29" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Substitute%20%E2%80%93%20Variable%20Substitution%20Utility%20for%20Config%20Management%20%28FinalBuilder%20etc.%29&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F16%2Fsubstitute-%25e2%2580%2593-variable-substitution-utility-for-config-management-finalbuilder-etc%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Substitute%20%E2%80%93%20Variable%20Substitution%20Utility%20for%20Config%20Management%20%28FinalBuilder%20etc.%29&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F16%2Fsubstitute-%25e2%2580%2593-variable-substitution-utility-for-config-management-finalbuilder-etc%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F16%2Fsubstitute-%25e2%2580%2593-variable-substitution-utility-for-config-management-finalbuilder-etc%2F&amp;title=Substitute%20%E2%80%93%20Variable%20Substitution%20Utility%20for%20Config%20Management%20%28FinalBuilder%20etc.%29&amp;body=Introduction%20%20At%20Lightbox%20we%20use%20an%20excellent%20program%20called%20FinalBuilder%20for%20automating%20all%20of%20our%20builds%2C%20and%20managing%20the%20configuration%20for%20the%20various%20environments%20we%20build%20to%20%28system%20test%2C%20user%20acceptance%20testing%2C%20production%20etc.%29%20It%E2%80%99s%20a%20very%20" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F16%2Fsubstitute-%25e2%2580%2593-variable-substitution-utility-for-config-management-finalbuilder-etc%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F16%2Fsubstitute-%25e2%2580%2593-variable-substitution-utility-for-config-management-finalbuilder-etc%2F&amp;title=Substitute%20%E2%80%93%20Variable%20Substitution%20Utility%20for%20Config%20Management%20%28FinalBuilder%20etc.%29" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/codeplex' rel='tag' target='_blank'>codeplex</a>, <a class='technorati-link' href='http://technorati.com/tag/configuration+management' rel='tag' target='_blank'>configuration management</a>, <a class='technorati-link' href='http://technorati.com/tag/finalbuilder' rel='tag' target='_blank'>finalbuilder</a>, <a class='technorati-link' href='http://technorati.com/tag/subtitute' rel='tag' target='_blank'>subtitute</a>, <a class='technorati-link' href='http://technorati.com/tag/utility' rel='tag' target='_blank'>utility</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2009/03/16/substitute-%e2%80%93-variable-substitution-utility-for-config-management-finalbuilder-etc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Strange Problem – Unable to Connect to the ASP.Net WebServer on Localhost</title>
		<link>http://www.grumpydev.com/2009/03/12/strange-problem-unable-to-connect-to-the-aspnet-webserver-on-localhost/</link>
		<comments>http://www.grumpydev.com/2009/03/12/strange-problem-unable-to-connect-to-the-aspnet-webserver-on-localhost/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 06:42:59 +0000</pubDate>
		<dc:creator>Steven Robbins</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[cassini]]></category>
		<category><![CDATA[localhost]]></category>
		<category><![CDATA[troubleshooting]]></category>
		<category><![CDATA[webserver]]></category>

		<guid isPermaLink="false">http://www.grumpydev.com/2009/03/12/strange-problem-unable-to-connect-to-the-aspnet-webserver-on-localhost/</guid>
		<description><![CDATA[Introduction This problem appeared out of the blue in Visual Studio 2005 on my work laptop. Google didn’t help with a solution, so I thought a brief blog post was in order. The Issue Trying to launch any ASP.Net application on my local machine, either in debug mode or starting without debugging, started the Cassini [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>This problem appeared out of the blue in Visual Studio 2005 on my work laptop. Google didn’t help with a solution, so I thought a brief blog post was in order.</p>
<h2>The Issue</h2>
<p>Trying to launch any ASP.Net application on my local machine, either in debug mode or starting without debugging, started the Cassini ASP.Net Webserver just fine, but the browser just threw up an “unable to connect” error. Google seemed to suggest it might be a corrupt webserver exe, but it seemed to be running fine so I ignored that option. I tried manually specifying a port in the project settings, and even using telnet to try access the port on localhost from the command prompt, but even though the webserver was running, nobody was listening!</p>
<h2>The Fix</h2>
<p>After clutching at random straws for a while I did a “ping localhost” from the command prompt and noticed it was returning replies from ::1 (the IPv6 “loopback” address). I popped open my hosts file (c:\windows\system32\drivers\etc\hosts) and noticed that localhost was mapped to ::1, but not to 127.0.0.1. I have no need for IPv6 on my machine so I commented out that line and added:</p>
<pre>127.0.0.1       localhost</pre>
<p>Fired up Visual Studio, pressed F5 and voila – all fixed! I’m not sure <strong>why</strong> this was suddenly a problem, it just appears that Cassini just doesn’t like being accessed via IPv6, but this seems to be the solution if this issues bites you <img src='http://www.grumpydev.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>



Share:


	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Strange%20Problem%20-%20Unable%20to%20Connect%20to%20the%20ASP.Net%20WebServer%20on%20Localhost%20-%20http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F12%2Fstrange-problem-unable-to-connect-to-the-aspnet-webserver-on-localhost%2F" title="Twitter"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F12%2Fstrange-problem-unable-to-connect-to-the-aspnet-webserver-on-localhost%2F&amp;title=Strange%20Problem%20-%20Unable%20to%20Connect%20to%20the%20ASP.Net%20WebServer%20on%20Localhost" title="DotNetKicks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/dotnetkicks.png" title="DotNetKicks" alt="DotNetKicks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="" title="DotNetShoutout"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/" title="DotNetShoutout" alt="DotNetShoutout" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F12%2Fstrange-problem-unable-to-connect-to-the-aspnet-webserver-on-localhost%2F&amp;title=Strange%20Problem%20-%20Unable%20to%20Connect%20to%20the%20ASP.Net%20WebServer%20on%20Localhost&amp;annotation=Introduction%20%20This%20problem%20appeared%20out%20of%20the%20blue%20in%20Visual%20Studio%202005%20on%20my%20work%20laptop.%20Google%20didn%E2%80%99t%20help%20with%20a%20solution%2C%20so%20I%20thought%20a%20brief%20blog%20post%20was%20in%20order.%20%20The%20Issue%20%20Trying%20to%20launch%20any%20ASP.Net%20application%20on%20my%20local%20machine%2C%20" title="Google Bookmarks"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F12%2Fstrange-problem-unable-to-connect-to-the-aspnet-webserver-on-localhost%2F&amp;title=Strange%20Problem%20-%20Unable%20to%20Connect%20to%20the%20ASP.Net%20WebServer%20on%20Localhost&amp;bodytext=Introduction%20%20This%20problem%20appeared%20out%20of%20the%20blue%20in%20Visual%20Studio%202005%20on%20my%20work%20laptop.%20Google%20didn%E2%80%99t%20help%20with%20a%20solution%2C%20so%20I%20thought%20a%20brief%20blog%20post%20was%20in%20order.%20%20The%20Issue%20%20Trying%20to%20launch%20any%20ASP.Net%20application%20on%20my%20local%20machine%2C%20" title="Digg"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F12%2Fstrange-problem-unable-to-connect-to-the-aspnet-webserver-on-localhost%2F&amp;title=Strange%20Problem%20-%20Unable%20to%20Connect%20to%20the%20ASP.Net%20WebServer%20on%20Localhost&amp;notes=Introduction%20%20This%20problem%20appeared%20out%20of%20the%20blue%20in%20Visual%20Studio%202005%20on%20my%20work%20laptop.%20Google%20didn%E2%80%99t%20help%20with%20a%20solution%2C%20so%20I%20thought%20a%20brief%20blog%20post%20was%20in%20order.%20%20The%20Issue%20%20Trying%20to%20launch%20any%20ASP.Net%20application%20on%20my%20local%20machine%2C%20" title="del.icio.us"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="https://favorites.live.com/quickadd.aspx?marklet=1&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F12%2Fstrange-problem-unable-to-connect-to-the-aspnet-webserver-on-localhost%2F&amp;title=Strange%20Problem%20-%20Unable%20to%20Connect%20to%20the%20ASP.Net%20WebServer%20on%20Localhost" title="Live"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/live.png" title="Live" alt="Live" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F12%2Fstrange-problem-unable-to-connect-to-the-aspnet-webserver-on-localhost%2F" title="Technorati"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F12%2Fstrange-problem-unable-to-connect-to-the-aspnet-webserver-on-localhost%2F&amp;title=Strange%20Problem%20-%20Unable%20to%20Connect%20to%20the%20ASP.Net%20WebServer%20on%20Localhost" title="StumbleUpon"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="mailto:?subject=Strange%20Problem%20-%20Unable%20to%20Connect%20to%20the%20ASP.Net%20WebServer%20on%20Localhost&amp;body=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F12%2Fstrange-problem-unable-to-connect-to-the-aspnet-webserver-on-localhost%2F" title="email"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/email_link.png" title="email" alt="email" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.netvibes.com/share?title=Strange%20Problem%20-%20Unable%20to%20Connect%20to%20the%20ASP.Net%20WebServer%20on%20Localhost&amp;url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F12%2Fstrange-problem-unable-to-connect-to-the-aspnet-webserver-on-localhost%2F" title="Netvibes"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/netvibes.png" title="Netvibes" alt="Netvibes" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F12%2Fstrange-problem-unable-to-connect-to-the-aspnet-webserver-on-localhost%2F&amp;title=Strange%20Problem%20-%20Unable%20to%20Connect%20to%20the%20ASP.Net%20WebServer%20on%20Localhost&amp;body=Introduction%20%20This%20problem%20appeared%20out%20of%20the%20blue%20in%20Visual%20Studio%202005%20on%20my%20work%20laptop.%20Google%20didn%E2%80%99t%20help%20with%20a%20solution%2C%20so%20I%20thought%20a%20brief%20blog%20post%20was%20in%20order.%20%20The%20Issue%20%20Trying%20to%20launch%20any%20ASP.Net%20application%20on%20my%20local%20machine%2C%20" title="Ping.fm"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/ping.png" title="Ping.fm" alt="Ping.fm" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.printfriendly.com/print?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F12%2Fstrange-problem-unable-to-connect-to-the-aspnet-webserver-on-localhost%2F&amp;partner=sociable" title="Print"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/printfriendly.png" title="Print" alt="Print" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fwww.grumpydev.com%2F2009%2F03%2F12%2Fstrange-problem-unable-to-connect-to-the-aspnet-webserver-on-localhost%2F&amp;title=Strange%20Problem%20-%20Unable%20to%20Connect%20to%20the%20ASP.Net%20WebServer%20on%20Localhost" title="Reddit"><img src="http://www.grumpydev.com/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>


<br/><br/>
<!-- start wp-tags-to-technorati 1.01 -->

<p class='technorati-tags'>Technorati Tags: <a class='technorati-link' href='http://technorati.com/tag/cassini' rel='tag' target='_blank'>cassini</a>, <a class='technorati-link' href='http://technorati.com/tag/localhost' rel='tag' target='_blank'>localhost</a>, <a class='technorati-link' href='http://technorati.com/tag/troubleshooting' rel='tag' target='_blank'>troubleshooting</a>, <a class='technorati-link' href='http://technorati.com/tag/Visual+Studio' rel='tag' target='_blank'>Visual Studio</a>, <a class='technorati-link' href='http://technorati.com/tag/webserver' rel='tag' target='_blank'>webserver</a></p>

<!-- end wp-tags-to-technorati -->
]]></content:encoded>
			<wfw:commentRss>http://www.grumpydev.com/2009/03/12/strange-problem-unable-to-connect-to-the-aspnet-webserver-on-localhost/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>
