<?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:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>CodeBetter.Com - Stuff you need to Code Better!</title><link>http://codebetter.com/blogs/</link><description>Stuff you need to code better!</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/CodeBetter" type="application/rss+xml" /><feedburner:browserFriendly>This is an XML content feed. It is intended to be viewed in a newsreader or syndicated to another site, subject to copyright and fair use.</feedburner:browserFriendly><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item><title>Using Latest NUnit Version With MSpec</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/63qD6S3UuT8/using-latest-nunit-version-with-mspec.aspx</link><pubDate>Sun, 08 Nov 2009 20:11:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:416195</guid><dc:creator>hdierking</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;As I&amp;rsquo;ve been working another blog post about my adventures in learning BDD ala &lt;a href="http://codebetter.com/blogs/aaron.jensen/archive/2008/05/08/introducing-machine-specifications-or-mspec-for-short.aspx"&gt;MSpec&lt;/a&gt;, I ran into something that I wanted to share as the problem wasn&amp;rsquo;t immediately obvious (to me anyway).&lt;/p&gt;
&lt;p&gt;The problem is that MSpec has a dependency on version 2.4.6.0 of the nunit.framework assembly &amp;ndash; and frankly, it&amp;rsquo;s not really a very big problem.&amp;nbsp; In fact, I didn&amp;rsquo;t even notice it until now because until I had been &lt;a href="http://www.lostechies.com/blogs/seanbiefeld/archive/2009/08/25/step-by-step-to-using-machine-specifications-with-resharper.aspx"&gt;running all of my specs exclusively through the Resharper runner (enabled by the MSpec plugin&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;** As a side note, using R# with the MSpec plugin absolutely rocks, and while the runner is needed for integrating MSpec with your automated builds, I would totally recommend R# for your regular dev rhythm.&lt;/p&gt;
&lt;p&gt;In my project, I originally had some integration tests in the same assembly as my specifications.&amp;nbsp; As a result, I had a direct reference to NUnit (version 2.5.2.9222) in addition to the reference to Machine.Specifications and Machine.Specifications.NUnit (which has a reference to version 2.4.6.0).&amp;nbsp; As a result, the later version of NUnit was being copied to my bin folder and throwing a file load exception for every specification when run using the console runner.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/howard.dierking/Untitled_5F00_549F853E.png"&gt;&lt;img height="224" width="668" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/howard.dierking/Untitled_5F00_thumb_5F00_31FB46C3.png" alt="Untitled" border="0" title="Untitled" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;My initial reaction was to simply move all my integration tests to a different assembly and remove the direct NUnit reference in my specifications assembly (remember that referencing Machine.Specifications.NUnit will copy the version of NUnit to the bin folder that MSpec expects.&amp;nbsp; No problem &amp;ndash; everything works as you would expect.&lt;/p&gt;
&lt;p&gt;However, it seems reasonable to me that, at least in larger projects that are wanting to incorporate specs and not have to re-write all existing tests, that it would be good to simply reconfigure the MSpec console runner to use the latest version of NUnit.&amp;nbsp; This can be done easily using the standard .NET assembly binding redirection feature.&amp;nbsp; Simply create a file named Machine.Specifications.ConsoleRunner.exe.config and drop it into the MSpec folder that contains your console runner (Machine.Specifications.ConsoleRunner.exe).&amp;nbsp; The contents of the file should look like this.&lt;/p&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot;?&amp;gt;
&amp;lt;configuration&amp;gt;
    &amp;lt;runtime&amp;gt;
      &amp;lt;assemblyBinding xmlns=&amp;quot;urn:schemas-microsoft-com:asm.v1&amp;quot;&amp;gt;
        &amp;lt;dependentAssembly&amp;gt;
          &amp;lt;assemblyIdentity name=&amp;quot;nunit.framework&amp;quot;
                            publicKeyToken=&amp;quot;96d09a1eb7f44a77&amp;quot;
                            culture=&amp;quot;neutral&amp;quot; /&amp;gt;
          &amp;lt;bindingRedirect oldVersion=&amp;quot;2.4.6.0&amp;quot;
                           newVersion=&amp;quot;2.5.2.9222&amp;quot;/&amp;gt;
        &amp;lt;/dependentAssembly&amp;gt;
      &amp;lt;/assemblyBinding&amp;gt;
    &amp;lt;/runtime&amp;gt;
&amp;lt;/configuration&amp;gt;&lt;/pre&gt;
&lt;p&gt;Run the MSpec console again, and voila! Works like a charm.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/howard.dierking/Untitled2_5F00_5EA4009C.png"&gt;&lt;img height="199" width="529" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/howard.dierking/Untitled2_5F00_thumb_5F00_6B9DE0AD.png" alt="Untitled2" border="0" title="Untitled2" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=416195" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/63qD6S3UuT8" height="1" width="1"/&gt;</description><category domain="http://codebetter.com/blogs/howard.dierking/archive/tags/R_2300_/default.aspx">R#</category><category domain="http://codebetter.com/blogs/howard.dierking/archive/tags/BDD/default.aspx">BDD</category><category domain="http://codebetter.com/blogs/howard.dierking/archive/tags/MSpec/default.aspx">MSpec</category><feedburner:origLink>http://codebetter.com/blogs/howard.dierking/archive/2009/11/08/using-latest-nunit-version-with-mspec.aspx</feedburner:origLink></item><item><title>Astoria, SSIS Adapters and BDD – Code</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/PSIi7C0B3xI/astoria-ssis-adapters-and-bdd-code.aspx</link><pubDate>Fri, 06 Nov 2009 19:57:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:413671</guid><dc:creator>hdierking</dc:creator><slash:comments>4</slash:comments><description>&lt;p&gt;I&amp;rsquo;m currently working on the post talking about how, in the course of writing my SSIS data source for ADO.NET Data Services, I stumbled into replacing my unit tests with specifications.&amp;nbsp; However, in advance of that, I wanted to go ahead and provide the link to the source code.&amp;nbsp; I would love to get feedback on what&amp;rsquo;s working and what&amp;rsquo;s not so that I can get better &amp;ndash; and so that ideally, those the random stranger who downloads and looks at it on some idle Tuesday gets better as well.&lt;/p&gt;
&lt;p&gt;The code can be found at &lt;a href="http://code.msdn.microsoft.com/ssisastoria" title="http://code.msdn.microsoft.com/ssisastoria"&gt;http://code.msdn.microsoft.com/ssisastoria&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=413671" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/PSIi7C0B3xI" height="1" width="1"/&gt;</description><category domain="http://codebetter.com/blogs/howard.dierking/archive/tags/SSIS/default.aspx">SSIS</category><category domain="http://codebetter.com/blogs/howard.dierking/archive/tags/ADO.NET+Data+Services/default.aspx">ADO.NET Data Services</category><feedburner:origLink>http://codebetter.com/blogs/howard.dierking/archive/2009/11/06/astoria-ssis-adapters-and-bdd-code.aspx</feedburner:origLink></item><item><title>December 2-3 London Workshop Update</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/3xBeH-OvrRs/december-2-3-london-workshop-update.aspx</link><pubDate>Thu, 05 Nov 2009 15:29:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:411776</guid><dc:creator>Dave Laribee</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;Forgive the self-promotional interruption, but quick housekeeping note:&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve asked the company hosting my workshop in London to reduce the price of my 2-day workshop on December 2-3 aimed at &lt;a href="http://codebetter.com/blogs/david_laribee/archive/2009/09/30/london-workshop-december-1-2.aspx"&gt;tools and techniques technical leads, folks interested in lean, standard work, etc.&lt;/a&gt; to try to get as many people there (it&amp;#39;s a group collaboration focused thing). I also want to get as much feedback as I can. &lt;b&gt;If you book before November 15th, the price is &amp;pound;550&lt;/b&gt;.

					&lt;/p&gt;
&lt;p&gt;Register &lt;a href="http://skillsmatter.com/course/design-architecture/towards-a-new-architect"&gt;at the SkillsMatter site&lt;/a&gt;. &lt;i&gt;Also feel free to contact me with any questions laribee/AT/gmail/DOT/com&lt;/i&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=411776" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/3xBeH-OvrRs" height="1" width="1"/&gt;</description><category domain="http://codebetter.com/blogs/david_laribee/archive/tags/housekeeping/default.aspx">housekeeping</category><category domain="http://codebetter.com/blogs/david_laribee/archive/tags/announcements/default.aspx">announcements</category><feedburner:origLink>http://codebetter.com/blogs/david_laribee/archive/2009/11/05/december-2-3-london-workshop-update.aspx</feedburner:origLink></item><item><title>The code is the truth, but it is not the whole truth</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/Dg151FqDah0/the-code-is-the-truth-but-it-is-not-the-whole-truth.aspx</link><pubDate>Wed, 04 Nov 2009 13:55:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:409582</guid><dc:creator>Patrick Smacchia</dc:creator><slash:comments>10</slash:comments><description>&lt;p&gt;In a recent &lt;a target="_blank" href="http://www.informit.com/articles/article.aspx?p=1405569"&gt;interview from Grady Booch&lt;/a&gt;, co-creator of UML, Grady said:&lt;br /&gt;&lt;br /&gt;&lt;i&gt;When Jim, Ivar, and I began our journey that became manifest in the UML, we never intended it to become a programming language. I think that there&amp;#39;s a fairly narrow domain for which model-driven development makes sense but that we should return to the roots of the UML, which was to be a language for visualizing, specifying, constructing, and documenting the artifacts of a software-intensive system&amp;mdash;in short, a graphical language to help reason about the design of a system as it unfolds. Most diagrams should be thrown away, but there are a few that should be preserved, and in all, one should only use a graphical notation for those things that cannot easily be reasoned about in code. As I&amp;#39;ve also often said, the code is the truth, but it is not the whole truth, and there are things such as rationale, cross-cutting concerns, and patterns that cannot easily be recovered or seen from code.... These are the things for which a graphical notation adds value, and any such notation should be used only if it has predictive power or reasoning power (meaning, you can ask questions about it).&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;I especially cannot agree more with:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;As I&amp;#39;ve also often said, the code is the truth, but it is not the whole truth, and there are things such as rationale, cross-cutting concerns, and patterns that cannot easily be recovered or seen from code....&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;The code is the truth, the code represents the whole asset of a software shop. But code base is a complex asset. Call them &lt;i&gt;patterns&lt;/i&gt;, &lt;i&gt;rationales&lt;/i&gt;, &lt;i&gt;intentions &lt;/i&gt;or &lt;i&gt;decisions&lt;/i&gt;, there are many valuable intellectual artifacts buried in a code base that cannot easily be recovered or seen from code.&lt;br /&gt;&lt;br /&gt;This is something I realized in 1997 while trying for the first time to demystify a C++ legacy code base. I was angry! What, in 1997, we, the professional developers, haven&amp;rsquo;t any tooling to visualize code? I remember also, in the architecture department next door, the architects were spending days doing diagrams that had nothing to do with what actually the code was. Putting hands in the code was something considered with low value. It was let for fresh graduated like me.&lt;br /&gt;&lt;br /&gt;Hopefully, the result of this period was the seed from where the idea of a tool such as &lt;a target="_blank" href="http://www.NDepend.com"&gt;NDepend &lt;/a&gt;came to me. Code Metrics, Treemap, Dependency Graph, Dependency Matrix, Instability vs Abstractness diagrams&amp;hellip; are natural artifacts to shed light on all these precious &lt;i&gt;intentions &lt;/i&gt;buried in the code. I especially like the word &lt;i&gt;intentions &lt;/i&gt;that was often used by &lt;a target="_blank" href="http://proagora.com/fr/experts/profiles/brunoboucard"&gt;Bruno Boucard&lt;/a&gt;, a former colleague I have great respect for. The idea of a language such as &lt;a target="_blank" href="http://www.ndepend.com/Features.aspx#CQL"&gt;Code Query Language&lt;/a&gt; came to me when &lt;a target="_blank" href="http://codebetter.com/blogs/patricksmacchia/archive/2008/05/11/write-active-conventions-on-your-code-base.aspx"&gt;the need to make all these intentions concrete and verifiable&lt;/a&gt;, was clear.&lt;br /&gt;&lt;br /&gt;What we do is the result of what we did and who we met, no matter whether it was good or bad experiences. There is no such thing as: today, I gonna find an idea to make my own business. Good ideas come naturally along the way, through what, &lt;a target="_self" href="http://bookreviews.nabou.com/reviews/thealchemist.html"&gt;Paulo Coehlo&lt;/a&gt;, would call &lt;i&gt;signs&lt;/i&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=409582" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/Dg151FqDah0" height="1" width="1"/&gt;</description><feedburner:origLink>http://codebetter.com/blogs/patricksmacchia/archive/2009/11/04/the-code-is-the-truth-but-it-is-not-the-whole-truth.aspx</feedburner:origLink></item><item><title>Introduction to the Reactive Framework Part II</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/LTkhG4JcCgE/introduction-to-the-reactive-framework-part-ii.aspx</link><pubDate>Tue, 03 Nov 2009 05:28:37 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:409480</guid><dc:creator>Matthew.Podwysocki</dc:creator><slash:comments>6</slash:comments><description>&lt;p&gt;In my &lt;a href="http://codebetter.com/blogs/matthew.podwysocki/archive/2009/10/19/f-october-2009-ctp-beta2-f-rx-together-at-last.aspx"&gt;previous post&lt;/a&gt;, I talked a little bit about the parts of the Reactive Framework that are coming to the .NET 4 BCL as well as their implementation in F# as part of F# First Class Events.&amp;nbsp; This time, let’s come back to the Reactive Framework itself from which the IObservable&amp;lt;T&amp;gt; and IObserver&amp;lt;T&amp;gt; originated.&amp;nbsp; As you may remember, you can play with the bits of the Reactive Framework from the &lt;a href="http://www.codeplex.com/Silverlight"&gt;Silverlight 3 Toolkit&lt;/a&gt;.&amp;nbsp; &lt;/p&gt; &lt;p&gt;In the &lt;a href="http://codebetter.com/blogs/matthew.podwysocki/archive/2009/10/14/introducing-the-reactive-framework-part-i.aspx"&gt;first post in the series&lt;/a&gt;, I gave a basic introduction to the basic problems we have with asynchronous and reactive programming.&amp;nbsp; We covered some of the evolution of the .NET framework with asynchronous programming and where the Reactive Framework fits.&amp;nbsp; This time, I’ll pick up where we left off to talk about one of the important ideas behind the Reactive Framework, the duality of Enumerable and Observable.&lt;/p&gt; &lt;h2&gt;The Duality of Enumerable&amp;nbsp; &amp;amp; Observable&lt;/h2&gt; &lt;p&gt;During &lt;a href="http://channel9.msdn.com/shows/Going+Deep/E2E-Erik-Meijer-and-Wes-Dyer-Reactive-Framework-Rx-Under-the-Hood-1-of-2/"&gt;Erik’s appearances on Channel 9&lt;/a&gt;, an important, yet recurring theme was the &lt;a href="http://en.wikipedia.org/wiki/Duality_theory"&gt;mathematical duality&lt;/a&gt; of the Enumerable to the Observable.&amp;nbsp; What does that mean exactly though?&amp;nbsp; &lt;p&gt;We remember from our first post in the series where we talked about the pull (interactive) versus the push (reactive) model.&amp;nbsp; The pull model, represented by the iterator pattern of IEnumerable&amp;lt;T&amp;gt;/IEnumerator&amp;lt;T&amp;gt; states that we must explicitly call a method in order to get each item from our abstracted collection.&amp;nbsp; On the other hand, our push model, represented by the observable pattern of IObservable&amp;lt;T&amp;gt;/IObserver&amp;lt;T&amp;gt; states that we register an interest through a subscription and then items are subsequently handed to us from some abstracted collection.  &lt;p&gt;First, let’s look at the iterator pattern, which is a common interactive programming pattern that’s used quite frequently inside .NET.&amp;nbsp; This consists of two interfaces, the IEnumerable&amp;lt;T&amp;gt; and the IEnumerator&amp;lt;T&amp;gt;.&amp;nbsp; Listed below are some of the highlights of these two interfaces.&amp;nbsp; I cut down what they are to their essential bits. &lt;/p&gt; &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:78c27d02-2831-4956-a74e-25506fe8b415" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:#FFFFFF;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;interface&lt;/span&gt;&lt;span style="color:#000000;"&gt; IEnumerable&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;T&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;
{
    IEnumerator&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;T&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; GetEnumerator();
} 

&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;interface&lt;/span&gt;&lt;span style="color:#000000;"&gt; IEnumerator&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;T&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; : IDisposable
{
    T Current { &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;get&lt;/span&gt;&lt;span style="color:#000000;"&gt;; }
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;bool&lt;/span&gt;&lt;span style="color:#000000;"&gt; MoveNext();
}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;The IEnumerable&amp;lt;T&amp;gt; interface exposes a single method which returns an IEnumerator&amp;lt;T&amp;gt; to iterate some object.&amp;nbsp; The IEnumerator&amp;lt;T&amp;gt; gives us the ability to get the current item and determine whether there are more items to iterate.&amp;nbsp; &lt;p&gt;To think about basic asynchronous programming, we must consider a basic Gang of Four Pattern, the Observer Pattern.&amp;nbsp; This pattern describes where an object called an Observable, maintains a list of its dependent Observer classes and notifies them automatically of any state changes.&amp;nbsp; In Java, this should be rather familiar territory with the java.util.Observer class and the java.util.Observable interfaces.&amp;nbsp; In the Reactive Framework, this approach is no different, as we have an IObservable&amp;lt;T&amp;gt; interface which maintains a list of dependent IObserver&amp;lt;T&amp;gt; interfaces and notifies them automatically of any state changes.&amp;nbsp; Let’s look at the signatures below: &lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:a22fc1cf-6ce7-41d9-b977-1c914f6dea63" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:#FFFFFF;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;interface&lt;/span&gt;&lt;span style="color:#000000;"&gt; IObserver&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;T&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;
{
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; OnCompleted();
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; OnError(Exception exception);
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; OnNext(T value);
} 

&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;interface&lt;/span&gt;&lt;span style="color:#000000;"&gt; IObservable&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;T&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;
{
    IDisposable Subscribe(IObserver&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;T&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; observer);
}
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;What you may notice, and what you may have seen on some of Erik Meijer’s Channel 9 videos is that there is a duality between the Enumerable and Observable, given the signature of these interfaces.&amp;nbsp; To explain what I mean, let’s first look at the flow of the Enumerator: 
&lt;p&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/matthew.podwysocki/image_5F00_02D24D1F.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" border="0" alt="image" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/matthew.podwysocki/image_5F00_thumb_5F00_494F3D27.png" width="244" height="83" /&gt;&lt;/a&gt; 
&lt;p&gt;The GetEnumerator function takes no arguments and returns the IEnumerator&amp;lt;T&amp;gt; which has a no-argument function and returns the next item in the list through MoveNext and Current.&amp;nbsp; Now, let’s look at the inverse of it.&amp;nbsp; &lt;p&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/matthew.podwysocki/image_5F00_2FE739ED.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" border="0" alt="image" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/matthew.podwysocki/image_5F00_thumb_5F00_21A8C0FD.png" width="244" height="123" /&gt;&lt;/a&gt; 
&lt;p&gt;The duality of the Enumerable solution is quite simple.&amp;nbsp; We have our observer on the left hand side which has an action function which takes a T argument and returns void.&amp;nbsp; The right hand side is the notification that is sent when something happens.&amp;nbsp; This is all managed by the Observable as it maintains a list of all observers so that it can notify them.&amp;nbsp; &lt;p&gt;To make this a little more concrete, let mash these two sets of interfaces together in order to dualize.&amp;nbsp; First, let’s start with the IEnumerator&amp;lt;T&amp;gt; interface.&amp;nbsp; &lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:31648a45-a756-4dad-876e-eb6beff8ac03" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:#FFFFFF;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;interface&lt;/span&gt;&lt;span style="color:#000000;"&gt; IEnumerator&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;T&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; : IDisposable
{
    T Current { &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;get&lt;/span&gt;&lt;span style="color:#000000;"&gt;; } &lt;/span&gt;&lt;span style="color:#008000;"&gt;//&lt;/span&gt;&lt;span style="color:#008000;"&gt; throws exception&lt;/span&gt;&lt;span style="color:#008000;"&gt;
&lt;/span&gt;&lt;span style="color:#000000;"&gt;    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;bool&lt;/span&gt;&lt;span style="color:#000000;"&gt; MoveNext();
}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;What we’ll notice is that we have two items the Current property with a get accessor and the MoveNext method which takes nothing and returns a boolean that indicates if it can move next.&amp;nbsp; You’ll also notice that our Current property also could throw an exception.&amp;nbsp; If we’re in the Java world, we’d explicitly mark this interface with throws Exception, but as C# doesn’t have that, this comment will do.&amp;nbsp; Now, let’s look to dualize this interface.&lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:d43100c1-d9db-443e-a5e1-bbac9d2b880f" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:#FFFFFF;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;interface&lt;/span&gt;&lt;span style="color:#000000;"&gt; IDualEnumerator&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;T&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;
{
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; SetCurrent(T value &lt;/span&gt;&lt;span style="color:#000000;"&gt;|&lt;/span&gt;&lt;span style="color:#000000;"&gt; Exception ex);
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; MoveNext(&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;bool&lt;/span&gt;&lt;span style="color:#000000;"&gt; canMove);
}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;At first glance, all we have to do is flip our Current property to have a setter.&amp;nbsp; Because the Current yielded a value or threw an exception, that’s the way we’ll model it for now.&amp;nbsp; Secondly, our MoveNext will now take a boolean to indicate whether we’re done.&amp;nbsp; Let’s refactor this a little bit more and break the SetCurrent into two distinct operations, one for yielding the next value, and one for throwing an exception.&amp;nbsp; &lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:644732de-0d0e-424d-8a79-f2e41f88677f" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:#FFFFFF;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;interface&lt;/span&gt;&lt;span style="color:#000000;"&gt; IDualEnumerator&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;T&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;
{
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; Yield(T value);
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; Throw(Exception ex);
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; MoveNext(&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;bool&lt;/span&gt;&lt;span style="color:#000000;"&gt; canMove);
}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now that we have that under control, let’s then move onto our MoveNext method.&amp;nbsp; As you’ll notice, we’ll continue to send in a true until we’re finished pushing values.&amp;nbsp; Instead of calling MoveNext repeatedly, let’s instead call this only once when we’re finished.&lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:67e3bcd0-71a6-4f8a-b2a7-38b4e6cfe217" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:#FFFFFF;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;interface&lt;/span&gt;&lt;span style="color:#000000;"&gt; IDualEnumerator&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;T&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;
{
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; Yield(T value);
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; Throw(Exception ex);
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; Break();
}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;What we then end up with is pretty much the signature of our IObserver&amp;lt;T&amp;gt;.&amp;nbsp; By renaming our Yield to OnNext, our Throw to OnException and Break to OnCompleted, we’re left with our original IObserver&amp;lt;T&amp;gt; interface.&lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:64b72f33-4825-40a2-bbd3-9dc86c9d9445" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:#FFFFFF;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;interface&lt;/span&gt;&lt;span style="color:#000000;"&gt; IObserver&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;T&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;
{   
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; OnNext(T value);
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; OnError(Exception exception);
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; OnCompleted();
} 
&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;What about the dual of IEnumerable&amp;lt;T&amp;gt;?&amp;nbsp; Let’s first look at what that interface is.&lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:de589912-3310-4d59-8687-6f512c6b547a" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:#FFFFFF;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;interface&lt;/span&gt;&lt;span style="color:#000000;"&gt; IEnumerable&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;T&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;
{
    IEnumerator&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;T&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; GetEnumerator();
} &lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This interface has a single method called GetEnumerator which returns an IEnumerator&amp;lt;T&amp;gt;.&amp;nbsp; How might we dualize this interface?&amp;nbsp; Well, we already know that the dual of the IEnumerator&amp;lt;T&amp;gt; is IObservable&amp;lt;T&amp;gt;, just as well, we need a way to attach interest in a given dualized Enumerator, so we’ll create a method called Attach.&amp;nbsp; Just as well, when we attach interest, we also need a way to detach our interest for a given observer.&amp;nbsp; That might look like the following.&lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:b4d287df-8902-4317-bcd8-02d136ddbfa1" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:#FFFFFF;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;interface&lt;/span&gt;&lt;span style="color:#000000;"&gt; IDualEnumerable&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;T&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;
{
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; Attach(IObserver&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;T&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; observer);
    &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;void&lt;/span&gt;&lt;span style="color:#000000;"&gt; Detach(IObserver&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;T&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; observer);
}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If we look at the Java interfaces for Observer and Observable, these are pretty close in signature.&amp;nbsp; There ultimately is a problem with this scenario in terms of composition.&amp;nbsp; At each level, it needs to remember which things maps to which so that you could undo any of the observers if need be.&amp;nbsp; Not doing so could lead to space leaks and is generally a bad idea.&amp;nbsp; How could we solve this then?&amp;nbsp; Ultimately, we need a way to track our attachment once we call the Attach through some form of a return value.&amp;nbsp; At this point, the tracking is nothing more than needing the ability to detach our given Observer.&amp;nbsp; If you’ll notice in our IEnumerator&amp;lt;T&amp;gt; interface, it inherits the IDisposable interface which gets one thinking.&amp;nbsp; Could we instead, change our Attach method so that when we call it, we return an IDisposable instead which gives us the ability to track our subscription and be able to clean up after we’re done?&amp;nbsp; That’s exactly the approach that the IObservable&amp;lt;T&amp;gt; takes in the final version of the interface.&lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:e3753e03-8bdf-460e-a35d-0b9c26aef767" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:#FFFFFF;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"&gt;&lt;span style="color:#0000FF;"&gt;public&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;interface&lt;/span&gt;&lt;span style="color:#000000;"&gt; IObservable&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;T&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;
{
    IDisposable Subscribe(IObserver&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#000000;"&gt;T&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; observer);
}&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Now that we’ve proven the duality, why does it matter?&amp;nbsp; Because of this duality, the laws that apply to LINQ to Objects now can apply to LINQ to Observables (or Events).&amp;nbsp; And in fact, we can see that through the Observable class which has many of our standard LINQ combinators such as: 
&lt;ul&gt;
&lt;li&gt;Aggregate 
&lt;li&gt;First/FirstOrDefault 
&lt;li&gt;GroupBy 
&lt;li&gt;Join 
&lt;li&gt;Last/LastOrDefault 
&lt;li&gt;Select 
&lt;li&gt;SelectMany 
&lt;li&gt;Single/SingleOrDefault 
&lt;li&gt;Skip/SkipWhile 
&lt;li&gt;Take/TakeWhile 
&lt;li&gt;Where 
&lt;li&gt;Zip&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Because of this duality, we can do such simple things as fire the ProgressChanged event until the RunWorkerCompleted event happens.&lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:5b6433cf-f1f2-4c82-9d79-72eb72d9fbed" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:#FFFFFF;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"&gt;&lt;span style="color:#0000FF;"&gt;var&lt;/span&gt;&lt;span style="color:#000000;"&gt; worker &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; BackgroundWorker();

&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;var&lt;/span&gt;&lt;span style="color:#000000;"&gt; percentage &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;from&lt;/span&gt;&lt;span style="color:#000000;"&gt; progress &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;in&lt;/span&gt;&lt;span style="color:#000000;"&gt; worker.ProgressChangedEvent()
                           .Until(worker.RunWorkerCompletedEvent())
                 &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;select&lt;/span&gt;&lt;span style="color:#000000;"&gt; progress.EventArgs.ProgressPercentage;

&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;var&lt;/span&gt;&lt;span style="color:#000000;"&gt; subscription &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; percentage.Subscribe(
    p &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; Console.WriteLine(&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Percentage Complete: {0}&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;, p));&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:38465fdf-0cb4-41e9-afd5-0468654547a4" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:#FFFFFF;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;white-space:pre-wrap;word-wrap:break-word;overflow:auto;"&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;That’s only scratching the surface of the power of the Reactive Framework.&amp;nbsp; We’ll go in depth in the next part of the series on the combinators.&amp;nbsp; We could go into the fact that the Enumerable solution is really just the lazy list monad and the Observable solution is really just the continuation monad, but that’s for another time as well.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;As I’ve stated before, the LiveLabs Reactive Framework gives us the ability to harness reactive programming and treat events as the first class citizens they should have been using LINQ expressions and other standard LINQ combinators.&amp;nbsp; Still, there is much to cover in this series with the standard LINQ combinators, the monadic heritage of this solution and more.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=409480" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/LTkhG4JcCgE" height="1" width="1"/&gt;</description><category domain="http://codebetter.com/blogs/matthew.podwysocki/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://codebetter.com/blogs/matthew.podwysocki/archive/tags/Event-based+Porgramming/default.aspx">Event-based Porgramming</category><category domain="http://codebetter.com/blogs/matthew.podwysocki/archive/tags/Reactive+Framework/default.aspx">Reactive Framework</category><feedburner:origLink>http://codebetter.com/blogs/matthew.podwysocki/archive/2009/11/03/introduction-to-the-reactive-framework-part-ii.aspx</feedburner:origLink></item><item><title>Should I use MEF with an IoC container? - Part 1</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/pBxpc37LwH8/should-i-use-mef-with-an-ioc-container.aspx</link><pubDate>Sun, 01 Nov 2009 06:36:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:408260</guid><dc:creator>Glenn Block</dc:creator><slash:comments>6</slash:comments><description>&lt;p&gt;In my post &lt;a href="http://codebetter.com/blogs/glenn.block/archive/2009/08/16/should-i-use-mef-for-my-general-ioc-needs.aspx"&gt;&amp;quot;Should I use MEF for my IoC needs&amp;quot;&lt;/a&gt;&amp;nbsp;we took a look at the question of whether or not it is appropriate to use MEF instead of a traditional&amp;nbsp;IoC container. In this post we&amp;#39;ll discuss the question of whether or not you should use both an IoC container and MEF in the same application. &lt;/p&gt;
&lt;h2&gt;MEF and IoC container concerns&lt;/h2&gt;
&lt;p&gt;As we&amp;#39;ve mentioned in the past, MEF&amp;#39;s primary design in V1&amp;nbsp;is&amp;nbsp;around open-systems whose components (parts) are dynamically discovered at runtime. IoC containers on the other hand are primarily&amp;nbsp;designed for&amp;nbsp;decoupling&amp;nbsp;a closed&amp;nbsp;(fixed) set of application components in order to&amp;nbsp;improve the maintainability of the system by the engineering team. In other words each is addressing a specific set of concerns. So if that is the case then is it plausable to use both in an application? The answer is &lt;strong&gt;Yes&lt;/strong&gt;. Not only that, but we specifically designed MEF with the idea of integration with other containers in mind. Below will explore one of the key-scenarios for doing this.&lt;/p&gt;
&lt;h2&gt;Enabling third-party extensibility in an IoC container-dependent application.&amp;nbsp;&lt;/h2&gt;
&lt;p&gt;You have an existing customer management system that uses an IoC container such as Castle Windsor which you use in order to promote separation-of-concens and testability. The application leverages advanced Windsor facilities for integrating with NHibernate and for applying cross-cutting-concerns (AOP) such as logging, etc. The loosely coupled design of the system has proven to be greatly beneficial and has minimized the friction for developing and deploying the system through several releases. &lt;/p&gt;
&lt;p&gt;At some point requests start pouring in&amp;nbsp;from customers want to create their own extensions in order to customize the application in their specific environments. Additionally several ISVs express interest in providing third-party&amp;nbsp;value-adds such as telephony integration, and scheduling.&amp;nbsp;&amp;nbsp;You determine that adding a third-party&amp;nbsp;extensibility model to the application makes sense in order to address this opportunity. Through your&amp;nbsp;research you come across MEF and realize that it provides the infrastructure you need for extensibility.&amp;nbsp; However&amp;nbsp;it does so&amp;nbsp;in a manner that&amp;nbsp;overlaps with&amp;nbsp;many of the&amp;nbsp;functions that Windsor is providing.&amp;nbsp;What to do? Let&amp;#39;s explore various options.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;a. Migrate the existing code to use MEF and remove&amp;nbsp;the IoC container&amp;nbsp;completely.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;One option is to consider ripping out Castle and just using MEF. Technically this&amp;nbsp;sounds reasonable, however after investigation&amp;nbsp;it is not feasible. There are literally thousands&amp;nbsp;of components that are currently registered in the Windsor container.&amp;nbsp;Moving these to MEF&amp;nbsp;involves modfying all of these existing classes&amp;nbsp;in order to make them discoverable by MEF, not to mention refactoring all the places in the application where the container is accessed.&amp;nbsp; Because the changes are so widespread, the likelihood of introducing&amp;nbsp; breakages / bugs in the system is very high. Additionally there are the various Castle facilities such as Dynamic Proxy, and NHibernate integration&amp;nbsp;which MEF does not yet support, which will have to authored by the team. The cost / risk of such changes is too prohibitive, not to mention that it seems&amp;nbsp;like it should be unnecessary.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;b. Implement a custom&amp;nbsp;extensibility mechanism&amp;nbsp;built on top of the&amp;nbsp;IoC container?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Another option is to author a home-grown solution. This can be a viable option depending on the needs, and the willingness to author your own solution. For simple cases you can easily facade an extensibility mechanism on top of an IoC. Once you start getting into more advanced features like lazy instantiation, metadata, recomposition and stable composition, you are in for quite a bit of work. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;c. Have&amp;nbsp;both&amp;nbsp;the IoC&amp;nbsp;and MEF both present in the same application?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The final option I want to discuss (and the one I recommend for these situations) is to use both. Use the IoC container for addressing internal application decoupling needs, and use MEF for third-party extensibiltiy needs, that is the IoC container for IoCish things and the MEF container for MEFfish things :-)&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This path is appealing for several reasons. &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It works with existing codebases whether they be applications or frameworks. it does not require any significant rewrite.&lt;/li&gt;
&lt;li&gt;It allows leveraging the strengths of each container for the things it does best. For example leveraging MEF&amp;#39;s metadata model for discriminating between different extensions vs the dynamic proxy support in Castle. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;However, there are several caveats of this approach.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It&amp;nbsp;raises questions such as: 
&lt;ul&gt;
&lt;li&gt;Which component (part) should live in which container? &lt;/li&gt;
&lt;li&gt;Who owns the lifetime?&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Can a MEF part access services coming from the IoC?&amp;nbsp; How?&lt;/li&gt;
&lt;li&gt;Can the IoC access exports coming from MEF?&amp;nbsp;&amp;nbsp;How?&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;It increases complexity in that now there are components living in mulitple places. &lt;/li&gt;
&lt;li&gt;It increases the potential points of failuire within the application. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All of these issues are managable. In my next post we&amp;#39;ll see how.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=408260" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/pBxpc37LwH8" height="1" width="1"/&gt;</description><category domain="http://codebetter.com/blogs/glenn.block/archive/tags/IOC/default.aspx">IOC</category><category domain="http://codebetter.com/blogs/glenn.block/archive/tags/MEF/default.aspx">MEF</category><feedburner:origLink>http://codebetter.com/blogs/glenn.block/archive/2009/10/31/should-i-use-mef-with-an-ioc-container.aspx</feedburner:origLink></item><item><title>Getting Your Groove Off</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/LX6W-b-cZI8/getting-your-groove-off.aspx</link><pubDate>Thu, 29 Oct 2009 21:26:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:403450</guid><dc:creator>hdierking</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;Until recently, the only knowledge I had of Groove was that it was some kind of collaboration product that we got as a result of bringing in &lt;a href="http://www.microsoft.com/presspass/exec/ozzie/?tab=biography"&gt;Ray Ozzie&lt;/a&gt;.&amp;nbsp; Then I got a new manager who insisted that our team standardize on Groove for the team document repository - so I got setup on Groove and went on with my life.&amp;nbsp; In general, there&amp;rsquo;s nothing I found terribly impressive about it, but it wasn&amp;rsquo;t really getting in my way so no reason to get too upset&amp;hellip;&lt;/p&gt;
&lt;p&gt;Until my &lt;a href="http://tortoisesvn.net/"&gt;Tortoise SVN&lt;/a&gt; icon overlays stopped working.&lt;/p&gt;
&lt;p&gt;I ended up spending quite a bit of time this morning trying to figure out exactly why they weren&amp;rsquo;t working.&amp;nbsp; It was odd &amp;ndash; I had no problems on my home machine &amp;ndash; but on both of my work machines, same result &amp;ndash; no TSVN icons.&amp;nbsp; Finally, &lt;a href="http://twitter.com/pilotbob"&gt;@pilotbob&lt;/a&gt; pointed me to &lt;a href="http://msdn.microsoft.com/en-us/library/cc144123%28VS.85%29.aspx"&gt;this article&lt;/a&gt; which set off a chain of recollections &amp;ndash; most notably that the major difference between my work machines and my home machine had to do with the order that I installed stuff.&amp;nbsp; On my home machine, I installed Office after I got my dev environment setup.&amp;nbsp; However, on my work machine, Office was installed as a part of the default OS install image - and Groove was included in that installation.&lt;/p&gt;
&lt;p&gt;So why is this important?&amp;nbsp; Because if you remember from the article, Windows supports only 15 overlay handler slots &amp;ndash; and installing Groove puts 5 handlers right there on top of my TSVN handlers &amp;ndash; the net result being that my TSVN icon overlays don&amp;rsquo;t load.&lt;/p&gt;
&lt;p&gt;To fix, I simply went into the registry, deleted all of the Groove overlay handlers from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers&lt;/p&gt;
&lt;p&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/howard.dierking/reg_5F00_5DBA9B31.png"&gt;&lt;img height="464" width="644" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/howard.dierking/reg_5F00_thumb_5F00_1F059DCB.png" alt="reg" border="0" title="reg" style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Then rebooted.&amp;nbsp; Voila!&amp;nbsp; TSVN icon overlays come right back up!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=403450" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/LX6W-b-cZI8" height="1" width="1"/&gt;</description><category domain="http://codebetter.com/blogs/howard.dierking/archive/tags/TortoiseSVN/default.aspx">TortoiseSVN</category><feedburner:origLink>http://codebetter.com/blogs/howard.dierking/archive/2009/10/29/getting-your-groove-off.aspx</feedburner:origLink></item><item><title>Low-Technology</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/QLCKhPrYHO8/low_2D00_technology.aspx</link><pubDate>Thu, 29 Oct 2009 18:55:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:403429</guid><dc:creator>Dave Laribee</dc:creator><slash:comments>13</slash:comments><description>&lt;p&gt;I&amp;#39;m completely obsessed with the idea of &lt;a href="http://en.wikipedia.org/wiki/Low-technology"&gt;low-technology&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;The term low-technology is a description of those crafts and tools whose inception (typically) predates the Industrial Revolution.&lt;/blockquote&gt;
&lt;blockquote&gt;A test for low-technology may be that it can be practiced or fabricated with a minimum of Capital investment by an individual or small group of individuals; and that the knowledge of the practice can be completely comprehended by a single individual, free from increasing specialization and compartmentalization.&lt;/blockquote&gt;
&lt;p&gt;An excellent overview of some of the cutting edge efforts in low-technologies can be seen in this &lt;a href="http://www.ted.com/talks/amy_smith_shares_simple_lifesaving_design.html"&gt;TED video with low-technologist Amy Smith&lt;/a&gt;. I completely agree with when says, &amp;quot;not all inventions need to be grandiose, complex things... sometimes they can be simple and smart ideas that just help a lot of people.&amp;quot;&lt;/p&gt;
&lt;p&gt;The second block quote is where I&amp;#39;m coming from. What are those tools in software development that add lots of value without minimal getting started overhead. Pair-programming seems like an excellent example of low technology. Emergent design, test-driven development and value-driven approaches like XP are yet more.&lt;/p&gt;
&lt;p&gt;It seems, to me anyway, that these are the things that&amp;#39;ll yield the most benefits. Both vendor-supplied tooling and trending topics we hold near and dear, like &lt;a href="http://domaindrivendesign.org/"&gt;Domain-Driven Design&lt;/a&gt; and &lt;a href="http://www.martinfowler.com/bliki/DomainSpecificLanguage.html"&gt;DSLs&lt;/a&gt; and this fluent madness in general, strike me as more &lt;i&gt;high-technology&lt;/i&gt; approaches.&lt;/p&gt;
&lt;p&gt;There&amp;#39;s nothing wrong with high-technology, of course, but my instinct is that the risk-reward equation for most teams usually favors low-technology. We have, after all, limited bandwidth and attention, so my vote will ever go to what I see as big and easy wins: stuff focused on beefing up the signal of our communication as a team and community against the noise we might get as a software fashion victim.&lt;/p&gt;
&lt;p&gt;Anyway, this is a key topic I&amp;#39;ll be centering on over the next little while and thought y&amp;#39;all might find this way of looking at our kit, our standard tradecraft at least a little bit interesting.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=403429" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/QLCKhPrYHO8" height="1" width="1"/&gt;</description><category domain="http://codebetter.com/blogs/david_laribee/archive/tags/XP/default.aspx">XP</category><category domain="http://codebetter.com/blogs/david_laribee/archive/tags/opinion/default.aspx">opinion</category><category domain="http://codebetter.com/blogs/david_laribee/archive/tags/TDD/default.aspx">TDD</category><category domain="http://codebetter.com/blogs/david_laribee/archive/tags/teams/default.aspx">teams</category><category domain="http://codebetter.com/blogs/david_laribee/archive/tags/coaching/default.aspx">coaching</category><category domain="http://codebetter.com/blogs/david_laribee/archive/tags/practices/default.aspx">practices</category><category domain="http://codebetter.com/blogs/david_laribee/archive/tags/low-technology/default.aspx">low-technology</category><feedburner:origLink>http://codebetter.com/blogs/david_laribee/archive/2009/10/29/low_2D00_technology.aspx</feedburner:origLink></item><item><title>Eschewing Date Types in our Database</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/apbWKuyKBm8/eschewing-date-types-in-our-database.aspx</link><pubDate>Thu, 29 Oct 2009 13:41:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:402818</guid><dc:creator>karl</dc:creator><slash:comments>17</slash:comments><description>&lt;p&gt;About a month ago, I found myself transforming data for the reporting portion of our application. Like many reporting systems, ours works off of date ranges, with statistics grouped together by the day (and a few by the hour). An early prototype made heavy use of TSQL Date functions (like DateAdd and DatePart). However, I wasn&amp;#39;t happy with this solution, my transformations were unnecessarily coupled to SQL Server. I mean, database date functions all do pretty primitive date arithmetic&amp;#39;s, surely we can come up with a way to do that ourselves?&lt;/p&gt;
&lt;p&gt;I decided to borrow the strategy long-used by the Unix and PHP community (or JavaScript or doubtless countless other platforms/languages) - to store dates as seconds relative to a starting point. Unix Epoch is January 1st, 1970. If you store seconds since then in an unsigned 32 bit integer, you can store up to 136 years. If you only need minute-resolution, you can store over 8 100 years. If you only need day-resolution, then you can store a bit under 12 million years.&lt;/p&gt;
&lt;p&gt;Best of all, you can do straight up arithmetic&amp;#39;s against these fields to manipulate the dates. If you want to group hits per user for a day, you can do:&lt;/p&gt;
&lt;pre class="sql" name="code"&gt;insert into DailyHits (UserId, DaysSince, Count)
select UserId, SecondsSince/86400, count(*) 
   from Hits 
   group by UserId, SecondsSince/86400
--86400 is the number of seconds in a day

insert into HourlyHits (UserId, HoursSince, Count)
select UserId, SecondsSince/3600, count(*) 
   from Hits 
   group by UserId, SecondsSince/3600 
--3600 is the number of seconds in a hour&lt;/pre&gt;
&lt;p&gt;You can also manipulate relative times in C#, to apply as parameters:&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;public static readonly DateTime Epoch = new DateTime(1970, 1, 1);
public IList GetDailyHits(DateTime from, DateTime to)
{

   command.CommandText = &amp;quot;select * from DailyHits where DaysSince &amp;gt; @From and DaysSince &amp;lt; @To&amp;quot;;
   command.Parameters.Add(&amp;quot;@From&amp;quot;, from.Substract(Epoch).TotalDays);
   command.Parameters.Add(&amp;quot;@To&amp;quot;, to.Substract(Epoch).TotalDays);
   ...
}&lt;/pre&gt;
&lt;p&gt;If you are using NHibernate, you can use the IUserType interface to help map DateTimes to their relative counterparts (I think).&lt;/p&gt;
&lt;p&gt;The examples above are simplistic, but they do work very well and have a number of benefits - the most significant being great independence from the underlying database.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=402818" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/apbWKuyKBm8" height="1" width="1"/&gt;</description><feedburner:origLink>http://codebetter.com/blogs/karlseguin/archive/2009/10/29/eschewing-date-types-in-our-database.aspx</feedburner:origLink></item><item><title>Astoria, SSIS Adapters and BDD – Take 1</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/mVYHfxnN23s/astoria-ssis-adapters-and-bdd-take-1.aspx</link><pubDate>Wed, 28 Oct 2009 16:00:17 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:400446</guid><dc:creator>hdierking</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;Yea I know – 3 things you never thought you would hear mentioned together.&amp;#160; And to be really honest, I didn’t start out trying to build this in a BDD fashion – and since I’m totally new to the disciplines of BDD, I may not have been all that successful.&amp;#160; But hey, it’s all about the journey, and so I wanted to at least go ahead and start posting about the work I’ve been doing here, partly to share and partly to get your input ways to improve my design/specs.&lt;/p&gt;  &lt;p&gt;So here was the initial goal – I was studying ADO.NET Data Services (previously known as Astoria) when I remembered &lt;a href="http://msdn.microsoft.com/en-us/library/bb245659.aspx"&gt;this article that I once read&lt;/a&gt; in the Architecture Journal about using RSS as a technique for surfacing data to load into an enterprise data warehouse.&amp;#160; That led me to think that it would be a cool opportunity to simultaneously learn Astoria and feed my BI sweet tooth by writing a SSIS data source that could consume an Astoria endpoint.&amp;#160; Given the fact that &lt;a href="https://blogs.msdn.com/astoriateam/archive/2009/10/21/using-data-services-over-sharepoint-2010-part-1-getting-started.aspx"&gt;more and more systems are exposing data using syndication&lt;/a&gt;, it seemed like creating an SSIS data source was something that could be helpful beyond my simply wanting to play with the technology.&lt;/p&gt;  &lt;p&gt;Wait - ADO.NET Data Services what??&lt;/p&gt;  &lt;p&gt;Just in case you weren’t 100% sure what ADO.NET Data Services is, it’s technology to expose data and enable operations on data via RESTful operations.&amp;#160; You can find out much more about it &lt;a href="http://msdn.microsoft.com/en-us/data/bb931106.aspx"&gt;here&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/astoriateam/"&gt;here&lt;/a&gt;, but for the purposes of this exercise, here are the 3 things you need to know.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;It uses all standard HTTP operations – which means that for getting data, you simply format a HTTP GET request for the service URL plus additional path information and optional querystring arguments to tell the framework how to shape the data. &lt;/li&gt;    &lt;li&gt;While there’s not a dependency on the Entity Framework, there is a dependency on the Entity Data Model in that metadata is exposed as &lt;a href="http://msdn.microsoft.com/en-us/library/bb399292.aspx"&gt;CSDL&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;Though you have a couple formatting options when getting data, the primary one (and the one used by the data source component) is to get the data as an ATOM feed.&amp;#160; The data source component can then project the XML into the appropriate output buffer (or buffers as you’ll see later). &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Wait – SSIS what??&lt;/p&gt;  &lt;p&gt;Sql Server Integration Services is Microsoft’s ETL tool that ships with SQL Server.&amp;#160; You can start learning more about it &lt;a href="http://msdn.microsoft.com/en-us/library/ms141026.aspx"&gt;here&lt;/a&gt;, but for the purpose of this exercise, here are the 3 things you need to know.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The unit of execution in SSIS is the package.&amp;#160; This is really similar nomenclature to DTS because, not surprisingly, SSIS evolved out of DTS. &lt;/li&gt;    &lt;li&gt;Every package contains 2 kinds of logic: 1 “Control Flow” and zero-to-many “Data Flows”.&amp;#160; Control flow is meant for larger operations like copying files or running some kind of database maintenance operation (and while interesting, it’s not something I care about for this exercise).&amp;#160; The real meat of SSIS (IMHO) happens within a data flow – this is where data is extracted from a source, massaged, and put into a destination.&amp;#160; Data flows maintain the entire pipeline of operations between source and destination via in memory buffers. &lt;/li&gt;    &lt;li&gt;Data flows use data source components to extract data from the source and add it to the appropriate buffers in the pipeline.&amp;#160; Data source components are also used to provide metadata to the SSIS design-time experience so that package designers can use it to clean up and massage the data using transformation components (** for those experienced SSIS folks, it’s worth noting that there is an XML data source component that is a part of the product, and since ADO.NET Data Services returns data as an ATOM feed, is is absolutely possible to consume it directly.&amp;#160; However, in order to take this approach, you will need to generate a XSD schema and associate it with the component at design time for the metadata – and every time you change the shape of your data services query, you will have to re-generate and re-associate a new schema.&amp;#160; This was one of the primary motivators for me to create a custom data source). &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;So then, the initial goals were as follows -&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Create an SSIS data source component that could consume an ADO.NET Data Services endpoint &lt;/li&gt;    &lt;li&gt;Ensure that the component participated in both the design time and runtime experiences &lt;/li&gt;    &lt;li&gt;Ensure that the component was able to handle projections of ADO.NET Data services queries that took advantage of the $&lt;a href="http://msdn.microsoft.com/en-us/library/cc668798.aspx"&gt;expand clause&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;As I got into the development I was pretty quickly able to accomplish the first 2 goals.&amp;#160; For example, given the following query configuration..&lt;/p&gt;  &lt;p&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/howard.dierking/ConfigDialog_5F00_76A43385.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="ConfigDialog" border="0" alt="ConfigDialog" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/howard.dierking/ConfigDialog_5F00_thumb_5F00_05F79595.png" width="244" height="230" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I was able to get the data shape using ADO.NET Data Service’s &lt;a href="http://blogs.thinktecture.com/cweyer/archive/2007/12/11/415061.aspx"&gt;$metadata&lt;/a&gt; option and expose it back to the designer..&lt;/p&gt;  &lt;p&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/howard.dierking/ColumnMappings_5F00_395358F1.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="ColumnMappings" border="0" alt="ColumnMappings" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/howard.dierking/ColumnMappings_5F00_thumb_5F00_36CA2733.png" width="244" height="230" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;I was even able to run the package for a simple data services query and pipe the results to a flat file..&lt;/p&gt;  &lt;p&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/howard.dierking/simpleExample_5F00_47622221.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="simpleExample" border="0" alt="simpleExample" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/howard.dierking/simpleExample_5F00_thumb_5F00_740ADBFA.png" width="170" height="244" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;However, when I started implementing that 3rd goal of managing projections, I quickly realized my quick and dirty project need more thought in its design.&amp;#160; This drove me to add a few more goals.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Project should separate the core logic of the component from the SSIS infrastructure – which is heavily reliant on inheritance &lt;/li&gt;    &lt;li&gt;Core component logic should be independently testable without requiring a running data services endpoint &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Separating the logic out into a different assembly wasn’t really all that painful – just a few keystrokes of Resharper, a couple file moves, a reference added, and I was good to go.&amp;#160; However, because this started as a quick and dirty project (I should have known better), I hadn’t designed for data source independence and as such had some larger refactorings to do.&amp;#160; And in that process (** keep in mind that this started as an remains primarily a learning exercise for me – I would NEVER recommend taking this kind of “while I’m at it approach” on a real project), I decided that my tests weren’t really where I wanted them and that I had always wanted to get my hands dirty with BDD anyway, so why not?&amp;#160; It’s just one more goal.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Tests should be written as specifications &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I’ve read from some that BDD is really meant more for testing larger behaviors in business applications.&amp;#160; However, it feels pretty good (though initially uncomfortable) at the grain at which I’m using it.&amp;#160; For example..&lt;/p&gt;  &lt;pre class="c-sharp" name="code"&gt;public class when_products_resource_is_queried : with_northwind_CSDL
{
    Establish context = () =&amp;gt; queryBuilder.ResourcePath = &amp;quot;Products&amp;quot;;

    Because of = () =&amp;gt; query = queryBuilder.GetQuery();

    It should_have_8_properties = () =&amp;gt; 
        query.DataShape.First().Properties.Count.ShouldEqual(8);

    It should_have_a_single_resource = () =&amp;gt; 
        query.DataShape.Count().ShouldEqual(1);

    It should_have_1_key_property = () =&amp;gt; 
        query.DataShape.First().Keys.Count.ShouldEqual(1);

    It should_have_correct_query_string = () =&amp;gt;
        query.ToString().ShouldEqual(string.Format(
            &amp;quot;{0}/Products&amp;quot;, Constants.SERVICE_URI));
}&lt;/pre&gt;

&lt;p&gt;Ok – so those were the goals as they evolved. Going forward, my plan is to dig into the logic design and specifications, then talk specifically about projections, then finally talk about how this stuff works with SSIS (and how I would like to see the SSIS API simplified).&amp;#160; Sorry to not get into all that tonight, but as my friend &lt;a href="http://blogs.msdn.com/gblock/archive/2007/08/29/improving-blogging-efficiency.aspx"&gt;Glenn has advised me countless times&lt;/a&gt;, if you wait to blog until everything is nice and tidy and completed, you may never blog again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=400446" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/mVYHfxnN23s" height="1" width="1"/&gt;</description><category domain="http://codebetter.com/blogs/howard.dierking/archive/tags/BDD/default.aspx">BDD</category><category domain="http://codebetter.com/blogs/howard.dierking/archive/tags/SSIS/default.aspx">SSIS</category><category domain="http://codebetter.com/blogs/howard.dierking/archive/tags/ADO.NET+Data+Services/default.aspx">ADO.NET Data Services</category><feedburner:origLink>http://codebetter.com/blogs/howard.dierking/archive/2009/10/28/astoria-ssis-adapters-and-bdd-take-1.aspx</feedburner:origLink></item><item><title>The Most Productive Programming Language</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/vb2_6KdSukk/the-most-productive-programming-language.aspx</link><pubDate>Wed, 28 Oct 2009 00:08:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:398206</guid><dc:creator>Dave Laribee</dc:creator><slash:comments>9</slash:comments><description>&lt;p&gt;The most productive and useful programming language you know, by a long shot, is English or Hindi or Portuguese or Spanish or French or whatever human language your team uses. Good communication skills are way more valuable to you and your customers than picking up &lt;a href="http://www.amazon.com/Pragmatic-Programmer-Journeyman-Master/dp/020161622X"&gt;a new language every year&lt;/a&gt;. That is, while there is value in the item on
the right, I value the item on the left more. &lt;a href="http://agilemanifesto.org/"&gt;Sound familiar?&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Developers that name things well and program with a respect for human
languages create more maintainable and easier to follow code. Being able to communicate with a customer, analyst and/or product owner can save you hour upon hour of effort and keep your solution simple. No programming language no matter how syntactically minimal or internal DSL friendly can ever come close to this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=398206" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/vb2_6KdSukk" height="1" width="1"/&gt;</description><category domain="http://codebetter.com/blogs/david_laribee/archive/tags/Language/default.aspx">Language</category><category domain="http://codebetter.com/blogs/david_laribee/archive/tags/coaching/default.aspx">coaching</category><category domain="http://codebetter.com/blogs/david_laribee/archive/tags/craftsmanship/default.aspx">craftsmanship</category><category domain="http://codebetter.com/blogs/david_laribee/archive/tags/basics/default.aspx">basics</category><feedburner:origLink>http://codebetter.com/blogs/david_laribee/archive/2009/10/27/the-most-productive-programming-language.aspx</feedburner:origLink></item><item><title>Hierarchical Namespace Component</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/2vwNcU8ErHo/hierarchical-namespace-component.aspx</link><pubDate>Mon, 26 Oct 2009 14:49:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:398024</guid><dc:creator>Patrick Smacchia</dc:creator><slash:comments>11</slash:comments><description>&lt;p&gt;Modeling components of a code base with namespaces is a much better idea than modeling them with assemblies. I wrote about the &lt;i&gt;namespaces vs. assemblies&lt;/i&gt; debate in the past (&lt;a target="_blank" href="http://www.theserverside.net/tt/articles/showarticle.tss?id=ControllingDependencies"&gt;Control components dependencies to gain clear architecture&lt;/a&gt;). The fact is that namespace is a logical artifact while assembly is a physical artifact. Of course, creating assemblies to partition parts of the code that at runtime physically don&amp;rsquo;t live within the same AppDomain is a good thing. I explained that in &lt;a target="_blank" href="http://codebetter.com/blogs/patricksmacchia/archive/2008/12/08/advices-on-partitioning-code-through-net-assemblies.aspx"&gt;Advices on partitioning code through .NET assemblies&lt;/a&gt;. Unfortunately, the vast majority of .NET teams use assemblies instead of namespaces to partition logically their code. They end up with hundreds of Visual Studio projects:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Hundreds of VS projects organized through dozens of VS solutions is something hard to manage.&lt;/li&gt;
&lt;li&gt;These hundreds of projects takes a lot of extra time to be compiled (because of the repetitive tier assemblies parsing).&amp;nbsp; By extra time I mean that the compilation takes minutes instead of seconds!&lt;/li&gt;
&lt;li&gt;And finally, loading all these assemblies at runtime slow down consequently the startup time of applications. Indeed, doing so multiply the unit overhead that the CLR needs to load an assembly. The overhead is mainly due to CAS security checks, cryptographic signing check, and IO file read.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In order to model logical components, the logical nature of namespace is a preemptive advantage over the physical nature of assembly. However namespace have a second awesome characteristic: they can be declared hierarchically. &lt;b&gt;So namespaces can be use to modelize a hierarchy of components. &lt;/b&gt;Today I would like to ramble on some consequences and caveat of organizing hierarchically components.&lt;/p&gt;
&lt;h2&gt;Theory: Tree vs. Flat view&lt;/h2&gt;
&lt;p&gt;This hierarchical way of componentizing code is something that we took account early in the &lt;a href="http://www.NDepend.com"&gt;NDepend&lt;/a&gt; development. At any time, the user can choose to display namespaces through tree (i.e through a hierarchy)&amp;hellip;&lt;br /&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.NamespaceHierarchy/TreeOption.png"&gt;&lt;img src="http://codebetter.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.NamespaceHierarchy/TreeOption.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&amp;hellip;or to display flat namespaces:&lt;br /&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.NamespaceHierarchy/FlatOption.png"&gt;&lt;img src="http://codebetter.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.NamespaceHierarchy/FlatOption.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Personally I prefer the tree option. After all, why do developers naturally partition the code? Because of the need to organize code and API through some smaller chunks. Smaller chunks are naturally easier to develop, understand, maintain, test and debug. This is the famous &lt;i&gt;divide and conquer tenet&lt;/i&gt;. &lt;br /&gt;&amp;nbsp;&lt;br /&gt;But when the code base is consequently growing developers are facing a dilemma:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Smaller components are easier to be managed one by one. But this implies to deal with hundreds of components. As a consequence the big picture becomes messy.&lt;/li&gt;
&lt;li&gt;Keeping a small number of components force to have large components. While the big picture remain understandable, larger components are harder to manage.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is why developers apply recursively the divide and conquer idea. As a result, they obtain a hierarchical organization of code.&lt;/p&gt;
&lt;h2&gt;Practice: Tree vs. Flat view&lt;/h2&gt;
&lt;p&gt;These 2 dependency graphs illustrate well the point. The first one is made of the 52 namespaces declared in the mscorlib (this is the flat view). &lt;br /&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.NamespaceHierarchy/FlatOptionGraph.png"&gt;&lt;img src="http://codebetter.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.NamespaceHierarchy/FlatOptionGraph.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The second one is made of the 16 root namespaces of the DLL mscorlib (this is the root tree view). The root tree view present less information than the flat view, but at least it is readable. &lt;br /&gt;&lt;img src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.NamespaceHierarchy/TreeOptionGraph.png" style="max-width:600px;border:0;" border="0" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;Moreover the root tree view is a good start to dig into the code and browse nested namespaces inter-dependency:&lt;br /&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.NamespaceHierarchy/Graph2Graph.png"&gt;&lt;img src="http://codebetter.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.NamespaceHierarchy/Graph2Graph.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The same phenomenon appears with the Dependency Matrix. The root tree view (first matrix) is a better way to browse the code than the flat view (second matrix).&lt;/p&gt;
&lt;p&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.NamespaceHierarchy/TreeOptionMatrix.png"&gt;&lt;img src="http://codebetter.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.NamespaceHierarchy/TreeOptionMatrix.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.NamespaceHierarchy/FlatOptionMatrix.png"&gt;&lt;img src="http://codebetter.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.NamespaceHierarchy/FlatOptionMatrix.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.NamespaceHierarchy/TreeOptionMatrix.png"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Component Hierarchy and Dependency Cycle&lt;/h2&gt;
&lt;p&gt;Avoiding cycles between components is an essential point to care for, in order to keep a code base maintainable. I detailed that in the post: &lt;a target="_blank" href="http://codebetter.com/blogs/patricksmacchia/archive/2009/07/29/maintainability-learnability-component-layering.aspx"&gt;Maintainability, Learnability, Component, Layering&lt;/a&gt;. When components are hierarchically organized, some &lt;i&gt;non-trivial &lt;/i&gt;cycles can appear. Let&amp;#39;s look at a small example.&lt;br /&gt;&amp;nbsp;&lt;br /&gt;If we look at the dependency between the 3 following namespaces we won&amp;rsquo;t find any cycles:&lt;/p&gt;
&lt;pre name="code" class="c-sharp"&gt;namespace ParentA.Child1 {&lt;br /&gt;   public class ClassA1 { private ParentB.ClassB m_Field; }&lt;br /&gt;}&lt;br /&gt;namespace ParentA.Child2 {&lt;br /&gt;   public class ClassA2 { }&lt;br /&gt;}&lt;br /&gt;namespace ParentB {&lt;br /&gt;   public class ClassB { private ParentA.Child2.ClassA2 m_Field; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;


&lt;br /&gt;There is no cycle, this is clear from the flat dependency view, &lt;br /&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.NamespaceHierarchy/RootCycle.png"&gt;&lt;img src="http://codebetter.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.NamespaceHierarchy/RootCycle.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is what I called a &lt;i&gt;non-trivial&lt;/i&gt; cycle because a cycle exists while there are no cycles between namespaces. The fact is that &lt;b&gt;RootA.*&lt;/b&gt; is not considered as a namespace because it doesn&amp;rsquo;t contain directly any class. In our internal NDepend terminology we named &lt;b&gt;RootA.*&lt;/b&gt; a namespace container. Technically your code is entangled and contain a cycle even if physically there is no cycle between namespaces!&lt;br /&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.NamespaceHierarchy/RootCycle2.png"&gt;&lt;img src="http://codebetter.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.NamespaceHierarchy/RootCycle2.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Hierarchical components constitute a powerful way to partition code but be aware that some non-trivial entangling cases might appear. In a next post, I&amp;rsquo;ll expose a cool way to use hierarchical componentization effectively in the real world.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=398024" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/2vwNcU8ErHo" height="1" width="1"/&gt;</description><feedburner:origLink>http://codebetter.com/blogs/patricksmacchia/archive/2009/10/26/hierarchical-namespace-component.aspx</feedburner:origLink></item><item><title>Something you can (not) do with your (old) MSDN disks</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/jYPvSYxdXns/something-you-can-not-do-with-your-old-msdn-disks.aspx</link><pubDate>Mon, 26 Oct 2009 12:52:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:398019</guid><dc:creator>pvanooijen</dc:creator><slash:comments>6</slash:comments><description>&lt;p&gt;Time to renew my MSDN subscription. I don&amp;rsquo;t know about you but I&amp;rsquo;m still very pleased with the MSDN program.&lt;/p&gt;
&lt;p&gt;In the old pre DVD days it used to be quite a problem what to do with the enormous piles of disks you received over and over again. Especially those things you never use. Anyone interested in a Finish version of Exchange server ? A Greek version of Windows 98 ? Since DVD times the piles has gotten a little smaller, but still. Googling around what to do with all these disks pops up an &lt;a href="http://codebetter.com/blogs/peter.van.ooijen/archive/2004/05/31/14832.aspx"&gt;old rant of mine&lt;/a&gt; on this.&lt;/p&gt;
&lt;p&gt;Being a biologist with a huge interest in aquarium fish (see my &lt;a href="http://codebetter.com/blogs/peter.van.ooijen/archive/2009/05/20/a-first-glimpse-of-virtualization-in-windows-7.aspx"&gt;W7 betta rant&lt;/a&gt;) and an &amp;ldquo;old goat-wool-socks&amp;rdquo; environmental concern I thought I had a good use. Digital disk are very reflective, using them as a reflector for the light in my aquarium would give the disks a new life and would increase the effectiveness of fish tank lighting. So I tried.&lt;/p&gt;
&lt;p&gt;This is what the result looked like in less than a year.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/peter.van.ooijen/OldMSDNdisks_5F00_7F8CB94B.jpg"&gt;&lt;img height="476" width="754" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/peter.van.ooijen/OldMSDNdisks_5F00_thumb_5F00_2F675B0D.jpg" alt="Old MSDN disks" border="0" title="Old MSDN disks" style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Moist has crept between the reflective (aluminum) layer and the (polycarbonate) disk itself and completely oxidized the metal. Resulting in a surface which reflects far less than the ground surface itself. Lesson learned: this does not work.&lt;/p&gt;
&lt;p&gt;What you can do today with your disks is what I already asked for in &lt;a href="http://codebetter.com/blogs/peter.van.ooijen/archive/2004/05/31/14832.aspx"&gt;my original rant&lt;/a&gt;: don&amp;rsquo;t get them. MSDN subscriptions now offer a download only option. You are free to download what you need (and what&amp;rsquo;s in your license). For many a product this was what I did already, downloading got me the product long before the disk finally arrived by mail. So if you want to stop wasting resources too: do switch to this subscription type. The only wish I have left is to save a little on money. Not producing and distributing the disks saves MS in the costs. I would like a small share of that in the form of a reduction on my MSDN fee. Fair deal ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=398019" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/jYPvSYxdXns" height="1" width="1"/&gt;</description><feedburner:origLink>http://codebetter.com/blogs/peter.van.ooijen/archive/2009/10/26/something-you-can-not-do-with-your-old-msdn-disks.aspx</feedburner:origLink></item><item><title>Postgresql - Day 2</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/2ElvldQCHAg/postgresql-day-2.aspx</link><pubDate>Sun, 25 Oct 2009 01:40:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:394963</guid><dc:creator>karl</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;My migration from SQL Server to PostgreSQL for an upcoming project continues. On &lt;a href="http://codebetter.com/blogs/karlseguin/archive/2009/10/22/migrating-to-postgresql-with-my-friend-nhibernate.aspx"&gt;day 1&lt;/a&gt; I managed to get the application up and running quickly, thanks to NHibernate. &lt;a href="http://ayende.com/Blog/archive/2009/10/22/database-independence-with-nhibernate.aspx"&gt;Ayende was kind enough&lt;/a&gt; to post some advice to minimize the already-few problems I ran into (I&amp;#39;ve since implemented the &lt;code&gt;ISQLExceptionConverter&lt;/code&gt; and am really happy about it).&lt;/p&gt;
&lt;p&gt;Today I had a bigger challenge - making the OLTP to OLAP transformation script work. I knew this would be more difficult because I&amp;#39;m using straight up SQL (instead of HQL), as well as a couple instances of &lt;code&gt;SQLBulkCopy&lt;/code&gt;. So far, most of the transformation is done in sql - there&amp;#39;s very little data being pulled down and processed by in code. Luckily, I have a huge and thorough integration test, which populates the database with a couple days worth of data, executes the transformation script in steps (as it would be in real life), and then validates the results. Essentially my test figures out the results in C# (by looping over the entities and aggregating the results every which way) and compares it to what the transformation scripts does. &lt;/p&gt;
&lt;p&gt;Aside from a couple syntactical differences, such as having used &lt;code&gt;[ ]&lt;/code&gt; to escape the count column, 1 column ambiguity that PostgreSQL couldn&amp;#39;t resolve (weird), and having used &lt;code&gt;insert {table}&lt;/code&gt; instead of &lt;code&gt;insert into {table}&lt;/code&gt;, I only ran into 2 major problem.&lt;/p&gt;
&lt;p&gt;The first was my usage of &lt;code&gt;SqlBulkCopy&lt;/code&gt; which is tied to SQL Server&amp;#39;s bcp utility. I was only using it to bulk-load the data for my integration test, but it did make a huge difference, and I wanted to keep the same performance if possible. It turns out that PostgreSQL supports a &lt;code&gt;COPY from STDIN&lt;/code&gt; command, which the &lt;a href="http://pgfoundry.org/projects/npgsql/"&gt;.NET Npgsql library&lt;/a&gt; exposes as an &lt;code&gt;NpgsqlCopyIn&lt;/code&gt; class. Although it didn&amp;#39;t perform quite as well (it still rocked), I much prefer the implementation. You essentially write a CSV to a stream - much nicer than having to transform my objects to datatables. Here&amp;#39;s the reusable code that I used:&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;public static void BulkCopy&amp;lt;T&amp;gt;(IEnumerable&amp;lt;T&amp;gt; items, Func&amp;lt;T, object[]&amp;gt; callback, string tableName, string columns)
{
    var sql = string.Format(&amp;quot;copy {0} {1} from stdin with delimiter &amp;#39;|&amp;#39;&amp;quot;, tableName, columns &amp;gt;&amp;gt; string.Empty);
    using (var connection = new NpgsqlConnection(_connectionString))
    {
        connection.Open();                
        using (var command = new NpgsqlCommand(sql, connection))                
        {                    
            var copy = new NpgsqlCopyIn(command, connection);                    
            try
            {
                copy.Start();                        
                foreach (var item in items)
                {
                    var data = SerializeData(callback(item));
                    var raw = Encoding.UTF8.GetBytes(string.Concat(data, &amp;quot;\n&amp;quot;));
                    copy.CopyStream.Write(raw, 0, raw.Length);
                }
            }
            catch (Exception)
            {
                copy.Cancel(&amp;quot;Undo copy&amp;quot;);
                throw;
            }
            finally
            {                        
                if (copy.CopyStream != null)
                {                            
                    copy.CopyStream.Close();
                }
                copy.End();
            }
        }
    }
}
private static string SerializeData(object[] data)
{
    var sb = new StringBuilder();
    foreach(var d in data)
    {
        if (d == null)
        {
            sb.Append(&amp;quot;\\N&amp;quot;);
        }
        else if (d is DateTime)
        {
            sb.Append(((DateTime) d).ToString(&amp;quot;yyyy-MM-dd HH:mm:ss&amp;quot;));
        }
        else if (d is Enum)
        {
            sb.Append(((Enum) d).ToString(&amp;quot;d&amp;quot;));
        }
        else
        {
            sb.Append(d.ToString());
        }
        sb.Append(&amp;quot;|&amp;quot;);
    }
    return sb.Remove(sb.Length - 1, 1).ToString();
}&lt;/pre&gt;
&lt;p&gt;You use it like so:&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;var users = GetAllUsers();
Func&amp;lt;User, object[]&amp;gt; callback = u =&amp;gt; new object[] { p.Id, p.Email, p.UserName, p.Password };
BulkCopy(users, callback, &amp;quot;Users&amp;quot;, null);&lt;/pre&gt;
&lt;p&gt;If you want to specify the columns, say because the Id is an auto incrementing field, simply do:&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;var users = GetAllUsers();
Func&amp;lt;User, object[]&amp;gt; callback = u =&amp;gt; new object[] {  p.Email, p.UserName, p.Password };
BulkCopy(users, callback, &amp;quot;Users&amp;quot;, &amp;quot;(Email, UserName, Password)&amp;quot;);&lt;/pre&gt;
&lt;p&gt;The code essentially turns each entity in your collection into a serialized string, which gets written to the stream.&lt;/p&gt;
&lt;p&gt;The other problem I had was that one of my most complex queries was really slow. The query had joins, joining a subselect in the where clause. SQL Server didn&amp;#39;t have a problem with it, PostgreSQL did. I wasn&amp;#39;t too surprised because past experience with MySQL had taught me that such queries could be problematic. I saw a few statements hinting that PostgreSQL 8.4 (I&amp;#39;m running 8.3) might fix it. I spent some time trying to speed it up, had some success, and then simply decided to go about it a different way. While I think its very likely that I wasn&amp;#39;t doing it properly, there&amp;#39;s no denying that SQL Server handled this better.&lt;/p&gt;
&lt;p&gt;I did time the execution of my integration test, using the same code. This was run on identically pathetic machines - an Atom 330 with 4gigs of ram and a 5400RMP hard drive. Postgresql 8.3 on Ubuntu server 9.04 and SQL Server 2008 on Windows Server 2008 R2. Without using any bulk copy, Postgresql was slightly faster. With their respective bulk copy, SQL Server was slightly faster. I&amp;#39;m not giving numbers because the results were really close, seconds apart when everything took minutes. Also, I do think the test was useful; however, the code was single threaded which means it didn&amp;#39;t provide any insight on how the databases behave when under a more typical kind of load. My goal was really just to make sure I wasn&amp;#39;t making a huge mistake, and it doesn&amp;#39;t look, or feel, like I am.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=394963" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/2ElvldQCHAg" height="1" width="1"/&gt;</description><feedburner:origLink>http://codebetter.com/blogs/karlseguin/archive/2009/10/24/postgresql-day-2.aspx</feedburner:origLink></item><item><title>Machine.Migrations changes</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/Xh8I9H0AwVM/machine-migrations-changes.aspx</link><pubDate>Sat, 24 Oct 2009 21:56:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:394459</guid><dc:creator>aaronjensen</dc:creator><slash:comments>6</slash:comments><description>&lt;p&gt;&lt;a href="http://codebetter.com/blogs/jacob.lewallen/archive/2008/04/25/a-first-look-at-machine-migrations.aspx"&gt;Jacob first introduced&lt;/a&gt; Machine.Migrations over a year ago. Since then, it&amp;#39;s been a solid part of our process and we&amp;#39;re up to nearly 500 migrations with it on one project.&lt;/p&gt; &lt;p&gt;Recently, I finally got around to making some changes I&amp;#39;ve been wanting to make and I wanted to call&amp;#39;em out:&lt;/p&gt;  &lt;ul&gt;&lt;li&gt;We split the repostiory out to its own &lt;a href="http://github.com/machine/machine.migrations"&gt;on github&lt;/a&gt;. I did this similar to the &lt;a href="http://codebetter.com/blogs/aaron.jensen/archive/2009/03/07/machine-specifications-mspec-has-moved-and-git-rocks.aspx"&gt;way I did it for MSpec&lt;/a&gt; some time ago. Again, the advantage here is that change logs are localized to the project rather than the entire machine overarching project.&lt;/li&gt; &lt;li&gt;I added complaints if you have multiple migrations with the same number. This silently caused problems before as one of the migrations would not get applied. Now it just yells and dies like a good app. Of course, this is not as important because of the next change.&lt;/li&gt; &lt;li&gt;&lt;p&gt;Next I added support for timestamped migrations. This helps &lt;strong&gt;immensely&lt;/strong&gt; on active projects with multiple developers. You don&amp;#39;t have to deal with communicating migration numbers to the team when you add them, you just generate a new one and merge it when you feel like it. We actually had half of our topic on Campfire dedicated to our current migration number. The other half was who owed how many pushups for breaking the build.&lt;/p&gt; &lt;p&gt;Here&amp;#39;s the rake task we use to generate a new migration:&lt;/p&gt; &lt;pre class="ruby" name="code"&gt;
namespace :new do
  task :migration do
    raise &amp;quot;usage: rake new:migration name=\&amp;quot;Your migration name\&amp;quot;&amp;quot; unless ENV.include?(&amp;#39;name&amp;#39;)

    name = ENV[&amp;#39;name&amp;#39;]

    filepath = &amp;quot;db/migrate/#{Time.now.strftime(&amp;#39;%Y%m%d%H%M%S&amp;#39;)}_#{name.gsub(/ /,&amp;#39;_&amp;#39;)}.cs&amp;quot;

    text = File.read(&amp;quot;db/migrate/template.cs&amp;quot;)
    File.open(filepath, &amp;#39;w&amp;#39;) { |file|
      file.puts text.gsub(/\$MigrationName\$/,&amp;quot;#{name.gsub(/ /,&amp;#39;_&amp;#39;)}&amp;quot;)
    }
  end
end
&lt;/pre&gt;
&lt;p&gt;Usage is simple, just create a template.cs in the directory (we use db/migrate) and then type &lt;pre&gt;rake new:migration name=&amp;quot;this is my migration name&amp;quot;&lt;/pre&gt;
Example template:
&lt;/p&gt;
&lt;pre class="c-sharp" name="code"&gt;
using System;
using System.Collections.Generic;
using System.Text;
using Machine.Migrations;

public class $MigrationName$ : SimpleMigration
{
  public override void Up()
  {
    throw new System.NotImplementedException();
  }

  public override void Down()
  {
    throw new System.NotImplementedException();
  }
}
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Finally, I added a command line runner. As we&amp;#39;ve grown more and more sick of msbuild and more and more fond of rake, we&amp;#39;ve wanted to slowly all but eliminate our dependency on MSBuild. The command line tool is quite simple:&lt;/p&gt;
&lt;pre&gt;
Machine.Migrations
Copyright (C) 2007, 2008, 2009 Machine Project

  c, connection-string  Required. The connection string to the database to migrate
  t, to                 Applies or unapplies migrations to get to the specified migration
  u, up                 Applies migrations to the latest
  s, scope              The scope?
  d, directory          Required. Directory containing the migrations
  v, compiler-version   Version of the compiler to use
  debug                 Show Diagnostics
  r, references         Assemblies to reference while building migrations separated by commas
  t, timeout            Default command timeout for migrations
  ?, help               Display this help screen
&lt;/pre&gt;
&lt;p&gt;
The only two flags you usually need are -c and -d. Just pass in the connection string and the location of your migrations. Be sure to quote them: migrate.exe -c &amp;quot;my connection string&amp;quot; -d &amp;quot;my migration directory&amp;quot;.&lt;/p&gt;
&lt;/li&gt;

&lt;p&gt;Hopefully these changes help others. Grab the latest &lt;a href="http://github.com/machine/machine.migrations"&gt;here&lt;/a&gt; and just msbuild the sln to build it.&lt;/p&gt;

&lt;p&gt;I do wonder though, what other active .NET migration projects are people using and how do you like them?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=394459" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/Xh8I9H0AwVM" height="1" width="1"/&gt;</description><category domain="http://codebetter.com/blogs/aaron.jensen/archive/tags/machine/default.aspx">machine</category><category domain="http://codebetter.com/blogs/aaron.jensen/archive/tags/migrations/default.aspx">migrations</category><feedburner:origLink>http://codebetter.com/blogs/aaron.jensen/archive/2009/10/24/machine-migrations-changes.aspx</feedburner:origLink></item><item><title>Map control confusion</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/F3wBLPEMcOs/map-control-confusion.aspx</link><pubDate>Thu, 22 Oct 2009 15:30:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:392558</guid><dc:creator>pvanooijen</dc:creator><slash:comments>6</slash:comments><description>&lt;p&gt;When it comes to including geographical information in your web-application you have to make two main decisions. The first one is which API you are going to use, the second one is who is going to provide the geographical data. These two are not always completely independent. &lt;/p&gt;
&lt;p&gt;A lot of websites use google maps. The geographical information is supplied by google and the only way to get to that information is by using the &lt;a href="http://code.google.com/apis/maps/index.html"&gt;Google Javascript API&lt;/a&gt;. When it comes to performance Javascript is far from ideal, more sophisticated applications which try to add a lot of information to a map are quite likely to hit a script timeout. The other downside of this approach is the (lack of) smoothness of the display. Panning or zooming a map results in a lot of&amp;nbsp; image blur.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/peter.van.ooijen/Blurredmap_5F00_383981DA.png"&gt;&lt;img height="494" width="772" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/peter.van.ooijen/Blurredmap_5F00_thumb_5F00_44B70929.png" alt="Blurredmap" border="0" title="Blurredmap" style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Both downsides can be overcome by using Silverlight. The &lt;a href="http://www.codeplex.com/deepearth"&gt;DeepEarth&lt;/a&gt; project was the first to use &lt;a href="http://silverlight.net/learn/quickstarts/deepzoom/"&gt;deepzoom&lt;/a&gt; which results in a smooth display when scanning or zooming. The strong typed compiled C# Silverlight code working with the map has not only a speed advantage over Javascript, it&amp;rsquo;s running async resulting in an app which not only has a smooth look but also a smooth feel.&lt;/p&gt;
&lt;p&gt;You can build amazing apps with that. This is a part of the &lt;a href="http://www.soulsolutions.com.au/silverlight/mvpsummit09/"&gt;MVP map&lt;/a&gt; created by DeepEarth evangelist &lt;a href="http://www.soulsolutions.com.au/"&gt;SoulSolutions&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/peter.van.ooijen/mvpMAP_5F00_77D2F6F8.png"&gt;&lt;img height="593" width="771" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/peter.van.ooijen/mvpMAP_5F00_thumb_5F00_1C4438E3.png" alt="mvpMAP" border="0" title="mvpMAP" style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;When it comes to where and how to get the geographical data, which can be satellite images, road maps or routing information, confusion starts. The DeepEarth project offered a choice of map providers. Ranging from &lt;a href="http://www.openstreetmap.org/"&gt;OpenStreetmap&lt;/a&gt; to Yahoo maps and Microsoft Live Earth. Google maps were not included, the reason is the one I mentioned. Nobody so far has managed to create a hack to get Google Map data without leaving JS.&lt;/p&gt;
&lt;p&gt;But the most confusing data-provider was and is Microsoft. The first versions of DeepEarth offered plain Live maps. In later versions you were supposed to use LiveMaps webservices. The usage of these services was by far free. There was a free developer test account available which resulted in map images all decorated with the word &amp;ldquo;staging&amp;rdquo;. For production you had to buy a license. To get a proper deal for that always got stuck somewhere in the pipeline. At the same time the old versions using plain Live maps kept working. At the moment I&amp;rsquo;m writing this seems to be history already.&lt;/p&gt;
&lt;p&gt;LiveMaps have become Bing maps. At the same time Microsoft started developing their own &lt;a href="https://connect.microsoft.com/silverlightmapcontrolctp?wa=wsignin1.0"&gt;Silverlight map control&lt;/a&gt;. The good thing is that it is a marvel to work with. The performance is even better than DeepEarth. The API just shines, a lot of functionality is present straight out of the box. All &lt;a href="http://codebetter.com/blogs/peter.van.ooijen/archive/2008/12/11/wpf-code-markup-custom-pushpins-for-deepearth.aspx"&gt;the extra work I had to do&lt;/a&gt; to get my app running in Deep Earth could be replaced by just hooking into some events. The architecture is great as well. It is by no means just limited to using Bing Maps data, you can even bypass that completely using the control as a blank working surface with a Latitude-Longitude coordinate system. A part of the architecture is a clear and easy way to use any map provider you can imagine, or build yourself. There are a lot of good stories on the web on working with the control.&lt;/p&gt;
&lt;p&gt;But, as announced, there is still confusion. First there is the name. It is Microsoft Virtual Earth Silverlight Map Control. I have no problem with that, do you like &lt;em&gt;Bing&lt;/em&gt; ? I can&amp;rsquo;t get used to that. More serious is the source of map data. The control, now in CTP, displays full MS map data without any need to apply for a (test-) license. No staging, no problem. The control itself has a &lt;strong&gt;Token&lt;/strong&gt; property, according to the documentation:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Gets or sets the token to use for service requests. &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It contains an empty string. How and when to use it is not clear at all. When it comes to production will it be needed to use the control? Or will it only be needed to get actual MS map data? Which data ? Just routing information ? Maps? Satellite images ? I just cannot find out. In case anybody can shed some light on this, I would appreciate that very much. Building software using the control is great, but what are price and conditions my customer will have to deal with?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=392558" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/F3wBLPEMcOs" height="1" width="1"/&gt;</description><feedburner:origLink>http://codebetter.com/blogs/peter.van.ooijen/archive/2009/10/22/map-control-confusion.aspx</feedburner:origLink></item><item><title>Migrating to Postgresql with my friend NHibernate</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/0yBYUnlw9RI/migrating-to-postgresql-with-my-friend-nhibernate.aspx</link><pubDate>Thu, 22 Oct 2009 13:23:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:392493</guid><dc:creator>karl</dc:creator><slash:comments>34</slash:comments><description>&lt;p&gt;Last night I decided to accelerate our plan to migrate from SQL Server to PostgreSQL and gave it a quick attempt to see what the work involved was. I was hoping that due to our usage of NHibernate, and by having meticulously written database agonistic code the migration would be cake.&lt;/p&gt;
&lt;p&gt;Turns out I was right and although there were a couple bugs along the way, the process took less than 30 minutes. Today I want to talk about the small issues we faced in migrating our code, as well as provide an overview of what I&amp;#39;ve learned about PostgreSQL so far.&lt;/p&gt;
&lt;p&gt;First though, why migrate? I want to avoid getting rantish [in this post], but the cost of ownership for SQL Server isn&amp;#39;t remotely close to being competitive. SQL Express is great, provided you can live with (or are willing to) its numerous constraints. Bizspark (I only bring it up because I feel someone will mention it in a comment) is a subprime mortgage - it lulls you into a sense of free only to nail you with licensing cost down the road. I&amp;#39;m sure someone can quote some obscure feature that might be needed by some system, but for the rest of us, the only reason to use SQL Server is familiarity. Familiarity is a pragmatic and reasonable reason to pick a technology, but only for so long. &lt;/p&gt;
&lt;p&gt;Secondly, why PostgresQL? Well, I&amp;#39;ve used sqlite and MySQL extensively in the past (including submitting patches to their .NET drivers). However, MySQL is currently in a weird state (the sun/oracle thing) and I need ACID compliance and my experience with InnoDB has been average.&lt;/p&gt;
&lt;p&gt;Thirdly, its worth pointing out that the system being migrated has a comprehensive set of unit tests, including a number tests which hit the DB. While I generally consider unit tests a design-tool, there&amp;#39;s no doubt that they provided a significant sanity check. &lt;/p&gt;
&lt;h4 style="margin-bottom:0px;padding-bottom:0px;"&gt;So, what problems did I run into?&lt;/h4&gt;
&lt;p&gt;Given the use of NHibernate, the application side of things was migrated quiet easily. However, I did have to modify a few things. This is possibly because of flaws in my code (vs limitations of NHibernate) - hopefully someone will point such flaws out.&lt;/p&gt;
&lt;h5 style="margin-bottom:0px;padding-bottom:0px;"&gt;Unique Constraints&lt;/h5&gt;
&lt;p&gt;I use unique indexes to ensure that things like user emails are unique throughout the system. However, I haven&amp;#39;t yet figured out a way to catch such exceptions in a db-agnostic manner. My code looked something like:&lt;/p&gt;
&lt;pre name="code" class="c-sharp"&gt;try
{
    Session.SaveOrUpdate(user);
    transaction.Commit();
    return true;
}
catch (GenericADOException ex)
{
    transaction.Rollback();
    var sql = ex.InnerException as SqlException;
    if (sql != null &amp;amp;&amp;amp; sql.Number == 2601)
    {
        return false;
    }
    throw;
}
catch (Exception)
{
    transaction.Rollback();
    throw;
}&lt;/pre&gt;
&lt;p&gt;Obviously this code isn&amp;#39;t going to work with the PostgreSQL driver. I keep thinking there *is* a way to handle this across multiple databases, but haven&amp;#39;t found the answer yet.&lt;/p&gt;
&lt;h5 style="margin-bottom:0px;padding-bottom:0px;"&gt;Count - Long vs Int&lt;/h5&gt;
&lt;p&gt;When I fetch the number of rows for a query - more often than not to do paging - i do a &lt;code&gt;select count(*) with a UniqueResult&amp;lt;int&amp;gt;()&lt;/code&gt;. However, PostgreSQL&amp;#39;s &lt;code&gt;count(*) &lt;/code&gt;returns a &lt;code&gt;long&lt;/code&gt;, while SQL Server returns an &lt;code&gt;int&lt;/code&gt; (I&amp;#39;ve run into this before, since sqlite also returns a &lt;code&gt;long&lt;/code&gt;). This causes a cast exception. Again, I&amp;#39;m sure there&amp;#39;s a simple solution to this inconsistency.&lt;/p&gt;
&lt;h5 style="margin-bottom:0px;padding-bottom:0px;"&gt;Bit and Booleans&lt;/h5&gt;
&lt;p&gt;There was one specific query which tried to retrieve all active users. The IsActive field was declared as a bit in SQL Server (and a boolean in PostgreSQL). The following query didn&amp;#39;t work in PostgresQL &amp;quot;from User where IsActive = 1&amp;quot;. Why? because 1 isn&amp;#39;t a valid boolean, and you&amp;#39;ll get a database error that an integer can&amp;#39;t be converted to a boolean. I had to change the query to use &amp;#39;1&amp;#39; (in single quotes) or one of the other valid boolean values for true.&lt;/p&gt;
&lt;h5 style="margin-bottom:0px;padding-bottom:0px;"&gt;Connection String&lt;/h5&gt;
&lt;p&gt;Its also worth mentioning that the connection string example listed here, didn&amp;#39;t work for me using the latest &lt;a href="http://pgfoundry.org/projects/npgsql/"&gt;Npgsql drivers&lt;/a&gt;. Instead of &lt;code&gt;Initial Catalog&lt;/code&gt;, I had to use the &lt;code&gt;Database&lt;/code&gt; key.&lt;/p&gt;
&lt;p&gt;Aside from those little issues, the code was up in running in about 10 minutes. Most of my time was actually spent getting to know PostgreSQL. Here&amp;#39;s what I&amp;#39;ve learned so far.&lt;/p&gt;
&lt;h4 style="margin-bottom:0px;padding-bottom:0px;"&gt;Learning PostgreSQL&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;PostgreSQL doesn&amp;#39;t consider two null values to be the same, meaning you can put a unique constraint on a nullable column without any problems. In SQL Server you need a Nullbuster column to achieve this same result (its a neat trick, but its neater not having to use it).&lt;/li&gt;
&lt;li&gt;PostgreSQL&amp;#39;s &lt;code&gt;uniqueidentifier&lt;/code&gt; type is called &lt;code&gt;UUID&lt;/code&gt;, a &lt;code&gt;bit&lt;/code&gt; is a &lt;code&gt;boolean&lt;/code&gt;, and a &lt;code&gt;datetime&lt;/code&gt; is a &lt;code&gt;timestamp&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;All of PostgreSQL&amp;#39;s text types are unicode by default (so there is no &lt;code&gt;nvarchar&lt;/code&gt; you simply use &lt;code&gt;varchar&lt;/code&gt; and get the same benefits)&lt;/li&gt;
&lt;li&gt;PostgreSQL&amp;#39;s handling of auto incrementing (identity) is pretty different. Instead of declaring a column as &lt;code&gt;int not null identity(1, 1) primary key&lt;/code&gt;, you define it as s&lt;code&gt;erial not null primary key&lt;/code&gt;. &amp;quot;serial&amp;quot; is just some syntactical sugar around what actually happens - PostgreSQL generates a sequence table for that column, and sets the columns default value to the sequence&amp;#39;s next value. Of course, identity(1, 1) is just some syntactical sugar around however SQL Server implements the feature - its just more transparent in PostgreSQL.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Hopefully as the weeks go by, I&amp;#39;ll have more information to share about the migration, and what I&amp;#39;ve learned.
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=392493" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/0yBYUnlw9RI" height="1" width="1"/&gt;</description><feedburner:origLink>http://codebetter.com/blogs/karlseguin/archive/2009/10/22/migrating-to-postgresql-with-my-friend-nhibernate.aspx</feedburner:origLink></item><item><title>Being Business Focused: Risk</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/Nm7DlFaCgyY/being-business-focused-risk.aspx</link><pubDate>Thu, 22 Oct 2009 11:08:26 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:392306</guid><dc:creator>drusellers</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;
&amp;#39;Being Business Focused&amp;#39; is going to explore various business concepts and how we can use them to explain the bottom line impact of our decisions.
&lt;/p&gt;

&lt;p&gt;
Don&amp;#39;t forget &lt;a href="http://codebetter.com/blogs/dru.sellers/archive/2009/10/15/being-business-focused-roi.aspx"&gt;we learned roi&lt;/a&gt; = (fv-iv)/iv
&lt;/p&gt;

&lt;p&gt;
Now I want to talk about another fundamental concept at the bank and how it can affect overall ROI. Today&amp;#39;s word is &amp;#39;Risk&amp;#39;. In the world of finance risk has a very real and measurable impact. You can see that impact very easily in the interest rates charged for loans. The riskier the loan the higher the interest rate. There is a financial model that we can use to discuss the different elements of risk and its impact on the cost of financing a project. The specific one I want to talk about is the &amp;#39;Capital Asset Pricing Model&amp;#39; (CAPM). I like this model because it is simple and demonstrates a few things that I think are interesting about risk.
&lt;/p&gt;

&lt;p&gt;
Ok, so what is CAPM? CAPM states that the expected return (Ri) is equal to the risk free rate (Rf) plus the beta coefficient (Beta) multiplied by the risk premium, where the risk premium is the market risk rate (Rm) minus the risk free rate.
&lt;/p&gt;

&lt;pre&gt;
Ri = Rf + Beta*(Rm - Rf)
&lt;/pre&gt;

&lt;p&gt;
So what does all that mean? Risk free price/rate is the price for the THING if there is no risk involved. The market price/rate is the price for the THING on the street, this price is usually higher than the risk free rate because it includes a &amp;#39;premium&amp;#39; to account for the risk involved, ie &amp;quot;You mean I might lose my money, then I want a bigger payout!&amp;quot; The beta coefficient I can only explain as the volatility in the market, if the market is making wild swings then any risk you take will be magnified by it and therefore affects the expected return.
&lt;/p&gt;

&lt;p&gt;
&lt;em&gt;This next section is not entirely accurate and is used only to show how playing with the risk levers can change the ROI. &lt;strong&gt;NOTE: You probably won&amp;#39;t use the model directly, but understanding the different components of this model has been helpful for me when talking to the business.&lt;/strong&gt;&lt;/em&gt;
&lt;/p&gt;

&lt;p&gt;
When we start to talk about buying and selling money, my brain starts to hurt. I am going to buy money...with money? owwwww... What I have noticed is that the smart guys with the finance knowledge talk about the price of money as the rate that you borrow it at, the money borrowed is called capital, and the CAPM helps us analyze the rate. To show its impact on ROI I am going to substitute it for the initial value since it kinda represents the price we borrow money at.
&lt;/p&gt;
&lt;p&gt;WARNING: Dru is getting jiggy with the math&lt;/p&gt;
&lt;pre&gt;
roi = (fv - capm)/capm
&lt;/pre&gt;

&lt;p&gt;Now that we have a game plan, lets plug some numbers into CAPM and see what happens. In the financial world government bonds tend to be the benchmark of risk free money, so lets say that gov bonds are going for 0.05, and the same bond offered by your company is going for 0.07 (these are totally made up numbers), and for the beta lets assume a 1 (so that we can ignore it for now, hit me up on email for more info).
&lt;/p&gt;

&lt;pre&gt;
0.05 + 1 * (0.07-0.05)
0.05 + 1 * 0.02
0.05 + 0.02
0.7
&lt;/pre&gt;

&lt;p&gt;
We can see now that we have a risk premium of 0.02, and that if we can find a way to reduce that risk premium it will have a direct affect on our ROI calculation above. Like the financial world anything we do to try and reduce risk is going to cost us something, so its nice to know that your cost (increase initial value) of the mitigation is less than its return (future value). Let&amp;#39;s say that something happens and we can now offer that same bond at 0.06, with negligible impact on initial value.
&lt;/p&gt;

&lt;pre&gt;
0.05 + 1 * (0.06-0.05)
0.05 + 1 * 0.01
0.05 + 0.01
0.06
&lt;/pre&gt;

&lt;p&gt;
So we see the price lowered. Not a big surprise since we were able to magically lower it, but we did it by targeting the risk premium and we can now see its impacts on ROI. By lowering CAPM in our ROI calculation we have increased ROI (lowering the bottom number and increasing the top number).
&lt;/p&gt;

Before
&lt;pre&gt;
roi = (x - 0.07)/0.07
&lt;/pre&gt;

After
&lt;pre&gt;
roi = (x - 0.06)/0.06
&lt;/pre&gt;

&lt;p&gt;
Ok, so what are some examples of developers lowering risk? As developers we do many things to reduce risk in our projects. I know one thing that I like to do is put the risky parts of my code base behind an interface. That way I contain the risk of that section to just that section. In financial terms I am limiting my exposure to the risk. Maybe the risk is that the business hasn&amp;#39;t decided something, like which payment gateway to use. When building a system that kind of unknown brings an implementation risk to the project, but we can effectively nullify a large chunk of that by simply coding against an interface that we will implement once the business has decided.
&lt;/p&gt;

&lt;p&gt;
&lt;strong&gt;So what is the take away?&lt;/strong&gt; Lowering risk &lt;em&gt;can&lt;/em&gt; lower your effective initial investment, which will then increase your return on investment.
&lt;/p&gt;

&lt;p&gt;I hope that you find this helpful&lt;/p&gt;

-d
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=392306" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/Nm7DlFaCgyY" height="1" width="1"/&gt;</description><feedburner:origLink>http://codebetter.com/blogs/dru.sellers/archive/2009/10/22/being-business-focused-risk.aspx</feedburner:origLink></item><item><title>Building an iPhone app</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/h0xnGmvnV0U/building-an-iphone-app.aspx</link><pubDate>Wed, 21 Oct 2009 20:12:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:390365</guid><dc:creator>aaronjensen</dc:creator><slash:comments>12</slash:comments><description>&lt;p&gt;Today we launched &lt;a href="http://www.pictranslator.com"&gt;PicTranslator&lt;/a&gt;, a free Picture Translator for the iPhone. Building it was quite an adventure. I wanted to share some of the technologies we used, you may be surprised.&lt;/p&gt;  &lt;h3&gt;On the iPhone:&lt;/h3&gt; &lt;ul&gt; &lt;li&gt;&lt;strong&gt;&lt;a href="http://www.devworld.apple.com/iphone/"&gt;iPhone SDK&lt;/a&gt;&lt;/strong&gt;: This one&amp;#39;s obvious. Unfortunately, &lt;a href="http://monotouch.net/"&gt;MonoTouch&lt;/a&gt; wasn&amp;#39;t out when we started to develop. It looks rather promising. &lt;br /&gt; To be perfectly honest though, Objective-C is pretty cool. Especially once you figure out it&amp;#39;s memory management scheme. It&amp;#39;s kind of fun to be back in pointer land again. Brings back fond memories. Oh, and though I did miss vim, xcode is a pretty darn good little editor.&lt;/li&gt; &lt;li&gt;&lt;strong&gt;&lt;a href="http://code.google.com/p/json-framework/"&gt;json-framework&lt;/a&gt;&lt;/strong&gt;: This is a pretty slick JSON parser for the iPhone. Hand parsing JSON in obj-C would not have been fun. This made it easy. I&amp;#39;m pretty sure I followed &lt;a href="http://www.mobileorchard.com/tutorial-json-over-http-on-the-iphone/"&gt;this tutorial&lt;/a&gt; to get it up and running.&lt;/li&gt; &lt;li&gt;&lt;strong&gt;&lt;a href="http://allseeing-i.com/ASIHTTPRequest/"&gt;ASIHttpRequest&lt;/a&gt;&lt;/strong&gt;: Nice Http framework, helpful for doing asynchronous requests and sending and receing files easily.&lt;/li&gt; &lt;li&gt;We also used a few random snippets found around the web. Here&amp;#39;s one on &lt;a href="http://iphonedevelopment.blogspot.com/2008/11/creating-transparent-uiviews-rounded.html"&gt;rounded corners&lt;/a&gt;. Also &lt;a href="http://stackoverflow.com"&gt;stackoverflow&lt;/a&gt; was invaluable.&lt;/li&gt; &lt;/ul&gt; &lt;h3&gt;On the server:&lt;/h3&gt; &lt;ul&gt; &lt;li&gt;&lt;strong&gt;&lt;a href="http://nservicebus.com/"&gt;nServiceBus&lt;/a&gt;&lt;/strong&gt;: NSB is fantastic. It allows us to scale to any size machine or any number of machines. I&amp;#39;m realizing more and more than most reasonable size applications should leverage messaging in one way or another. We&amp;#39;re using MSMQ as the transport.&lt;/li&gt; &lt;li&gt;&lt;strong&gt;&lt;a href="http://asp.net/mvc"&gt;ASP.NET MVC&lt;/a&gt;&lt;/strong&gt;: My web framework of choice.&lt;/li&gt; &lt;li&gt;&lt;strong&gt;&lt;a href="http://github.com/machine/machine.specifications"&gt;MSpec&lt;/a&gt;&lt;/strong&gt;: Gotta test it somehow right, why not use my own framework.&lt;/li&gt; &lt;li&gt;&lt;strong&gt;&lt;a href="http://code.google.com/p/topshelf/"&gt;Topshelf&lt;/a&gt;&lt;/strong&gt;: Best way I know of to create services in .NET. Makes it easy to run as a console app or a service. Love it.&lt;/li&gt; &lt;li&gt;&lt;strong&gt;&lt;a href="http://logging.apache.org/log4net/index.html"&gt;log4net&lt;/a&gt;&lt;/strong&gt;: Another no brainer. log4net is how you log in .NET. Well, most of you any ways :).&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Not a bad stack, eh? Any surprises? Oh, and if you have an iPhone, be sure to give PicTranslator a shot, we&amp;#39;d love your feedback.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=390365" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/h0xnGmvnV0U" height="1" width="1"/&gt;</description><category domain="http://codebetter.com/blogs/aaron.jensen/archive/tags/asp.net+mvc/default.aspx">asp.net mvc</category><category domain="http://codebetter.com/blogs/aaron.jensen/archive/tags/mspec/default.aspx">mspec</category><category domain="http://codebetter.com/blogs/aaron.jensen/archive/tags/list/default.aspx">list</category><category domain="http://codebetter.com/blogs/aaron.jensen/archive/tags/iphone/default.aspx">iphone</category><feedburner:origLink>http://codebetter.com/blogs/aaron.jensen/archive/2009/10/21/building-an-iphone-app.aspx</feedburner:origLink></item><item><title>Interesting findings in the diff between .NET Fx v4 Beta1 and Beta2</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/m2A7wOF7Y_s/interesting-findings-in-the-diff-between-net-fx-v4-beta1-and-beta2.aspx</link><pubDate>Wed, 21 Oct 2009 14:31:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:389564</guid><dc:creator>Patrick Smacchia</dc:creator><slash:comments>11</slash:comments><description>&lt;p&gt;












































 






































  






































  






































 
















































































 






































  Normal






































  0






































  






































  






































  21






































  






































  






































  false






































  false






































  false






































  






































  FR






































  X-NONE






































  X-NONE






































  






































   






































   






































   






































   






































   






































   






































   






































   






































   






































   






































   






































   






































  






































  






































   






































   






































   






































   






































   






































   






































   






































   






































   






































   






































   






































  













































































 






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































  






































 














































































&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;I compared with
&lt;a target="_blank" href="http://www.NDepend.com"&gt;NDepend&lt;/a&gt; .NET Fx &lt;b&gt;v4.0&lt;/b&gt; &lt;b&gt;Beta1&lt;/b&gt; with the new.NET Fx &lt;b&gt;v4.0&lt;/b&gt;
&lt;b&gt;Beta2&lt;/b&gt; just released. I enumerated below some random
interesting finds. Don&amp;rsquo;t hesitate to ping me back if I&amp;rsquo;ve missed some cool public
API things. &lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;To do the
comparison yourself, you need to have kept a copy of beta1 assemblies as I
explained in this post: &lt;a target="_blank" href="http://codebetter.com/blogs/patricksmacchia/archive/2009/06/01/analyze-and-explore-the-evolution-of-net-framework-by-yourself.aspx"&gt;Analyze and explore the evolution of .NET Framework by
yourself&lt;/a&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;A lot of
work has been done since the Beta1, there are 92K methods modified or added!&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color:red;" lang="EN-US"&gt;&lt;a target="_blank" href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.DotNetFx4Beta2/MethodChangedNew_5F00_Big.png"&gt;&lt;img src="http://codebetter.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.DotNetFx4Beta2/MethodChangedNew_5F00_Small.jpg" border="0" alt="" /&gt;&lt;/a&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color:red;" lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color:red;" lang="EN-US"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color:red;" lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;I take a
chance to show a preview screenshot of a great upcoming NDepend feature concerning
the comparison mode: the possibility to disassemble (with Reflector) and
compare implementations of a modified method. With this feature one can fine-grain control evolution of a codebase from assemblies only.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color:red;" lang="EN-US"&gt;&lt;a target="_blank" href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.DotNetFx4Beta2/ReflectorCompare_5F00_Big.png"&gt;&lt;img src="http://codebetter.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.DotNetFx4Beta2/ReflectorCompare_5F00_Small.jpg" border="0" alt="" /&gt;&lt;/a&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color:red;" lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Some new
core types whose names are pretty explicit:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color:red;" lang="EN-US"&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.DotNetFx4Beta2/NewCoreTypes.png"&gt;&lt;img src="http://codebetter.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.DotNetFx4Beta2/NewCoreTypes.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Some new
core public methods that seem useful to me.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color:red;" lang="EN-US"&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.DotNetFx4Beta2/NewPublicMethods.png"&gt;&lt;img src="http://codebetter.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia.DotNetFx4Beta2/NewPublicMethods.png" border="0" alt="" /&gt;&lt;/a&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;Some new WPF
types. None of them contains IL instructions, meaning that they are DataObjects
(declared with auto properties), enumerations, delegates or interfaces:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="color:red;" lang="EN-US"&gt;&lt;img src="http://s3.amazonaws.com/CodeBetter/CommunityServer.Blogs.Components.WeblogFiles/patricksmacchia/DotNetFx4Beta2/NewWPFTypes.png?AWSAccessKeyId=0KMA35HT86EVXB99Z302&amp;amp;Expires=1256236593&amp;amp;Signature=outhyy9id1DO2XPaqO9K3bN9x20=" style="max-width:600px;" border="0" alt="" /&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;A new &lt;b&gt;System.Numerics&lt;/b&gt; assembly has been
created. &lt;/span&gt;&lt;span lang="EN-US"&gt;This assembly &lt;/span&gt;&lt;span lang="EN-US"&gt;now contains the class &lt;b&gt;BigInteger&lt;/b&gt;
(formerly defined in &lt;b&gt;System&lt;/b&gt;). This assembly also contains 3 new interesting classes: &lt;b&gt;Complex&lt;/b&gt;, &lt;b&gt;DoubleULong&lt;/b&gt; and
&lt;b&gt;NumericsHelpers&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;The
assembly &lt;b&gt;System.Caching&lt;/b&gt; seems to have been renamed &lt;b&gt;System.Runtime.Caching&lt;/b&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;A new
assembly &lt;b&gt;System.Device&lt;/b&gt; that seems to
only expose so far classes to modelize a Geo Localization &lt;/span&gt;&lt;span lang="EN-US"&gt;(GPS) &lt;/span&gt;&lt;span lang="EN-US"&gt;device API&amp;nbsp; in the namespace &lt;b&gt;System.Device.Location&lt;/b&gt;. It is pretty surprising actually, it looks like the .NET Fx is now modelizing some domains! It is like if future versions of .NET Fx will come with a &lt;b&gt;System.Financial&lt;/b&gt; assembly with &lt;b&gt;Account&lt;/b&gt;, &lt;b&gt;Bid &lt;/b&gt;and &lt;b&gt;Stock &lt;/b&gt;classes?!&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-US"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;span lang="EN-US"&gt;System.Activities.*&lt;/span&gt;&lt;/b&gt;&lt;span lang="EN-US"&gt; assemblies have been merged to give birth to a
new &lt;b&gt;System.Activities.Presentation&lt;/b&gt;
assembly that seems to contain all previous assemblies code, now organized
through namespaces.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=389564" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/m2A7wOF7Y_s" height="1" width="1"/&gt;</description><feedburner:origLink>http://codebetter.com/blogs/patricksmacchia/archive/2009/10/21/interesting-findings-in-the-diff-between-net-fx-v4-beta1-and-beta2.aspx</feedburner:origLink></item><item><title>Advanced Selenium RC logging with MSpec</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/Ggdg8-HP95E/advanced-selenium-logging-with-mspec.aspx</link><pubDate>Tue, 20 Oct 2009 01:30:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:387122</guid><dc:creator>aaronjensen</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Today I pushed some new features to &lt;a&gt;MSpec&lt;/a&gt; to allow you to see this in MSpec’s html report when you get Selenium RC failures:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/aaron.jensen/20091019_5F00_1810_5F00_53AFD739.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="2009-10-19_1810" border="0" alt="2009-10-19_1810" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/aaron.jensen/20091019_5F00_1810_5F00_thumb_5F00_6BD34194.png" width="244" height="149" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This is very similar to ruby’s selenium client’s rspec report. You can see a real example of that &lt;a href="http://ph7spot.com/examples/selenium_rspec_report.html"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;So how do you get this? It’s pretty easy. All you need to do is &lt;a&gt;grab&lt;/a&gt; and build the latest MSpec, add a reference to Machine.Specifications.SeleniumSupport.dll and add a class like the following to your assembly that contains your selenium specs in it:&lt;/p&gt;  &lt;pre class="c-sharp" name="code"&gt;
  public class SeleniumSupport : SeleniumResultSupplementer
  {
    protected override string ImagesPath
    {
      get { return GetTempPath(); }
    }

    protected override DefaultSelenium Selenium
    {
      get { return ...; } // Replace with the DefaultSelenium in use 
                          // by the current running spec
    }

    static string tempPath;

    private static string GetTempPath()
    {
      if (string.IsNullOrEmpty(tempPath))
      {
        tempPath = Path.Combine(Path.GetTempPath(), &amp;quot;selenium&amp;quot;);

        if (Directory.Exists(tempPath))
        {
          Directory.Delete(tempPath, true);
        }

        Directory.CreateDirectory(tempPath);
      }

      return tempPath;
    }
  }
&lt;/pre&gt;

&lt;p&gt;That&amp;#39;s pretty much it. Like I said, this is brand new, just got it up today so please let me know if you have any problems with it. You can do so on &lt;a href="http://twitter.com/aaronjensen"&gt;twitter&lt;/a&gt; or the &lt;a href="http://groups.google.com/group/machine_users"&gt;machine google group&lt;/a&gt;. Enjoy!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=387122" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/Ggdg8-HP95E" height="1" width="1"/&gt;</description><category domain="http://codebetter.com/blogs/aaron.jensen/archive/tags/mspec/default.aspx">mspec</category><category domain="http://codebetter.com/blogs/aaron.jensen/archive/tags/selenium/default.aspx">selenium</category><feedburner:origLink>http://codebetter.com/blogs/aaron.jensen/archive/2009/10/19/advanced-selenium-logging-with-mspec.aspx</feedburner:origLink></item><item><title>F# October 2009 CTP/Beta2 – F# + Rx Together At Last</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/1H2rMMOT2HU/f-october-2009-ctp-beta2-f-rx-together-at-last.aspx</link><pubDate>Mon, 19 Oct 2009 22:37:24 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:387117</guid><dc:creator>Matthew.Podwysocki</dc:creator><slash:comments>12</slash:comments><description>&lt;p&gt;Lately, I’ve been covering a lot of F# First Class Events as well as the Reactive Framework which has been leading up to a head as it were.&amp;#160; It &lt;a href="http://channel9.msdn.com/shows/Going+Deep/Kim-Hamilton-and-Wes-Dyer-Inside-NET-Rx-and-IObservableIObserver-in-the-BCL-VS-2010/"&gt;has been announced through Channel 9&lt;/a&gt; that .NET 4 will include the two major interfaces from the Reactive Framework, the &lt;a href="http://msdn.microsoft.com/en-us/library/dd990377%28VS.100%29.aspx"&gt;IObservable&amp;lt;T&amp;gt;&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/dd783449(VS.100).aspx"&gt;IObserver&amp;lt;T&amp;gt;&lt;/a&gt;.&amp;#160; Today, as &lt;a href="http://blogs.msdn.com/dsyme/archive/2009/10/19/visual-studio-2010-beta2-with-f-is-now-available-plus-matching-f-ctp-update-for-vs2008.aspx"&gt;Don Syme announces&lt;/a&gt; with the release of the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=b55f0532-ac3c-4106-918c-5586a953a7da&amp;amp;displaylang=en"&gt;F# October 2009 CTP&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx"&gt;F# for Visual Studio 2010 Beta 2&lt;/a&gt;, those two interfaces, the IObservable&amp;lt;T&amp;gt; and IObserver&amp;lt;T&amp;gt; have been integrated into F# First Class Events. &lt;/p&gt;  &lt;p&gt;What does that mean and what are the implications?&lt;/p&gt;  &lt;h2&gt;Mixing in Observables&lt;/h2&gt;  &lt;p&gt;In the previous version of F#, you may remember that we dealt primary with the IEvent interface and if you needed the ability to subscribe and unsubscribe, you would use the IDelegateEvent interface.&amp;#160; Let’s look at how this was implemented in the past.&lt;/p&gt;  &lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:71bd7b00-ef31-4a9b-be74-1eddcc9e3223" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:#FFFFFF;overflow:auto;"&gt;&lt;span style="color:#0000FF;"&gt;type&lt;/span&gt;&lt;span style="color:#000000;"&gt; IDelegateEvent&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Delegate when &lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#000000;"&gt;Delegate :&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; System.Delegate &lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt;
  &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;abstract&lt;/span&gt;&lt;span style="color:#000000;"&gt; AddHandler: handler:&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Delegate -&amp;gt; unit&lt;/span&gt;&lt;span style="color:#800000;"&gt;
&lt;/span&gt;&lt;span style="color:#000000;"&gt;  &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;abstract&lt;/span&gt;&lt;span style="color:#000000;"&gt; RemoveHandler: handler:&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Delegate -&amp;gt; unit &lt;/span&gt;&lt;span style="color:#800000;"&gt;
&lt;/span&gt;&lt;span style="color:#000000;"&gt;
&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;type&lt;/span&gt;&lt;span style="color:#000000;"&gt; IEvent&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Delegate,&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#000000;"&gt;Args when &lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Delegate : delegate&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#000000;"&gt;Args,&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;unit&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;and&lt;/span&gt;&lt;span style="color:#000000;"&gt; 
                                 &lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Delegate :&amp;gt; System.Delegate &amp;gt; =&lt;/span&gt;&lt;span style="color:#800000;"&gt;
&lt;/span&gt;&lt;span style="color:#000000;"&gt;  &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;abstract&lt;/span&gt;&lt;span style="color:#000000;"&gt; Add: callback:(&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Args -&amp;gt; unit) -&amp;gt; unit&lt;/span&gt;&lt;span style="color:#800000;"&gt;
&lt;/span&gt;&lt;span style="color:#000000;"&gt;  &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;inherit&lt;/span&gt;&lt;span style="color:#000000;"&gt; IDelegateEvent&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Delegate&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As you’ll note, we had the ability to add and remove delegate handlers using the AddHandler and RemoveHandler methods with our IDelegateEvent interface and our ability to add a handler via the Add method in the IEvent interface.&amp;#160; Both of these gave us some pretty rich options when dealing with first class events.&amp;#160; When the Reactive Framework interfaces were to be folded in to .NET 4.0, it was only a matter of time before the F# team looked on how to integrate the idea of Observables and F# First Class Events.&amp;#160; WIthin the Visual Studio 2010 Beta 2 download, you’ll find that F# does in fact reference the System.IObservable&amp;lt;T&amp;gt; and System.IObserver&amp;lt;T&amp;gt; interfaces.&amp;#160; If you are still using Visual Studio 2008, these interfaces have also been included as well so that you can take advantage of them.&amp;#160; Now if we are to look at how F# First Class Events work now, let’s go over the inheritance chain.&lt;/p&gt;

&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:d7115a12-076a-42d1-b652-c3eb5dd5220c" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:#FFFFFF;overflow:auto;"&gt;&lt;span style="color:#0000FF;"&gt;type&lt;/span&gt;&lt;span style="color:#000000;"&gt; IObserver&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;T&amp;gt; =&lt;/span&gt;&lt;span style="color:#800000;"&gt;
&lt;/span&gt;&lt;span style="color:#000000;"&gt;  &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;abstract&lt;/span&gt;&lt;span style="color:#000000;"&gt; OnNext : value : &lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;T -&amp;gt; unit&lt;/span&gt;&lt;span style="color:#800000;"&gt;
&lt;/span&gt;&lt;span style="color:#000000;"&gt;  &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;abstract&lt;/span&gt;&lt;span style="color:#000000;"&gt; OnError : error : exn &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;unit&lt;/span&gt;&lt;span style="color:#000000;"&gt;
  &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;abstract&lt;/span&gt;&lt;span style="color:#000000;"&gt; OnCompleted : &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;unit&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;unit&lt;/span&gt;&lt;span style="color:#000000;"&gt;

&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;type&lt;/span&gt;&lt;span style="color:#000000;"&gt; IObservable&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;T&amp;gt; =&lt;/span&gt;&lt;span style="color:#800000;"&gt;
&lt;/span&gt;&lt;span style="color:#000000;"&gt;  &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;abstract&lt;/span&gt;&lt;span style="color:#000000;"&gt; Subscribe : observer : IObserver&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;T&amp;gt; -&amp;gt; System.IDisposable&lt;/span&gt;&lt;span style="color:#800000;"&gt;
&lt;/span&gt;&lt;span style="color:#000000;"&gt;  
&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;type&lt;/span&gt;&lt;span style="color:#000000;"&gt; IDelegateEvent&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Delegate when &lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#000000;"&gt;Delegate :&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; System.Delegate &lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt;
  &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;abstract&lt;/span&gt;&lt;span style="color:#000000;"&gt; AddHandler: handler:&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Delegate -&amp;gt; unit&lt;/span&gt;&lt;span style="color:#800000;"&gt;
&lt;/span&gt;&lt;span style="color:#000000;"&gt;  &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;abstract&lt;/span&gt;&lt;span style="color:#000000;"&gt; RemoveHandler: handler:&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Delegate -&amp;gt; unit &lt;/span&gt;&lt;span style="color:#800000;"&gt;
&lt;/span&gt;&lt;span style="color:#000000;"&gt;
&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;type&lt;/span&gt;&lt;span style="color:#000000;"&gt; IEvent&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Delegate,&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#000000;"&gt;Args when &lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Delegate : delegate&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#000000;"&gt;Args,&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;unit&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;and&lt;/span&gt;&lt;span style="color:#000000;"&gt; 
                                 &lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Delegate :&amp;gt; System.Delegate &amp;gt; =&lt;/span&gt;&lt;span style="color:#800000;"&gt;
&lt;/span&gt;&lt;span style="color:#000000;"&gt;  &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;inherit&lt;/span&gt;&lt;span style="color:#000000;"&gt; IDelegateEvent&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Delegate&amp;gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;
&lt;/span&gt;&lt;span style="color:#000000;"&gt;  &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;inherit&lt;/span&gt;&lt;span style="color:#000000;"&gt; IObservable&lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Args&amp;gt;  &lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;What you’ll now notice is that we have in code, defined our IObserver&amp;lt;T&amp;gt; and IObservable&amp;lt;T&amp;gt; which either come from the .NET 4.0 base class library or in F# itself for Visual Studio 2008, and then we have our IEvent&amp;lt;TDel,T&amp;gt; inheriting both the IDelegateEvent&amp;lt;TDel&amp;gt; and the IObservable&amp;lt;T&amp;gt; interfaces.&amp;#160; This means that when we’re dealing with First Class Events in F#, we can go back and forth from using the IEvent&amp;lt;TDel,T&amp;gt; and IObservable&amp;lt;T&amp;gt; interfaces, based upon our needs.&amp;#160; So, what does that buy us?&lt;/p&gt;

&lt;h2&gt;Exploring Observables&lt;/h2&gt;

&lt;p&gt;Much like the Event module in F# defines combinators for F# First Class Events, the Observable module defines the standard combinators for using the IObservable&amp;lt;T&amp;gt; interface.&amp;#160; Much like the Event module, the Observable module includes add, filter, map, partition, merge, choose, and scan.&amp;#160; Let’s go over these briefly about what each one is about.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;add&lt;/strong&gt;

    &lt;br /&gt;Create an observer which permanently subscribes to the given observable and which calls the given function for each observation.

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;&lt;strong&gt;subscribe&lt;/strong&gt;

    &lt;br /&gt;Create an observer which subscribes to the given observable and which calls the given function for each observation.

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;&lt;strong&gt;map
      &lt;br /&gt;&lt;/strong&gt;Return an observable which transforms the observations of the source by the given function. The transformation function is executed once for each subscribed observer. The returned object also propagates error observations arising from the source and completes when the source completes. 

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;&lt;strong&gt;filter&lt;/strong&gt;

    &lt;br /&gt;Return an observable which filters the observations of the source by the given function. The observable will see only those observations for which the predicate returns true. The predicate is executed once for each subscribed observer. The returned object also propagates error observations arising from the source and completes when the source completes.

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;&lt;strong&gt;scan&lt;/strong&gt;

    &lt;br /&gt;Return an observables which, for each observer, allocates an item of state and applies the given accumulating function to successive values arising from the input. The returned object will trigger observations for each computed state value, excluding the initial value. The returned object propagates all errors arising from the source and completes when the source completes.

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;&lt;strong&gt;choose
      &lt;br /&gt;&lt;/strong&gt;Return an observable which chooses a projection of observations from the source using the given function. The returned object will trigger observations x for which the splitter returns Some x. The returned object also propagates all errors arising from the source and completes when the source completes.

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;&lt;strong&gt;partition&lt;/strong&gt;

    &lt;br /&gt;Return two observables which partition the observations of the source by the given function. The first will trigger observations for those values for which the predicate returns true. The second will trigger observations for those values where the predicate returns false. The predicate is&amp;#160; executed once for each subscribed observer. Both also propagate all error observations arising from the source and each completes when the source completes. 

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;&lt;strong&gt;split&lt;/strong&gt;

    &lt;br /&gt;Return two observables which split the observations of the source by the given function. The first will trigger observations x for which the splitter returns Choice1Of2 x. The second will trigger observations y for which the splitter returns Choice2Of2 y.&amp;#160; The splitter is executed once for each subscribed observer. Both also propagate error observations arising from the source and each completes when the source completes. 

    &lt;br /&gt;&lt;/li&gt;

  &lt;li&gt;&lt;strong&gt;merge&lt;/strong&gt;&lt;/li&gt;

  &lt;p&gt;Return an observable for the merged observations from the sources. The returned object propagates success and error values arising from either source and completes when both the sources have completed.&lt;/p&gt;
&lt;/ul&gt;

&lt;p&gt;You’ll notice one difference from the Event module to the Observable module is the inclusion of the subscribe function.&amp;#160; This allows us to subscribe to an observable, which in turn will return an IDisposable.&amp;#160; This IDisposable, as I’ve covered before, allows us to nicely tell the system when we’re no longer interested in receiving notifications instead of having to tell the observer when we want to attach and detach.&amp;#160; We’ll cover more of this in a future post on the Introduction to the Reactive Framework series.&lt;/p&gt;

&lt;p&gt;What does this change buy us exactly?&amp;#160; Well, now we can treat observables much the same as we would for F# first class events.&amp;#160; Now we can take an example from a previous post and show how we can create two observables based upon whether the X and Y coordinate of the mouse is in a certain location as we drag it across our form.&lt;/p&gt;

&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:44566c3d-2ea5-4352-862e-9ed4004dd415" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:#FFFFFF;overflow:auto;"&gt;&lt;span style="color:#008000;"&gt;//&lt;/span&gt;&lt;span style="color:#008000;"&gt; Create form&lt;/span&gt;&lt;span style="color:#008000;"&gt;
&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;let&lt;/span&gt;&lt;span style="color:#000000;"&gt; form &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; Form(Visible&lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;true&lt;/span&gt;&lt;span style="color:#000000;"&gt;, TopMost&lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;true&lt;/span&gt;&lt;span style="color:#000000;"&gt;, Text&lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Event Sample&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt;)

&lt;/span&gt;&lt;span style="color:#008000;"&gt;//&lt;/span&gt;&lt;span style="color:#008000;"&gt; Create under and over for X and Y coordinates&lt;/span&gt;&lt;span style="color:#008000;"&gt;
&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;let&lt;/span&gt;&lt;span style="color:#000000;"&gt; (overEvent, underEvent) &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt;
  form.MouseDown
  &lt;/span&gt;&lt;span style="color:#000000;"&gt;|&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; Observable.merge form.MouseMove
  &lt;/span&gt;&lt;span style="color:#000000;"&gt;|&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; Observable.filter (&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;fun&lt;/span&gt;&lt;span style="color:#000000;"&gt; args &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; args.Button &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; MouseButtons.Left)
  &lt;/span&gt;&lt;span style="color:#000000;"&gt;|&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; Observable.map (&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;fun&lt;/span&gt;&lt;span style="color:#000000;"&gt; args &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; (args.X, args.Y))
  &lt;/span&gt;&lt;span style="color:#000000;"&gt;|&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; Observable.partition (&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;fun&lt;/span&gt;&lt;span style="color:#000000;"&gt; (x, y) &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; x &lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#800080;"&gt;100&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span style="color:#000000;"&gt; y &lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#800080;"&gt;100&lt;/span&gt;&lt;span style="color:#000000;"&gt;)

&lt;/span&gt;&lt;span style="color:#008000;"&gt;//&lt;/span&gt;&lt;span style="color:#008000;"&gt; Subscribe to each&lt;/span&gt;&lt;span style="color:#008000;"&gt;
&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;let&lt;/span&gt;&lt;span style="color:#000000;"&gt; overSubscription &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt;
  overEvent 
  &lt;/span&gt;&lt;span style="color:#000000;"&gt;|&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; Observable.subscribe (&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;fun&lt;/span&gt;&lt;span style="color:#000000;"&gt; (x, y) &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; printfn &lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Over (%d, %d)&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt; x y)
&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;let&lt;/span&gt;&lt;span style="color:#000000;"&gt; underSubscription &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt;
  underEvent 
  &lt;/span&gt;&lt;span style="color:#000000;"&gt;|&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; Observable.subscribe (&lt;/span&gt;&lt;span style="color:#0000FF;"&gt;fun&lt;/span&gt;&lt;span style="color:#000000;"&gt; (x, y) &lt;/span&gt;&lt;span style="color:#0000FF;"&gt;-&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; printfn &lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#800000;"&gt;Under (%d, %d)&lt;/span&gt;&lt;span style="color:#800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#000000;"&gt; x y)
  
&lt;/span&gt;&lt;span style="color:#008000;"&gt;//&lt;/span&gt;&lt;span style="color:#008000;"&gt; Much later, clean up&lt;/span&gt;&lt;span style="color:#008000;"&gt;
&lt;/span&gt;&lt;span style="color:#000000;"&gt;overSubscription.Dispose()
underSubscription.Dispose()&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As you can see from this code, we’re treating our Observables no differently than we would our F# First Class Events.&amp;#160; With the inheritance chain of the IEvent from the IObservable, we get seamless integration between the two.&amp;#160; Unlike C#, we don’t need to create extension methods to turn our events into observables and instead get that for free.&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;What you will notice is that we lack many of the combinators that the Reactive Framework has built in such as Until/WaitUntil, Take/TakeWhile, Skip/SkipWhile among others for which we’ll cover in the Introduction to the Reactive Framework series.&amp;#160; Many of these aren’t hard to implement and we’ll get the added benefit of exception management that the Observables give us.&lt;/p&gt;

&lt;p&gt;It’s pretty interesting to see how F# has evolved from release to release.&amp;#160; This release for &lt;a href="http://msdn.microsoft.com/en-us/vstudio/dd582936.aspx"&gt;Visual Studio 2010 Beta 2&lt;/a&gt; and the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=b55f0532-ac3c-4106-918c-5586a953a7da&amp;amp;displaylang=en"&gt;F# October 2009 CTP&lt;/a&gt; have some nice changes as noted in &lt;a href="http://blogs.msdn.com/dsyme/archive/2009/10/19/release-notes-for-the-f-october-2009-release.aspx"&gt;the release notes&lt;/a&gt;.&amp;#160; The integration of the IObservable/IObserver is not to be overlooked as one of them.&amp;#160; Download them today and give the team feedback!&amp;#160; Now back to our Observables series.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=387117" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/1H2rMMOT2HU" height="1" width="1"/&gt;</description><category domain="http://codebetter.com/blogs/matthew.podwysocki/archive/tags/F_2300_/default.aspx">F#</category><category domain="http://codebetter.com/blogs/matthew.podwysocki/archive/tags/Functional+Programming/default.aspx">Functional Programming</category><category domain="http://codebetter.com/blogs/matthew.podwysocki/archive/tags/Concurrency/default.aspx">Concurrency</category><category domain="http://codebetter.com/blogs/matthew.podwysocki/archive/tags/Event-based+Porgramming/default.aspx">Event-based Porgramming</category><category domain="http://codebetter.com/blogs/matthew.podwysocki/archive/tags/Reactive+Framework/default.aspx">Reactive Framework</category><feedburner:origLink>http://codebetter.com/blogs/matthew.podwysocki/archive/2009/10/19/f-october-2009-ctp-beta2-f-rx-together-at-last.aspx</feedburner:origLink></item><item><title>Time for a New Computer</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/98HacRzeX8M/time-for-a-new-computer.aspx</link><pubDate>Sun, 18 Oct 2009 21:25:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:386876</guid><dc:creator>karl</dc:creator><slash:comments>8</slash:comments><description>&lt;p&gt;A couple weeks ago I bought a new computer. While my existing computer still had a lot of life in it, I was eager to laverage the power of the solid state drives (SSD) - specifically Intel&amp;#39;s 2nd generation X25. I figured that since I&amp;#39;d be updating the hard drive and installing a new OS (Win7), then there&amp;#39;d really be no better time to upgrade everything else.&lt;br /&gt;&lt;br /&gt;You can see a video of the computer opening and building the NHibernate solution: &lt;a href="http://www.youtube.com/watch?v=kPdRwS3vEbE"&gt;http://www.youtube.com/watch?v=kPdRwS3vEbE&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A lot has been said about how fast SSDs are, and its all true. People who do straight up $/gb comparisons with normal mechanical hard drives are missing the point. Of course, if you can&amp;#39;t afford it, you can&amp;#39;t afford it, but if you are in the market for a new computer, I&amp;#39;d strongly suggest that you see if you can&amp;#39;t get it to fit into your budget.&lt;br /&gt;&lt;br /&gt;The core parts of my computer are:&lt;br /&gt;&lt;br /&gt;Intel Core i7 860&lt;br /&gt;G.SKILL DDR3-1600&amp;nbsp; 4x2GB&lt;br /&gt;Noctua NH-U12P SE2&lt;br /&gt;Gigabyte P55-UD4P ATX&lt;br /&gt;Intel X25-M 160GB G2&lt;br /&gt;Western Digital Caviar Black 640GB&lt;br /&gt;Corsair TX650W 650W ATX&lt;br /&gt;2x Scythe Ultra Kaze 120MM 1000RPM&lt;br /&gt;Antec P183 ATX &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Intel Core i7 860&lt;/b&gt;&lt;br /&gt;The new Lynnfield processors from Intel fit the LGA1156 socket. You&amp;#39;ll likely be interested in the i7 860 or the i5 750. Both are quad cores, but the i7 supports hyperthreading. Benchmarks have shown that hyperthreading will improve performance from ~0-30%...with 10% often being cited.&amp;nbsp; Given that the i7 860 costs more than 10%, the i5 750 is definitely a better value - and getting it instead of the i7 860 is a great way to fit an SSD into your build.&lt;br /&gt;&lt;br /&gt;On a side note, you might also be interested in the i7 920, which is based on the LGA1366 platform. The difference between the two is that the LGA1366 supports tripple channel memory and has more bandwidth to the pci-e slots. Only the most memory intensive applications have shown to benefit at all from triple channel memory. However, if you&amp;#39;re a heavy gamer and plan on doing SLI/Crossfire (2+ video cards), the LGA1366 and i7920 is probably for you.&lt;br /&gt;&lt;br /&gt;Both types of chip have something called Turbo Mode - that is they detect when cores are being underutilized and speed up the working cores. The overall effect is that the chips all stay within the same thermal envelope while allowing single threaded applications run faster.&lt;br /&gt;&lt;b&gt;&lt;br /&gt;G.SKILL DDR3-1600&amp;nbsp; 4x2GB&lt;/b&gt;&lt;br /&gt;RAM is really cheap, so there&amp;#39;s no reason not to do 4-8gb nowadays. My old computer had 8gb also, and although I only managed to pass the 5gb barrier a couple times (that I noticed), I still think its money well spent. Do note that today&amp;#39;s systems are running on DDR3 RAM, and, as a consequence, DDR2 RAM is starting to go up in price. Do be mindful of the RAM&amp;#39;s voltage. Many DDR3 modules are currently rated above the spec&amp;#39;d 1.5V.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Noctua NH-U12P SE2&lt;/b&gt;&lt;br /&gt;I bought an after-market cooler for my CPU because I like silent computers, and I like to overclock a little. Since I bought the CPU the day of their release, I had limited choice, and while I&amp;#39;m happy with the performance, there&amp;#39;s likely cheaper and/or better solutions currently available.&lt;br /&gt;&lt;br /&gt;The i7 860 runs at 2.8ghz, with a maximum turbo mode of 3.46ghz. The maximum junction temperature (Tj. Max) for the chip is 100C - which is when things start to shut off, definitely something we want to stay away from. With this cooler, and my RAM which is rated at 1600mhz, I easily got the CPU running at 3.5ghz. My idle temperature is 40C, and my load temperature is 60C. My definition of &amp;quot;easy&amp;quot; is that I clicked a couple settings in the bios, didn&amp;#39;t have to adjust the voltage to any components, and the system is rock solid. There&amp;#39;s a lot more that could be done, but overall, this is good enough for me.&lt;br /&gt;&lt;b&gt;&lt;br /&gt;Gigabyte P55-UD4P ATX&lt;/b&gt;&lt;br /&gt;Motherboards are very similar these days - especially since more and more features are being directly integrated into the CPU. The motherboard manufactures are trying all sorts of trick to differentiate themselves, but unless you are a power user just get a brand that you trust with the features that you like, compare the prices to make sure its reasonable, and buy it.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;There are a couple things that you do need to be careful of. First of all, uATX is becoming more and more popular, so don&amp;#39;t accidentally buy one of those (unless that&amp;#39;s what you want). Also, motherboard manufactures pay a licensing fee to Nvidia to include SLI support on their motherboards. If you plan on doing SLI, make sure your motherboard supports it. If you don&amp;#39;t, you can save $10 by buying a &amp;quot;lower&amp;quot; version (they don&amp;#39;t pay a licensing to AMD to Crossfire support, so most motherboards will support that).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Intel X25-M 160GB G2&lt;/b&gt;&lt;br /&gt;Whether you pick up a 160GB or an 80GB it really doesn&amp;#39;t matter - both are plenty to store Windows, VS.NET, Office, a couple other core apps and a couple games. What is important is that you get this drive. It is as far beyond other SSDs as SSDs are beyond mechanical drives. It destroys everything else when looking at random reads and writes. Other SSDs are faster when doing sequential reads and writes, but that is meaningless to 95% of how your computer operates day to day.&lt;br /&gt;&lt;br /&gt;The G2 will also (at some point in the near future) support the powerful TRIM command, which Windows 7 supports, via firmware upgrade. This is a command that Windows passes onto the SSD controller to tell it that a data block is no longer in use. Without it, SSDs slow down over time (Intel drives less than others).&lt;br /&gt;&lt;br /&gt;Also of interest, Windows 7 does a handful of optimization tricks when it detects an SSD. It disables defragmentation and other features like ReadyBoost. I&amp;#39;ve also disabled Windows Indexing on the drive.&lt;br /&gt;&lt;b&gt;&lt;br /&gt;Western Digital Caviar Black 640GB&lt;/b&gt;&lt;br /&gt;Although I&amp;#39;m running a NAS for backups, and file storage (mp3s, movies, pictures), I do feel a little claustrophobic with 160gb. Therefore I added another drive to my system to store files and applications which aren&amp;#39;t performance sensitive. There&amp;#39;s a lot of choice here...I&amp;#39;ve had great luck with WD.&lt;br /&gt;&lt;b&gt;&lt;br /&gt;Corsair TX650W 650W ATX&lt;/b&gt;&lt;br /&gt;A lot of people pick overly powerful power supplies, the truth is that the 650W I got has plenty of headroom, and could easily power a dual video-card setup. Make sure that the efficiency of the PSU is clearly listed. At the very least you want a 80 PLUS Bronze rating.&lt;br /&gt;&lt;b&gt;&lt;br /&gt;2x Scythe Ultra Kaze 120MM 1000RPM&lt;/b&gt;&lt;br /&gt;Just a couple case fans to keep everything cool. These puppies run at a very low 1000RPM, which means you can&amp;#39;t hear them.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Antec P183 ATX &lt;/b&gt;&lt;br /&gt;There are a lot of cases to chose from, they vary in price and looks greatly. I&amp;#39;m largely interested in tool-less access (thumb screws), compartmentalization, and good cable management.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Video Card&lt;/b&gt;&lt;br /&gt;I didn&amp;#39;t get a new video card, but I will be buying an ATI 5850 once 3rd party manufactures implement their own cooling solution to provide quieter operations. If you don&amp;#39;t play games at all, any video card will do - provided that it has the necessary outputs, and can do your monitor&amp;#39;s native resolution in 2d (and I bet they _all_ can). If you only play a little, an ATI 4870 or 5750 is currently a good buy. If you need something powerful right now, look at the 5850 or 5870.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=386876" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/98HacRzeX8M" height="1" width="1"/&gt;</description><feedburner:origLink>http://codebetter.com/blogs/karlseguin/archive/2009/10/18/time-for-a-new-computer.aspx</feedburner:origLink></item><item><title>Message Granularity</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/fTl8DDCvkl4/message-granularity.aspx</link><pubDate>Sun, 18 Oct 2009 00:39:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:367928</guid><dc:creator>drusellers</dc:creator><slash:comments>6</slash:comments><description>&lt;p&gt;So, how big is a message? What all should you include in a message? What if you are in a bigger company, how do you roll messaging out across an enterprise? Honestly, I am still learning here too, but here are some rules of thumb I have picked up along the way:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
You want more than one uber message for the whole company
&lt;/li&gt;
&lt;li&gt;
You want a canonical message model (this means that messages aren&amp;#39;t tied to any one application)
	
&lt;ul&gt;
&lt;li&gt;This one I am still not 100% sure on, but I am pretty sure its correct&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Each message should be a distinct unit or event
&lt;/li&gt;
&lt;li&gt;
It should represent a business transaction as an atomic, self-contained and self describing unit of work (don&amp;#39;t pass primary keys around)
&lt;/li&gt;
&lt;li&gt;
Don&amp;#39;t worry about the size of the message unless you have to. I don&amp;#39;t even think about it anymore. The size (bytes) of the message should be considered as it can affect how fast your message can go across the wire. If this level of speed isn&amp;#39;t a concern, then I wouldn&amp;#39;t worry about it. ie if you can wait 0.10 of a second or more than I wouldn&amp;#39;t sweat it.
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Fine grained messages create more overhead from a management perspective so each one needs to earn its place.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Governance
		
&lt;ul&gt;
&lt;li&gt;Build a way to track your messages. Even if its in excel.&lt;/li&gt;
&lt;li&gt;Once a message is deployed, be careful about upgrades. I try to follow Udi&amp;#39;s advice that instead of modifying the message I make a new one. &lt;/li&gt;
&lt;li&gt;Make sure that only one system / department owns the message. This will make changes a bit clearer to see who can initiate them.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Links:&lt;br /&gt;
&lt;a href="http://www.eaipatterns.com/CanonicalDataModel.html"&gt;http://www.eaipatterns.com/CanonicalDataModel.html&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://fuzzypanic.blogspot.com/2005/04/canonical-message-format-and-xml.html"&gt;http://fuzzypanic.blogspot.com/2005/04/canonical-message-format-and-xml.html&lt;/a&gt;&lt;br /&gt;
&lt;a href="http://fuzzypanic.blogspot.com/2006/05/eda-lessons-learned-canonical-message.html"&gt;http://fuzzypanic.blogspot.com/2006/05/eda-lessons-learned-canonical-message.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=367928" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/fTl8DDCvkl4" height="1" width="1"/&gt;</description><feedburner:origLink>http://codebetter.com/blogs/dru.sellers/archive/2009/10/17/message-granularity.aspx</feedburner:origLink></item><item><title>[ANN] DC ALT.NET 10/22/2009 – MongoDB with David James</title><link>http://feedproxy.google.com/~r/CodeBetter/~3/lThZMQA0a8U/ann-dc-alt-net-10-22-2009-mongodb-with-david-james.aspx</link><pubDate>Fri, 16 Oct 2009 03:38:45 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:381540</guid><dc:creator>Matthew.Podwysocki</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;This month DC ALT.NET will once again move into the not often covered subjects in the .NET world, in covering &lt;a href="http://www.mongodb.org/"&gt;MongoDB&lt;/a&gt; with &lt;a href="http://twitter.com/djsunlight"&gt;David James&lt;/a&gt;.&amp;#160; Stay tuned to the &lt;a href="http://tech.groups.yahoo.com/group/dcaltnet/"&gt;mailing list&lt;/a&gt; for up to date details.&amp;#160; There has been a bit of discussion around non relational databases lumped under the name of NoSQL, especially given the upcoming &lt;a href="https://nosqleast.com/2009/"&gt;NoSQLEast conference&lt;/a&gt;.&amp;#160; This meeting, we&amp;#39;ll dive into MongoDB, one of the NoSQL solutions.&lt;/p&gt;  &lt;p&gt;MongoDB is an open source document-oriented database written in the C++ programming language.&amp;#160; Like other document-oriented databases, MongoDB is designed for problems without heavy transactional requirements that aren&amp;#39;t easily solved by traditional relational databases, including problems which require the database to span many servers.&amp;#160; K. Scott Allen has a great writeup on how to use MongoDB from C# that you can find &lt;a href="http://odetocode.com/Blogs/scott/archive/2009/10/13/experimenting-with-mongodb-from-c.aspx"&gt;here&lt;/a&gt; and is a great read.&amp;#160; And yes, there is even &lt;a href="http://www.claassen.net/geek/blog/2009/09/linq2mongodb-building-linq-provider-for.html"&gt;LINQ support as well&lt;/a&gt;. Come join us and find out what NoSQL alternatives can do for you.&lt;/p&gt;  &lt;p&gt;Also, we&amp;#39;ll have a hacking session for those interested, so be sure to install &lt;a href="http://www.mongodb.org/display/DOCS/Downloads"&gt;MongoDB&lt;/a&gt; beforehand.&amp;#160; The presentation will be mainly in Ruby and JavaScript, but there are C# options available as well.&lt;/p&gt;  &lt;h2&gt;About David James&lt;/h2&gt;  &lt;p&gt;David James is a Web Developer for Sunlight Labs. Prior to joining Sunlight, David founded CommunityGoals, a socially minded startup, and Collective Insight, a technology consultancy. He has worn the hats of entrepreneur, analyst, software developer, and consultant while working in fields including software, energy, and hardware engineering. David has a Master of Public Affairs degree from the LBJ School of Public Affairs, a liberal arts BA degree and an electrical and computer engineering BS degree from The University of Texas at Austin. He enjoys building tools that advance causes such as open government, community development, and environmental and energy policy. David also enjoys playing the piano and cycling and is sometimes known for coaxing friends into sprinting for city limit signs.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Date/Time:&lt;/strong&gt; 10/22/2009 – 7-9PM&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Location:      &lt;br /&gt;&lt;/strong&gt;The Motley Fool     &lt;br /&gt;2000 Duke Street     &lt;br /&gt;Alexandria, VA 22314&lt;/p&gt; &lt;a href="http://www.eventbrite.com/event/464904542?ref=ebtn" target="_blank"&gt;&lt;img style="border-right-width:0px;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" border="0" src="http://www.eventbrite.com/registerbutton?eid=464904542" alt="" /&gt;&lt;/a&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=381540" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/CodeBetter/~4/lThZMQA0a8U" height="1" width="1"/&gt;</description><category domain="http://codebetter.com/blogs/matthew.podwysocki/archive/tags/ALT.NET/default.aspx">ALT.NET</category><category domain="http://codebetter.com/blogs/matthew.podwysocki/archive/tags/User+Groups/default.aspx">User Groups</category><category domain="http://codebetter.com/blogs/matthew.podwysocki/archive/tags/NOSQL/default.aspx">NOSQL</category><feedburner:origLink>http://codebetter.com/blogs/matthew.podwysocki/archive/2009/10/15/ann-dc-alt-net-10-22-2009-mongodb-with-david-james.aspx</feedburner:origLink></item></channel></rss>
