<?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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Code Fury</title><link>http://www.nerdfurio.us/blog/</link><description>My Brain: Indexed By Bots and Spiders</description><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Nerdfurious" /><feedburner:info uri="nerdfurious" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2FNerdfurious" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FNerdfurious" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2FNerdfurious" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/Nerdfurious" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FNerdfurious" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FNerdfurious" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FNerdfurious" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><item><title>Mix11 Video Downloader</title><description>&lt;p&gt;I updated my PdcDownloader to be able to download videos from Pdc '10 and Mix '11. This probably warrants a renaming, but I'll deal with that later.&lt;/p&gt;
&lt;p&gt;Unlike PDC, the OData feed does not have the download file information. So I hacked together a download url based on the pattern on the channel 9 pages. Early on there was some variability in the file urls, but this all seems to have been straightened out. The Keynotes seem to be the only videos that have not followed the convention. Also to note, the session title isn't coming back in the OData feed when I access it via code, so the files are saved with the session code.&lt;/p&gt;
&lt;p&gt;The application now needs two parameters. The first being the key of the conference you want to download content for (either &lt;span class="code"&gt;PDC10&lt;/span&gt; or &lt;span class="code"&gt;MIX11&lt;/span&gt;). The second parameter is the video quality you want. There are 4 keys: &lt;span class="code"&gt;wmvhigh&lt;/span&gt;, &lt;span class="code"&gt;wmvlow&lt;/span&gt;, &lt;span class="code"&gt;mp4high&lt;/span&gt;, and &lt;span class="code"&gt;mp4low&lt;/span&gt;. If you don't specify one, then &lt;span class="code"&gt;wmvlow&lt;/span&gt; is defaulted as before.&lt;/p&gt;
&lt;p class="code"&gt;pdcdownloader MIX11 wmvhigh&lt;/p&gt;
&lt;p&gt;The application will then download all of the power point and video files from all of the sessions into the folder that you ran the application from. To skip a file, press 's', or to abort the processes, press 'q'.&lt;/p&gt;
&lt;p&gt;Download the executable &lt;a title="i gots your binary right here" href="http://www.nachocode.com/projects/mix_downloader2011/downloads/mix_downloader.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The source is as before, up on &lt;a title="git bits here" href="https://github.com/bgertonson/pdc-downloader"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Nerdfurious/~4/zq_H_CJtuT8" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Nerdfurious/~3/zq_H_CJtuT8/post.aspx</link><feedburner:origLink>http://www.nerdfurio.us/blog/post.aspx?id=fb0b61f8-9b6a-e011-9b8f-001143eed2d5</feedburner:origLink></item><item><title>Pdc 2010 Downloader</title><description>&lt;p&gt;I still wish that Microsoft would create a torrent with all the content, but I realize that this is too much to ask. I decided to write a PDC downloader over the weekend since Microsoft does expose all of the session information via on OData feed. There are a couple of other downloaders out there, a couple in silverlight (&lt;a title="silverlight downloader A" href="http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2010/11/07/pdc-2010-session-downloader-in-silverlight.aspx"&gt;here&lt;/a&gt;, and &lt;a title="silverlight downloader B" href="http://blogs.msdn.com/b/mark/archive/2010/11/03/pdc10-downloader.aspx"&gt;here&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Mine lacks any kind of visual flash as it is a simple console app that just downloads everything. It is safe for multiple runs (won't re-download something already downloaded) and does support some basic skip/abort functions. When you run the application, you need to specify what quality of video you would like. There are 4 keys: &lt;span class="code"&gt;wmvhigh&lt;/span&gt;, &lt;span class="code"&gt;wmvlow&lt;/span&gt;, &lt;span class="code"&gt;mp4high&lt;/span&gt;, and &lt;span class="code"&gt;mp4low&lt;/span&gt;. If you don't specify one, then &lt;span class="code"&gt;wmvlow&lt;/span&gt; is defaulted.&lt;/p&gt;
&lt;p class="code"&gt;pdcdownloader wmvhigh&lt;/p&gt;
&lt;p&gt;The application will then download all of the power point and video files from all of the sessions into the folder that you ran the application from. To skip a file, press 's', or to abort the processes, press 'q'.&lt;/p&gt;
&lt;p&gt;Download the executable &lt;a title="i gots your binary right here" href="http://www.nachocode.com/projects/pdc_downloader2010/downloads/pdc_downloader.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p style="text-decoration: line-through;"&gt;I will post the source soon.&lt;/p&gt;
&lt;p&gt;The source is now up on &lt;a title="git bits here" href="https://github.com/bgertonson/pdc-downloader"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Nerdfurious/~4/Yxg43Gknpv4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Nerdfurious/~3/Yxg43Gknpv4/post.aspx</link><feedburner:origLink>http://www.nerdfurio.us/blog/post.aspx?id=724274be-1eec-df11-9c2a-001143eed2d5</feedburner:origLink></item><item><title>Clearing the ClickOnce App Cache</title><description>&lt;p&gt;I had a user complain that they were unable to launch an application that was published using ClickOnce. They were kind enough to pass along a log file that the error message provided making finding the issue very easy. The log file contained the following error:&lt;/p&gt;
&lt;pre style="font-size: .7em; font-weight: bold;"&gt;Following errors were detected during this operation.
 * [6/7/2010 10:54:17 AM] System.Deployment.Application.DeploymentException (Subscription)
  - Unable to install this application because an application with the same identity 
    is already installed. To install this application, either modify the manifest version
    for this application or uninstall the preexisting application.
  - Source: System.Deployment
&lt;/pre&gt;
&lt;p&gt;I took this to mean that the user needed to remove the currently installed version of the application, and remove it. However, the application must be launched from the deployment page, and cannot be installed local. So how do you clear this cache for ClickOnce deployed applications? Easy, Google knows. I just needed to use a simple command line tool mage.exe (Manifest Generation and Editing Tool). For me it was found in &lt;span class="code"&gt;/Program Files/Microsoft Sdks/Windows/v7.0A/bin&lt;/span&gt;. Calling the tool like this &lt;span class="code"&gt;mage -cc&lt;/span&gt; cleared the cache. However, on a machine for non developers, this was not an option, as they don't have the Sdks on their machines. So, I needed an alternative.&lt;/p&gt;
&lt;p&gt;A little more Google-fu resulted in an alternate call that would do the same thing on a computer without development sdks. And I know some day I'll need to remember this, so here it is: &lt;span class="code"&gt;rundll32 dfshim CleanOnlineAppCache&lt;/span&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Nerdfurious/~4/3GEIRDvtc-I" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Nerdfurious/~3/3GEIRDvtc-I/post.aspx</link><feedburner:origLink>http://www.nerdfurio.us/blog/post.aspx?id=004f104e-da73-df11-949e-001143eed2d5</feedburner:origLink></item><item><title>VB.NET Gotchas for C# Devs</title><description>&lt;p&gt;I have been coding in VB.NET on contract for just under a year now. And having done so, I have come up with a small list of 'Gotchas' that I have encountered. At times, these differences have cost me quite a bit of time in debugging, and if I can save someone else even a small amount of this pain, it will be worth it.&lt;/p&gt;
&lt;p&gt;VB.NET does not throw a compiler error when you create a function without a return type. Can you tell me the return type of the method below?&lt;/p&gt;
&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Public&lt;/span&gt; &lt;span style="color: blue;"&gt;Function&lt;/span&gt; GetNumberOne()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; num &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Integer&lt;/span&gt; = 1&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Return&lt;/span&gt; num&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Function&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="520" height="160" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;
&lt;param name="id" value="scPlayer" /&gt;
&lt;param name="quality" value="high" /&gt;
&lt;param name="bgcolor" value="#FFFFFF" /&gt;
&lt;param name="flashVars" value="thumb=http://content.screencast.com/users/bgertonson/folders/Jing/media/25ccf583-0265-45bc-b536-133d8e10c32d/FirstFrame.jpg&amp;amp;containerwidth=520&amp;amp;containerheight=160&amp;amp;content=http://content.screencast.com/users/bgertonson/folders/Jing/media/25ccf583-0265-45bc-b536-133d8e10c32d/FunctionWithoutReturnType.swf" /&gt;
&lt;param name="allowFullScreen" value="true" /&gt;
&lt;param name="scale" value="showall" /&gt;
&lt;param name="allowScriptAccess" value="always" /&gt;
&lt;param name="base" value="http://content.screencast.com/users/bgertonson/folders/Jing/media/25ccf583-0265-45bc-b536-133d8e10c32d/" /&gt;
&lt;param name="src" value="http://content.screencast.com/users/bgertonson/folders/Jing/media/25ccf583-0265-45bc-b536-133d8e10c32d/jingswfplayer.swf" /&gt;&lt;embed id="scPlayer" type="application/x-shockwave-flash" width="520" height="160" src="http://content.screencast.com/users/bgertonson/folders/Jing/media/25ccf583-0265-45bc-b536-133d8e10c32d/jingswfplayer.swf" base="http://content.screencast.com/users/bgertonson/folders/Jing/media/25ccf583-0265-45bc-b536-133d8e10c32d/" allowscriptaccess="always" scale="showall" allowfullscreen="true" flashvars="thumb=http://content.screencast.com/users/bgertonson/folders/Jing/media/25ccf583-0265-45bc-b536-133d8e10c32d/FirstFrame.jpg&amp;amp;containerwidth=520&amp;amp;containerheight=160&amp;amp;content=http://content.screencast.com/users/bgertonson/folders/Jing/media/25ccf583-0265-45bc-b536-133d8e10c32d/FunctionWithoutReturnType.swf" bgcolor="#FFFFFF" quality="high"&gt;&lt;/embed&gt;
&lt;/object&gt;
&lt;/p&gt;
&lt;p&gt;VB.NET is also content compiling a Function without a return statement. It isn't frequent that I forget to add a return statement, but it has happened.&lt;/p&gt;
&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Public&lt;/span&gt; &lt;span style="color: blue;"&gt;Function&lt;/span&gt; WithoutReturnStatement() &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Integer&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; bool = &lt;span style="color: blue;"&gt;False&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; s = &lt;span style="color: #a31515;"&gt;"A String"&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; concat = &lt;span style="color: blue;"&gt;String&lt;/span&gt;.Concat(s, bool)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Function&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="520" height="256" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;
&lt;param name="id" value="scPlayer" /&gt;
&lt;param name="quality" value="high" /&gt;
&lt;param name="bgcolor" value="#FFFFFF" /&gt;
&lt;param name="flashVars" value="thumb=http://content.screencast.com/users/bgertonson/folders/Jing/media/afaa0788-2ce5-494e-8f1e-63f3b23d8ecf/FirstFrame.jpg&amp;amp;containerwidth=520&amp;amp;containerheight=256&amp;amp;content=http://content.screencast.com/users/bgertonson/folders/Jing/media/afaa0788-2ce5-494e-8f1e-63f3b23d8ecf/Gotcha_FunctionWithoutReturn.swf" /&gt;
&lt;param name="allowFullScreen" value="true" /&gt;
&lt;param name="scale" value="showall" /&gt;
&lt;param name="allowScriptAccess" value="always" /&gt;
&lt;param name="base" value="http://content.screencast.com/users/bgertonson/folders/Jing/media/afaa0788-2ce5-494e-8f1e-63f3b23d8ecf/" /&gt;
&lt;param name="src" value="http://content.screencast.com/users/bgertonson/folders/Jing/media/afaa0788-2ce5-494e-8f1e-63f3b23d8ecf/jingswfplayer.swf" /&gt;&lt;embed id="scPlayer" type="application/x-shockwave-flash" width="520" height="256" src="http://content.screencast.com/users/bgertonson/folders/Jing/media/afaa0788-2ce5-494e-8f1e-63f3b23d8ecf/jingswfplayer.swf" base="http://content.screencast.com/users/bgertonson/folders/Jing/media/afaa0788-2ce5-494e-8f1e-63f3b23d8ecf/" allowscriptaccess="always" scale="showall" allowfullscreen="true" flashvars="thumb=http://content.screencast.com/users/bgertonson/folders/Jing/media/afaa0788-2ce5-494e-8f1e-63f3b23d8ecf/FirstFrame.jpg&amp;amp;containerwidth=520&amp;amp;containerheight=256&amp;amp;content=http://content.screencast.com/users/bgertonson/folders/Jing/media/afaa0788-2ce5-494e-8f1e-63f3b23d8ecf/Gotcha_FunctionWithoutReturn.swf" bgcolor="#FFFFFF" quality="high"&gt;&lt;/embed&gt;
&lt;/object&gt;
&lt;/p&gt;
&lt;p&gt;Another good idea: turn on Option Strict. If you don't, the runtime will attempt to do a lot of implicit conversions for you. I wrote some code where I thought that I could call &lt;span class="code"&gt;GetBoolean()&lt;/span&gt; on a &lt;span class="code"&gt;DataReader&lt;/span&gt; passing in a string representing the column name. It compiled fine. After running the application, I realized that I needed to pass in the columns index instead. Sure, if I would have slowed down, Intellisense would have told me different, but I was cocky&lt;/p&gt;
&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Public&lt;/span&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt; TakesNumberParam(&lt;span style="color: blue;"&gt;ByVal&lt;/span&gt; value &lt;span style="color: blue;"&gt;As&lt;/span&gt; &lt;span style="color: blue;"&gt;Integer&lt;/span&gt;)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; result = value + 1&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Without option explicit on, I am able to write a test for the above method, that passes in a string that cannot be cast to an integer, and the project builds. At runtime, the code will throw an &lt;span class="code"&gt;InvalidCastException&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;
&lt;object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="520" height="256" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;
&lt;param name="id" value="scPlayer" /&gt;
&lt;param name="quality" value="high" /&gt;
&lt;param name="bgcolor" value="#FFFFFF" /&gt;
&lt;param name="flashVars" value="thumb=http://content.screencast.com/users/bgertonson/folders/Jing/media/b1d449ce-6d25-4417-8303-9660635c37e2/FirstFrame.jpg&amp;amp;containerwidth=520&amp;amp;containerheight=256&amp;amp;content=http://content.screencast.com/users/bgertonson/folders/Jing/media/b1d449ce-6d25-4417-8303-9660635c37e2/Gotcha_OptionStrict.swf" /&gt;
&lt;param name="allowFullScreen" value="true" /&gt;
&lt;param name="scale" value="showall" /&gt;
&lt;param name="allowScriptAccess" value="always" /&gt;
&lt;param name="base" value="http://content.screencast.com/users/bgertonson/folders/Jing/media/b1d449ce-6d25-4417-8303-9660635c37e2/" /&gt;
&lt;param name="src" value="http://content.screencast.com/users/bgertonson/folders/Jing/media/b1d449ce-6d25-4417-8303-9660635c37e2/jingswfplayer.swf" /&gt;&lt;embed id="scPlayer" type="application/x-shockwave-flash" width="520" height="256" src="http://content.screencast.com/users/bgertonson/folders/Jing/media/b1d449ce-6d25-4417-8303-9660635c37e2/jingswfplayer.swf" base="http://content.screencast.com/users/bgertonson/folders/Jing/media/b1d449ce-6d25-4417-8303-9660635c37e2/" allowscriptaccess="always" scale="showall" allowfullscreen="true" flashvars="thumb=http://content.screencast.com/users/bgertonson/folders/Jing/media/b1d449ce-6d25-4417-8303-9660635c37e2/FirstFrame.jpg&amp;amp;containerwidth=520&amp;amp;containerheight=256&amp;amp;content=http://content.screencast.com/users/bgertonson/folders/Jing/media/b1d449ce-6d25-4417-8303-9660635c37e2/Gotcha_OptionStrict.swf" bgcolor="#FFFFFF" quality="high"&gt;&lt;/embed&gt;
&lt;/object&gt;
&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Nerdfurious/~4/-5rSEqp42vs" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Nerdfurious/~3/-5rSEqp42vs/post.aspx</link><feedburner:origLink>http://www.nerdfurio.us/blog/post.aspx?id=3de60664-4759-df11-949e-001143eed2d5</feedburner:origLink></item><item><title>Wholesale Linqification, everything must be Linqified</title><description>&lt;p&gt;I have been browsing through the source for the Subtext Blog Engine, and have come across a lot of cool ideas, and also, a lot of code that is showing its age. Subtext has been around for a long time, and in some places, the code could use some updating. Of course, the contributors to the project are probably not going to find a need to go through every line of code and modernize it, but it's hard not to see places where Linq can really make things more awesome. For instance, there are a handful of methods that try to determine what kind of request is being made, and specify a RequestLocation based on that. One of the methods that tests for a request to a static file looks like this:&lt;/p&gt;
&lt;div style="font-family: Consolas; font-size: 10pt; color: black; background: white;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;bool&lt;/span&gt; IsStaticFileRequest(&lt;span style="color: #2b91af;"&gt;HttpRequestBase&lt;/span&gt; request)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;string&lt;/span&gt; filePath = request.FilePath;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;return&lt;/span&gt; filePath.EndsWith(&lt;span style="color: #a31515;"&gt;".css"&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;StringComparison&lt;/span&gt;.OrdinalIgnoreCase)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; || filePath.EndsWith(&lt;span style="color: #a31515;"&gt;".jpg"&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;StringComparison&lt;/span&gt;.OrdinalIgnoreCase)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; || filePath.EndsWith(&lt;span style="color: #a31515;"&gt;".js"&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;StringComparison&lt;/span&gt;.OrdinalIgnoreCase)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; || filePath.EndsWith(&lt;span style="color: #a31515;"&gt;".gif"&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;StringComparison&lt;/span&gt;.OrdinalIgnoreCase)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; || filePath.EndsWith(&lt;span style="color: #a31515;"&gt;".png"&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;StringComparison&lt;/span&gt;.OrdinalIgnoreCase)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; || filePath.EndsWith(&lt;span style="color: #a31515;"&gt;".xml"&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;StringComparison&lt;/span&gt;.OrdinalIgnoreCase)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; || filePath.EndsWith(&lt;span style="color: #a31515;"&gt;".txt"&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;StringComparison&lt;/span&gt;.OrdinalIgnoreCase)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; || filePath.EndsWith(&lt;span style="color: #a31515;"&gt;".html"&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;StringComparison&lt;/span&gt;.OrdinalIgnoreCase)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; || filePath.EndsWith(&lt;span style="color: #a31515;"&gt;".htm"&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;StringComparison&lt;/span&gt;.OrdinalIgnoreCase)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; || filePath.Contains(&lt;span style="color: #a31515;"&gt;"/images/"&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;StringComparison&lt;/span&gt;.OrdinalIgnoreCase);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;However, this can be made much more awesome with Linq. Behold the More Awesome:&lt;/p&gt;
&lt;div style="font-family: Consolas; font-size: 10pt; color: black; background: white;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;bool&lt;/span&gt; IsStaticFileRequest(&lt;span style="color: #2b91af;"&gt;HttpRequestBase&lt;/span&gt; request)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;string&lt;/span&gt; filePath = request.FilePath;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;var&lt;/span&gt; extensions = &lt;span style="color: blue;"&gt;new&lt;/span&gt;[]&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; { &lt;span style="color: #a31515;"&gt;".css"&lt;/span&gt;, &lt;span style="color: #a31515;"&gt;".jpg"&lt;/span&gt;, &lt;span style="color: #a31515;"&gt;".js"&lt;/span&gt;, &lt;span style="color: #a31515;"&gt;".gif"&lt;/span&gt;, &lt;span style="color: #a31515;"&gt;".png"&lt;/span&gt;,&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style="color: #a31515;"&gt;".xml"&lt;/span&gt;, &lt;span style="color: #a31515;"&gt;".txt"&lt;/span&gt;, &lt;span style="color: #a31515;"&gt;".html"&lt;/span&gt;, &lt;span style="color: #a31515;"&gt;".htm"&lt;/span&gt;, &lt;span style="color: #a31515;"&gt;"/images/"&lt;/span&gt; };&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;return&lt;/span&gt; extensions.Any(e =&amp;gt; filePath.EndsWith(e, &lt;span style="color: #2b91af;"&gt;StringComparison&lt;/span&gt;.OrdinalIgnoreCase));&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;I hope I never have to go back to .NET 2.0; I will most certainly weep heavily.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Nerdfurious/~4/Ml4fcoknmdI" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Nerdfurious/~3/Ml4fcoknmdI/post.aspx</link><feedburner:origLink>http://www.nerdfurio.us/blog/post.aspx?id=fd44809d-6d46-df11-bbe5-001143eed2d5</feedburner:origLink></item><item><title>Careful Letting Your Objects Expose Themselves </title><description>&lt;p&gt;I have been working on a project recently where many classes have collections (specifically Lists) of related information contained within them, but expose the full functionality of the list to consumers of the class. The issue with this, is that any consuming class has to be aware of any rules or restrictions that need to be applied to the child elements before adding to the collection. It also makes it more difficult for the class to validate the items being put into the collection and ensure that they are valid.&lt;/p&gt;
&lt;p&gt;As an example, consider a pile of cards used in a card game.&lt;/p&gt;
&lt;div style="font-family: Consolas; font-size: 10pt; color: black; background: white;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;CardPile&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; CardPile()&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Cards = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Card&lt;/span&gt;&amp;gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Card&lt;/span&gt;&amp;gt; Cards { &lt;span style="color: blue;"&gt;get&lt;/span&gt;; &lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;set&lt;/span&gt;; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;In this scenario, I can add, insert, remove, or clear the entire pile of cards. Maybe that is exactly the scenario you want, but usually there are rules associated with adding or removing cards from a pile. Consider a game like Solitare. In order to play a card, the face value needs to be 1 lower than the previous card in the pile, and of the opposite color. So, anywhere I want to add a card to the pile, I need logic like this:&lt;/p&gt;
&lt;div style="font-family: Consolas; font-size: 10pt; color: black; background: white;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt; addCard = &lt;span style="color: blue;"&gt;false&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt; last = cardPile.Cards.LastOrDefault();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (last != &lt;span style="color: blue;"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; last.FaceValue - card.FaceValue == 1&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;&amp;amp; last.Color != card.Color) addCard = &lt;span style="color: blue;"&gt;true&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (last == &lt;span style="color: blue;"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; card.FaceValue == &lt;span style="color: #2b91af;"&gt;FaceValue&lt;/span&gt;.King) addCard = &lt;span style="color: blue;"&gt;true&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (!addCard) &lt;span style="color: blue;"&gt;return&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;cardPile.Cards.Add(card);&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;It's all about &lt;a href="http://www.pragprog.com/articles/tell-dont-ask"&gt;Tell don't Ask&lt;/a&gt; here. We have to ask the &lt;span class="code"&gt;CardPile&lt;/span&gt; about the last card, and do a lot of checking before we can add the card. I don't want to deal with all of that. I just want to tell the &lt;span class="code"&gt;CardPile&lt;/span&gt;, here is a card, I am adding it to you. Then the &lt;span class="code"&gt;CardPile&lt;/span&gt; can take it, or tell me to buzz off. The &lt;span class="code"&gt;CardPile&lt;/span&gt; knows best. I really want to have an &lt;span class="code"&gt;AddCard()&lt;/span&gt; method here that encapsulates the logic above.  The result is less code duplication, and good encapsulation.&lt;/p&gt;
&lt;p&gt;At this point you might have a red flag. In our example of Solitare, we need to have two types of card piles. The lower staging piles build downwards from King to Ace while alternating colors. The top home piles count up from Ace to King and must have the same suit throughout. The CardPile class is a very basic class that should be able to function for any CardPile needed by a game. So, for this example, it does make sense to just expose the List, and place the logic outside of the class. Right?! Wrong, I don't want to create repeated validation logic around when a card can and can not be added to a pile, and I don't want different &lt;span class="code"&gt;CardPile&lt;/span&gt; classes for each implementation of &lt;span class="code"&gt;AddCard()&lt;/span&gt;. The best solution in my mind is to use the Strategy pattern, and encapsulate the card adding validation logic into a &lt;span class="code"&gt;CardPilePolicy&lt;/span&gt; class.&lt;/p&gt;
&lt;div style="font-family: Consolas; font-size: 10pt; color: black; background: white;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;interface&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;ICardPilePolicy&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;bool&lt;/span&gt; CanAdd(&lt;span style="color: #2b91af;"&gt;Card&lt;/span&gt; card, &lt;span style="color: #2b91af;"&gt;CardPile&lt;/span&gt; pile);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Now that I have the policy class, I need to implement the validation logic for my two types of card piles, the play area, and the home row.&lt;/p&gt;
&lt;div style="font-family: Consolas; font-size: 10pt; color: black; background: white;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;PlayFieldPilePolicy&lt;/span&gt;: &lt;span style="color: #2b91af;"&gt;ICardPilePolicy&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;bool&lt;/span&gt; CanAdd(&lt;span style="color: #2b91af;"&gt;Card&lt;/span&gt; card, &lt;span style="color: #2b91af;"&gt;CardPile&lt;/span&gt; pile)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;var&lt;/span&gt; addCard = &lt;span style="color: blue;"&gt;false&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;var&lt;/span&gt; last = pile.Cards.LastOrDefault();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (last != &lt;span style="color: blue;"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; last.FaceValue - card.FaceValue == 1&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;&amp;amp; last.Color != card.Color) addCard = &lt;span style="color: blue;"&gt;true&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (last == &lt;span style="color: blue;"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; card.FaceValue == &lt;span style="color: #2b91af;"&gt;FaceValue&lt;/span&gt;.King) addCard = &lt;span style="color: blue;"&gt;true&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;return&lt;/span&gt; addCard;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;HomePilePolicy&lt;/span&gt;: &lt;span style="color: #2b91af;"&gt;ICardPilePolicy&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;bool&lt;/span&gt; CanAdd(&lt;span style="color: #2b91af;"&gt;Card&lt;/span&gt; card, &lt;span style="color: #2b91af;"&gt;CardPile&lt;/span&gt; pile)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;var&lt;/span&gt; addCard = &lt;span style="color: blue;"&gt;false&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;var&lt;/span&gt; last = pile.Cards.LastOrDefault();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (last != &lt;span style="color: blue;"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; card.FaceValue - last.FaceValue == 1&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;&amp;amp; last.Suit == card.Suit) addCard = &lt;span style="color: blue;"&gt;true&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (last == &lt;span style="color: blue;"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; card.FaceValue == &lt;span style="color: #2b91af;"&gt;FaceValue&lt;/span&gt;.Ace) addCard = &lt;span style="color: blue;"&gt;true&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;return&lt;/span&gt; addCard;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Now let's look at what the new &lt;span class="code"&gt;CardPile&lt;/span&gt; class would look like.&lt;/p&gt;
&lt;div style="font-family: Consolas; font-size: 10pt; color: black; background: white;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;CardPile&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;readonly&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Card&lt;/span&gt;&amp;gt; _cards;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; CardPile(&lt;span style="color: #2b91af;"&gt;ICardPilePolicy&lt;/span&gt; policy): &lt;span style="color: blue;"&gt;this&lt;/span&gt;(policy, &lt;span style="color: blue;"&gt;null&lt;/span&gt;) {}&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; CardPile(&lt;span style="color: #2b91af;"&gt;ICardPilePolicy&lt;/span&gt; policy, &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Card&lt;/span&gt;&amp;gt; initalCards)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Policy = policy;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (initalCards == &lt;span style="color: blue;"&gt;null&lt;/span&gt;) &lt;span style="color: blue;"&gt;return&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _cards = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Card&lt;/span&gt;&amp;gt;(initalCards);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;bool&lt;/span&gt; IsEmpty { &lt;span style="color: blue;"&gt;get&lt;/span&gt; { &lt;span style="color: blue;"&gt;return&lt;/span&gt; !_cards.Any(); }}&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;bool&lt;/span&gt; AddCard(&lt;span style="color: #2b91af;"&gt;Card&lt;/span&gt; card)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;var&lt;/span&gt; canAdd = &lt;span style="color: blue;"&gt;true&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt;((canAdd = Policy.CanAdd(card, &lt;span style="color: blue;"&gt;this&lt;/span&gt;))) _cards.Add(card);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;return&lt;/span&gt; canAdd;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;ICardPilePolicy&lt;/span&gt; Policy { &lt;span style="color: blue;"&gt;get&lt;/span&gt;; &lt;span style="color: blue;"&gt;set&lt;/span&gt;; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;Card&lt;/span&gt;&amp;gt; Cards&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;get&lt;/span&gt; { &lt;span style="color: blue;"&gt;return&lt;/span&gt; _cards.ToArray(); }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The idea here, is that we don't want consumers of our class to worry about the logic required to add to our collections. If we do let them worry about it, we might accidentally allow the consumer to do something bad with our card piles. Notice in the last version of the class, I do still allow the consumer to get the list of cards from the pile. This might be necessary for the game to draw the pile to the screen for instance. However, I expose it as an IEnumerable, and return an array, not the internal collection. In this example, Cards are an immutable object, so no harm can be done by giving the consumer direct access to the cards, they couldn't change the values or anything like that. If you see a class with an exposed collection, I hope you slow down and contemplate whether this is what you want or not.&lt;/p&gt;
&lt;p&gt;These code samples are provided openly and freely for any use without warranty.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Nerdfurious/~4/07Ms4m58NCc" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Nerdfurious/~3/07Ms4m58NCc/post.aspx</link><feedburner:origLink>http://www.nerdfurio.us/blog/post.aspx?id=490cba48-93a4-de11-b052-001143eed2d5</feedburner:origLink></item><item><title>If Obama is a Socialist, what is Steve Jobs?</title><description>&lt;p&gt;Yesterday, Steve Jobs, and Apple announced, and detailed iPhone OS 4. There's some interesting stuff there, if you care, there is lots of coverage elsewhere on the web. What I'm interested in, is this clause in the new developer agreement:&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Applications may only use Documented APIs in the manner  prescribed by  Apple and must not use or call any private APIs.  Applications must be  originally written in Objective-C, C, C++, or  JavaScript as executed by  the iPhone OS WebKit engine, and &lt;strong&gt;only  code written in C, C++,  and Objective-C may compile and directly  link against the Documented  APIs&lt;/strong&gt; (e.g., Applications that link to  Documented APIs through  an intermediary translation or  compatibility layer or tool are  prohibited).&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This is just one more element of control that Apple puts over developers. I understand that Apple wants to maintain a level of quality over their products, but I'm guessing they also want to make money, and to do that, they need apps. The mobile space has been taking off, and there are several competing Smartphone platforms. If a company wants to add a mobile element to their product, they have several platforms to develop for, and that can be expensive. Groups like the Mono team are working to allow developers to utilize existing skills and code to get apps onto mobile marketplaces, and that's a good thing. Companies can't afford to have development staff that is familiar with Objective-C and Cocoa, and Android Java, and Windows Phone 7 Silverlight. That's too expensive, so if there is any way to simplify the porting of applications, that's great for business.&lt;/p&gt;
&lt;p&gt;Apple wants to make sure that all iPhone apps are written in XCode using Objective-C, which in my opinion is strange because &lt;strong&gt;they give away the tools for free&lt;/strong&gt;! I understand that there could be quality issues with these other cross compilers that might hurt the experience for the end user if the code isn't linked right. But why does Apple get to have so much control? At what point do they have to worry about anti-trust? They already don't allow apps that duplicate functionality that Apple puts into the iPhone (i.e. no other browsers), and they deny applications for unknown reasons, and now they dictate what tools you can use to build applications.&lt;/p&gt;
&lt;p&gt;I realize that the implications of this are stricktly thorns in a developers side, and really have no effect on the end user. But Microsoft got in a bunch of hot water for bundling a browser with an OS. Why doesn't Apple? How did they manage this public perception? At what point will people realize, Apple products crash, are susceptible to viruses, and are a little too controlling? I guess good for Apple, they are making tons of money, and people are happy with the product.&lt;/p&gt;
&lt;p&gt;But seriously Steve, loosen up.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Nerdfurious/~4/eyu9WpX5f64" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Nerdfurious/~3/eyu9WpX5f64/post.aspx</link><feedburner:origLink>http://www.nerdfurio.us/blog/post.aspx?id=27a46ee2-d643-df11-bbe5-001143eed2d5</feedburner:origLink></item><item><title>Dreamhost 1 year Special</title><description>&lt;p&gt;In anticipation of J. Wynia's &lt;a title="This link is not a rickroll, promise." href="http://www.twincitiescodecamp.com"&gt;Twin Cities Code Camp&lt;/a&gt; talk on &lt;a title="DIY is what DIYers do best" href="http://www.twincitiescodecamp.com/TCCC/Spring2010/Sessions.aspx#ss6"&gt;DIY Project Hosting&lt;/a&gt;, I went to check out &lt;a title="Zzzzz" href="http://www.dreamhost.com"&gt;Dreamhost&lt;/a&gt; and check prices and features. To my surprise, there is a March Madness sale going on, where you can get 1 year of hosting (domain included) for $9.24. They say it ends today at the end of the day, but I think that's just to create a sense of urgency.&lt;/p&gt;
&lt;p&gt;To get the special offer, sign up for the one-year hosting plan (comes with a free trial), and use the promo code "777". For a long time, I've wanted to have version control available via the web, but didn't want to pay a site like assembla a monthly fee. I also wasn't sure that I wanted to host a machine on my crappy cable connection. I figure 1 year for less than $10, I can give it a try. It is general website hosting, so I can (and will) have a blog up there, and host other files, and anything else I want. If it works out, I can rationalize the $9 a month, if it doesn't work out, or a better option comes around, I can cancel at the end of the year.&lt;/p&gt;
&lt;p&gt;So, come April 10th, when the next code camp rolls around, I'll have everything I need to play along with the take home version of J. Wynia's talk.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Nerdfurious/~4/lPsuyRE6nRk" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Nerdfurious/~3/lPsuyRE6nRk/post.aspx</link><feedburner:origLink>http://www.nerdfurio.us/blog/post.aspx?id=162e3ec1-e235-df11-bbe5-001143eed2d5</feedburner:origLink></item><item><title>Can I Suggest Bit Torrent?</title><description>&lt;p&gt;At this point, everyone knows that Microsoft's Mix event happened this week. I know everyone knows, because they had to take the video downloads offline due to their inability to handle the demand:&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: georgia, verdana, sans-serif; font-size: 16px; color: #800020; line-height: 24px;"&gt;&lt;em style="font-weight: inherit; font-style: italic; font-size: 16px; font-family: inherit; padding: 0px; margin: 0px; border: 0px initial initial;"&gt;&lt;strong style="font-weight: bold;"&gt;We are currently experiencing issues with download speeds and buffering. The demand for the sessions videos has been extremely high and has exceeded our ability to serve these videos up with sufficient bandwidth. At this point, we are going to remove the links and the player from the site to allow our engineering team to push the content out to various media caches around the world. When that is completed (current estimate is 8PM PST) the result should be a much better experience and we will re-enable playback and download. Thank for your patience as we deal with this issue.&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;If they took all the content, and provided a torrent file with all the videos and slideshows, they wouldn't be responsible for all the bandwidth, the consumers could share the burden. After NDC last year, &lt;a title="Someone did it right" href="../blog/post.aspx?id=c123e93d-4896-de11-b052-001143eed2d5"&gt;all the videos were provided as a really large torrent file&lt;/a&gt;, and getting the content was very easy. Easier than a batch file with a bunch of curl calls.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Nerdfurious/~4/rxrozibgVC8" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Nerdfurious/~3/rxrozibgVC8/post.aspx</link><feedburner:origLink>http://www.nerdfurio.us/blog/post.aspx?id=2ddf09d4-9833-df11-bbe5-001143eed2d5</feedburner:origLink></item><item><title>Moq and VB.Net are Frenemies</title><description>&lt;p&gt;Mocking is an important aspect of writing unit tests. The current project that I am on does a lot of integration testing, but not much unit testing. I'm trying to increase the amount of true unit tests, but struggle to do so due to the difficulty in mocking subroutines.&lt;/p&gt;
&lt;p&gt;The team that I am on had selected Moq as the mocking framework of choice prior to my arrival, however there aren't actually any tests using it. As long as I am mocking functions on an interface, Moq is an acceptable framework, however subroutines are completely unmockable. I have done a fair amount of googling, and there seems to be quite a few questions on Stackoverflow about it, but no real answers.&lt;/p&gt;
&lt;p&gt;In this particular case, what I want to do with mocking is ensure that the proper subroutine is called when I pass in an object that matches certain criteria. I am able to get it to work with Rhino Mocks by doing the following:&lt;/p&gt;
&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TestMethod()&amp;gt; _&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Public&lt;/span&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt; SaveProposal_WhenProposalIsNew_CallCreate()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; proposal = &lt;span style="color: blue;"&gt;New&lt;/span&gt; Proposal(&lt;span style="color: #a31515;"&gt;"title"&lt;/span&gt;, &lt;span style="color: #a31515;"&gt;"description"&lt;/span&gt;)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; dataProvider = MockRepository.GenerateMock(&lt;span style="color: blue;"&gt;Of&lt;/span&gt; IProposalDataProvider)()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; dataProvider.Expect(&lt;span style="color: blue;"&gt;Function&lt;/span&gt;(dp) CreateProposal(dp)).IgnoreArguments()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; service = &lt;span style="color: blue;"&gt;New&lt;/span&gt; ProposalService(dataProvider, TestAppContext.Current)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; service.SaveProposal(proposal)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; dataProvider.VerifyAllExpectations()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Private&lt;/span&gt; &lt;span style="color: blue;"&gt;Function&lt;/span&gt; CreateProposal(&lt;span style="color: blue;"&gt;ByVal&lt;/span&gt; dp &lt;span style="color: blue;"&gt;As&lt;/span&gt; IProposalDataProvider)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; dp.CreateProposal(&lt;span style="color: blue;"&gt;Nothing&lt;/span&gt;)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Return&lt;/span&gt; &lt;span style="color: blue;"&gt;Nothing&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Function&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;However, when I try something similar with Moq using the code below:&lt;/p&gt;
&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;TestMethod()&amp;gt; _&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Public&lt;/span&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt; SaveProposal_WhenProposalIsNew_CallCreate()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; proposal = &lt;span style="color: blue;"&gt;New&lt;/span&gt; Proposal(&lt;span style="color: #a31515;"&gt;"title"&lt;/span&gt;, &lt;span style="color: #a31515;"&gt;"description"&lt;/span&gt;)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; dataProvider = &lt;span style="color: blue;"&gt;New&lt;/span&gt; Mock(&lt;span style="color: blue;"&gt;Of&lt;/span&gt; IProposalDataProvider)()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; dataProvider.Setup(&lt;span style="color: blue;"&gt;Function&lt;/span&gt;(dp &lt;span style="color: blue;"&gt;As&lt;/span&gt; IProposalDataProvider) CreateProposal(dp))&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Dim&lt;/span&gt; service = &lt;span style="color: blue;"&gt;New&lt;/span&gt; ProposalService(dataProvider.Object, TestAppContext.Current)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; service.SaveProposal(proposal)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; dataProvider.VerifyAll()&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Sub&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Private&lt;/span&gt; &lt;span style="color: blue;"&gt;Function&lt;/span&gt; CreateProposal(&lt;span style="color: blue;"&gt;ByVal&lt;/span&gt; dp &lt;span style="color: blue;"&gt;As&lt;/span&gt; IProposalDataProvider)&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; dp.CreateProposal(It.IsAny(&lt;span style="color: blue;"&gt;Of&lt;/span&gt; ProposalDto))&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;Return&lt;/span&gt; &lt;span style="color: blue;"&gt;Nothing&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;End&lt;/span&gt; &lt;span style="color: blue;"&gt;Function&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;I get the following exception:&lt;/p&gt;
&lt;div class="code"&gt;System.ArgumentException: Invalid setup on a non-overridable member: dp =&amp;gt; value(ProposalManagerApp.Tests.ProposalServiceTests).CreateProposal(dp).&lt;/div&gt;
&lt;p&gt;Any mock-magicians out there know the answer? The problem stems from the inability of VB to create an Expression(Of Action(Of Something)) because lambdas must return a value. The universe plans on correcting itself with the release of VB10, by allowing Sub() lambdas, but I can't wait that long.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Nerdfurious/~4/pqIVM7asK6Y" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Nerdfurious/~3/pqIVM7asK6Y/post.aspx</link><feedburner:origLink>http://www.nerdfurio.us/blog/post.aspx?id=5e7af5be-8a2b-df11-bbe5-001143eed2d5</feedburner:origLink></item><item><title>Google Buzz - Impressions</title><description>&lt;p&gt;I have started to explore Google's new Buzz social enhancement to GMail. I don't consider this a twitter killer, but each system has pros and cons. I wanted to briefly put down some of my thoughts, and maybe get some feedback as well.&lt;/p&gt;
&lt;p&gt;
&lt;h4&gt;I Suck at 140 Characters&lt;/h4&gt;
One of the things I struggle with on twitter is the 140 character limit. Over time I have developed a wordy style of writing that doesn't fit into a single tweet. I often spend more time trying to choose words that allow me to present my full thought than actually formulating my thought, and this frustrates me. With Buzz, I don't have that limitation. I still consider it a microblog like twitter, but one without the distraction of character limitations.&lt;/p&gt;
&lt;p&gt;
&lt;h4&gt;The Conversation is in your Face&lt;/h4&gt;
One of my frustrations with twitter is following conversations. There is no simple way to do it. If you catch a response, it is fairly trivial to trace it back to the originating tweet. However, if someone asks a question, and you want to know how other people respond, the only way to do so is use twitter search. With Buzz, one person starts a thread with their "buzz", and responses are inline in the comments area. This makes it easy to see the conversation, even when it involves people you don't follow. In my opinion, this will also make buzz entries more useful in google search results.&lt;/p&gt;
&lt;p&gt;
&lt;h4&gt;Privacy&lt;/h4&gt;
Currently I use twitter for my professional life, and facebook for my personal life. Sometimes one leaks into the other, but for the most part, I have made that distinction. Buzz is tied to my gmail contacts which come from mail, reader, or my android phone. This encompasses multiple facets of my life. This makes for a fuzzy line that I don't really have with the other two social services. However, buzz does have a nice security feature that makes it easy to have a post only be visible to one or more contact groups. This to me means that it can be both, and I don't have to worry about the fuzzy line. I have often wanted this ability with facebook, and am happy to see it here. The downside is now I'm going to waste hours organizing my contacts into appropriate groups.&lt;/p&gt;
&lt;p&gt;
&lt;h4&gt;Summary&lt;/h4&gt;
In summary, I'm looking forward to following more people using Buzz, and seeing how discussions unfold. I could see tweets that point to buzz discussions, as I think the environment is more appropriate for that. The downside is, it doesn't have the discoverability that twitter has. If you follow someone that is involved in a conversation, you can butt in. With buzz, if you don't follow the person that started the conversation, you'll miss the whole thing. I decided not to have my tweets replicated on my buzz feed because I found the delay in google fetching the tweets makes the feature less valueabl. Also, the same post in two places would cause any discussion to be fractured.&lt;/p&gt;
&lt;p&gt;Anyone else have any thoughts on Buzz? I think Google needs to put out an API sooner rather than later, as I can see tools like TweetDeck and Digsby integrating with Buzz, and adding value. The rollout is still in progress, but I'm curious to see what happens after the curiousity subsides.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Nerdfurious/~4/pahl33UjZks" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Nerdfurious/~3/pahl33UjZks/post.aspx</link><feedburner:origLink>http://www.nerdfurio.us/blog/post.aspx?id=81f0bcca-c816-df11-86b7-001143eed2d5</feedburner:origLink></item><item><title>O Rly? Editing Project File XML in Visual Studio</title><description>&lt;p&gt;File this under things I probably should have known by now.&lt;/p&gt;
&lt;p&gt;Whenever I have needed to edit a visual studio project file's XML, I have used an external XML/text editor. All my attempts to edit with Visual Studio resulted in the entire project being loaded, not the xml contents. So, here's the trick. First right-click on the project file in the solution explorer and select 'Unload Project'. This option will only show up if your project is a part of a solution.&amp;nbsp;Once the project has been unloaded, right-click again and select the 'Edit [your project file name]' command and this will bring up the XML editor with the contents of your project file. Once the changes have been made, right-click on the project again and&amp;nbsp;select 'Reload&amp;nbsp;Project'&amp;nbsp;to bring the project back into the solution.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Nerdfurious/~4/QDhN1NEr7Ak" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Nerdfurious/~3/QDhN1NEr7Ak/post.aspx</link><feedburner:origLink>http://www.nerdfurio.us/blog/post.aspx?id=34fb3428-b8a6-de11-b052-001143eed2d5</feedburner:origLink></item><item><title>O Rly? Intellisense requires XML + DLL</title><description>&lt;p&gt;File this under things I probably should have known by now.&lt;/p&gt;
&lt;p&gt;If you have gone through all the trouble of marking up all of your classes and methods with XML documentation so everyone who consumes your API has helpful summary and description information, make sure you deploy the .xml file with your compiled library. The documentation information is not embedded in the binary. I knew that the xml was required to generate documentation help files, I did not know that Visual Studio also required them for populating documentation in intellisense and the Object Browser.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Nerdfurious/~4/M5ARosTpBZo" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Nerdfurious/~3/M5ARosTpBZo/post.aspx</link><feedburner:origLink>http://www.nerdfurio.us/blog/post.aspx?id=835ec5bc-8ea4-de11-b052-001143eed2d5</feedburner:origLink></item><item><title>Self Documenting Code - FAIL</title><description>&lt;p&gt;I read some code the other day that made me do a double take.&lt;/p&gt;
&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt;(businessObject.Id.Equals(&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Guid&lt;/span&gt;()))&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;// create object in db&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;The first thing I thought was "Is this even possible? Will this code ever run?" But it will, and it does, because the default constructor on a Guid returns Guid.Empty. And while this is counter intuitive, it is the expected behavior of a default constructor on a value type.&lt;/p&gt;
&lt;p&gt;The C# &lt;a title="Default Constructors on Value Types" href="http://msdn.microsoft.com/en-us/library/aa691142%28VS.71%29.aspx"&gt;spec says&lt;/a&gt; that a default constructor is implicitly provided and cannot be overridden. And the behavior is to give a value produced by a bit pattern of all zeros. So this isn't a problem with the behavior of Guid, it's a problem with the behavior of the developer. Comparing to Guid.Empty is much more intuitive in terms of expected behavior.&lt;/p&gt;
&lt;div style="font-family: Courier New; font-size: 10pt; color: black; background: white;"&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt; (businessObject.Id.Equals(&lt;span style="color: #2b91af;"&gt;Guid&lt;/span&gt;.Empty))&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;// create object in db&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="margin: 0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;Please think about the poor souls who have to read your code after you are done creating it.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Nerdfurious/~4/65uk8DRJSrw" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Nerdfurious/~3/65uk8DRJSrw/post.aspx</link><feedburner:origLink>http://www.nerdfurio.us/blog/post.aspx?id=cd214b2d-ac98-de11-b052-001143eed2d5</feedburner:origLink></item><item><title>The 'F' in TFS is for 'Friction'</title><description>&lt;p&gt;I am currently at a client that uses TFS for source control. This is my second exposure to using TFS source control, and my first time doing it in a team environment. This is the first time, in a long time, that I can remember, where source control has been such a point of friction in terms of getting stuff done.&lt;/p&gt;
&lt;p&gt;One of the first issues is that when "Getting Latest" it doesn't always seem to get the latest. I've encountered a few times where new files are added to a project, or a new project is added to a solution, and when I get latest, I don't get the added files. The first accusation is usually "It doesn't look like you checked in file xxx", but when you look in the source control browser, there they are, greyed out and marked as "not downloaded".&amp;nbsp; Well, why not? So from the source control browser, I click get latest, and if I'm lucky, down they come, and I can get back to work. Sometimes, they don't. Then you have to get a specific version, specify the latest version and make sure you overwrite. Then it usually comes down. I've tried asking the googles about this situation, but I haven't found anyone with the answer. When I get latest, I want the latest please.&lt;/p&gt;
&lt;p&gt;The next issue I have is the Merge/Compare tools that are built in are pretty weak. The googles let me know that I can replace these tools with my preferred third party tools. So I now have WinMerge in place to do this job for me. I don't think I've ever had to do as many manual merges with Subversion as I have had to do with TFS. I think every checkin has required 2+ manual merges.&lt;/p&gt;
&lt;p&gt;As a note, instructions for changing the Compare and Merge tools can be found in a two &lt;a title="WinMerge only" href="http://www.neovolve.com/post/2007/06/19/using-winmerge-with-tfs.aspx"&gt;blog&lt;/a&gt; &lt;a title="Many 3rd party tools" href="http://blogs.msdn.com/jmanning/articles/535573.aspx"&gt;posts&lt;/a&gt;. The quick version for WinMerge is this:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Tools &amp;gt; Options &amp;gt; Source Control&lt;/li&gt;
&lt;li&gt;Expand Team Foundation Server&lt;/li&gt;
&lt;li&gt;Click Configure User Tools&lt;/li&gt;
&lt;li&gt;For Filetype *&lt;/li&gt;
&lt;li&gt;Add Compare Tool Pointing to WinMerge executable&lt;/li&gt;
&lt;li&gt;Use these arguments &lt;strong&gt;/x /e /ub /wl /dl %6 /dr %7 %1 %2&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;For Filetype *&lt;/li&gt;
&lt;li&gt;Add Merge Tool pointing to WinMerge executable&lt;/li&gt;
&lt;li&gt;Use these arguments &lt;strong&gt;/x /e /ub /wl /dl %6 /dr %7&amp;nbsp;%1 %2 %4&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If anyone knows why new files are not automatically downloaded when getting latest, I'd love to know. Please leave a comment.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/Nerdfurious/~4/_zE8QA2xZAs" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/Nerdfurious/~3/_zE8QA2xZAs/post.aspx</link><feedburner:origLink>http://www.nerdfurio.us/blog/post.aspx?id=851b76ff-a898-de11-b052-001143eed2d5</feedburner:origLink></item></channel></rss>

