<?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:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-22451229</atom:id><lastBuildDate>Tue, 14 Aug 2012 06:29:57 +0000</lastBuildDate><category>SOLID</category><category>DVCS</category><category>Visual Studio</category><category>tools</category><category>Zero41</category><category>javascript</category><category>Subversion</category><category>Source Control</category><category>Subjective</category><category>tutorial</category><category>.NET Framework</category><category>Personnel</category><category>ASP.NET MVC</category><category>C#</category><category>Development</category><category>Web Development</category><category>Firefox</category><category>Psychic debugging</category><category>TDD</category><category>Chrome</category><category>Open/Closed Principle</category><category>trivia</category><category>Patterns</category><category>DDD</category><category>Clean Code</category><category>Domain Model</category><category>VisualSVN</category><category>printers</category><category>rant</category><category>x64</category><title>Jon Cahill's Technical blog</title><description /><link>http://joncahill.zero41.com/</link><managingEditor>noreply@blogger.com (Jon Cahill)</managingEditor><generator>Blogger</generator><openSearch:totalResults>24</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/BobaFaux" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="bobafaux" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-1849382826720893710</guid><pubDate>Thu, 18 Feb 2010 05:25:00 +0000</pubDate><atom:updated>2010-02-18T13:25:19.891+08:00</atom:updated><title>Backup failed while creating Hyper-V VSS Snapshot</title><description>&lt;p align="justify"&gt;I use &lt;a href="http://www.backupassist.com.au/"&gt;Backup Assist&lt;/a&gt; to perform backup our Hyper-V instances we use for our development machines (code repositories, bug tracking, test databases etc).&amp;#160; This morning I arrived in the office to find the backup had failed overnight, with the following error:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p align="justify"&gt;&lt;em&gt;Backup stopped before completing.        &lt;br /&gt;&lt;/em&gt;&lt;em&gt;&lt;font color="#ff0000"&gt;Detailed Error:          &lt;br /&gt;ERROR - Volume Shadow Copy Service operation error (0x800423f3)           &lt;br /&gt;The writer experienced a transient error. If the backup process is retried,           &lt;br /&gt;&lt;/font&gt;the error may not reoccur.&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p align="justify"&gt;Nothing had been changed on the Hyper-V server, any of the Hyper-V instances or Backup Assist, so I was shocked that the backup just all of a sudden failed with a cryptic error.&lt;/p&gt;  &lt;p align="justify"&gt;I started googling and all I could find about this error was a hot fix which resolved the issue.&amp;#160; I was sure the hot fix wasn’t going to do squat as the backup was working yesterday.&amp;#160; So before looking further into the hot fix I decided to have a poke around my Hyper-V server and instances to see if there was anything obvious.&lt;/p&gt;  &lt;p align="justify"&gt;After about 1/2 an hour of looking into the event logs or each machine etc I found one Hyper-V instance had only 100megs of free disk space.&amp;#160; Surely that wasn’t causing the backup to fail?&amp;#160; So I freed up some space so it had a gig of room free and now the backup is working!&lt;/p&gt;  &lt;p align="justify"&gt;Moral of the story, always make sure your Hyper-V instances have a reasonable amount of free disk space and if you get the error above, your more than likely run out of space somewhere.&lt;/p&gt;  </description><link>http://joncahill.zero41.com/2010/02/backup-failed-while-creating-hyper-v.html</link><author>noreply@blogger.com (Jon Cahill)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-7069750190954208142</guid><pubDate>Mon, 04 Jan 2010 02:48:00 +0000</pubDate><atom:updated>2010-01-04T10:48:12.860+08:00</atom:updated><title>How to install the Hyper-V Management Tools for Windows 7?</title><description>&lt;p&gt;Every time I need to install the Hyper-V Management tools on a Windows 7 installation I always have trouble finding the related installer and setting it up.&amp;#160; &lt;/p&gt;  &lt;p&gt;If anyone else has this problem (or when I next forget) here is what you need to do:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Download the Remote Server Administration Tools (RSAT) for Windows 7 from &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=7d2f6ad7-656b-4313-a005-4e344e43997d&amp;amp;displaylang=en"&gt;here&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Install the update&lt;/li&gt;    &lt;li&gt;Then go to &lt;em&gt;Turn Windows features on or off&lt;/em&gt; in your control panel&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_KNPkr0KdMAw/S0FW2vmVkgI/AAAAAAAAAFY/rNV2K6NWxyo/s1600-h/image%5B15%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="control panel" border="0" alt="control panel" src="http://lh3.ggpht.com/_KNPkr0KdMAw/S0FW3RRUQ4I/AAAAAAAAAFc/_ZyxxLzHIYs/image_thumb%5B9%5D.png?imgmax=800" width="449" height="169" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Under &lt;em&gt;Remote Server Administration Tools &lt;/em&gt;and then under &lt;em&gt;Role Administration Tools&lt;/em&gt; select &lt;em&gt;Hyper-V Tools&lt;/em&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_KNPkr0KdMAw/S0FW4Cc5-eI/AAAAAAAAAFg/a41TtzlVLhk/s1600-h/image%5B13%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="Windows Features" border="0" alt="Windows Features" src="http://lh3.ggpht.com/_KNPkr0KdMAw/S0FW5BjtVbI/AAAAAAAAAFk/kc5bUlkqoxg/image_thumb%5B7%5D.png?imgmax=800" width="333" height="293" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;You can then find Hyper-V Manager in your start menu&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_KNPkr0KdMAw/S0FW6Aj3SuI/AAAAAAAAAFo/HKtBXv721_A/s1600-h/image%5B19%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_KNPkr0KdMAw/S0FW6xdPl1I/AAAAAAAAAFs/pO3r_t-7A_I/image_thumb%5B11%5D.png?imgmax=800" width="307" height="369" /&gt;&lt;/a&gt;&lt;/p&gt;  </description><link>http://joncahill.zero41.com/2010/01/how-to-install-hyper-v-management-tools.html</link><author>noreply@blogger.com (Jon Cahill)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/_KNPkr0KdMAw/S0FW3RRUQ4I/AAAAAAAAAFc/_ZyxxLzHIYs/s72-c/image_thumb%5B9%5D.png?imgmax=800" height="72" width="72" /><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-5767936963105115088</guid><pubDate>Thu, 05 Nov 2009 15:35:00 +0000</pubDate><atom:updated>2009-11-05T23:35:57.282+08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET MVC</category><category domain="http://www.blogger.com/atom/ns#">Chrome</category><category domain="http://www.blogger.com/atom/ns#">Firefox</category><title>Problems with Uploadify, ASP.NET MVC and Chrome/Firefox</title><description>&lt;p&gt;Today I came across a problem where all of a sudden &lt;a href="http://www.uploadify.com/" target="_blank"&gt;Uploadify&lt;/a&gt; stopped working with both Chrome and Firefox but continued to work with IE.&amp;#160; I could have sworn that it was working on all 3 browsers previously and had now idea what had changed.&lt;/p&gt;  &lt;p&gt;So I started doing some digging and found that &lt;a href="http://www.uploadify.com/" target="_blank"&gt;Uploadify&lt;/a&gt; was trying to upload the file to the correct controller and action but Forms Authentication was rejecting it, even though I was logged in correctly!&lt;/p&gt;  &lt;p&gt;After doing a few Google searches I came across this &lt;a href="http://www.trycatchfail.com/blog/post/2009/05/23/using-flash-with-aspnet-mvc-and-authentication.aspx" target="_blank"&gt;blog post&lt;/a&gt; which explains the problem and even has code for a new AuthorizationAttribute which solves the problem.&lt;/p&gt;  &lt;p&gt;Basically the issue is with flash where it will ignore the browser’s session state and grab the cookies from IE, which is a known and active bug.&amp;#160; This means that both Chrome and Firefox won’t work with &lt;a href="http://www.uploadify.com/" target="_blank"&gt;Uploadify&lt;/a&gt; and authorisation because flash will send no cookies!&amp;#160; It also means it is entirely possible for it to have previously work for me while testing because I probably also had a IE window open and logged in while testing, which would have given me a valid cookie.&lt;/p&gt;  </description><link>http://joncahill.zero41.com/2009/11/problems-with-uploadify-aspnet-mvc-and.html</link><author>noreply@blogger.com (Jon Cahill)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-7660666783052260645</guid><pubDate>Thu, 05 Nov 2009 15:04:00 +0000</pubDate><atom:updated>2009-11-05T23:04:11.370+08:00</atom:updated><title>Announcing My Family Photos</title><description>&lt;p&gt;Today &lt;a title="Web Development, Software Development and Database Development" href="http://www.zero41.com" target="_blank"&gt;Zero41&lt;/a&gt; released the invite only beta of &lt;a title="Privately and securely share your family photos" href="http://www.myfamilyphotos.com.au/" target="_blank"&gt;My Family Photos&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;This is something we have been working part time on the for past couple of months and we will be continuing to add new features in the future.&lt;/p&gt;  &lt;p&gt;For more details go to the &lt;a title="Privately and securely share your family photos" href="http://blog.myfamilyphotos.com.au/" target="_blank"&gt;My Family Photos Blog&lt;/a&gt;.&lt;/p&gt;  </description><link>http://joncahill.zero41.com/2009/11/announcing-my-family-photos.html</link><author>noreply@blogger.com (Jon Cahill)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-7834157589341127027</guid><pubDate>Tue, 07 Jul 2009 14:59:00 +0000</pubDate><atom:updated>2009-07-07T22:59:01.251+08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET MVC</category><title>Why won’t ASP.NET MVC rebase a CSS link for a masterpage?</title><description>&lt;p&gt;I just spent the better part of an hour trying to work out why one particular CSS link in an ASP.NET MVC masterpage would not rebase when the others were working perfectly.&amp;#160; &lt;/p&gt;  &lt;p&gt;Lets see if you can spot the problem?&lt;/p&gt;  &lt;div&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 118.4%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; height: 32px; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #006080"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;link&lt;/span&gt; href=&amp;quot;../../Scripts/&lt;span style="color: #0000ff"&gt;style&lt;/span&gt;&lt;span style="color: #cc6633"&gt;.css&lt;/span&gt;&amp;quot;rel=&amp;quot;stylesheet&amp;quot; type=&amp;quot;text/css&amp;quot; /&lt;span style="color: #006080"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div&gt;Can you see the problem?&lt;/div&gt;

&lt;div&gt;I couldn’t for almost an hour and then it struck me, there is no space between my href and rel attributes surely it can’t be that.&amp;#160; Yup that was exactly the problem, sticking the space in there made it all work!&amp;#160; Sometimes I just *love* development!&lt;/div&gt;

&lt;div&gt;So remember, if ASP.NET MVC isn’t rebasing a CSS link in one of your masterpages make sure there is a space between all your link attributes!&lt;/div&gt;  </description><link>http://joncahill.zero41.com/2009/07/why-wont-aspnet-mvc-rebase-css-link-for.html</link><author>noreply@blogger.com (Jon Cahill)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-695311292835046103</guid><pubDate>Mon, 15 Jun 2009 03:52:00 +0000</pubDate><atom:updated>2009-06-15T11:52:47.007+08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Clean Code</category><title>Clean code – No double negatives</title><description>&lt;p&gt;Today I came across the something similar to the following code today:&lt;/p&gt;  &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left"&gt;   &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;     &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum1" style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ProcessSomething(&lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; unsuccessful)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum2" style="color: #606060"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum3" style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!unsuccessful)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum4" style="color: #606060"&gt;   4:&lt;/span&gt;         SendEmail();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum5" style="color: #606060"&gt;   5:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;At first glance this method looks fine but if you read it out loud you would say “If not unsuccessful then send email” which is a little bit confusing because of the “not unsuccessful” double negative.&amp;#160; If the method is more complicated then double negatives just add to the complexity.&lt;/p&gt;

&lt;p&gt;Instead it is best to just flip the bool around so you don’t end up with the double negative:&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left"&gt;
  &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;
    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum1" style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ProcessSomething(&lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; successful)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum2" style="color: #606060"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum3" style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (successful)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum4" style="color: #606060"&gt;   4:&lt;/span&gt;         SendEmail();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum5" style="color: #606060"&gt;   5:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Which would read “If successful then send email”, simpler, clearer and just plain cleaner code.&lt;/p&gt;  </description><link>http://joncahill.zero41.com/2009/06/clean-code-no-double-negatives.html</link><author>noreply@blogger.com (Jon Cahill)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-5860745292339011526</guid><pubDate>Wed, 10 Jun 2009 16:02:00 +0000</pubDate><atom:updated>2009-06-11T00:05:02.782+08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET MVC</category><category domain="http://www.blogger.com/atom/ns#">trivia</category><title>ASP.NET MVC Controllers can automatically cast DropDownList values as int, Very Impressed!</title><description>&lt;p&gt;I just did something which I totally did not expect ASP.NET MVC to handle but I thought I would try it anyway and amazingly it worked, adding more proof to how well a job the guys at Microsoft did with this framework.&lt;/p&gt;  &lt;p&gt;I added a drop down list to my view with the following Html helper:&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &amp;lt;%= Html.DropDownList(&lt;span style="color: #006080"&gt;&amp;quot;myDropDown&amp;quot;&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;SelectListItem&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SelectListItem{Text = &lt;span style="color: #006080"&gt;&amp;quot;Item 1&amp;quot;&lt;/span&gt;,Value = &lt;span style="color: #006080"&gt;&amp;quot;1&amp;quot;&lt;/span&gt;},&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SelectListItem{Text = &lt;span style="color: #006080"&gt;&amp;quot;Item 2&amp;quot;&lt;/span&gt;,Value = &lt;span style="color: #006080"&gt;&amp;quot;2&amp;quot;&lt;/span&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;         }) %&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;I originally had an action on my controller which looked like this:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; [AcceptVerbs(HttpVerbs.Post)]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; ActionResult DoSomething(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; myDropDown)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;  {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;      &lt;span style="color: #008000"&gt;//Cast myDropDown to an integer, handle empty &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;      &lt;span style="color: #008000"&gt;//strings etc&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;  }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Which is a pain having to parse &lt;em&gt;myDropDown&lt;/em&gt; to an integer and just makes things messy, so I wondered what would happen if I changed myDropDown from a string to a nullable int?&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; [AcceptVerbs(HttpVerbs.Post)]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; ActionResult DoSomething(&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;? myDropDown)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//Surprisingly it works&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;
And to my surprise it work exactly as I had expected!&amp;#160; ASP.NET MVC seems to be impressing me more every day that I use it.&amp;#160; It is the small things like this which make working with ASP.NET MVC such a joy.  </description><link>http://joncahill.zero41.com/2009/06/damn-aspnet-mvc-is-good.html</link><author>noreply@blogger.com (Jon Cahill)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-5139352685553291871</guid><pubDate>Thu, 28 May 2009 16:43:00 +0000</pubDate><atom:updated>2009-05-29T00:43:40.983+08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Open/Closed Principle</category><category domain="http://www.blogger.com/atom/ns#">Patterns</category><category domain="http://www.blogger.com/atom/ns#">SOLID</category><title>Stop violating the Open/Closed principle with your repositories</title><description>&lt;p&gt;I a lot of implementations of the repository pattern I see have interfaces like:&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;interface&lt;/span&gt; IOrderRepository&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     Order FindById(&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; id);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     IList&amp;lt;Order&amp;gt; FindOrdersByCustomer(Customer customer);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;     IList&amp;lt;Order&amp;gt; FindOrdersByProduct(Product product);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;     IList&amp;lt;Order&amp;gt; FindOrdersGreaterThan(&lt;span style="color: #0000ff"&gt;decimal&lt;/span&gt; amount);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;     IList&amp;lt;Order&amp;gt; FindOrdersForDateRange(DateTime startDate,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;                                         DateTime endDate);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The problem with this implementation is if a new query is required then the IOrderRepository interface will need to be changed, which will cause all the IOrderRepository implementations to also need to be changed.&amp;#160; This is not open to extension, because the only way to add new queries is to change the interface, and not closed to change, because the interface will have frequent reasons to change.&lt;/p&gt;

&lt;p&gt;An approach which I have been using to avoid this violation, made easier by linq, is to have a simple repository interface who’s only responsibility is to execute queries and not define them, who’s responsibility now belongs to an IQueryDefinition.&amp;#160; &lt;/p&gt;

&lt;p&gt;Now the only interface for all my repositories is:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;interface&lt;/span&gt; IRepository&amp;lt;T&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     T FindById(&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; id);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     IQueryable&amp;lt;T&amp;gt; Find(IQueryDefinition&amp;lt;T&amp;gt; queryDefinition);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Save(T domainEntity);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;   &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Delete(T domainEntity);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Notice I also return IQueryable&amp;lt;T&amp;gt;, this is so consumers of the repository can do additional things like pagination, ordering etc which I believe is really a UI concern and shouldn’t be defined within the repository or the query definition.&lt;/p&gt;

&lt;p&gt;And the interface for the IQueryDefinition is very simple:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;interface&lt;/span&gt; IQueryDefinition&amp;lt;T&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     IQueryable&amp;lt;T&amp;gt; CreateQuery(IQueryable&amp;lt;T&amp;gt; queryable);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;

  &lt;p&gt;Which allows me to create QueryDefinitions such as:&lt;/p&gt;

  &lt;div id="codeSnippetWrapper"&gt;
    &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; FindOrdersByCustomer : IQueryDefinition&amp;lt;Order&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Customer Customer { get; set; }&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; IQueryable&amp;lt;Order&amp;gt; CreateQuery(IQueryable&amp;lt;Order&amp;gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;                                         queryable)&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; queryable.Where(o =&amp;gt; o.Customer == Customer);&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

      &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Then from within the implementation of the Find(IQueryDefinition&amp;lt;T&amp;gt; queryDefinition) method is to get the query from the passed IQueryDefinition and execute it on the relevant data source. &lt;/p&gt;

&lt;p&gt;You can also create fluent interfaces for your QueryDefinitions which makes reading and understanding existing queries nice and easy.&lt;/p&gt;  </description><link>http://joncahill.zero41.com/2009/05/stop-violating-openclosed-principle.html</link><author>noreply@blogger.com (Jon Cahill)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-5769710594148681467</guid><pubDate>Tue, 19 May 2009 10:23:00 +0000</pubDate><atom:updated>2009-05-20T01:03:38.375+08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Visual Studio</category><category domain="http://www.blogger.com/atom/ns#">trivia</category><title>What did Visual Studio do with my tests?</title><description>&lt;p&gt;More often then I would like when I open a solution in Visual Studio 2008 all the files from my test project are missing!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_KNPkr0KdMAw/ShKIpn_HeKI/AAAAAAAAAEg/iEsH4BEdD3s/s1600-h/image%5B3%5D.png"&gt;&lt;img title="image" style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" height="270" alt="image" src="http://lh6.ggpht.com/_KNPkr0KdMAw/ShKIqVouk5I/AAAAAAAAAEk/QrN427ip0tQ/image_thumb%5B1%5D.png?imgmax=800" width="344" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;When this first happened I checked the file system to see if they were actually there, which they were (phew!) then I would close and re-open the solution, which is very time consuming for larger projects and doesn’t always work.  Finally I worked out I could right click on the project and go to &lt;em&gt;Unload Project,&lt;/em&gt; which will unload the project and grey it out, then right click again and go to &lt;em&gt;Reload Project&lt;/em&gt; and everything is back to normal.  This works every time.&lt;/p&gt;  &lt;p&gt;I find it weird that this only seems to occur for test projects.&lt;/p&gt;</description><link>http://joncahill.zero41.com/2009/05/what-did-visual-studio-do-with-my-tests.html</link><author>noreply@blogger.com (Jon Cahill)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/_KNPkr0KdMAw/ShKIqVouk5I/AAAAAAAAAEk/QrN427ip0tQ/s72-c/image_thumb%5B1%5D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-5845484518353080529</guid><pubDate>Sun, 10 May 2009 04:21:00 +0000</pubDate><atom:updated>2009-05-13T01:04:50.125+08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">ASP.NET MVC</category><category domain="http://www.blogger.com/atom/ns#">tutorial</category><category domain="http://www.blogger.com/atom/ns#">Domain Model</category><title>Building an application with ASP.NET MVC – Defining the Domain Model</title><description>&lt;p align="justify"&gt;The first step needed when building the application is to define it’s requirements then capture those within a &lt;a href="http://www.martinfowler.com/eaaCatalog/domainModel.html"&gt;domain model&lt;/a&gt;. This application, which will be called Moola, has the following requirements (Keep it simple to start with, additional requirements can be added later):&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;div align="justify"&gt;Create accounts which relate to a person’s banking accounts with different types e.g. Savings accounts, credit cards, mortgages etc &lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;Record transactions for an account &lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;Group the transactions into different categories, e.g. Groceries, Mortgage Payments, Entertainment etc&amp;#160; &lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;View transactions for a day, week, month or quarter. &lt;/div&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p align="justify"&gt;With the requirements defined a domain model can be attempted:&lt;/p&gt;  &lt;p align="justify"&gt;&lt;a href="http://lh5.ggpht.com/_KNPkr0KdMAw/SgZWCTRlvzI/AAAAAAAAAEI/vFPBwWBwUBA/s1600-h/image45.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Domain Model" border="0" alt="Domain Model" src="http://lh4.ggpht.com/_KNPkr0KdMAw/SgZWEpxbNvI/AAAAAAAAAEM/AcHXlivV-Vs/image_thumb43.png?imgmax=800" width="458" height="236" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;Not bad for the first pass, but with some further thought this model could be improved.&amp;#160; As it stands now if a transfer of money was to be made from one account to another two transactions would need to be made, negative from the source account and positive to the destination account.&amp;#160; This is not terrible in itself but there is no way to determine which transactions made up the one transfer, except by matching them on time and amount which is not accurate.&amp;#160; To resolve this the transaction can have two accounts, the source and destination accounts.&amp;#160; The domain model can now be updated to:&lt;/p&gt;  &lt;p align="justify"&gt;&lt;a href="http://lh5.ggpht.com/_KNPkr0KdMAw/SgZWI5ID9AI/AAAAAAAAAEQ/3LRG_mpEaTM/s1600-h/image51.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://lh6.ggpht.com/_KNPkr0KdMAw/SgZWKyPQITI/AAAAAAAAAEU/e4QAQ1MEhEA/image_thumb47.png?imgmax=800" width="458" height="224" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p align="justify"&gt;This domain model now appears to cover all the requirements.&amp;#160; It has &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;div align="justify"&gt;Accounts which can be typed&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;Transactions which can be categorised&lt;/div&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;div align="justify"&gt;And only a single transaction needs to be created for a transfer between multiple accounts (A transfer from one account to multiple destination accounts should each be separate transactions).&lt;/div&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p align="justify"&gt;You may be asking why the Account does not have a collection of transaction that belong to it.&amp;#160; This is because the requirements state the transactions will be accessed for a day, week, month or quarter there isn’t a case for retrieving all the transactions for an Account.&amp;#160; Also an Account could potentially have thousands of transactions and it would not be very efficient to load all of them with the Account to just access a small subset.&amp;#160; &lt;/p&gt;  &lt;p align="justify"&gt;The other reasons is because an Account and Transactions are logically their own aggregates,&amp;#160; Eric Evans defines an aggregate in &lt;a href="http://www.amazon.com/gp/product/0321125215?ie=UTF8&amp;amp;tag=joncahstecblo-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=0321125215"&gt;Domain-Driven Design&lt;/a&gt;&lt;img style="border-bottom-style: none !important; border-right-style: none !important; margin: 0px; border-top-style: none !important; border-left-style: none !important" border="0" alt="" src="http://www.assoc-amazon.com/e/ir?t=joncahstecblo-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=0321125215" width="1" height="1" /&gt;as:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p align="justify"&gt;&lt;em&gt;An AGGREGATE is a cluster of associated objects that we treat as a unit for the purpose of data changes. Each AGGREGATE has a root and a boundary. The boundary defines what is inside the AGGREGATE. The root is a single, specific ENTITY contained in the AGGREGATE&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p align="justify"&gt;and within this domain the Account is it’s own unit and the Transaction is it’s own unit, the application should not have to save an Account just to create a new transaction.&amp;#160; This can be clearly shown by drawing the aggregates on the domain model:&lt;/p&gt;  &lt;p align="justify"&gt;&lt;a href="http://lh6.ggpht.com/_KNPkr0KdMAw/SgZWMapGkNI/AAAAAAAAAEY/hp0OJjm9wOc/s1600-h/image5.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://lh4.ggpht.com/_KNPkr0KdMAw/SgZWN8X-ukI/AAAAAAAAAEc/EHXjjKrC4IM/image_thumb2.png?imgmax=800" width="458" height="257" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p align="justify"&gt;This will be important when defining the repositories for the application.&lt;/p&gt;  &lt;p align="justify"&gt;It is now time to move start implementing the domain model, which will be done in the next post.&lt;/p&gt;  </description><link>http://joncahill.zero41.com/2009/05/building-application-with-aspnet-mvc_10.html</link><author>noreply@blogger.com (Jon Cahill)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/_KNPkr0KdMAw/SgZWEpxbNvI/AAAAAAAAAEM/AcHXlivV-Vs/s72-c/image_thumb43.png?imgmax=800" height="72" width="72" /><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-2844231587546261673</guid><pubDate>Sun, 10 May 2009 04:18:00 +0000</pubDate><atom:updated>2009-05-10T12:25:12.889+08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">DDD</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET MVC</category><category domain="http://www.blogger.com/atom/ns#">tutorial</category><category domain="http://www.blogger.com/atom/ns#">TDD</category><title>Building an application with ASP.NET MVC</title><description>&lt;p&gt;I have been writing a simple web application to manage my personal finances and have been documenting how I have gone about building it so it can be used as a tutorial at &lt;a href="http://www.zero41.com/"&gt;Zero41&lt;/a&gt;. I have decided to open source the application, called Moola and available on CodePlex &lt;a href="http://moola.codeplex.com/"&gt;here&lt;/a&gt;, and post all the tutorials here.&amp;#160; The tutorials are application are a work in a progress but I will post each here as&amp;#160; finish them, so expect some genuine refactoring as I build the application.&amp;#160; I will be building the application using &lt;a href="http://www.asp.net/mvc/"&gt;ASP.NET MVC&lt;/a&gt;, &lt;a href="http://www.microsoft.com/express/sql/"&gt;Sql Server 2008 Express&lt;/a&gt;, &lt;a href="http://sourceforge.net/projects/nhibernate/"&gt;nHibernate&lt;/a&gt; and &lt;a href="http://ayende.com/projects/rhino-mocks.aspx"&gt;Rhino Mocks&lt;/a&gt;, so download these if you plan to follow along.&lt;/p&gt;  &lt;p&gt;I will be building Moola using Domain Driven Design (DDD) and Test Driven Development (TDD) so if you are new to these concepts then this tutorial should give you some real world examples.&lt;/p&gt;  &lt;p&gt;At the end of each tutorial I will include a link which will allow you to download the matching code.&amp;#160; I also be using this post as the “contents page” for the tutorials, so come back to this post regularly if you want to follow along.&amp;#160; I will be doing this tutorial in my own free time but hopefully I can get one done at least once a week.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://joncahill.zero41.com/2009/05/building-application-with-aspnet-mvc_10.html"&gt;Defining the Domain Model&lt;/a&gt;&lt;/p&gt;  </description><link>http://joncahill.zero41.com/2009/05/building-application-with-aspnet-mvc.html</link><author>noreply@blogger.com (Jon Cahill)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-1914995223468604593</guid><pubDate>Fri, 01 May 2009 05:59:00 +0000</pubDate><atom:updated>2009-05-19T16:05:48.788+08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">tools</category><title>The easy was to blog, use Windows Live Writer</title><description>&lt;p&gt;This post will probably make &lt;a href="http://www.codinghorror.com/"&gt;Jeff Atwood&lt;/a&gt; cringe because of his complete distain for meta conversations, and this will be a blog post about blogging, but who really cares what Jeff thinks :)&lt;/p&gt;  &lt;p&gt;I have never taken much notice of Windows Live Writer, I saw it in the Live installer when upgrading/installing Messenger but didn’t really know or care what it did.  Meanwhile I have been creating blog posts the &lt;strong&gt;hard&lt;/strong&gt; way by using the blogger online interface.  So like everyone else using the blogger interface I was struggling with formatting, inserting images and code syntax highlighting, basically I was living in the dark ages!&lt;/p&gt;  &lt;p&gt;The other day I saw a tweet where &lt;a href="http://www.hanselman.com/blog/"&gt;Scott Hanselman&lt;/a&gt; mentioned he was using Windows Live Writer for blogging.  I knew Scott ran his blog on &lt;a href="http://www.dasblog.info/"&gt;dasBlog&lt;/a&gt; so Windows Live Writer must work with other blog engines other then Live Spaces, which I thought would be the only blog supported by Windows Live Writer.  So I downloaded Windows Live Writer to give it a whirl, and have been very impressed with it right away.  Just compare the experience between using Windows Live Writer and the blogger online interface:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Windows Live Writer:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_KNPkr0KdMAw/SfqPlbcp7VI/AAAAAAAAAD4/y8Vg5dfVqlU/s1600-h/image%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_KNPkr0KdMAw/SfqPnle050I/AAAAAAAAAD8/vIO8MD93054/image_thumb%5B1%5D.png?imgmax=800" width="434" height="356" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Blogger Online Interface:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_KNPkr0KdMAw/SfqPpbelm8I/AAAAAAAAAEA/oDV5q5cOwhE/s1600-h/image%5B7%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_KNPkr0KdMAw/SfqPrYi3IFI/AAAAAAAAAEE/IdtXDuainn4/image_thumb%5B3%5D.png?imgmax=800" width="452" height="398" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The blogger interface is cumbersome difficult to insert images and doesn’t use your screen real estate properly (The edit box doesn’t even fill half the height of my screen).  Windows Live Writer doesn’t have any of these problems, with the additional benefit of being able to blog offline (which is while when travelling to work).  It also supports plugins and there are some fantastic &lt;a href="http://gallery.live.com/results.aspx?bt=9&amp;amp;pl=8&amp;amp;st=3"&gt;plugins&lt;/a&gt;.  I would recommend checking out the following:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://gallery.live.com/liveItemDetail.aspx?li=0aeb208a-81d1-4197-bbce-b4a42f5ec430&amp;amp;bt=9&amp;amp;pl=8"&gt;&lt;strong&gt;Amazon Book Linker&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;Allows you to search and insert links to your favourite books on Amazon directly into your blog quickly and easily&lt;/p&gt;    &lt;p&gt;&lt;a href="http://gallery.live.com/liveItemDetail.aspx?li=d4409446-af7f-42ec-aa20-78aa5bac4748&amp;amp;bt=9&amp;amp;pl=8"&gt;&lt;strong&gt;Code Snippet&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;Inserts code snippets into your blog with full syntax highlighting for lots of different languages.  This is how I do the syntax highlighting on this blog, doesn’t require you to change your blog/use javascript etc.&lt;/p&gt;    &lt;p&gt;&lt;a href="http://gallery.live.com/liveItemDetail.aspx?li=6b2b5ffe-936a-4cb3-869c-c01de29de176&amp;amp;bt=9&amp;amp;pl=8"&gt;&lt;strong&gt;Twitter Notify&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;Great little plugin which posts a twitter message when you publish a blog post.&lt;/p&gt;    &lt;p&gt;&lt;a href="http://gallery.live.com/liveItemDetail.aspx?li=a7613ad9-6054-4211-a5b6-b08e86242247&amp;amp;bt=9&amp;amp;pl=8"&gt;&lt;strong&gt;Bullets!&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;Adds heaps of different bullet list options to your blog to spice things up instead of the boring fat dot style ones.  You can even create custom bullets.&lt;/p&gt;    &lt;p&gt;&lt;a href="http://gallery.live.com/liveItemDetail.aspx?li=4d65ba39-74c5-4c57-a679-9301d757f8cb&amp;amp;bt=9&amp;amp;pl=8"&gt;&lt;strong&gt;Flickr Upload&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;Uploads images to your flickr account and automatically links to them from your blog.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;If you haven’t started using Windows Live Writer go get it &lt;a href="http://windowslivewriter.spaces.live.com/"&gt;now&lt;/a&gt;.  It supports most of the major blogging engines/sites so start making your blogging life easier!&lt;/p&gt;</description><link>http://joncahill.zero41.com/2009/05/easy-was-to-blog-use-windows-live.html</link><author>noreply@blogger.com (Jon Cahill)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/_KNPkr0KdMAw/SfqPnle050I/AAAAAAAAAD8/vIO8MD93054/s72-c/image_thumb%5B1%5D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-5202079147556282938</guid><pubDate>Sat, 25 Apr 2009 15:23:00 +0000</pubDate><atom:updated>2009-05-01T15:57:57.452+08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">tutorial</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">trivia</category><title>Subtle difference between passing Reference Type by value and passing them by reference</title><description>&lt;p&gt;It is generally understand the differences between passing by reference and by value when dealing with value types but not everyone knows the difference between passing a reference type by reference and by value.&lt;/p&gt;  &lt;p&gt;If we have the following code:&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;     &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum1" style="color:#606060;"&gt;   1:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; Customer&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum2" style="color:#606060;"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum3" style="color:#606060;"&gt;   3:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; Name { get; set; }&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum4" style="color:#606060;"&gt;   4:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum5" style="color:#606060;"&gt;   5:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum6" style="color:#606060;"&gt;   6:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; Example&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum7" style="color:#606060;"&gt;   7:&lt;/span&gt;  {&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum8" style="color:#606060;"&gt;   8:&lt;/span&gt;      &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; PassByValue(Customer customer)&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum9" style="color:#606060;"&gt;   9:&lt;/span&gt;      {&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum10" style="color:#606060;"&gt;  10:&lt;/span&gt;          customer = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Customer {Name = &lt;span style="color:#006080;"&gt;"Fred"&lt;/span&gt;};&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum11" style="color:#606060;"&gt;  11:&lt;/span&gt;      }&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum12" style="color:#606060;"&gt;  12:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum13" style="color:#606060;"&gt;  13:&lt;/span&gt;      &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; PassByReference(&lt;span style="color:#0000ff;"&gt;ref&lt;/span&gt; Customer customer)&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum14" style="color:#606060;"&gt;  14:&lt;/span&gt;      {&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum15" style="color:#606060;"&gt;  15:&lt;/span&gt;          customer = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Customer {Name = &lt;span style="color:#006080;"&gt;"Fred"&lt;/span&gt;};&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum16" style="color:#606060;"&gt;  16:&lt;/span&gt;      }&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum17" style="color:#606060;"&gt;  17:&lt;/span&gt;  }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;At first glance you might thing that both the methods &lt;em&gt;PassByReference&lt;/em&gt; and &lt;em&gt;PassByValue&lt;/em&gt; would have the same effect, but we can see this is not the case if we create unit tests for each method:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
 &lt;div    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;
   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum1" style="color:#606060;"&gt;   1:&lt;/span&gt; [TestClass]&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum2" style="color:#606060;"&gt;   2:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; ExampleTest&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum3" style="color:#606060;"&gt;   3:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum4" style="color:#606060;"&gt;   4:&lt;/span&gt;     [TestMethod]&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum5" style="color:#606060;"&gt;   5:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; TestPassByReference()&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum6" style="color:#606060;"&gt;   6:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum7" style="color:#606060;"&gt;   7:&lt;/span&gt;         Customer customer = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Customer { Name = &lt;span style="color:#006080;"&gt;"Tim"&lt;/span&gt; };&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum8" style="color:#606060;"&gt;   8:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum9" style="color:#606060;"&gt;   9:&lt;/span&gt;         Example example = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Example();&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum10" style="color:#606060;"&gt;  10:&lt;/span&gt;         example.PassByReference(&lt;span style="color:#0000ff;"&gt;ref&lt;/span&gt; customer);&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum11" style="color:#606060;"&gt;  11:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum12" style="color:#606060;"&gt;  12:&lt;/span&gt;         Assert.AreEqual(&lt;span style="color:#006080;"&gt;"Fred"&lt;/span&gt;, customer.Name);&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum13" style="color:#606060;"&gt;  13:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum14" style="color:#606060;"&gt;  14:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum15" style="color:#606060;"&gt;  15:&lt;/span&gt;     [TestMethod]&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum16" style="color:#606060;"&gt;  16:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; TestPassByValue()&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum17" style="color:#606060;"&gt;  17:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum18" style="color:#606060;"&gt;  18:&lt;/span&gt;         Customer customer = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Customer { Name = &lt;span style="color:#006080;"&gt;"Tim"&lt;/span&gt; };&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum19" style="color:#606060;"&gt;  19:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum20" style="color:#606060;"&gt;  20:&lt;/span&gt;         Example example = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Example();&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum21" style="color:#606060;"&gt;  21:&lt;/span&gt;         example.PassByValue(customer);&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum22" style="color:#606060;"&gt;  22:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum23" style="color:#606060;"&gt;  23:&lt;/span&gt;         Assert.AreEqual(&lt;span style="color:#006080;"&gt;"Fred"&lt;/span&gt;, customer.Name);&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum24" style="color:#606060;"&gt;  24:&lt;/span&gt;     }        &lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum25" style="color:#606060;"&gt;  25:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;When we run these tests we see that &lt;em&gt;TestPassByReference&lt;/em&gt; passes but &lt;em&gt;TestPassByValue&lt;/em&gt; doesn’t.  The different is, obviously, because we are passing &lt;em&gt;customer&lt;/em&gt; by reference in one test and by value in the second.  We can further explore what is happening by expanding our tests a little:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
 &lt;div    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;
   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum1" style="color:#606060;"&gt;   1:&lt;/span&gt; [TestClass]&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum2" style="color:#606060;"&gt;   2:&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; ExampleTest&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum3" style="color:#606060;"&gt;   3:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum4" style="color:#606060;"&gt;   4:&lt;/span&gt;     [TestMethod]&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum5" style="color:#606060;"&gt;   5:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; TestPassByReference()&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum6" style="color:#606060;"&gt;   6:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum7" style="color:#606060;"&gt;   7:&lt;/span&gt;         Customer customer = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Customer { Name = &lt;span style="color:#006080;"&gt;"Tim"&lt;/span&gt; };&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum8" style="color:#606060;"&gt;   8:&lt;/span&gt;         Customer customerCopy = customer;&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum9" style="color:#606060;"&gt;   9:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum10" style="color:#606060;"&gt;  10:&lt;/span&gt;         Example example = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Example();&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum11" style="color:#606060;"&gt;  11:&lt;/span&gt;         example.PassByReference(&lt;span style="color:#0000ff;"&gt;ref&lt;/span&gt; customer);&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum12" style="color:#606060;"&gt;  12:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum13" style="color:#606060;"&gt;  13:&lt;/span&gt;         Assert.AreNotSame(customerCopy, customer);&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum14" style="color:#606060;"&gt;  14:&lt;/span&gt;         Assert.AreEqual(&lt;span style="color:#006080;"&gt;"Fred"&lt;/span&gt;, customer.Name);&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum15" style="color:#606060;"&gt;  15:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum16" style="color:#606060;"&gt;  16:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum17" style="color:#606060;"&gt;  17:&lt;/span&gt;     [TestMethod]&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum18" style="color:#606060;"&gt;  18:&lt;/span&gt;     &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; TestPassByValue()&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum19" style="color:#606060;"&gt;  19:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum20" style="color:#606060;"&gt;  20:&lt;/span&gt;         Customer customer = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Customer { Name = &lt;span style="color:#006080;"&gt;"Tim"&lt;/span&gt; };&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum21" style="color:#606060;"&gt;  21:&lt;/span&gt;         Customer customerCopy = customer;&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum22" style="color:#606060;"&gt;  22:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum23" style="color:#606060;"&gt;  23:&lt;/span&gt;         Example example = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Example();&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum24" style="color:#606060;"&gt;  24:&lt;/span&gt;         example.PassByValue(customer);&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum25" style="color:#606060;"&gt;  25:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum26" style="color:#606060;"&gt;  26:&lt;/span&gt;         Assert.AreSame(customerCopy, customer);&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum27" style="color:#606060;"&gt;  27:&lt;/span&gt;         Assert.AreEqual(&lt;span style="color:#006080;"&gt;"Tim"&lt;/span&gt;, customer.Name);&lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum28" style="color:#606060;"&gt;  28:&lt;/span&gt;     }        &lt;/pre&gt;
&lt;!--CRLF--&gt;

   &lt;pre    style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px;  direction: ltr; border-top-style: none;   border-left-style: none; overflow: visible; padding-top: 0pxfont-family:'Courier New', courier, monospace;font-size:8pt;color:black;"&gt;&lt;span  id="lnum29" style="color:#606060;"&gt;  29:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div&gt;Both tests now pass and it is clear what is happening, when we pass our customer object into &lt;em&gt;PassByReference&lt;/em&gt; it is actually changing the reference held in the test method, &lt;em&gt;PassByValue&lt;/em&gt; does not do this.&lt;/div&gt;

&lt;div&gt;To fully understand what is happening we need to work through what is happening in each case.  For &lt;em&gt;PassByValue&lt;/em&gt; the following occurs:&lt;/div&gt;

&lt;ul&gt;
 &lt;li&gt;Create a new Customer object and we store a reference to that object in our local variable called &lt;em&gt;customer&lt;/em&gt; &lt;/li&gt;

 &lt;li&gt;Call &lt;em&gt;PassByValue&lt;/em&gt; passing our reference to &lt;em&gt;customer.  &lt;/em&gt;This is actually making a &lt;span style="font-size:78%;"&gt;*&lt;/span&gt;copy of our &lt;em&gt;customer&lt;/em&gt; reference and the copy into &lt;em&gt;PassByValue&lt;/em&gt;, similar to what happens to Value Types. &lt;/li&gt;

 &lt;li&gt;When &lt;em&gt;PassByValue&lt;/em&gt; creates a new instance of Customer it changes the &lt;strong&gt;copied&lt;/strong&gt; reference to customer not the one owned by the calling method, which is left completely alone. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For &lt;em&gt;PassByReference&lt;/em&gt; the following occurs:&lt;/p&gt;

&lt;ul&gt;
 &lt;li&gt;We create a new Customer object and we store a reference to that object in our local variable called &lt;em&gt;customer&lt;/em&gt; &lt;/li&gt;

 &lt;li&gt;Call &lt;em&gt;PassByReference&lt;/em&gt; passing in a reference to our reference to &lt;em&gt;customer&lt;/em&gt;.  This statement makes it clear what is happening, now both the calling method and &lt;em&gt;PassByReference&lt;/em&gt; are working with the same reference to &lt;em&gt;customer.&lt;/em&gt; &lt;/li&gt;

 &lt;li&gt;When &lt;em&gt;PassByReference&lt;/em&gt; creates a new instance of Customer it changes it’s reference which is also the same reference as the calling method so both are affected. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After working those these two examples we can now see how passing a reference is not only significant for Value Types but also for Reference Types.&lt;/p&gt;

&lt;p&gt;* This is a copy of the reference, not actually a copy of the customer object&lt;/p&gt;</description><link>http://joncahill.zero41.com/2009/04/subtle-difference-between-passing.html</link><author>noreply@blogger.com (Jon Cahill)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-2652541078428899256</guid><pubDate>Tue, 21 Apr 2009 14:34:00 +0000</pubDate><atom:updated>2009-04-21T22:34:57.619+08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Development</category><category domain="http://www.blogger.com/atom/ns#">Subjective</category><title>The role of a Software Architect</title><description>&lt;p&gt;I was just listening to the Stackoverflow podcast &lt;a href="http://blog.stackoverflow.com/2009/04/podcast-48/"&gt;48&lt;/a&gt; and which has a phone in question asking the real value of an involved and development orientated architect on a project.&amp;#160; Joel seemed to liked the idea of an architect who doesn’t dictate from an ivory tower but is involved everyday at a developer level.&amp;#160; Jeff on the other had must of had some bad experiences with some useless so called architects in the past as he wasn’t receptive to the idea in the least, he just kept saying that instead more communication was need.&lt;/p&gt;  &lt;p&gt;I do agree with Jeff in that communication in a development team is important but I also believe the role of an architect is important as well.&amp;#160; An architect should not be a position in a company where their only job is to mandate company wide architecture choices.&amp;#160; A software company should also not be employing or hiring architects.&amp;#160; Instead an architect should be a senior developer on a project who, as well as their development duties, is given the role of architect for that one particular project. When in the role of architect the senior developer is then responsible for the architecture, technologies and model for the project whilst also performing normal development duties. An architect should only be responsible for a single project/application and not the architect for all projects within a software company.&amp;#160; It is also perfectly acceptable to have more than one architect for the project if it the size and complexity of the project warrants it.&lt;/p&gt;  &lt;p&gt;Now being an architect should not mean that the developer dictates how everything is to be developed, but the architect &lt;strong&gt;is&lt;/strong&gt;&amp;#160;&lt;strong&gt;responsible &lt;/strong&gt;for it, which is why they must be a developer with excellent skills and experience.&amp;#160; A architect is needed because not every application should be build in the same way using he same technologies, patterns and architecture.&amp;#160; With important decisions such as the need for web services, the need for an ORM or straight sql/stores procedures, storage requirements, scaling issues, etc it becomes clear that one is needed.&amp;#160; The architect should also be responsible for managing technical debt and ensuring this does not get out of hand and start impeding on the progress of the project.&amp;#160; However it is important for the architect to make these decisions collaboratively with all other members on the team but like with most things if you want the project to progress you need to have a leader to provide direction, vision and consistency.&amp;#160; &lt;/p&gt;  &lt;p&gt;Joel has mentioned in the past that Fog Creek, and Microsoft, have the Program Manager roll who’s job is to get the best outcome for the clients, the architect is similar in that they should be trying to get the best technical outcome for the client.&amp;#160; From listening to the Stackoverflow podcasts it is also obvious the Jeff, as much as he hates the architect term, is the architect of Stackoverflow.&lt;/p&gt;  </description><link>http://joncahill.zero41.com/2009/04/role-of-software-architect.html</link><author>noreply@blogger.com (Jon Cahill)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-6451975077458213670</guid><pubDate>Fri, 10 Apr 2009 10:54:00 +0000</pubDate><atom:updated>2009-04-23T01:11:18.978+08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">VisualSVN</category><category domain="http://www.blogger.com/atom/ns#">Subversion</category><category domain="http://www.blogger.com/atom/ns#">Source Control</category><title>VisualSVN and how to handle expired trials</title><description>I have been using the trial of &lt;a href="http://www.visualsvn.com/visualsvn/"&gt;VisualSVN&lt;/a&gt; to see how well it actually integrates with Visual Studio, already recommended by &lt;a href="http://blog.stackoverflow.com/2008/06/podcast-10/"&gt;Jeff Atwood of Coding Horror/Stack Overflow&lt;/a&gt;, and what affect it would have on the day to day development. We already use &lt;a href="http://www.visualsvn.com/server/"&gt;Visual SVN Server&lt;/a&gt; at &lt;a title="Web Development, Software Development, Database Development" href="http://www.zero41.com/"&gt;Zero41&lt;/a&gt;, which is a fantastic product as well as being free, so I was expecting it to be a good things. All in all I have been extremely pleased with it and will be purchasing licenses for all developers at &lt;a title="Web Development, Software Development, Database Development" href="http://www.zero41.com/"&gt;Zero41&lt;/a&gt; but what really impressed me was how it handled itself once the trial expired. I didn't get any of the usually evil I would expect from an expiring trial such as:   &lt;ul&gt;   &lt;li&gt;A dialog when opening Visual Studio which prevented me from continuing unless I registered the product &lt;/li&gt;    &lt;li&gt;Regular an inconvenient reminders saying I need to register the product, interrupting me from my work &lt;/li&gt;    &lt;li&gt;Any other interruption or obstacle preventing me from working unless I registered the product &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;All I got was the following dialog when trying to use any of the &lt;a href="http://www.visualsvn.com/visualsvn/"&gt;VisualSVN&lt;/a&gt; functions: &lt;/p&gt;  &lt;p&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_KNPkr0KdMAw/Sd8tQM3J61I/AAAAAAAAADc/nfYSdKKnwxQ/s1600-h/VisualSVN.png"&gt;&lt;img style="text-align: center; margin: 0px auto 10px; width: 320px; display: block; height: 162px; cursor: hand" id="BLOGGER_PHOTO_ID_5323023040928934738" border="0" alt="" src="http://3.bp.blogspot.com/_KNPkr0KdMAw/Sd8tQM3J61I/AAAAAAAAADc/nfYSdKKnwxQ/s320/VisualSVN.png" /&gt;&lt;/a&gt; and best of all none of these functions are linked/required by everyday work, only when trying to interact with Subversion. Thank you &lt;a href="http://www.visualsvn.com/visualsvn/"&gt;VisualSVN&lt;/a&gt; team for keeping the experience great.&lt;/p&gt;  </description><link>http://joncahill.zero41.com/2009/04/visualsvn-and-how-to-handle-expired.html</link><author>noreply@blogger.com (Jon Cahill)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_KNPkr0KdMAw/Sd8tQM3J61I/AAAAAAAAADc/nfYSdKKnwxQ/s72-c/VisualSVN.png" height="72" width="72" /><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-8981726705608021894</guid><pubDate>Tue, 07 Apr 2009 12:21:00 +0000</pubDate><atom:updated>2009-04-08T00:33:46.044+08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Personnel</category><title>A very special announcement</title><description>I have been very busy over the last two weeks with no blogging and little twittering because on Tuesday the 24th of March 2009 at 7:07 pm my partner, Louise, and I were blessed with the birth of our first child!  A beautiful baby girl named Embeth Georgina Marendoli-Cahill, I know what a mouthful, the poor girl :)

She was born after 14 hours of labour, she was 3.4kg, with a length of 50.3 cms and a head circumference of 35cms.  She has been very alert and accutely aware of both Louise and myself since the moment she was born, deeply looking into our eyes and responding to our voices immediately.  Truly amazing!  Since then I have not been about to get enough of here and always want to play and spend as much time as I can with her.

I have also been extremely proud of Louise and how she handled the labour, the lack of sleep (she gets less then me and I am struggling!) as well as the stress and hard work involved in breast feeding.

All in all the three of us are all doing well, except for the need to have some good sleep!</description><link>http://joncahill.zero41.com/2009/04/very-special-announcement.html</link><author>noreply@blogger.com (Jon Cahill)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-2118703352034768201</guid><pubDate>Mon, 23 Mar 2009 04:33:00 +0000</pubDate><atom:updated>2009-03-23T17:54:10.422+09:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Zero41</category><category domain="http://www.blogger.com/atom/ns#">Web Development</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET MVC</category><title>ASP.NET MVC 1.0 Released!</title><description>ASP.NET MVC 1.0 was &lt;a href="http://haacked.com/archive/2009/03/18/aspnet-mvc-rtw.aspx"&gt;officially released&lt;/a&gt; at Mix 09 a few days ago!&lt;div&gt;
&lt;/div&gt;&lt;div&gt;This is very exciting news because ASP.NET MVC is a lightweight platform for the development of web sites and web applications which is fully supported by Microsoft.  This new platform will allow &lt;a href="http://www.zero41.com" title="Web Development, Software Development and Database Development"&gt;Zero41&lt;/a&gt; to develop web sites and web applications for the Perth and Australian market with increased productivity, consistency and testability (improving quality).  &lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.zero41.com" title="Web Development, Software Development and Database Development" &gt;Zero41&lt;/a&gt; has been using the ASP.NET MVC platform throughout its entire Beta cycle to develop our own products (Which are soon to be released) so we have extensive skills and expertise in development with this new platform.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;We are very excited to start developing in this new platform for the Perth market and Australian market.&lt;/div&gt;</description><link>http://joncahill.zero41.com/2009/03/aspnet-mvc-10-released.html</link><author>noreply@blogger.com (Jon Cahill)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-1873238710068424520</guid><pubDate>Tue, 17 Mar 2009 04:32:00 +0000</pubDate><atom:updated>2009-03-23T18:01:40.276+09:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">DVCS</category><category domain="http://www.blogger.com/atom/ns#">Source Control</category><title>Enough with "DVCS allows me to work on the plane"</title><description>&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;div style="border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 3px; width: auto; font: normal normal normal 100%/normal Georgia, serif; text-align: left; "&gt;&lt;div&gt;&lt;p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;I have been following&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; Eric&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; Sink's &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;latest posts with his thoughts on&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; DVCS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;, found &lt;/span&gt;&lt;/span&gt;&lt;a href="http://www.ericsink.com/entries/dvcs_dag_1.html"&gt;&lt;span style="color:blue;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;here&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;a href="http://www.ericsink.com/entries/dvcs_dag_2.html"&gt;&lt;span style="color:blue;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;here&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; and &lt;/span&gt;&lt;/span&gt;&lt;a href="http://www.ericsink.com/entries/dbts_fossil.html"&gt;&lt;span style="color:blue;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;here&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;.  While reading these posts, and the associated comments, as well as on the&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; internet&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;, there seems to be an agreement&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;that the greatest thing about &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;DVCS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;is that you can work while you are on the plane.  This is a poor sales point for a&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; DVCS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;, when you can work on a plane just as easily using linear source control, such as&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; SVN&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;, than with a&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; DVCS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;.  Just get latest version before jumping on the plane, do your work while on the plane, then commit once you arrive at your destination, which is all quite easy, particularly these days with wireless and mobile&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; internet &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;available extensively.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;We at Zero41 have started taking an interest in&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; DVCS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;(Mostly Mercurial and Git at this stage) to try to solve scenarios other than the "work on the plane" scenario which would provide massive advantages over the standard linear model.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal"&gt;&lt;span style="color:black;"&gt;&lt;o:p&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; Some are:&lt;/span&gt;&lt;/span&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul type="disc"&gt;  &lt;li class="MsoNormal"  style="mso-margin-top-alt:auto;mso-margin-bottom-alt:      auto;line-height:normal;mso-list:l0 level1 lfo1;tab-stops:list 36.0ptcolor:black;"&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Local commits, roll backs, tags and other version control      mechanisms.  This would provide massive&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; benefits &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;for developers to work on      things they are not to sure about and rollback to a known good point      quickly and easily&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;  &lt;li class="MsoNormal"  style="mso-margin-top-alt:auto;mso-margin-bottom-alt:      auto;line-height:normal;mso-list:l0 level1 lfo1;tab-stops:list 36.0ptcolor:black;"&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Setting up remote work environments where you have multiple central      repositories for different physical work locations.  Eric mentions      this with his New York/&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Strawn &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;example. This also gives great&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; benefits &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;to start-ups and other small      companies where developers are working from home.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;  &lt;li class="MsoNormal"  style="mso-margin-top-alt:auto;mso-margin-bottom-alt:      auto;line-height:normal;mso-list:l0 level1 lfo1;tab-stops:list 36.0ptcolor:black;"&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Lightweight branching, easy merging.  Giving      developers the power of branches without the groaning which comes because you      have to deal with the complexity and problems typically associated with branching&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;  &lt;li class="MsoNormal"  style="mso-margin-top-alt:auto;mso-margin-bottom-alt:      auto;line-height:normal;mso-list:l0 level1 lfo1;tab-stops:list 36.0ptcolor:black;"&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Full revision history of changes applied from the source branch in      the destination branch.  This has been a pet hate of mine since I      first started using version control&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;  &lt;li class="MsoNormal"  style="mso-margin-top-alt:auto;mso-margin-bottom-alt:      auto;line-height:normal;mso-list:l0 level1 lfo1;tab-stops:list 36.0ptcolor:black;"&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Allowing developers to push/pull changes between each other so they      can work more collaboratively.  This would help massively for pair      programming, code reviews etc where incomplete changes can be easily      exchanged without going though the central repository and affecting      everyone else.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height: normal"&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;These are all much more powerful reason to be looking at a&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; DVCS&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;, so please stop promoting &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;DVCS &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;by saying "I can work on the plane"!&lt;/span&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;</description><link>http://joncahill.zero41.com/2009/03/enough-with-dvcs-allows-me-to-work-on.html</link><author>noreply@blogger.com (Jon Cahill)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-1989066527286805677</guid><pubDate>Mon, 09 Mar 2009 11:49:00 +0000</pubDate><atom:updated>2009-04-23T01:09:39.907+08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Visual Studio</category><category domain="http://www.blogger.com/atom/ns#">Psychic debugging</category><title>Visual Studio 2008 crashes hard when opening a form in the designer</title><description>&lt;div style="text-align: left"&gt;&lt;span style="font-family: verdana" class="Apple-style-span"&gt;Today I came across a problem where Visual Studio 2008 would crash pretty hard every time I opened a particular form in design mode. This is a Winforms application which has recently been upgraded from .NET 1.1 to .NET 2.0 and this form worked perfectly fine in Visual Studio 2003.&lt;/span&gt;&lt;/div&gt;  &lt;div style="text-align: left"&gt;&lt;span style="font-family: verdana" class="Apple-style-span"&gt;     &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div style="text-align: left"&gt;&lt;span style="font-family: verdana" class="Apple-style-span"&gt;When the crash occurred the following error dialogs would be displayed:&lt;/span&gt;     &lt;br /&gt;&lt;/div&gt;  &lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_KNPkr0KdMAw/SbUQTlT1HVI/AAAAAAAAAB0/E1WF5pJFSnE/s1600-h/Crash2.png"&gt;&lt;img style="text-align: center; margin: 0px auto 10px; width: 320px; display: block; height: 145px; cursor: hand" id="BLOGGER_PHOTO_ID_5311169264172211538" border="0" alt="" src="http://3.bp.blogspot.com/_KNPkr0KdMAw/SbUQTlT1HVI/AAAAAAAAAB0/E1WF5pJFSnE/s320/Crash2.png" /&gt;&lt;/a&gt;   &lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_KNPkr0KdMAw/SbUQTTSkDvI/AAAAAAAAABs/hPEhbZyjj-o/s1600-h/Crash1.png"&gt;&lt;img style="text-align: center; margin: 0px auto 10px; width: 320px; display: block; height: 173px; cursor: hand" id="BLOGGER_PHOTO_ID_5311169259335061234" border="0" alt="" src="http://1.bp.blogspot.com/_KNPkr0KdMAw/SbUQTTSkDvI/AAAAAAAAABs/hPEhbZyjj-o/s320/Crash1.png" /&gt;&lt;/a&gt;   &lt;br /&gt;  &lt;div&gt;&lt;span style="font-family: verdana" class="Apple-style-span"&gt;Not very useful at all and the only errors in the event log say:&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: verdana" class="Apple-style-span"&gt;&lt;/span&gt;&lt;/div&gt;  &lt;blockquote&gt;   &lt;div&gt;&lt;span style="font-family: verdana" class="Apple-style-span"&gt;       &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;    &lt;div&gt;&lt;span style="font-family: verdana" class="Apple-style-span"&gt;The remote debugger is unable to communicate with Visual Studio, and must abort the remote debugging session. Please restart debugging.&lt;/span&gt;&lt;/div&gt; &lt;/blockquote&gt;  &lt;div&gt;&lt;span style="font-family: verdana" class="Apple-style-span"&gt;     &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: verdana" class="Apple-style-span"&gt;Again useless, so it was time to do some psychic debugging!&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: verdana" class="Apple-style-span"&gt;     &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: verdana" class="Apple-style-span"&gt;This particular form inherits from another form which when opened works fine. I have previously read that the designer works by running the constructor of the class your form inherits from, which is why (at least in Visual Studio 2003) the designer can't handle forms which inherit from abstract base classes. So the logical place to start looking was in the constructor of the base form to see if there was anything there that could possibly be causing the crash. But after looking at the pretty simple constructor there was nothing of significance that was likely to cause the crash but I commented it all out anyway and tried again. Just as suspected, no luck.&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: verdana" class="Apple-style-span"&gt;&lt;/span&gt;&lt;span style="font-family: verdana" class="Apple-style-span"&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: verdana" class="Apple-style-span"&gt;I went through removing all child controls to ensure none of those constructors were causing the problem, but again no dice. Frustrated, as this was preventing me from working with a looming deadline no less, it finally dawned on me that perhaps the Load event was being fired and the code there was the problem.&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: verdana" class="Apple-style-span"&gt;     &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;span style="font-family: verdana" class="Apple-style-span"&gt;Opening the Load event of the base form showed the following:&lt;/span&gt;&lt;/div&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;If&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Not&lt;/span&gt; currentTimer &lt;span style="color: #0000ff"&gt;Is&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Nothing&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Then&lt;/span&gt;    &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;     currentTimer.Start()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; If&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div&gt;After commenting this out it all worked fine! Who would have guessed the timer control was causing the problem. I added the following before this code:&lt;/div&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;If&lt;/span&gt; DesignMode &lt;span style="color: #0000ff"&gt;Then&lt;/span&gt;    &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;Return&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; If&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div&gt;and all is good in the world again :) Now back to what I was trying to start a few hours ago.&lt;/div&gt;
&lt;/span&gt;  </description><link>http://joncahill.zero41.com/2009/03/visual-studio-2008-hard-crashes-when.html</link><author>noreply@blogger.com (Jon Cahill)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_KNPkr0KdMAw/SbUQTlT1HVI/AAAAAAAAAB0/E1WF5pJFSnE/s72-c/Crash2.png" height="72" width="72" /><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-6812824342044204088</guid><pubDate>Mon, 09 Mar 2009 08:16:00 +0000</pubDate><atom:updated>2009-03-09T17:24:16.777+09:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">x64</category><category domain="http://www.blogger.com/atom/ns#">.NET Framework</category><title>PrintDialog will not display....continued</title><description>&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;Yesterday I blogged about an issue I was having with the &lt;a href="http://joncahill.zero41.com/2009/03/printdialog-not-displaying-in-net-2-and.html"&gt;PrintDialog not displaying in Vista x64&lt;/a&gt;.&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;After some further research and reading of MSDN (yes I know, RTFM), I came across the following in the remarks section for the &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.printdialog.useexdialog.aspx"&gt;PrintDialog.UseExDialog&lt;/a&gt; documentation:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;&lt;span class="Apple-style-span"   style="  line-height: 15px; font-family:Verdana;font-size:11px;"&gt;&lt;blockquote&gt;When this property is set to &lt;span&gt;&lt;span class="input" style="font-weight: 700; "&gt;true&lt;/span&gt;&lt;/span&gt;, &lt;span&gt;&lt;a id="ctl00_rs1_mainContentContainer_ctl26" onclick="javascript:Track('ctl00_rs1_mainContentContainer_cpe296165_c|ctl00_rs1_mainContentContainer_ctl26',this);" href="http://msdn.microsoft.com/en-us/library/system.windows.forms.printdialog.showhelp.aspx" style="text-decoration: none; color: rgb(0, 51, 204); "&gt;ShowHelp&lt;/a&gt;&lt;/span&gt; and &lt;span&gt;&lt;a id="ctl00_rs1_mainContentContainer_ctl27" onclick="javascript:Track('ctl00_rs1_mainContentContainer_cpe296165_c|ctl00_rs1_mainContentContainer_ctl27',this);" href="http://msdn.microsoft.com/en-us/library/system.windows.forms.printdialog.shownetwork.aspx" style="text-decoration: none; color: rgb(0, 51, 204); "&gt;ShowNetwork&lt;/a&gt;&lt;/span&gt; will be ignored as these properties were made obsolete for Windows 2000 and later versions of Windows. Also, The &lt;span&gt;&lt;a id="ctl00_rs1_mainContentContainer_ctl28" onclick="javascript:Track('ctl00_rs1_mainContentContainer_cpe296165_c|ctl00_rs1_mainContentContainer_ctl28',this);" href="http://msdn.microsoft.com/en-us/library/system.windows.forms.printdialog.aspx" style="text-decoration: none; color: rgb(0, 51, 204); "&gt;PrintDialog&lt;/a&gt;&lt;/span&gt; class may not work on AMD64 microprocessors unless you set the &lt;span&gt;&lt;span class="selflink" style="font-weight: 700; "&gt;UseEXDialog&lt;/span&gt;&lt;/span&gt; property to &lt;span&gt;&lt;span class="input" style="font-weight: 700; "&gt;true&lt;/span&gt;&lt;/span&gt;&lt;/blockquote&gt;&lt;span&gt;&lt;span class="input" style="font-weight: 700; "&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-family:verdana;"&gt;So there is an issue here but it is a documented "feature" so I guess that makes it ok....&lt;/span&gt;&lt;/div&gt;</description><link>http://joncahill.zero41.com/2009/03/printdialog-will-not-displaycontinued.html</link><author>noreply@blogger.com (Jon Cahill)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-5039692207898204041</guid><pubDate>Sun, 08 Mar 2009 15:09:00 +0000</pubDate><atom:updated>2009-03-09T17:11:16.469+09:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">x64</category><category domain="http://www.blogger.com/atom/ns#">.NET Framework</category><title>PrintDialog will not display</title><description>&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;Today I was making changes for a client on an application which has not been deployed since we upgraded it from .NET 1.1 to .NET 2.0, when I stumbled upon a weird issue.&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;At some point this application displays a PrintDialog for the user to select a printer, this was working perfectly before the upgrade to .NET 2.0, afterwards the dialog is never displayed.  Stepping through the code revealed it is not blocking on the call to ShowDialog(), which should be a blocking call, and the DialogResult returned is Cancel.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;After playing around with trial and error for about 1/2 an hour I came across the property UseEXDialog which when set to true solved the problem.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;I have yet to test to see if this issue occurs in Windows XP or Vista 32bit.&lt;/span&gt;&lt;/div&gt;</description><link>http://joncahill.zero41.com/2009/03/printdialog-not-displaying-in-net-2-and.html</link><author>noreply@blogger.com (Jon Cahill)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-6860900003437343555</guid><pubDate>Mon, 23 Feb 2009 08:49:00 +0000</pubDate><atom:updated>2009-02-23T17:52:07.978+09:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">SOLID</category><title>SOLID Development Principles as Motivational Posters</title><description>&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;I &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;have&lt;/span&gt; to get some high quality prints of &lt;a href="http://www.lostechies.com/blogs/derickbailey/archive/2009/02/11/solid-development-principles-in-motivational-pictures.aspx"&gt;these&lt;/a&gt; for the &lt;a href="http://www.zero41.com/"&gt;Zero41&lt;/a&gt; office.&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;They are absolutely fantastic!&lt;/span&gt;&lt;/div&gt;</description><link>http://joncahill.zero41.com/2009/02/solid-development-principles-as.html</link><author>noreply@blogger.com (Jon Cahill)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-835761877881090264</guid><pubDate>Sat, 21 Feb 2009 08:53:00 +0000</pubDate><atom:updated>2009-02-22T11:44:26.779+09:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">rant</category><category domain="http://www.blogger.com/atom/ns#">printers</category><title>An open letter to Epson (And all other printer manufacturers)</title><description>&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;Dear Epson (And all other printer manufacturers),&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:verdana;"&gt;Please provide downloadable packages which contains only the drivers for your printers.  It is not good enough to provide a PDF saying the drivers are baked into Windows, as is the case with my AcuLaser C1100 laser printer.  I have a scenario where I want to install my printer on a windows install which does not have the drivers (Windows Server 2008 Core, I intended to use the Vista drivers) and I should be able to get access to the drivers for my printer.  I am not asking for support on Windows Server 2008 Core, I just want the ability to do what I want with my printer.  You should provide me with the drivers to work the printer I purchased off you.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: verdana;"&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: verdana; "&gt;Also just because I purchase your printer does not mean I want to use your bloated software, which does not provide me anything that I would use, just to install the drivers.&lt;/span&gt;
&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: verdana;"&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: verdana;"&gt;Regards,&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: verdana;"&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: verdana;"&gt;Jon&lt;/span&gt;&lt;/div&gt;</description><link>http://joncahill.zero41.com/2009/02/open-letter-to-epson-and-all-other.html</link><author>noreply@blogger.com (Jon Cahill)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-22451229.post-7739923830437293018</guid><pubDate>Thu, 19 Feb 2009 14:22:00 +0000</pubDate><atom:updated>2009-04-23T00:04:20.325+08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">javascript</category><title>Javascript and the power of prototyping</title><description>Recently I have started work on a new project for &lt;a href="http://www.zero41.com/"&gt;Zero41&lt;/a&gt; which will make heavy use of javascript, so I have had to learn some of it's ins and outs.&amp;#160; The first problem I came up against is that there is no way to determine if a text area has focus.&amp;#160;&amp;#160; &lt;div&gt;   &lt;br /&gt;&lt;/div&gt;  &lt;div&gt;In a more traditional language like C#, Java etc you would be screwed and have to somehow manage this by &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-corrected"&gt;sub classing&lt;/span&gt; the control, hooking into the focus and lost focus events to flick a &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-error"&gt;HasFocus&lt;/span&gt; &lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;boolean&lt;/span&gt; flag.&amp;#160; Even worse you could just hook into the focus and lost focus events and store the &lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;HasFocus&lt;/span&gt; flag in a &lt;span id="SPELLING_ERROR_4" class="blsp-spelling-error"&gt;KeyValue&lt;/span&gt; pair collection.&amp;#160; Either way is a bit painful and somewhat messy.&lt;/div&gt;  &lt;div&gt;   &lt;br /&gt;&lt;/div&gt;  &lt;div&gt;Javascript on the other hand is a prototype-based language, which basically means there are no classes and instead you build up your objects through prototypes.&amp;#160; This means you will define a &amp;quot;class&amp;quot; like so:&lt;/div&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;//The constructor for the class  &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; SomeThing()  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; {  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//A field for the class  &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.value = 100;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;     &lt;span style="color: #008000"&gt;//A method on the class  &lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.AMethod = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt;()  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;     {  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;         alert(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.value);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;     };&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;  }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div&gt;You can also add additional methods after an instance has been created like so:&lt;/div&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; instance = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SomeThing()        &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; instance.AMethod();        &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; instance.DiffentMethod = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt;()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     alert(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.value + 1);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt; };&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div&gt;Once we know this we can go back and solve the initial problem I was having where we cannot determine if a text area has focus.&amp;#160; We can add a field to each text area and then bind to the focus and blur events of each text area to update this field.&amp;#160; This is made even more simple when using a javascript framework like such as &lt;a href="http://jquery.com/"&gt;&lt;span id="SPELLING_ERROR_10" class="blsp-spelling-error"&gt;jQuery&lt;/span&gt;&lt;/a&gt;.&amp;#160; To do this in &lt;span id="SPELLING_ERROR_11" class="blsp-spelling-error"&gt;jQuery&lt;/span&gt; we only need the following three lines of code:&lt;/div&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; $(textarea).each(&lt;span style="color: #0000ff"&gt;function&lt;/span&gt;() { &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.hasFocus = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;; });&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; $(textarea).focus(&lt;span style="color: #0000ff"&gt;function&lt;/span&gt;() { &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.hasFocus = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt; })&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;            .blur(&lt;span style="color: #0000ff"&gt;function&lt;/span&gt;() { &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.hasFocus = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt; });&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div&gt;
  &lt;div&gt;The first line sets the &lt;span id="SPELLING_ERROR_17" class="blsp-spelling-error"&gt;hasFocus&lt;/span&gt; field on each text area to false, this adds the field to each text area.&amp;#160; The second line adds the event handlers to focus and blur to update the &lt;span id="SPELLING_ERROR_18" class="blsp-spelling-error"&gt;hasFocus&lt;/span&gt; appropriately.

    &lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div&gt;And that is it!&amp;#160; &lt;span id="SPELLING_ERROR_19" class="blsp-spelling-error"&gt;Javascripts&lt;/span&gt; being prototype based makes extending existing objects a very quick and simple task to do, once you get your head around it first :)&lt;/div&gt;  </description><link>http://joncahill.zero41.com/2009/02/javascript-and-prototyping.html</link><author>noreply@blogger.com (Jon Cahill)</author><thr:total>1</thr:total></item></channel></rss>
