<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Sneal</title>
    <link>http://www.sneal.net/blog/</link>
    <description>The development of Shawn Neal</description>
    <language>en-us</language>
    <copyright>Shawn Neal</copyright>
    <lastBuildDate>Sat, 07 Nov 2009 19:59:07 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.1.8102.813</generator>
    <managingEditor>sneal@sneal.net</managingEditor>
    <webMaster>sneal@sneal.net</webMaster>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/Sneal" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
      <trackback:ping>http://www.sneal.net/blog/Trackback.aspx?guid=50c478ae-ccd3-4260-98a8-4a46e165cf8a</trackback:ping>
      <pingback:server>http://www.sneal.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.sneal.net/blog/PermaLink,guid,50c478ae-ccd3-4260-98a8-4a46e165cf8a.aspx</pingback:target>
      <dc:creator>Sneal</dc:creator>
      <wfw:comment>http://www.sneal.net/blog/CommentView,guid,50c478ae-ccd3-4260-98a8-4a46e165cf8a.aspx</wfw:comment>
      <wfw:commentRss>http://www.sneal.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=50c478ae-ccd3-4260-98a8-4a46e165cf8a</wfw:commentRss>
      <title>ReSharper 5 won't run unit tests in Visual Studio 2010</title>
      <guid isPermaLink="false">http://www.sneal.net/blog/PermaLink,guid,50c478ae-ccd3-4260-98a8-4a46e165cf8a.aspx</guid>
      <link>http://www.sneal.net/blog/2009/11/07/ReSharper5WontRunUnitTestsInVisualStudio2010.aspx</link>
      <pubDate>Sat, 07 Nov 2009 19:59:07 GMT</pubDate>
      <description>&lt;div&gt;&lt;p&gt;I've been playing around with Visual Studio 2010, and of course the latest ReSharper, version 5.  Unfortunately my NUnit tests wouldn't run inside the ReSharper runner.  Instead they would spin for a second then turn grey, like nothing happened.&lt;/p&gt;
&lt;p&gt;
Running the tests under the debugger turned up an interesting exception in the VS output window: BadImageFormatException.  I also noticed a bunch of DLLs being loaded out of the v2.0 framework GAC, and not .NET 4.  Shouldn't my .NET 4 app be using the .NET 4.0 GAC?
&lt;/p&gt;
Of course it should. There's an easy fix to this. ReSharper shells out to another exe that actuall runs the unit tests JetBrains.ReSharper.TaskRunner.exe.  If we modify the JetBrains.ReSharper.TaskRunner.exe.config in the ReSharper installation directory we can force the test runner to run under the .NET 4.0 framework. At the bottom of the file you'll find the associated startup element already there, just commented out and with the .NET 4.0 beta 1 framework version.  To fix it, just incomment it and change the version to the .NET beta 2 framework version.
&lt;/p&gt;
&lt;p&gt;

  &amp;lt;!-- Needed in dev10, not needed in dev9/8 --&amp;gt;

  &amp;lt;startup&amp;gt;
    &amp;lt;requiredRuntime version="v4.0.21006"/&amp;gt;
  &amp;lt;/startup&amp;gt;
&lt;/p&gt;
&lt;p&gt;
Now you can run unit tests via ReSharper in VS 2010 beta 2.
&lt;/p&gt;&lt;img width="0" height="0" src="http://www.sneal.net/blog/aggbug.ashx?id=50c478ae-ccd3-4260-98a8-4a46e165cf8a"/&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Sneal?a=7J6LYKPhpwQ:O6_WrMCIvjs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Sneal?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Sneal/~4/7J6LYKPhpwQ" height="1" width="1"/&gt;</description>
      <comments>http://www.sneal.net/blog/CommentView,guid,50c478ae-ccd3-4260-98a8-4a46e165cf8a.aspx</comments>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.sneal.net/blog/Trackback.aspx?guid=52622b21-310d-4117-b601-498416f98ac1</trackback:ping>
      <pingback:server>http://www.sneal.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.sneal.net/blog/PermaLink,guid,52622b21-310d-4117-b601-498416f98ac1.aspx</pingback:target>
      <dc:creator>Sneal</dc:creator>
      <wfw:comment>http://www.sneal.net/blog/CommentView,guid,52622b21-310d-4117-b601-498416f98ac1.aspx</wfw:comment>
      <wfw:commentRss>http://www.sneal.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=52622b21-310d-4117-b601-498416f98ac1</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <title>Erlang’s sweet spot</title>
      <guid isPermaLink="false">http://www.sneal.net/blog/PermaLink,guid,52622b21-310d-4117-b601-498416f98ac1.aspx</guid>
      <link>http://www.sneal.net/blog/2009/10/19/ErlangsSweetSpot.aspx</link>
      <pubDate>Mon, 19 Oct 2009 15:52:56 GMT</pubDate>
      <description>&lt;div&gt;&lt;p&gt;Most every language has a sweet spot, something it does better than any other language around it.&lt;/p&gt;  &lt;p&gt;C and C++ are really good for writing console video games because of its speed, portability, and deterministic finalization.&amp;#160; Perl is really good at string manipulation. Java has a gazillion OSS frameworks and application servers. Ruby is damn pretty and has a couple of really super productive web frameworks.&lt;/p&gt;  &lt;p&gt;Erlang has a very succinct and elegant syntax, a syntax that is highly optimized for writing recursive functions. One could argue that’s just a property of being a functional language, but I think there’s more too it than just being functional.&lt;/p&gt;  &lt;p&gt;C# 3 has a decent functional syntax that is clearly more succinct than Java or C# 2, but it just doesn’t stack up to Erlang.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#ffff00"&gt;&lt;font color="#ff8040"&gt;Warning&lt;/font&gt;: &lt;/font&gt;&lt;font color="#000000"&gt;don’t use these code samples in production code! They use Ω(n) extra storage space and are toy functions.&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;For example, take this Erlang quick sort function:&lt;/p&gt;  &lt;pre&gt;qsort([]) -&amp;gt; [];
qsort([Pivot|T]) -&amp;gt;
	qsort([X || X &amp;lt;- T, X &amp;lt; Pivot])
	++ [Pivot] ++
	qsort([X || X &amp;lt;- T, X &amp;gt;= Pivot]).&lt;/pre&gt;

&lt;p&gt;That is, IMO, beautiful code.&amp;#160; Small, compact, succinct, powerful, readable. On the other hand, what does a comparable implementation look like in C# 3?&amp;#160; &lt;/p&gt;

&lt;pre&gt;&lt;span style="color: #0000ff"&gt;static&lt;/span&gt; IEnumerable&amp;lt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;&amp;gt; Qsort(IEnumerable&amp;lt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;&amp;gt; list)
{
    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (list.Count() &amp;lt;= 1)
        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; list;

    &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; pivot = list.First();
    var tail = list.Skip(1).Take(list.Count() - 1);

    var result = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;&amp;gt;();
    result.AddRange(Qsort(tail.Where(o =&amp;gt; o &amp;lt; pivot)));
    result.Add(pivot);
    result.AddRange(Qsort(tail.Where(o =&amp;gt; o &amp;gt;= pivot)));
    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; result;
}&lt;/pre&gt;

&lt;p&gt;It works, it doesn’t contain any loops and only one if statement (the initial C# 2 version was even longer and uglier), but its still very much lacking in the beautiful code department.&amp;#160; Did you also notice it was more than twice as long as the Erlang function? Perhaps you can improve the syntax?&lt;/p&gt;

&lt;p&gt;I don’t have numbers to prove this, but the Erlang implementation can also be made faster with a lot less effort since each recursive call can be run in parallel.&amp;#160; Try that in C# without writing extra threading code. Even if you did, your threads are probably going to be a lot slower than the light weight threads in Erlang.&lt;/p&gt;

&lt;p&gt;Recursive functions in Erlang are definitely a sweet spot.&lt;/p&gt;&lt;img width="0" height="0" src="http://www.sneal.net/blog/aggbug.ashx?id=52622b21-310d-4117-b601-498416f98ac1"/&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Sneal?a=CuyfZWoalwM:Eph2A0A1O2k:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Sneal?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Sneal/~4/CuyfZWoalwM" height="1" width="1"/&gt;</description>
      <comments>http://www.sneal.net/blog/CommentView,guid,52622b21-310d-4117-b601-498416f98ac1.aspx</comments>
      <category>Erlang</category>
    </item>
    <item>
      <trackback:ping>http://www.sneal.net/blog/Trackback.aspx?guid=3cd93898-78c8-45dd-b7ff-68ba4f38a3c1</trackback:ping>
      <pingback:server>http://www.sneal.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.sneal.net/blog/PermaLink,guid,3cd93898-78c8-45dd-b7ff-68ba4f38a3c1.aspx</pingback:target>
      <dc:creator>Sneal</dc:creator>
      <wfw:comment>http://www.sneal.net/blog/CommentView,guid,3cd93898-78c8-45dd-b7ff-68ba4f38a3c1.aspx</wfw:comment>
      <wfw:commentRss>http://www.sneal.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=3cd93898-78c8-45dd-b7ff-68ba4f38a3c1</wfw:commentRss>
      <title>I’m enjoying learning Erlang</title>
      <guid isPermaLink="false">http://www.sneal.net/blog/PermaLink,guid,3cd93898-78c8-45dd-b7ff-68ba4f38a3c1.aspx</guid>
      <link>http://www.sneal.net/blog/2009/10/09/ImEnjoyingLearningErlang.aspx</link>
      <pubDate>Fri, 09 Oct 2009 01:09:12 GMT</pubDate>
      <description>&lt;div&gt;&lt;p&gt;Sometimes you need a paradigm shift, a different way to look at the same set of problems. Erlang I hope will give me that paradigm shift. Hopefully I can add another a screwdriver to my toolbox, if not, hopefully something besides a hammer.&lt;/p&gt;  &lt;p&gt;I just bought a copy (on PDF) of &lt;em&gt;Programming Erlang Software for a Concurrent World&lt;/em&gt;. I’ve only gotten through the first few pages of chapter 1, and so far I’m impressed. I guess its no surprise as the book is published by Pragmatic Programmers.&lt;/p&gt;  &lt;p&gt;I &lt;em&gt;finally&lt;/em&gt; understand why mathematicians like functional languages.&amp;#160; Its so obvious now, and it has a lot to do with immutability. From the book:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;When I went to school, my math teacher said, “If there’s an X in several different parts in the same equation, then all the Xs mean the same thing.” That’s how we can solve equations: if we know that X+Y=10 and X-Y=2, then X will be 6 and Y will be 4 in both equations. But when I learned my first programming language, we were shown stuff like this:     &lt;br /&gt;X = X + 1      &lt;br /&gt;Everyone protested, saying “you can’t do that!” But the teacher said we were wrong, and we had to unlearn what we learned in math class. X isn’t a math variable: it’s like a pigeon hole/little box.... In Erlang, variables are just like they are inmath.When you associate a value with a variable, you’re making an assertion—a statement of fact. This variable has that value. And that’s that.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I guess mutability is a strange beast for most people when learning to program, forcing a lot of them to quit while in their first year of CS.&amp;#160; Well, that and pointers. Its an odd way to think of things for people living in a concrete world. I wonder if first year CS students wouldn’t have an easier time learning a functional language?&lt;/p&gt;&lt;img width="0" height="0" src="http://www.sneal.net/blog/aggbug.ashx?id=3cd93898-78c8-45dd-b7ff-68ba4f38a3c1"/&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Sneal?a=Duk3BIYFQn8:9C9saX58JN8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Sneal?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Sneal/~4/Duk3BIYFQn8" height="1" width="1"/&gt;</description>
      <comments>http://www.sneal.net/blog/CommentView,guid,3cd93898-78c8-45dd-b7ff-68ba4f38a3c1.aspx</comments>
      <category>Erlang</category>
    </item>
    <item>
      <trackback:ping>http://www.sneal.net/blog/Trackback.aspx?guid=59f75922-c05d-4447-8f90-748406fc6cc2</trackback:ping>
      <pingback:server>http://www.sneal.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.sneal.net/blog/PermaLink,guid,59f75922-c05d-4447-8f90-748406fc6cc2.aspx</pingback:target>
      <dc:creator>Sneal</dc:creator>
      <wfw:comment>http://www.sneal.net/blog/CommentView,guid,59f75922-c05d-4447-8f90-748406fc6cc2.aspx</wfw:comment>
      <wfw:commentRss>http://www.sneal.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=59f75922-c05d-4447-8f90-748406fc6cc2</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <title>Fluent NUnit Assertions</title>
      <guid isPermaLink="false">http://www.sneal.net/blog/PermaLink,guid,59f75922-c05d-4447-8f90-748406fc6cc2.aspx</guid>
      <link>http://www.sneal.net/blog/2009/10/01/FluentNUnitAssertions.aspx</link>
      <pubDate>Thu, 01 Oct 2009 01:19:34 GMT</pubDate>
      <description>&lt;div&gt;&lt;p&gt;I found another reason to love open source NUnit over MSTest, &lt;a href="http://code.google.com/p/nunitex/wiki/SyntaxOverview"&gt;NUnitEx&lt;/a&gt;. NUnitEx provides a fluent DSL to write NUnit assertions where Visual Studio intellisense is your guiding friend. I’m sure you’re thinking, “Yeah whatever, show me some code.”&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;pre&gt;[Test]
&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; AdjacencyGraph_is_directed_by_default()
{
    var graph = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; AdjacencyGraph&amp;lt;Task, TaskDependency&amp;gt;(DoNotAllowParallelEdges);
    graph.IsDirected.Should().Be.True();
}&lt;/pre&gt;

&lt;p&gt;Nice eh? graph.IsDirected is the property I want to test.&amp;#160; Everything after that is the NUnitEx extension methods. I know I find it much more readable than this:&lt;/p&gt;

&lt;pre&gt;[Test]
&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; AdjacencyGraph_is_directed_by_default()
{
    var graph = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; AdjacencyGraph&amp;lt;Task, TaskDependency&amp;gt;(DoNotAllowParallelEdges);
    Assert.IsTrue(graph.IsDirected);
}&lt;/pre&gt;

&lt;p&gt;I would also like to add that this syntax is likely to be included in NUnit 3, which would be excellent!&lt;/p&gt;&lt;img width="0" height="0" src="http://www.sneal.net/blog/aggbug.ashx?id=59f75922-c05d-4447-8f90-748406fc6cc2"/&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Sneal?a=sKoIAl3DbMg:OTbIvVdYLy8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Sneal?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Sneal/~4/sKoIAl3DbMg" height="1" width="1"/&gt;</description>
      <comments>http://www.sneal.net/blog/CommentView,guid,59f75922-c05d-4447-8f90-748406fc6cc2.aspx</comments>
      <category>Testing</category>
    </item>
    <item>
      <trackback:ping>http://www.sneal.net/blog/Trackback.aspx?guid=68a0ce6d-6f97-4cf1-b399-79f63ba2ae23</trackback:ping>
      <pingback:server>http://www.sneal.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.sneal.net/blog/PermaLink,guid,68a0ce6d-6f97-4cf1-b399-79f63ba2ae23.aspx</pingback:target>
      <dc:creator>Sneal</dc:creator>
      <wfw:comment>http://www.sneal.net/blog/CommentView,guid,68a0ce6d-6f97-4cf1-b399-79f63ba2ae23.aspx</wfw:comment>
      <wfw:commentRss>http://www.sneal.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=68a0ce6d-6f97-4cf1-b399-79f63ba2ae23</wfw:commentRss>
      <title>Visual Studio webtests hurt my eyes</title>
      <guid isPermaLink="false">http://www.sneal.net/blog/PermaLink,guid,68a0ce6d-6f97-4cf1-b399-79f63ba2ae23.aspx</guid>
      <link>http://www.sneal.net/blog/2009/09/23/VisualStudioWebtestsHurtMyEyes.aspx</link>
      <pubDate>Wed, 23 Sep 2009 00:47:31 GMT</pubDate>
      <description>&lt;div&gt;&lt;p&gt;Ive spent the last couple of days writing visual studio web tests to create a load test scenario for a critical section of application. Unfortunately i find it repetitive and boring.&lt;/p&gt;
&lt;p&gt;The web tests recorder in VS doesn't capture everything and additionally it hurts to look at the produced code. I did find fiddler much better at recording tests but they still needed serious cleaning up.&lt;/p&gt;
&lt;p&gt;I wish there was a more polished tool for this kind of test. I doubt other tools like JMeter are much better, and for .NET their probably worse because of viewstate and other platform specifics.&lt;/p&gt;&lt;img width="0" height="0" src="http://www.sneal.net/blog/aggbug.ashx?id=68a0ce6d-6f97-4cf1-b399-79f63ba2ae23"/&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Sneal?a=fLx2TmOZZKY:unS3BDt0E7g:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Sneal?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Sneal/~4/fLx2TmOZZKY" height="1" width="1"/&gt;</description>
      <comments>http://www.sneal.net/blog/CommentView,guid,68a0ce6d-6f97-4cf1-b399-79f63ba2ae23.aspx</comments>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.sneal.net/blog/Trackback.aspx?guid=fd1e03ad-007e-4682-a853-56b68719bea0</trackback:ping>
      <pingback:server>http://www.sneal.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.sneal.net/blog/PermaLink,guid,fd1e03ad-007e-4682-a853-56b68719bea0.aspx</pingback:target>
      <dc:creator>Sneal</dc:creator>
      <wfw:comment>http://www.sneal.net/blog/CommentView,guid,fd1e03ad-007e-4682-a853-56b68719bea0.aspx</wfw:comment>
      <wfw:commentRss>http://www.sneal.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=fd1e03ad-007e-4682-a853-56b68719bea0</wfw:commentRss>
      <title>Check for parameter null, more ReSharper goodness</title>
      <guid isPermaLink="false">http://www.sneal.net/blog/PermaLink,guid,fd1e03ad-007e-4682-a853-56b68719bea0.aspx</guid>
      <link>http://www.sneal.net/blog/2009/09/17/CheckForParameterNullMoreReSharperGoodness.aspx</link>
      <pubDate>Thu, 17 Sep 2009 15:46:55 GMT</pubDate>
      <description>&lt;div&gt;&lt;p&gt;I just found another useful thing that resharper does for you, it can generate code to check for null method parameters.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.sneal.net/blog/content/binary/CheckforparameternullmoreReSharpergoodne_79E3/image.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="141" alt="image" src="http://www.sneal.net/blog/content/binary/CheckforparameternullmoreReSharpergoodne_79E3/image_thumb.png" width="428" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Just put the cursor on the parameter….&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.sneal.net/blog/content/binary/CheckforparameternullmoreReSharpergoodne_79E3/image_3.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="96" alt="image" src="http://www.sneal.net/blog/content/binary/CheckforparameternullmoreReSharpergoodne_79E3/image_thumb_3.png" width="576" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Nice huh!?&lt;/p&gt;&lt;img width="0" height="0" src="http://www.sneal.net/blog/aggbug.ashx?id=fd1e03ad-007e-4682-a853-56b68719bea0"/&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Sneal?a=1Mxxhto1gnU:k404ZPmRVts:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Sneal?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Sneal/~4/1Mxxhto1gnU" height="1" width="1"/&gt;</description>
      <comments>http://www.sneal.net/blog/CommentView,guid,fd1e03ad-007e-4682-a853-56b68719bea0.aspx</comments>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.sneal.net/blog/Trackback.aspx?guid=3e30d1b1-a5fe-4588-a109-276f0db03fce</trackback:ping>
      <pingback:server>http://www.sneal.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.sneal.net/blog/PermaLink,guid,3e30d1b1-a5fe-4588-a109-276f0db03fce.aspx</pingback:target>
      <dc:creator>Sneal</dc:creator>
      <wfw:comment>http://www.sneal.net/blog/CommentView,guid,3e30d1b1-a5fe-4588-a109-276f0db03fce.aspx</wfw:comment>
      <wfw:commentRss>http://www.sneal.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=3e30d1b1-a5fe-4588-a109-276f0db03fce</wfw:commentRss>
      <title>The singleton that wasn’t</title>
      <guid isPermaLink="false">http://www.sneal.net/blog/PermaLink,guid,3e30d1b1-a5fe-4588-a109-276f0db03fce.aspx</guid>
      <link>http://www.sneal.net/blog/2009/09/15/TheSingletonThatWasnt.aspx</link>
      <pubDate>Tue, 15 Sep 2009 01:54:46 GMT</pubDate>
      <description>&lt;div&gt;&lt;p&gt;Its amazing how one single line of code and a bad assumption (or misunderstanding) can cause all sorts of strange production issues. &lt;/p&gt;  &lt;p&gt;The day started out with static content throwing exceptions that contained our UnitOfWork in the call stack.&amp;#160; My first question was, why on earth is a static resource request hitting our begin unit of work.&amp;#160; Well it turns out that we map all requests through the ASP.NET pipeline because of some nameless .NET document management module.&amp;#160; Unfortunately we generally don’t have wild card mapping enabled for ASP.NET in our dev environment because:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;We weren’t aware of the requirement.&lt;/li&gt;    &lt;li&gt;There’s no documentation surrounding proper dev environment setup (e.g. script).&lt;/li&gt;    &lt;li&gt;Only one dev in our entire organization has ever actively touched this module.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Why is the wildcard mapping a big deal?&amp;#160; Because a single page load will create 10, 20, or more HTTP get requests for static content.&amp;#160; If you have a threading bug in your begin request, they’re much, much more likely to show up with numerous requests.&amp;#160; &lt;/p&gt;  &lt;p&gt;The sad truth of the matter is that because our environment we have a lot of NHibernate session factories, which is not normal for most applications. All of these session factories need to be configured and were using Fluent NHibernate to do so.&amp;#160; FNH is a great tool and makes configuration so much easier for us devs, but the fact remains FNH is not thread safe.&lt;/p&gt;  &lt;p&gt;Seems easy enough, put a lock around the FNH stuff.&amp;#160; Well, we did, but the locker class was not static, we were relying on AutoFac to ensure that our NHibernate session factory class (the class with the lock) was a singleton.&amp;#160; Not too hard since AutoFac defaults to singleton.&lt;/p&gt;  &lt;p&gt;Here’s the mistake.&amp;#160; ASP.NET creates not one, but many HttpApplication instances for each app domain.&amp;#160; I was falsely under the assumption is only ever created one, maybe two, but only ever kept one around.&amp;#160; Our AutoFac registration was setup in the Global instance constructor, so each app instance was getting its own container instance.&amp;#160; Can you guess why this is bad?&lt;/p&gt;  &lt;p&gt;Each request had its own NHibernate configuration class with its own instance lock, thus multiple threads were entering into the critical section at the same time since they couldn’t see each other.&amp;#160; Lots of weirdness ensued.&amp;#160; We saw all sorts of the strange Nhibernate and FNH errors, things like property “XYZ” doesn’t exist on class “ABC&amp;quot;.&amp;#160; Odd stuff that definitely smelt of threading.&lt;/p&gt;  &lt;p&gt;I was starting to think SELECT was broken (e.g. AutoFac), but soon realized the errors of my ways with a simple Debug.Assert. Yep, multiple container, produce multiple “singletons”.&amp;#160; &lt;/p&gt;&lt;img width="0" height="0" src="http://www.sneal.net/blog/aggbug.ashx?id=3e30d1b1-a5fe-4588-a109-276f0db03fce"/&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Sneal?a=rr5sK4BqeqQ:MsbQbIEExag:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Sneal?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Sneal/~4/rr5sK4BqeqQ" height="1" width="1"/&gt;</description>
      <comments>http://www.sneal.net/blog/CommentView,guid,3e30d1b1-a5fe-4588-a109-276f0db03fce.aspx</comments>
      <category>WTF</category>
    </item>
    <item>
      <trackback:ping>http://www.sneal.net/blog/Trackback.aspx?guid=b077df51-cb05-4e94-a45b-9f17b9b5f9e3</trackback:ping>
      <pingback:server>http://www.sneal.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.sneal.net/blog/PermaLink,guid,b077df51-cb05-4e94-a45b-9f17b9b5f9e3.aspx</pingback:target>
      <dc:creator>Sneal</dc:creator>
      <wfw:comment>http://www.sneal.net/blog/CommentView,guid,b077df51-cb05-4e94-a45b-9f17b9b5f9e3.aspx</wfw:comment>
      <wfw:commentRss>http://www.sneal.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=b077df51-cb05-4e94-a45b-9f17b9b5f9e3</wfw:commentRss>
      <title>ReSharper 4.5 MsTest Plugin</title>
      <guid isPermaLink="false">http://www.sneal.net/blog/PermaLink,guid,b077df51-cb05-4e94-a45b-9f17b9b5f9e3.aspx</guid>
      <link>http://www.sneal.net/blog/2009/09/10/ReSharper45MsTestPlugin.aspx</link>
      <pubDate>Thu, 10 Sep 2009 18:41:16 GMT</pubDate>
      <description>&lt;div&gt;&lt;p&gt;Thanks to Justin Burns who submitted the required code changes to upgrade my &lt;a href="http://www.sneal.net/blog/2009/01/24/MSTestReSharper4Plugin.aspx"&gt;MsTest plugin&lt;/a&gt; to ReSharper 4.5.&amp;#160; I just applied the patch and &lt;a href="http://code.google.com/p/sneal/"&gt;posted the new plugin DLL&lt;/a&gt;.&amp;#160; For those of you who wonder why you would use this over the JetBrains provided MsTest runner, one word: speed.&lt;/p&gt;  &lt;p&gt;This has been pretty low on my priority list since I don’t use MsTest very often anymore since converting of all but one of our test projects to NUnit, but for the rest of you, enjoy!&lt;/p&gt;&lt;img width="0" height="0" src="http://www.sneal.net/blog/aggbug.ashx?id=b077df51-cb05-4e94-a45b-9f17b9b5f9e3"/&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Sneal?a=VhWtuyx-fRI:4m1obZ2AzKA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Sneal?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Sneal/~4/VhWtuyx-fRI" height="1" width="1"/&gt;</description>
      <comments>http://www.sneal.net/blog/CommentView,guid,b077df51-cb05-4e94-a45b-9f17b9b5f9e3.aspx</comments>
      <category>Testing</category>
      <category>Visual Studio</category>
    </item>
    <item>
      <trackback:ping>http://www.sneal.net/blog/Trackback.aspx?guid=3697da87-6ccd-4f90-a569-9b584720be7e</trackback:ping>
      <pingback:server>http://www.sneal.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.sneal.net/blog/PermaLink,guid,3697da87-6ccd-4f90-a569-9b584720be7e.aspx</pingback:target>
      <dc:creator>Sneal</dc:creator>
      <wfw:comment>http://www.sneal.net/blog/CommentView,guid,3697da87-6ccd-4f90-a569-9b584720be7e.aspx</wfw:comment>
      <wfw:commentRss>http://www.sneal.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=3697da87-6ccd-4f90-a569-9b584720be7e</wfw:commentRss>
      <title>Opera has a BitTorrent client?</title>
      <guid isPermaLink="false">http://www.sneal.net/blog/PermaLink,guid,3697da87-6ccd-4f90-a569-9b584720be7e.aspx</guid>
      <link>http://www.sneal.net/blog/2009/08/24/OperaHasABitTorrentClient.aspx</link>
      <pubDate>Mon, 24 Aug 2009 04:35:17 GMT</pubDate>
      <description>&lt;div&gt;&lt;p&gt;Indeed it does have the ability to download torrents. I needed to download an Ubuntu VMWare image via BitTorrent, but didn’t want the hassle of downloading and setting up a BitTorrent client.&amp;#160; As it turns out Opera (which I already have installed) comes with a torrent client built-in.&amp;#160; I never would have guessed a web browser would have that ability out of the box, but it does.&lt;/p&gt;&lt;img width="0" height="0" src="http://www.sneal.net/blog/aggbug.ashx?id=3697da87-6ccd-4f90-a569-9b584720be7e"/&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Sneal?a=zV2KX_e8nN8:vJUq3ZH6Agk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Sneal?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Sneal/~4/zV2KX_e8nN8" height="1" width="1"/&gt;</description>
      <comments>http://www.sneal.net/blog/CommentView,guid,3697da87-6ccd-4f90-a569-9b584720be7e.aspx</comments>
      <category>Other</category>
    </item>
    <item>
      <trackback:ping>http://www.sneal.net/blog/Trackback.aspx?guid=4112d0d5-fa8f-45bb-801b-0f9d7b5ceaea</trackback:ping>
      <pingback:server>http://www.sneal.net/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.sneal.net/blog/PermaLink,guid,4112d0d5-fa8f-45bb-801b-0f9d7b5ceaea.aspx</pingback:target>
      <dc:creator>Sneal</dc:creator>
      <wfw:comment>http://www.sneal.net/blog/CommentView,guid,4112d0d5-fa8f-45bb-801b-0f9d7b5ceaea.aspx</wfw:comment>
      <wfw:commentRss>http://www.sneal.net/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=4112d0d5-fa8f-45bb-801b-0f9d7b5ceaea</wfw:commentRss>
      <title>Dynamic languages aren’t only for alpha nerds</title>
      <guid isPermaLink="false">http://www.sneal.net/blog/PermaLink,guid,4112d0d5-fa8f-45bb-801b-0f9d7b5ceaea.aspx</guid>
      <link>http://www.sneal.net/blog/2009/08/19/DynamicLanguagesArentOnlyForAlphaNerds.aspx</link>
      <pubDate>Wed, 19 Aug 2009 15:47:59 GMT</pubDate>
      <description>&lt;div&gt;&lt;p&gt;I’m really liking Ruby on Rails for numerous reasons, and chief among these reasons is the ability to make a change to Ruby code and then refresh the browser to see the changes.&amp;#160; In other words I really like to avoid paying taxes, and in this case the compilation tax we all pay when using a static language.&lt;/p&gt;  &lt;p&gt;For a couple of years now, since I started using &lt;a href="http://www.castleproject.org"&gt;MonoRail&lt;/a&gt; back in 2007 I’ve always felt that productivity could be improved by writing not only views in a dynamic language, but the controllers too (maybe the entire app). There’s just something refreshing about making a change in &lt;em&gt;server side&lt;/em&gt; code and immediately see the changes without waiting 30 seconds for a complete recompile of the &lt;em&gt;entire&lt;/em&gt; application.&lt;/p&gt;  &lt;p&gt;Yesterday I was heavily doing some TDD on a very low level componenent in our application and wasted about 10 minutes waiting for Visual Studio to recompile the project I was working on… and then every other project that depends on that one. It takes a lot of focus to keep the TDD rhythm going when you’re forced to wait 1 minute between runs.&amp;#160; I just have one word for this, &lt;u&gt;painful&lt;/u&gt;.&lt;/p&gt;  &lt;p&gt;I can only imagine the benefits of doing TDD with a dynamic language since you have a whole lot more compile and test cycles with TDD than traditional programming techniques. The emergence of TDD over the past few years along with general acceptance of the practice will only further push teams towards dynamic languages. Sure you lose static type safety, but that’s why we have lots of good unit tests; and at the controller level that’s not a bad thing because you’re often dealing with key value pairs (think web form post or json DTOs) and a dynamic language is just a much more natural fit.&lt;/p&gt;  &lt;p&gt;I’m not completely sold that unit testing at the controller level always makes sense, it often involves too many collaborators and whole lot of mocking. With automocking this isn’t &lt;em&gt;so&lt;/em&gt; bad, but sometimes you have complex Ajax interactions in the middle and testing at a higher level via a web test sometimes makes more sense.&lt;/p&gt;  &lt;p&gt;I’m hoping Microsoft seriously starts supporting dynamic languages (the DLR) and makes it a first class citizen rather than pushing it to the side in favor of more C# language sugar. I was &lt;em&gt;very&lt;/em&gt; disappointed to see that Visual Studio 2010 has no support what so ever for Python or Ruby (unless I completely missed it somehow). Actually, I was shocked! The future belongs to dynamic languages and Microsoft is almost completely ignoring them. If they would support them officially along with ASP.NET MVC, the .NET world would be a whole lot better off.&amp;#160; Without dynamic languages the ASP.NET MVC 2 gets a B in my grade book (version 1 gets a C). Maybe its time to switch platforms?&lt;/p&gt;&lt;img width="0" height="0" src="http://www.sneal.net/blog/aggbug.ashx?id=4112d0d5-fa8f-45bb-801b-0f9d7b5ceaea"/&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/Sneal?a=eB2VVvGhtp8:cGjwvj6uqMQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Sneal?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Sneal/~4/eB2VVvGhtp8" height="1" width="1"/&gt;</description>
      <comments>http://www.sneal.net/blog/CommentView,guid,4112d0d5-fa8f-45bb-801b-0f9d7b5ceaea.aspx</comments>
      <category>.NET</category>
      <category>IronPython</category>
      <category>MonoRail</category>
      <category>RoR</category>
    </item>
  </channel>
</rss>
