<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7047850462274259068</id><updated>2011-11-27T15:21:21.094-08:00</updated><category term='c#'/><category term='LINQ'/><category term='WebOrb'/><category term='jQuery'/><category term='PowerShell'/><category term='scalability'/><category term='MSpec'/><category term='security'/><category term='craftsmanship'/><category term='Machine.Specifications'/><category term='internet'/><category term='NHibernate'/><category term='Flex'/><category term='IOC'/><category term='Windows'/><category term='MSBuild'/><category term='risk'/><category term='TortoiseSVN'/><category term='upgrades'/><category term='Automation'/><category term='Leopard'/><category term='subversion'/><category term='extension methods'/><category term='browsers'/><title type='text'>Still Pearling</title><subtitle type='html'>eating sand, writing code</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>26</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-2030305402676469822</id><published>2010-12-03T01:37:00.001-08:00</published><updated>2010-12-04T19:54:45.526-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Automation'/><category scheme='http://www.blogger.com/atom/ns#' term='MSBuild'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerShell'/><title type='text'>Automation</title><content type='html'>I've been intending to do this one for a while now. Build automation. Personally I try to automate wherever I can. I'm not at the level of &lt;a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET"&gt;CruiseControl(.Net)&lt;/a&gt; because frankly the shops where I've worked to date have only a fledgling Agile practice.&lt;br&gt;&lt;br&gt;A little while back I stepped into a project where there was no automation. Releases were fairly haphazard and required a lot of tweaking to install into each deployment environment. A bigger issue was the amount of effort required to regenerate the &lt;a href="http://nettiers.com/default.aspx?AspxAutoDetectCookieSupport=1"&gt;.netTiers&lt;/a&gt; data/service layers when a column was added to a table. To be effective this stuff needs to be a push button exercise. In this project there was so much deferred maintenance on the templates it could take a day of manual tweaks to apply the necessary changes to the generated code before it would successfully compile - this was occurring instead of applying those changes to the actual templates that generated the code. And you should be familiar with how accurate and error-free tweaking generated code manually is right? I'm rambling, the moral of the story is that automation salves a myriad of ills and improves not only your ability to do your job but delivering installers that reliably install your application also vastly improves your relationship with the people responsible for looking after the servers your application runs on.&lt;br&gt;&lt;br&gt;So this first post is to promote and for future reference record the sheer usefulness of PowerShell for getting your wares to where they need to be. Recently I've been refactoring a special application that keeps its data in XML files instead of, I don't know, an actual database? And for my first trick I need to separate one "manual" into two. Fortunately PowerShell knows XML in a very cool way. Time to look at a little code.&lt;br&gt;&lt;br&gt; &lt;blockquote&gt;&lt;br&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: 'Courier New', 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: 'Courier New', 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; # update manuals.xml&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: 'Courier New', 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; update_manual_xml {&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: 'Courier New', 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;     $docFile =  Join-Path $APP_DATA &lt;span style="color: #006080"&gt;"manuals.xml"&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: 'Courier New', 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;     Write-Host &lt;span style="color: #006080"&gt;"Updating $docFile"&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: 'Courier New', 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;nbsp; &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: 'Courier New', 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;span style="color: #0000ff"&gt;if&lt;/span&gt; (test-path $docFile)&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: 'Courier New', 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: 'Courier New', 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;         $doc = [xml](Get-Content $docFile)&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: 'Courier New', 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: 'Courier New', 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;         $eisaXml = $doc.manuals.manual | Where-Object { $_.code -eq &lt;span style="color: #006080"&gt;"eisa"&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: 'Courier New', 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;         $eiAdminEmail = $eisaXml.sections.section[0].GetAttribute(&lt;span style="color: #006080"&gt;"AdminEmail"&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: 'Courier New', 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;         $snAdminEmail = $eisaXml.sections.section[1].GetAttribute(&lt;span style="color: #006080"&gt;"AdminEmail"&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: 'Courier New', 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;&amp;nbsp; &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: 'Courier New', 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="lnum14"&gt;  14:&lt;/span&gt;         [xml]$ei = &lt;span style="color: #006080"&gt;'&amp;lt;manual AdminEmail="'&lt;/span&gt; + $eiAdminEmail + &lt;span style="color: #006080"&gt;'" HideEffectiveDate="true"&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: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', 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="lnum15"&gt;  15:&lt;/span&gt;                         &amp;lt;code&amp;gt;ei&amp;lt;/code&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: 'Courier New', 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="lnum16"&gt;  16:&lt;/span&gt;                         &amp;lt;title&amp;gt;Manual Title&amp;lt;/title&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: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', 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="lnum17"&gt;  17:&lt;/span&gt;                         &amp;lt;homePageText&amp;gt;&amp;lt;![CDATA[Manual description]]&amp;gt;&amp;lt;/homePageText&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: 'Courier New', 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="lnum18"&gt;  18:&lt;/span&gt;                         &amp;lt;sections&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: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', 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="lnum19"&gt;  19:&lt;/span&gt;                             &amp;lt;section&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: 'Courier New', 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="lnum20"&gt;  20:&lt;/span&gt;                                 &amp;lt;number&amp;gt;1&amp;lt;/number&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: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', 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="lnum21"&gt;  21:&lt;/span&gt;                                 &amp;lt;title&amp;gt;Section Title&amp;lt;/title&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: 'Courier New', 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="lnum22"&gt;  22:&lt;/span&gt;                             &amp;lt;/section&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: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', 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="lnum23"&gt;  23:&lt;/span&gt;                         &amp;lt;/sections&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: 'Courier New', 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="lnum24"&gt;  24:&lt;/span&gt;                     &amp;lt;/manual&amp;gt;'&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: 'Courier New', 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="lnum25"&gt;  25:&lt;/span&gt;         [xml]$sn = &lt;span style="color: #006080"&gt;'&amp;lt;manual AdminEmail="'&lt;/span&gt; + $snAdminEmail + &lt;span style="color: #006080"&gt;'" HideEffectiveDate="true"&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: 'Courier New', 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="lnum26"&gt;  26:&lt;/span&gt;                         &amp;lt;code&amp;gt;sn&amp;lt;/code&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: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', 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="lnum27"&gt;  27:&lt;/span&gt;                         &amp;lt;title&amp;gt;Another Manual Title&amp;lt;/title&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: 'Courier New', 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="lnum28"&gt;  28:&lt;/span&gt;                         &amp;lt;homePageText&amp;gt;&amp;lt;![CDATA[And description]]&amp;gt;&amp;lt;/homePageText&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: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', 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="lnum29"&gt;  29:&lt;/span&gt;                         &amp;lt;sections&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: 'Courier New', 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="lnum30"&gt;  30:&lt;/span&gt;                             &amp;lt;section&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: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', 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="lnum31"&gt;  31:&lt;/span&gt;                                 &amp;lt;number&amp;gt;1&amp;lt;/number&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: 'Courier New', 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="lnum32"&gt;  32:&lt;/span&gt;                                 &amp;lt;title&amp;gt;Section Title&amp;lt;/title&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: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', 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="lnum33"&gt;  33:&lt;/span&gt;                             &amp;lt;/section&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: 'Courier New', 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="lnum34"&gt;  34:&lt;/span&gt;                         &amp;lt;/sections&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: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', 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="lnum35"&gt;  35:&lt;/span&gt;                     &amp;lt;/manual&amp;gt;'&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: 'Courier New', 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="lnum36"&gt;  36:&lt;/span&gt;         $eiMan = $doc.ImportNode($ei.manual, $&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: 'Courier New', 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="lnum37"&gt;  37:&lt;/span&gt;         $doc.manuals.AppendChild($eiMan)&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: 'Courier New', 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="lnum38"&gt;  38:&lt;/span&gt;         $snMan = $doc.ImportNode($sn.manual, $&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: 'Courier New', 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="lnum39"&gt;  39:&lt;/span&gt;         $doc.manuals.AppendChild($snMan)&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: 'Courier New', 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="lnum40"&gt;  40:&lt;/span&gt;         $doc.manuals.RemoveChild($eisaXml)&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: 'Courier New', 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="lnum41"&gt;  41:&lt;/span&gt;         $doc.Save($docFile)&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: 'Courier New', 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="lnum42"&gt;  42:&lt;/span&gt;     } &lt;span style="color: #0000ff"&gt;else&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: 'Courier New', 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="lnum43"&gt;  43:&lt;/span&gt;         Write-Host &lt;span style="color: #006080"&gt;"File not found: $docFile"&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: 'Courier New', 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="lnum44"&gt;  44:&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: 'Courier New', 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="lnum45"&gt;  45:&lt;/span&gt; }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;br&gt;&lt;br&gt;How great is that? Working with XML in PowerShell is easy. I'm not going to claim I'm writing great code here. More like just enough to get a one off upgrade sorted. The script should be largely self-explanatory but in case you’re after a little more detail I’ll go through the important bits. In line 3 I’m putting together the path to the manuals XML file using the &lt;em&gt;Join-Path&lt;/em&gt; function. In this case the path is different for every location – in Test it’s on the C:\ drive, in Production it’s E:\ so for each case I load &lt;em&gt;$APP_DATA&lt;/em&gt; to point to the website’s &lt;em&gt;App_Data&lt;/em&gt; directory which is where the XML files are stored.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Line 6, it’s always good to check the file exists before trying to use it. Then the meat course in line 8, load all that XML into something I can manipulate, using &lt;em&gt;[xml]&lt;/em&gt; to convert the file contents into an XML DOM object. In line 10 I’m looking for an &lt;em&gt;&amp;lt;eisa /&amp;gt;&lt;/em&gt; element which contains the two manuals I need to separate. In lines 14 and 25 I’m creating the XML for the new manuals. And finally lines 36 – 40 where I import the new manuals and remove the manual I’m replacing.&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;Installers&lt;/h3&gt;&lt;br /&gt;&lt;p&gt;I also like to produce installers for each of the environments where I need to deploy an application. In my next post I'm going to document some MSBuild code to automate building an app for each configuration. Once those installers are built I use PowerShell to put them where the tech guys expect them to be, including creating the correct directory structure based on the application version number defined in Web.config:&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;div id="codeSnippetWrapper"&gt;&lt;br /&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: 'Courier New', 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: 'Courier New', 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; $cwm = &lt;span style="color: #006080"&gt;"D:\Work\AppRoot\"&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: 'Courier New', 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; $cwmPackages = Join-Path $cwm "&lt;/span&gt;ProjectRoot\obj&lt;span style="color: #006080"&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: 'Courier New', 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; $newVersions = "&lt;/span&gt;\\192.168.1.123\repo\&lt;span style="color: #006080"&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: 'Courier New', 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; $environments = @{ Path = "&lt;/span&gt;Staging&lt;span style="color: #006080"&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: 'Courier New', 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;                 @{ Path = "&lt;/span&gt;Development&lt;span style="color: #006080"&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: 'Courier New', 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;                 @{ Path = "&lt;/span&gt;Test&lt;span style="color: #006080"&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: 'Courier New', 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;                 @{ Path = "&lt;/span&gt;Production&lt;span style="color: #006080"&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: 'Courier New', 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: 'Courier New', 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; function get_version {&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: 'Courier New', 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;     $webConfig = Join-Path $cwm "&lt;/span&gt;Web.config&lt;span style="color: #006080"&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: 'Courier New', 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;     Write-Host "&lt;/span&gt;Web.config $webConfig&lt;span style="color: #006080"&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: 'Courier New', 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;     if (-not(test-path $webConfig)) {&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: 'Courier New', 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;         Write-Host("&lt;/span&gt;Can&lt;span style="color: #006080"&gt;'t locate Web.config")&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: 'Courier New', 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="lnum14"&gt;  14:&lt;/span&gt;         exit&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: 'Courier New', 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="lnum15"&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; font-family: 'Courier New', 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="lnum16"&gt;  16:&lt;/span&gt;&amp;nbsp; &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: 'Courier New', 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="lnum17"&gt;  17:&lt;/span&gt;     $configDoc = [xml](Get-Content $webConfig)&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: 'Courier New', 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="lnum18"&gt;  18:&lt;/span&gt;     $webVersionXml = $configDoc.configuration.appSettings.add | Where-Object { $_.key -eq "Version" }&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: 'Courier New', 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="lnum19"&gt;  19:&lt;/span&gt;     return $webVersionXml.GetAttribute("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: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', 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="lnum20"&gt;  20:&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: 'Courier New', 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="lnum21"&gt;  21:&lt;/span&gt;&amp;nbsp; &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: 'Courier New', 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="lnum22"&gt;  22:&lt;/span&gt; function create_new_version_folders {&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: 'Courier New', 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="lnum23"&gt;  23:&lt;/span&gt;     $deployPath = Join-Path $newVersions $webVersion&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: 'Courier New', 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="lnum24"&gt;  24:&lt;/span&gt;     if (-not(test-path $deployPath)) {&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: 'Courier New', 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="lnum25"&gt;  25:&lt;/span&gt;         mkdir $deployPath &amp;gt; $null&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: 'Courier New', 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="lnum26"&gt;  26:&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: 'Courier New', 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="lnum27"&gt;  27:&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: 'Courier New', 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="lnum28"&gt;  28:&lt;/span&gt;     # create subfolders&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: 'Courier New', 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="lnum29"&gt;  29:&lt;/span&gt;     foreach ($target in $environments) {&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: 'Courier New', 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="lnum30"&gt;  30:&lt;/span&gt;         $targetPath = Join-Path $deployPath $target.Path&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: 'Courier New', 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="lnum31"&gt;  31:&lt;/span&gt;         if (-not(test-path $targetPath)) {&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: 'Courier New', 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="lnum32"&gt;  32:&lt;/span&gt;             mkdir $targetPath &amp;gt; $null&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: 'Courier New', 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="lnum33"&gt;  33:&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: 'Courier New', 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="lnum34"&gt;  34:&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: 'Courier New', 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="lnum35"&gt;  35:&lt;/span&gt;&amp;nbsp; &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: 'Courier New', 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="lnum36"&gt;  36:&lt;/span&gt;     return $deployPath&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: 'Courier New', 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="lnum37"&gt;  37:&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: 'Courier New', 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="lnum38"&gt;  38:&lt;/span&gt;&amp;nbsp; &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: 'Courier New', 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="lnum39"&gt;  39:&lt;/span&gt; function copy_package {&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: 'Courier New', 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="lnum40"&gt;  40:&lt;/span&gt;     Param($deployPath)&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: 'Courier New', 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="lnum41"&gt;  41:&lt;/span&gt;&amp;nbsp; &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: 'Courier New', 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="lnum42"&gt;  42:&lt;/span&gt;     if (-not(test-path $cwmPackages)) {&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: 'Courier New', 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="lnum43"&gt;  43:&lt;/span&gt;         Write-Host("Can'&lt;/span&gt;t locate packages&lt;span style="color: #006080"&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: 'Courier New', 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="lnum44"&gt;  44:&lt;/span&gt;         exit&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: 'Courier New', 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="lnum45"&gt;  45:&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: 'Courier New', 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="lnum46"&gt;  46:&lt;/span&gt;&amp;nbsp; &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: 'Courier New', 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="lnum47"&gt;  47:&lt;/span&gt;     foreach ($target in $environments) {&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: 'Courier New', 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="lnum48"&gt;  48:&lt;/span&gt;         $sourcePath = Join-Path $cwmPackages ($target.Path + "&lt;/span&gt;\Package&lt;span style="color: #006080"&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: 'Courier New', 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="lnum49"&gt;  49:&lt;/span&gt;         $targetPath = Join-Path $deployPath $target.Path&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: 'Courier New', 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="lnum50"&gt;  50:&lt;/span&gt;         $targetTemp = Join-Path $targetPath "&lt;/span&gt;\Package\PackageTmp&lt;span style="color: #006080"&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: 'Courier New', 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="lnum51"&gt;  51:&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: 'Courier New', 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="lnum52"&gt;  52:&lt;/span&gt;         Write-Host "&lt;/span&gt;Copying package to $targetPath&lt;span style="color: #006080"&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: 'Courier New', 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="lnum53"&gt;  53:&lt;/span&gt;         cp $sourcePath $targetPath -Force -recurse&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: 'Courier New', 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="lnum54"&gt;  54:&lt;/span&gt;         rm $targetTemp -Force -recurse&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: 'Courier New', 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="lnum55"&gt;  55:&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: 'Courier New', 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="lnum56"&gt;  56:&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: 'Courier New', 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="lnum57"&gt;  57:&lt;/span&gt;&amp;nbsp; &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: 'Courier New', 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="lnum58"&gt;  58:&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: 'Courier New', 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="lnum59"&gt;  59:&lt;/span&gt; # Main&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: 'Courier New', 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="lnum60"&gt;  60:&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: 'Courier New', 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="lnum61"&gt;  61:&lt;/span&gt; Write-Host "&lt;/span&gt;Using path $cwm&lt;span style="color: #006080"&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: 'Courier New', 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="lnum62"&gt;  62:&lt;/span&gt; push-location $cwm&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: 'Courier New', 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="lnum63"&gt;  63:&lt;/span&gt;&amp;nbsp; &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: 'Courier New', 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="lnum64"&gt;  64:&lt;/span&gt; # 1. Get version from web config e.g. &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: 'Courier New', 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="lnum65"&gt;  65:&lt;/span&gt; $webVersion = get_version&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: 'Courier New', 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="lnum66"&gt;  66:&lt;/span&gt; Write-Host "&lt;/span&gt;WebsiteVersion: $webVersion"&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: 'Courier New', 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="lnum67"&gt;  67:&lt;/span&gt;&amp;nbsp; &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: 'Courier New', 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="lnum68"&gt;  68:&lt;/span&gt; # 2. Create &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; version folder &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; not exists&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: 'Courier New', 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="lnum69"&gt;  69:&lt;/span&gt; $deployPath = create_new_version_folders&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: 'Courier New', 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="lnum70"&gt;  70:&lt;/span&gt;&amp;nbsp; &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: 'Courier New', 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="lnum71"&gt;  71:&lt;/span&gt; # 3. Copy package&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: 'Courier New', 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="lnum72"&gt;  72:&lt;/span&gt; copy_package $deployPath&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: 'Courier New', 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="lnum73"&gt;  73:&lt;/span&gt;&amp;nbsp; &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: 'Courier New', 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="lnum74"&gt;  74:&lt;/span&gt; # &lt;span style="color: #0000ff"&gt;finally&lt;/span&gt; reset path&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: 'Courier New', 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="lnum75"&gt;  75:&lt;/span&gt; pop-location&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: 'Courier New', 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="lnum76"&gt;  76:&lt;/span&gt; exit&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;p&gt;&lt;br&gt;&lt;br&gt;In the first couple of lines I’m declaring where to find the packages and a list of the configurations that target each of the different deployment environments. In line 9 is my function to retrieve the current version number from Web.config, again using the PowerShell [xml] facility. &lt;em&gt;create_new_version_folders&lt;/em&gt; in line 22 does what its name suggests and creates the file structure where the installers will end up. And finally&lt;em&gt; copy_package&lt;/em&gt; copies each installer to the correct location in the new directory structure.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;For other projects I modify this script to copy e.g SQL scripts used to update the database for a particular version of the application. This can include modifying the SQL to match up any linked servers used in a particular deployment environment.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;The amount of time that saves me is significant and makes my day just a little bit better each time. The converse is also true, whenever I find myself having to do something manually more than once I curse myself for not having spent the time to automate it the first time.&lt;br&gt;&lt;/p&gt;&lt;br /&gt;&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:34f81d18-c32a-45a7-9c2b-533895b66b3f" class="wlWriterEditableSmartContent"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/PowerShell" rel="tag"&gt;PowerShell&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Automation" rel="tag"&gt;Automation&lt;/a&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-2030305402676469822?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/2030305402676469822/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=2030305402676469822' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/2030305402676469822'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/2030305402676469822'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2010/12/automation.html' title='Automation'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-5695805853068069454</id><published>2010-11-17T02:00:00.001-08:00</published><updated>2010-11-17T02:00:51.167-08:00</updated><title type='text'>Pain Points</title><content type='html'>Over at &lt;a href="http://msjoe.com/blog/posts/35-developer-learning-pain-points/"&gt;ms-joe&lt;/a&gt; Joe has a compiled a list of pain points that developers have suggested typically give concern when trying to stay on top of all the new and exciting stuff that pours out of Redmond and other forges. I don't normally follow Joe's blog and I got there I think from &lt;a href="http://www.alvinashcraft.com/"&gt;Alvin Ashcraft's Morning Dew&lt;/a&gt;. Whatever, I took it upon myself to, tongue somewhat in cheek, respond to the 35 items in the list. Clearly my response didn't pass moderation - it appeared briefly but was pulled almost straight away. Fair enough, I'm not about to take umbrage but I did feel that what I had to say might at least generate some feedback. I didn't save my original response so now I get to do it over. The items are copied from Joe's site and I'm not sure if I'm breaking any copyright rules by posting but I am giving full attribution to Joe for the questions. The responses/opinions are all mine.   &lt;br /&gt;&lt;br /&gt;1.) Choosing between Web Forms, MVC, WebMatrix or something else entirely.&lt;br /&gt;&lt;br /&gt;Real developers use MVC. If, like me, you are presently stuck with legacy Web Forms I feel your pain. MVC is the future and it is a huge improvement over Web Forms. I understand WebMatrix to be targeted at hobbiest devs who might more traditionally have gravitated towards Access.&lt;br /&gt;&lt;br /&gt;2.) Choose Windows Forms, WPF, Silverlight or something else for desktop development. &lt;br /&gt;&lt;br /&gt;WPF. I make this assertion not from experience with either WPF or Silverlight but long experience with Windows Forms. At this point there is enough of a question mark over Silverlight that I wouldn't go there and it is hampered for the desktop by it's sandboxing. For me the future lies with HTML5 and in particular the mobile space. HTML5, CSS, JavaScript, jQTouch, WebKit provide a natural cross platform environment for mobile development. There are only a couple of cross platform options in this space, it just makes sense.&lt;br /&gt;&lt;br /&gt;3.) Choosing a data access method (ADO.NET, LINQ to Objects, LINQ to SQL, Entity Framework, NHibernate, embedded SQL) and how to use that choice in application architecture. What are the good practices, should I use binding? Etc.?&lt;br /&gt;&lt;br /&gt;For small projects use LINQ to SQL, for large projects use LINQ to EF. In both cases use DTOs between layer boundaries. There are other players in this space including LightSpeed, SubSonic, NHibernate (stay away from NetTiers). Choosing an ORM is a difficult choice, and there are plenty of good options. If you have a clear separation between your business logic and data access layers then you should at least have some ability to revisit that choice but in reality I haven't seen anyone change ORMs mid-project.&lt;br /&gt;&lt;br /&gt;4.) Choosing between ASMX or WCF (When SHOULD I use WCF)&lt;br /&gt;&lt;br /&gt;You should always use WCF, WCF is good.&lt;br /&gt;&lt;br /&gt;5.) Determining the right practices and patterns for asp.net development.&lt;br /&gt;&lt;br /&gt;See item 1. I like REST, MVC, and AJAX via jQuery. This stuff works and provides a good separation between your different layers. I'm just now putting the finishing touches to an iPhone app written in HTML5/jQTouch/jQuery that uses JSON to talk to a WCF REST service hosted in IIS with an EF/SQL Server data store. It all seems very natural although I'm sure the Ruby community might have words to say about that claim.&lt;br /&gt;&lt;br /&gt;6.) Finding examples of non-trivial applications with great documentation and tutorials.&lt;br /&gt;&lt;br /&gt;TekPub. I find I'm fairly constrained in the time I have available to look at new stuff and I like to read so I tend to pick and choose and I rely on StackOverflow if I'm stuck on something specific.&lt;br /&gt;&lt;br /&gt;7.) How to build, consume, and manage Reusable Code (Libraries, Frameworks, Controls).&lt;br /&gt;&lt;br /&gt;Read &lt;a href="http://www.manning.com/seemann/"&gt;Dependency Injection in .Net&lt;/a&gt;. I'm supposed to be writing a review for it but those darn time constraints keep getting in the way. I'm about halfway done and despite already having experience with DI/IOC I am learning plenty. Again, the Ruby community have words to share on DI but if you're doing c# you owe it to yourself to read this, it will inform your code and app design.&lt;br /&gt;&lt;br /&gt;8.) Microsoft guidance focuses on HOW, but not when and why. Proved “Best Practices”.&lt;br /&gt;&lt;br /&gt;See item 7.&lt;br /&gt;&lt;br /&gt;9.) Moving from WebForms Controls to JavaScript (jQuery) (How, Why, and When to choose which.)&lt;br /&gt;&lt;br /&gt;If you're not familiar with JavaScript you need to spend some time learning the basics. I think &lt;a href="http://tekpub.com/"&gt;TekPub&lt;/a&gt; has some good JS stuff and there are a number of good books. For a .Netter JS contains some surprises. Doug Crockford's &lt;a href="http://www.amazon.com/exec/obidos/ASIN/0596517742/wrrrldwideweb"&gt;JavaScript: The Good Parts&lt;/a&gt; is a good read that will set you up to avoid some of those traps.&lt;br /&gt;&lt;br /&gt;In many ways moving from WebForms to jQuery is going to put you a lot closer to the wire than you might have been used to. I like that, ymmv. I really disliked how the MS tooling in WebForms was all about trying to abstract away the browser. If you followed the prescription then everything was ok, but if you wanted to to something outside that it all seemed to get very hard. There is no question there is a learning curve associated with moving to MVC and jQuery but it will tend to make sense. With Web Forms the learning curve was all about how to get around the limitations of the abstraction.&lt;br /&gt;&lt;br /&gt;10.) Show me how to do Grids and all other WeForms control functions in jQuery.&lt;br /&gt;&lt;br /&gt;Check out &lt;a href="Encosia.com"&gt;Encosia&lt;/a&gt; and working with jQuery templates. &lt;br /&gt;&lt;br /&gt;11.) Should I choose jQuery or ASP.NET AJAX (and how do I use jQuery to do all the things that I used to do in ASP.NET AJAX and the Ajax Control Toolkit.&lt;br /&gt;&lt;br /&gt;Choose jQuery and refer to item 10.&lt;br /&gt;&lt;br /&gt;12.) Deciding whether to use Silverlight in an ASP.Net app.&lt;br /&gt;&lt;br /&gt;Avoid Silverlight for the web. Like Flash it is not web friendly, it is not search engine friendly. I know of a bank that is using it for an intranet app and they are pleased with it so it does have a place and being able to use your existing C# skills is a plus.&lt;br /&gt;&lt;br /&gt;13.) Complete guidance on REST with samples of working will all major REST APIs (Twitter, Facebook, etc.)&lt;br /&gt;&lt;br /&gt;That's a tall order. I haven't looked for REST guidance for a while. There is some good stuff out there and the basics are simple. Use uri's to identify your resources, POST = Create, GET = Read, PUT = Update, DELETE = Delete.&lt;br /&gt;&lt;br /&gt;14.) How to do OO Design &amp; Coding with .NET (I never really had to learn)&lt;br /&gt;&lt;br /&gt;See item 7.&lt;br /&gt;&lt;br /&gt;15.) Changing our development practices to follow more of a TDD model.&lt;br /&gt;&lt;br /&gt;Read Uncle Bob's Agile Principles, Patterns, and Practices in C#. Prentice Hall. 2006&lt;br /&gt;&lt;br /&gt;16.) Source code management tool options. VSTS and cheaper solutions (CVN)&lt;br /&gt;&lt;br /&gt;How big is your shop and how deep are your pockets? SVN (including TortoiseSVN for explorer integration and AnkhSVN for Visual Studio integration) is a good free option, VSTS is also a good option but I think it is still the case that if you want to go over the 5 CALs that come with your MSDN subscription you're in for a hefty bill over and above what you're already paying for MSDN. I haven't used Git but I'm considering it to get my source into an offsite repository. Avoid CVS.&lt;br /&gt;&lt;br /&gt;17.) How do implement a true and Abstract DAL&lt;br /&gt;&lt;br /&gt;Item 7, use DTOs &lt;br /&gt;&lt;br /&gt;18.) How to build a good BLL with validation (required fields, etc...) in front of an Entity Framework DAL.&lt;br /&gt;&lt;br /&gt;If you have abstracted your DAL then the fact you're using EF is irrelevant.&lt;br /&gt;&lt;br /&gt;19.) I need a complete strategy for SEO. Microsoft has some tools, but no complete story!&lt;br /&gt;&lt;br /&gt;Your basic strategy for SEO is to write quality validating HTML that the crawlers can index. Everything else is snake oil.&lt;br /&gt;&lt;br /&gt;20.) How do I design and build for high performance and how to I troubleshoot performance problems.&lt;br /&gt;&lt;br /&gt;If you're Facebook you've got a team working on this for you. Otherwise design and build using what you already know. If you find there are performance issues, capture timing information by inserting NLog logging statements at suspected bottlenecks. There are other tools available, including a logging tool that can be applied without having to rebuild your app but I've not used it and I can't remember its name right now. There are also code profiling tools that can help but the basics are to start thinking about where the bottleneck might be and trying to prove it by judicious use of logging. Don't assume. Don't make random changes to your application based on where you think the issue might lie.&lt;br /&gt;&lt;br /&gt;21.) Understanding stateless application development. WebForms handled “state” for me. MVC and WebMatrix don’t.&lt;br /&gt;&lt;br /&gt;I'm not sure I understand the issue here. Is it the remembered state of controls or session state? Either way I don't feel knowledgable enough to give technical guidance but frankly this is web 101 stuff and you're a smart individual, google it. &lt;br /&gt;&lt;br /&gt;22.) Building a business case for management to migrate a Classic ASP (VBScript) (90% of app) to ASP.Net MVC instead of ASP.Net WebForms (10% of app).&lt;br /&gt;&lt;br /&gt;Don't kid yourself, this is not a migration, it is a rewrite either way. What are the advantages of MVC? For a developer a huge bonus is the testability and if you're rewriting an existing app you really want to make sure you capture those existing business rules in a test suite. Did I mention MVC produces better quality HTML and how, in turn, good quality HTML is better for SEO? &lt;br /&gt;&lt;br /&gt;23.) Building a business case for migrating Classic ASP to ASP.Net (Choosing MVC or WebForms)&lt;br /&gt;&lt;br /&gt;See item 22 above. Getting off Classic is also about dwindling skill-sets, support costs, and security.&lt;br /&gt;&lt;br /&gt;24.) How to understand and get started with ASP.NET MVC. (I’ve been an ASP.NET developer for years and have looked at the MVC samples but it’s too complex and requires advanced OO skills.)&lt;br /&gt;&lt;br /&gt;Hello world! Sheesh...&lt;br /&gt;&lt;br /&gt;25.) Application deployment is a mess. Which versions of .NET, IIS, SQL ? How to automate deployment? What works side-by-side? How to manage SQL schema updates.&lt;br /&gt;&lt;br /&gt;Latest .Net Framework absolutely. Same if possible for IIS and SQL Server. We're past version 1.0 issues with MS. Sure there will be edge cases but on the whole it's a solid platform. For packaging and deployment use the newest options and automate your build using MSBuild and PowerShell. Always automate your build.&lt;br /&gt;&lt;br /&gt;26.) Should I use Stored Procedures or not now that we have LINQ and EF? How do I manage versioning of Stored Procs if I use them.&lt;br /&gt;&lt;br /&gt;Use Stored Procs when it makes sense to do so, e.g. I recently wrote a SP to use a recursive CTE to flatten hierarchical parent/child relationships in a table - easy for a SP, more complex in code. Otherwise use the ORM, that is what it is for.&lt;br /&gt;&lt;br /&gt;27.) I need to understand and use the ASP.Net security model, providers, etc.&lt;br /&gt;&lt;br /&gt;Good luck with that. If you just remember that MS tooling is mostly about authenticating users against a MS credential store, i.e AD, you should be OK. Sometimes things aren't what they appear to be.&lt;br /&gt;&lt;br /&gt;28.) I need to understand How the .net framework versions work (and don't work) together.&lt;br /&gt;&lt;br /&gt;Assume they do, you will probably be correct.&lt;br /&gt;&lt;br /&gt;29.) I need detailed guidance about how to make my (web) application multi lingual. Should I use resource files, a SQL Database?&lt;br /&gt;&lt;br /&gt;I don't know but I would lean towards resource files unless your requirements are very complex.&lt;br /&gt;&lt;br /&gt;30.) ASP.NET Membership and Profile management is far too weak. Show my how to take both to the next level and highly customize them.&lt;br /&gt;&lt;br /&gt;If you stop drinking the koolaid you're on your own. Not really, &lt;br /&gt;check codeplex or other OSS, someone has done this already. &lt;br /&gt;&lt;br /&gt;31.) My team has major confusion over dataset binding in controls versus lists / listview, use of business objects and all the choices. Which controls are best to use for what user interface types and what is the best way to use data with those controls.&lt;br /&gt;&lt;br /&gt;I'm a simple guy, I like to avoid dataset binding and instead use DTOs and lists. I find it makes automated testing that much easier. I'm probably missing out on some convenience but I think I gain in understanding what is happening.&lt;br /&gt;&lt;br /&gt;32.) Help me learn how to deal with service binding and endpoint configuration headaches in my ASP.NET application; especially when developing on localhost (http) and deploying to a secure environment (https)... resulting in "works on my machine" syndrome.&lt;br /&gt;&lt;br /&gt;I empathize completely.&lt;br /&gt;&lt;br /&gt;33.) I need to understand the UpdatePanel (AJAX) and how it affects the page life cycle, security, and interaction between multiple UpdatePanels on same Page. Should I even be using the UpdatePanel? Is it going away? What is Microsoft’s plan for their AJAX stuff which seems to be going away and being replaced by jQuery.&lt;br /&gt;&lt;br /&gt;Update panels are going away, ding dong the witch is dead. Use jQuery.&lt;br /&gt;&lt;br /&gt;34.) Now that we’re doing more client side coding I need to really understand ViewState. It seems like a black box.&lt;br /&gt;&lt;br /&gt;No you don't. Step away from the black box, use MVC and jQuery, there is no ViewState.&lt;br /&gt;&lt;br /&gt;35.) How should I keeping up with new releases? How do I decide when to move to new versions.&lt;br /&gt;&lt;br /&gt;Always move to new versions. You don't want to be in a situation where your app lags a couple of e.g. VS versions behind. If there is stuff in your app that needs to upgrade you should do that sooner rather than later. Later may mean a lot more effort.&lt;br /&gt; &lt;br /&gt;So there you have it, as best as I can recall, somewhat tongue in cheek. I'm open to having my opinions adjusted.&lt;br /&gt;&lt;br /&gt;- Posted using BlogPress from my iPad&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-5695805853068069454?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/5695805853068069454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=5695805853068069454' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/5695805853068069454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/5695805853068069454'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2010/11/pain-points.html' title='Pain Points'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-2944660585998130586</id><published>2010-08-29T23:48:00.000-07:00</published><updated>2010-08-29T23:48:01.818-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MSBuild'/><title type='text'>MSBuild</title><content type='html'>Over at &lt;a href="http://www.wovs.com/"&gt;World of VS&lt;/a&gt; there's a scaled out online poll taking place about what extensions would be useful additions to Visual Studio. There are a couple I &lt;a href="http://feedback.wovs.com/forums/71955-extension-ideas/suggestions/1003567-stack-overflow-integration?ref=title"&gt;really&lt;/a&gt;&amp;nbsp;&lt;a href="http://feedback.wovs.com/forums/71955-extension-ideas/suggestions/1008363-find-duplicated-code?ref=title"&gt;like&lt;/a&gt; and I've voted accordingly. My own &lt;a href="http://feedback.wovs.com/forums/71955-extension-ideas/suggestions/1005279-msbuild-integration?ref=title"&gt;suggestion&lt;/a&gt; is something I personally would find extremely useful and that is being able to manipulate MSBuild files in Visual Studio with full intellisense, including &lt;a href="http://msbuildtasks.tigris.org/"&gt;community&lt;/a&gt; &lt;a href="http://msbuildextensionpack.codeplex.com/"&gt;MSBuild&lt;/a&gt; tasks. I've been a little underwhelmed by the love and I guess the question I have is what level of automation do Microsoft developers use in their projects and what tool is used if it isn't MSBuild?&lt;br /&gt;&lt;br /&gt;To me automation is a no-brainer - being able to kick off builds in Team Build that not only compile the source but also produce installers for my target deployment environments, e.g. test, staging, and production. That means that whenever a developer checks in some source code we end up with a consistent set of installers built using a known set of referenced assemblies. At the end of a sprint when you really want to demonstrate the work you've completed do you really want to waste effort figuring out why the build that was generated on one developer's machine doesn't install when it installed perfectly from a different machine's build last week?&lt;br /&gt;&lt;br /&gt;I also use MSBuild to update version numbers in a dozen configuration files, a job that previously was done by hand and resulted in many wasted hours and broken builds. I use MSBuild to precompile a website and copy the output to my local test site, including making the necessary modifications to config files for connection strings. I realise that Visual Studio is now far better at creating config files that match the target environment but just having that ability to press a button and know that if something is broken it has everything to do with some bad code I wrote and not the installer.&lt;br /&gt;&lt;br /&gt;The lack of support in Visual Studio for MSBuild, apart from the standard XML editor, is a hole that needs filling. I know enough about MSBuild to be able to get it to do what I need but while it is a core tool I rely on I don't use it often enough to be able to write out build targets without having to reach for Stack Overflow or Google. Once my build file is done I rarely have to revisit it which means my aging neurons aren't providing a feed the next time I need to automate a build task. Maybe next time I'll take the time to have a look at Attrice's &lt;a href="http://www.attrice.info/msbuild/index.htm"&gt;Microsoft Build Sidekick&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-2944660585998130586?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/2944660585998130586/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=2944660585998130586' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/2944660585998130586'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/2944660585998130586'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2010/08/msbuild.html' title='MSBuild'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-8356438261848278424</id><published>2010-08-15T02:00:00.000-07:00</published><updated>2010-08-15T02:00:30.424-07:00</updated><title type='text'>Custom Authentication in WCF</title><content type='html'>I'm building an HTML5 iPhone application that accesses a WCF RESTful web service hosted by IIS. The stumbling block for me has been authentication. I decided to go with Basic Authentication over HTTPS as a simple and secure enough approach for authenticating my users. But as with most Microsoft tech it doesn't pay to wander too far from the track. If you want to authenticate Windows users then I suspect everything would more or less just work. I'm working with an existing credential store in a SQL Server database so I needed something a little different. I'm not going to go into detail about how I eventually got it sorted - this is really just to acknowledge Dominick Baier over at &lt;a href="http://www.leastprivilege.com/HTTPBasicAuthenticationAgainstNonWindowsAccountsInIISASPNETPart3AddingWCFSupport.aspx"&gt;www.leastprivilege.com&lt;/a&gt; for shining a light on the process.&lt;br /&gt;&lt;br /&gt;A few things to note for future reference. WCF doesn't use &lt;i&gt;HttpContext.Current.User&lt;/i&gt; to identify the current user (although this can be enabled). Instead use &lt;i&gt;ServiceSecurityContext.Current.PrimaryIdentity.Name&lt;/i&gt;. If following along with Dominick's example and setting up the &lt;i&gt;HttpContextPrincipalPolicy&lt;/i&gt; it's quite valid to keep using the &lt;i&gt;Thread.CurrentPrincipal&lt;/i&gt; to identify the user. And if the identity of the user is not reflected in &lt;i&gt;Thread.CurrentPrincipal&lt;/i&gt; then something else is configured incorrectly. In my case the policy wasn't being loaded because I had it defined under the default behavior and not the &lt;i&gt;MunqServiceBehavior&lt;/i&gt; I set up in &lt;a href="http://stillpearling.blogspot.com/2010/07/dependency-injection-using-munq.html"&gt;an earlier post&lt;/a&gt;, see config section below: &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color: teal;"&gt; 1&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;behaviors&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 2&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;      &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;serviceBehaviors&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 3&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;behavior &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;="MunqServiceBehavior"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 4&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;          &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;serviceMetadata &lt;/span&gt;&lt;span style="color: red;"&gt;httpGetEnabled&lt;/span&gt;&lt;span style="color: blue;"&gt;="true"&lt;/span&gt;&lt;span style="color: red;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 5&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;          &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;serviceDebug &lt;/span&gt;&lt;span style="color: red;"&gt;includeExceptionDetailInFaults&lt;/span&gt;&lt;span style="color: blue;"&gt;="false"&lt;/span&gt;&lt;span style="color: red;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 6&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: black;"&gt;          &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;MunqInstanceProvider &lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 7&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style="color: black;"&gt;          &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;serviceAuthorization &lt;/span&gt;&lt;span style="color: red;"&gt;principalPermissionMode&lt;/span&gt;&lt;span style="color: blue;"&gt;="Custom"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: green;"&gt;&amp;lt;!--&lt;/span&gt;&lt;span style="color: green;"&gt; set to Custom to enable auth policies below &lt;/span&gt;&lt;span style="color: green;"&gt;--&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 8&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;authorizationPolicies&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 9&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;              &lt;/span&gt;&lt;span style="color: green;"&gt;&amp;lt;!--&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;10&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;                  sync ServiceSecurityContext.PrimaryIdentity with Context.User.Identity and Thread.CurrentPrincipal with Context.User&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;11&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;              &lt;/span&gt;&lt;span style="color: green;"&gt;--&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;12&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;              &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;add &lt;/span&gt;&lt;span style="color: red;"&gt;policyType&lt;/span&gt;&lt;span style="color: blue;"&gt;="CustomAuthenticationModule.HttpContextIdentityPolicy, CustomAuthenticationModule"&lt;/span&gt;&lt;span style="color: red;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;13&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;              &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;add &lt;/span&gt;&lt;span style="color: red;"&gt;policyType&lt;/span&gt;&lt;span style="color: blue;"&gt;="CustomAuthenticationModule.HttpContextPrincipalPolicy, CustomAuthenticationModule"&lt;/span&gt;&lt;span style="color: red;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;14&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;authorizationPolicies&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;15&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;          &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;serviceAuthorization&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;16&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;behavior&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;17&lt;/span&gt; &amp;nbsp; &amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;behavior &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=""&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;18&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;          &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;serviceMetadata &lt;/span&gt;&lt;span style="color: red;"&gt;httpGetEnabled&lt;/span&gt;&lt;span style="color: blue;"&gt;="true"&lt;/span&gt;&lt;span style="color: red;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;19&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;          &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;serviceDebug &lt;/span&gt;&lt;span style="color: red;"&gt;includeExceptionDetailInFaults&lt;/span&gt;&lt;span style="color: blue;"&gt;="false"&lt;/span&gt;&lt;span style="color: red;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;20&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;behavior&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;21&lt;/span&gt; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;      &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;serviceBehaviors&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;22&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;behaviors&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Then I couldn't figure out why the authentication module itself wasn't loading. Turns out it's a &lt;a href="http://stackoverflow.com/questions/963545/httpmodule-not-running-with-visual-studio/963975#963975"&gt;known issue with Cassini&lt;/a&gt;, the Visual Studio web server. For IIS7 we're supposed to be using the &lt;i&gt;&amp;lt;system.webServer&amp;gt;&lt;/i&gt; section but Cassini uses the old IIS6 syntax. The work around is to define the module in both locations:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color: teal;"&gt; 1&lt;/span&gt; &lt;span style="color: black;"&gt;  &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;system&lt;/span&gt;&lt;span style="color: red;"&gt;.web&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 2&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;compilation &lt;/span&gt;&lt;span style="color: red;"&gt;debug&lt;/span&gt;&lt;span style="color: blue;"&gt;="true"&lt;/span&gt;&lt;span style="color: red;"&gt; targetFramework&lt;/span&gt;&lt;span style="color: blue;"&gt;="4.0"&lt;/span&gt;&lt;span style="color: red;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 3&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;httpModules&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 4&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;      &lt;/span&gt;&lt;span style="color: green;"&gt;&amp;lt;!--&lt;/span&gt;&lt;span style="color: green;"&gt; added here and in system.webServer to load module using Cassini &lt;/span&gt;&lt;span style="color: green;"&gt;--&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 5&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;      &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;add &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;="CustomAuthenticationModule"&lt;/span&gt;&lt;span style="color: red;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 6&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: red;"&gt;           type&lt;/span&gt;&lt;span style="color: blue;"&gt;="&lt;/span&gt;&lt;span style="color: blue;"&gt;Custom&lt;/span&gt;&lt;span style="color: blue;"&gt;AuthenticationModule.&lt;/span&gt;&lt;span style="color: blue;"&gt;Custom&lt;/span&gt;&lt;span style="color: blue;"&gt;Authentication, &lt;/span&gt;&lt;span style="color: blue;"&gt;Custom&lt;/span&gt;&lt;span style="color: blue;"&gt;AuthenticationModule"&lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 7&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;httpModules&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 8&lt;/span&gt; &lt;span style="color: black;"&gt;  &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;system.web&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 9&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;10&lt;/span&gt; &lt;span style="color: black;"&gt;  &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;system&lt;/span&gt;&lt;span style="color: red;"&gt;.webServer&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;11&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;validation &lt;/span&gt;&lt;span style="color: red;"&gt;validateIntegratedModeConfiguration&lt;/span&gt;&lt;span style="color: blue;"&gt;="false"&lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;12&lt;/span&gt; &amp;nbsp; &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;modules &lt;/span&gt;&lt;span style="color: red;"&gt;runAllManagedModulesForAllRequests&lt;/span&gt;&lt;span style="color: blue;"&gt;="true"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;13&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;      &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;remove &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;="&lt;/span&gt;&lt;span style="color: blue;"&gt;Custom&lt;/span&gt;&lt;span style="color: blue;"&gt;AuthenticationModule"&lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;14&lt;/span&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;add &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;="UrlRoutingModule"&lt;/span&gt;&lt;span style="color: red;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;15&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: red;"&gt;           type&lt;/span&gt;&lt;span style="color: blue;"&gt;="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"&lt;/span&gt;&lt;span style="color: red;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;16&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;      &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;add &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;="&lt;/span&gt;&lt;span style="color: blue;"&gt;Custom&lt;/span&gt;&lt;span style="color: blue;"&gt;AuthenticationModule"&lt;/span&gt;&lt;span style="color: red;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;17&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: red;"&gt;           type&lt;/span&gt;&lt;span style="color: blue;"&gt;="&lt;/span&gt;&lt;span style="color: blue;"&gt;Custom&lt;/span&gt;&lt;span style="color: blue;"&gt;AuthenticationModule.&lt;/span&gt;&lt;span style="color: blue;"&gt;Custom&lt;/span&gt;&lt;span style="color: blue;"&gt;Authentication, &lt;/span&gt;&lt;span style="color: blue;"&gt;Custom&lt;/span&gt;&lt;span style="color: blue;"&gt;AuthenticationModule"&lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;18&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;modules&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;19&lt;/span&gt; &lt;span style="color: black;"&gt;  &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;system.webServer&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;20&lt;/span&gt; &lt;span style="color: black;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;So getting that sorted helped but the next issue was particularly annoying. I set breakpoints in my code and I could see the custom authentication taking place but after successfully authenticating the user and exiting my &lt;i&gt;AuthenticateRequest&lt;/i&gt; handler it would immediately hit the &lt;i&gt;EndRequest&lt;/i&gt; handler with a &lt;i&gt;401 - Unauthorized&lt;/i&gt; error. Apparently it pays to turn off security in the standard endpoint in order to use a custom handler. Presumably after executing my handler it was trundling off to a standard handler which wasn't then able to authenticate the user trying to access the service and returning &lt;i&gt;access denied&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color: teal;"&gt; 1&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;standardEndpoints&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 2&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;      &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;webHttpEndpoint&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 3&lt;/span&gt; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;        &lt;/span&gt;&lt;span style="color: green;"&gt;&amp;lt;!--&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 4&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;            Configure the WCF REST service base address via the global.asax.cs file and the default endpoint &lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 5&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;            via the attributes on the &amp;lt;standardEndpoint&amp;gt; element below&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 6&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;        &lt;/span&gt;&lt;span style="color: green;"&gt;--&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 7&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;standardEndpoint &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=""&lt;/span&gt;&lt;span style="color: red;"&gt; helpEnabled&lt;/span&gt;&lt;span style="color: blue;"&gt;="true"&lt;/span&gt;&lt;span style="color: red;"&gt; automaticFormatSelectionEnabled&lt;/span&gt;&lt;span style="color: blue;"&gt;="true"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 8&lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;          &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;security &lt;/span&gt;&lt;span style="color: red;"&gt;mode&lt;/span&gt;&lt;span style="color: blue;"&gt;="None"&lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: green;"&gt;&amp;lt;!--&lt;/span&gt;&lt;span style="color: green;"&gt; turn off security to use custom module &lt;/span&gt;&lt;span style="color: green;"&gt;--&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 9&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;standardEndpoint&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;10&lt;/span&gt;&amp;nbsp; &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;webHttpEndpoint&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;11&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;standardEndpoints&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;12&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;As a postscript and after working for more than a few years developing an Internet Banking site I'm extremely wary of roll-your-own authentication schemes. It's very difficult to get authentication right and the amount of effort required is typically a reflection of the overall risk of getting it wrong. For a bank that can include not just the risk of exposing a customer's accounts or even losing actual money. Banks have for a number of years implemented rules to minimise those losses by restricting the amount of money that can be transferred online and ensuring inter-bank transfers have a built-in delay period. The risk to a bank is also about the public perception of safety and bad press around online banking can result in substantial loss of custom. I walked away from a job with a bank where I felt strongly that inadequate steps were taken to ensure the security of the online application I was developing. I still think I made the right decision and in case anyone is wondering, it most definitely wasn't the &lt;a href="http://www.psis.co.nz/"&gt;PSIS&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-8356438261848278424?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/8356438261848278424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=8356438261848278424' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/8356438261848278424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/8356438261848278424'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2010/08/custom-authentication-in-wcf.html' title='Custom Authentication in WCF'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-3760492960079236735</id><published>2010-08-06T18:55:00.000-07:00</published><updated>2010-08-06T18:55:30.545-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IOC'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>Munq IocContainer Version 2.0</title><content type='html'>I've just upgraded my project to version 2 of &lt;a href="http://munq.codeplex.com/releases/view/45775"&gt;Munq&lt;/a&gt;, now &lt;a href="http://rattlingaroundmybrain.spaces.live.com/Blog/cns%2199CC0775D5794768%21289.entry?wa=wsignin1.0&amp;amp;sa=467338068"&gt;with lifetime managers&lt;/a&gt;. No drama and a great validation for the use of Unit Tests. Remove the reference to the original container, download and unzip the &lt;a href="http://munq.codeplex.com/releases/view/45775#DownloadId=123342"&gt;new version&lt;/a&gt;. Load up the source for the new version, rebuild, and run tests. Then add a reference to the new version, or in this case two references, Munq.Interfaces and Munq.IocContainer, adjust namespace imports (&lt;i&gt;using Munq&lt;/i&gt;), use the new IIocContainer interface to declare the container (see below), and run tests. That's it.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;static&lt;/span&gt;&lt;span style="color: black;"&gt; IIocContainer Di { &lt;/span&gt;&lt;span style="color: blue;"&gt;get&lt;/span&gt;&lt;span style="color: black;"&gt;; &lt;/span&gt;&lt;span style="color: blue;"&gt;private&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;set&lt;/span&gt;&lt;span style="color: black;"&gt;; }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-3760492960079236735?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/3760492960079236735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=3760492960079236735' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/3760492960079236735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/3760492960079236735'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2010/08/munq-ioccontainer-version-20.html' title='Munq IocContainer Version 2.0'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-6038285139811064742</id><published>2010-07-29T03:17:00.000-07:00</published><updated>2010-07-29T03:28:00.671-07:00</updated><title type='text'>Dependency Injection using Munq</title><content type='html'>I'm in the middle of a building a WCF Rest(ful) web service and I want to use some form of DI. I've used &lt;a href="http://www.clariusconsulting.net/blogs/kzu/archive/2009/02/02/116399.aspx"&gt;Daniel Cazzulino's Funq&lt;/a&gt; on a previous project and although it doesn't necessarily provide all the bells and whistles or have the market-share of some of the other frameworks it is extremely fast, easy to set up, and has a simple lambda-based configuration. It also comes with an awesome set of videos documenting the construction process, worth looking at just to see a developer doing some great TDD.&lt;br /&gt;&lt;br /&gt;For a WCF or MVC project there are some constraints that would make Funq a bit more interesting to set up. Fortunately there is a derivative of Funq, Matthew Dennis's &lt;a href="http://munq.codeplex.com/releases/view/45775"&gt;Munq&lt;/a&gt; project (example usage for ASP.NET MVC is available on &lt;a href="http://www.codeproject.com/Articles/43354/Using-Munq-IOC-with-ASP-NET-MVC-2-Preview-2.aspx"&gt;CodeProject&lt;/a&gt;) that is intended for this purpose.&lt;br /&gt;&lt;br /&gt;Using Munq for WCF differs from the ASP.NET MVC configuration example and I went through the exercise long enough ago that the only evidence I have is an old project that I've been trawling through to try and figure out how it is all wired together. I do recall following someone else's instructions (&lt;a href="http://orand.blogspot.com/2006/10/wcf-service-dependency-injection.html"&gt;Oran Dennison's&lt;/a&gt; I think) for implementing a different IOC framework with WCF and modifying it for Munq. This particular blog entry is at least in part to avoid having go through the same head scratching exercise the next time I want to use DI in a WCF service.&lt;br /&gt;&lt;br /&gt;My WCF service will be hosted in IIS and I created the initial project using the &lt;i&gt;WCF REST Service Application&lt;/i&gt; template. The idea is to allow Munq to serve up instances of the service and Microsoft provides a convenient hook for doing this using the &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.iinstanceprovider.aspx"&gt;&lt;i&gt;IInstanceProvider&lt;/i&gt; interface&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color: teal;"&gt; 1&lt;/span&gt;&amp;nbsp; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;class&lt;/span&gt;&lt;span style="color: black;"&gt; MunqInstanceProvider : IInstanceProvider&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 2&lt;/span&gt;&amp;nbsp; &lt;span style="color: black;"&gt;    {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 3&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 4&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;private&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;readonly&lt;/span&gt;&lt;span style="color: black;"&gt; Type serviceType;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 5&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 6&lt;/span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt;&lt;span style="color: black;"&gt; MunqInstanceProvider(Type serviceType)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 7&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style="color: black;"&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 8&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            &lt;/span&gt;&lt;span style="color: blue;"&gt;this&lt;/span&gt;&lt;span style="color: black;"&gt;.serviceType &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; serviceType;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 9&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;10&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;11&lt;/span&gt;&amp;nbsp;&lt;span style="color: black;"&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;#region&lt;/span&gt;&lt;span style="color: black;"&gt; Implementation of IInstanceProvider&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;12&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;13&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;14&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;        &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; Returns a service object given the specified &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;see cref="T:System.ServiceModel.InstanceContext"/&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt; object.&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;15&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;        &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;16&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: green;"&gt;        &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;17&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;        &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; A user-defined service object.&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;18&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;        &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;19&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;        &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;param name="instanceContext"&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;The current &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;see cref="T:System.ServiceModel.InstanceContext"/&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt; object.&lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;span style="color: grey;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;20&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;object&lt;/span&gt;&lt;span style="color: black;"&gt; GetInstance(InstanceContext instanceContext)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;21&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;22&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt;&lt;span style="color: black;"&gt; GetInstance(instanceContext, &lt;/span&gt;&lt;span style="color: blue;"&gt;null&lt;/span&gt;&lt;span style="color: black;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;23&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;24&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;25&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;26&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;        &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; Returns a service object given the specified &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;see cref="T:System.ServiceModel.InstanceContext"/&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt; object.&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;27&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: green;"&gt;        &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;28&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;        &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;29&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;        &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; The service object.&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;30&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;        &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;31&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;        &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;param name="instanceContext"&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;The current &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;see cref="T:System.ServiceModel.InstanceContext"/&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt; object.&lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;/param&amp;gt;&amp;lt;param name="message"&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;The message that triggered the creation of a service object.&lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;span style="color: grey;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;32&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;object&lt;/span&gt;&lt;span style="color: black;"&gt; GetInstance(InstanceContext instanceContext, Message message)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;33&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;34&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: black;"&gt;            var instance &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; Global.Di.Resolve(serviceType);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;35&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt;&lt;span style="color: black;"&gt; instance;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;36&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;37&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;38&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;39&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;        &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; Called when an &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;see cref="T:System.ServiceModel.InstanceContext"/&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt; object recycles a service object.&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;40&lt;/span&gt; &amp;nbsp; &amp;nbsp; &lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;41&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;        &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;param name="instanceContext"&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;The service's instance context.&lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;/param&amp;gt;&amp;lt;param name="instance"&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;The service object to be recycled.&lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;span style="color: grey;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;42&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;void&lt;/span&gt;&lt;span style="color: black;"&gt; ReleaseInstance(InstanceContext instanceContext, &lt;/span&gt;&lt;span style="color: blue;"&gt;object&lt;/span&gt;&lt;span style="color: black;"&gt; instance)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;43&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;44&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            &lt;/span&gt;&lt;span style="color: green;"&gt;//&lt;/span&gt;&lt;span style="color: green;"&gt; container disposes of instance?&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;45&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;            &lt;/span&gt;&lt;span style="color: green;"&gt;//&lt;/span&gt;&lt;span style="color: green;"&gt;if (instance is IDisposable)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;46&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;            &lt;/span&gt;&lt;span style="color: green;"&gt;//&lt;/span&gt;&lt;span style="color: green;"&gt;    ((IDisposable)instance).Dispose();&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;47&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;        }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;48&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;49&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;#endregion&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;50&lt;/span&gt; &lt;span style="color: black;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;That call to &lt;i&gt;Global.Di.Resolve()&lt;/i&gt; is where Munq returns an instance of the service. &lt;i&gt;Global.Di&lt;/i&gt; needs to be defined somewhere, I'll get to that in a bit. Having implemented &lt;i&gt;IInstanceProvider&lt;/i&gt; I now need to provide a custom &lt;i&gt;serviceBehavior&lt;/i&gt; using the &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.description.iservicebehavior.aspx"&gt;&lt;i&gt;IServiceBehavior interface&lt;/i&gt;&lt;/a&gt; for the service endpoint. The following code creates a new &lt;i&gt;MunqInstanceProvider&lt;/i&gt; for each &lt;i&gt;ChannelDispatcher&lt;/i&gt; endpoint.&lt;br /&gt;&lt;br /&gt;Note &lt;i&gt;ForAll()&lt;/i&gt; is an extension method not included in .NET but defined as you might expect. For an explanation as to why it wasn't included in the framework refer to &lt;a href="http://blogs.msdn.com/b/ericlippert/archive/2009/05/18/foreach-vs-foreach.aspx"&gt;Eric Lippert's blog&lt;/a&gt;. For a long time I assiduously used a &lt;i&gt;foreach&lt;/i&gt; loop to perform some action on every item in a sequence. Recently I've been reading &lt;a href="http://www.amazon.com/Effective-Covers-4-0-Specific-Development/dp/0321658701?ie=UTF8&amp;amp;tag=stillp-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Effective C# (Covers C# 4.0): 50 Specific Ways to Improve Your C#&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=stillp-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0321658701" style="border: medium none ! important; margin: 0px ! important; padding: 0px ! important;" width="1" /&gt;. Item 8 suggests I should &lt;i&gt;Prefer Query Syntax to Loops&lt;/i&gt; and I absolutely do.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color: teal;"&gt; 1&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;class&lt;/span&gt;&lt;span style="color: black;"&gt; MunqServiceBehavior : IServiceBehavior&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 2&lt;/span&gt; &lt;span style="color: black;"&gt;    {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 3&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;#region&lt;/span&gt;&lt;span style="color: black;"&gt; IServiceBehavior Members&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 4&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 5&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;void&lt;/span&gt;&lt;span style="color: black;"&gt; AddBindingParameters(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase, System.Collections.ObjectModel.Collection&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: black;"&gt;ServiceEndpoint&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt; endpoints, System.ServiceModel.Channels.BindingParameterCollection bindingParameters) {}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 6&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 7&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;void&lt;/span&gt;&lt;span style="color: black;"&gt; ApplyDispatchBehavior(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 8&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 9&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            var endpoints &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; from cd &lt;/span&gt;&lt;span style="color: blue;"&gt;in&lt;/span&gt;&lt;span style="color: black;"&gt; serviceHostBase.ChannelDispatchers.Cast&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: black;"&gt;ChannelDispatcher&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;()&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;10&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;                            &lt;/span&gt;&lt;span style="color: blue;"&gt;where&lt;/span&gt;&lt;span style="color: black;"&gt; cd &lt;/span&gt;&lt;span style="color: black;"&gt;!=&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;null&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;11&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;                            from endpoint &lt;/span&gt;&lt;span style="color: blue;"&gt;in&lt;/span&gt;&lt;span style="color: black;"&gt; cd.Endpoints&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;12&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;                            select endpoint;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;13&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;14&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            endpoints.ForAll(ep &lt;/span&gt;&lt;span style="color: black;"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt; ep.DispatchRuntime.InstanceProvider &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;new&lt;/span&gt;&lt;span style="color: black;"&gt; MunqInstanceProvider(serviceDescription.ServiceType));&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;15&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;16&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;17&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;void&lt;/span&gt;&lt;span style="color: black;"&gt; Validate(ServiceDescription serviceDescription, System.ServiceModel.ServiceHostBase serviceHostBase) {}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;18&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;19&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;#endregion&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;20&lt;/span&gt; &lt;span style="color: black;"&gt;    }&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;i&gt;Web.config&lt;/i&gt; is used to wire this all together but in order to reference the custom behavior a Munq-specific &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.configuration.behaviorextensionelement.aspx"&gt;BehaviorExtensionElement&lt;/a&gt; is required.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color: teal;"&gt; 1&lt;/span&gt;&amp;nbsp; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;class&lt;/span&gt;&lt;span style="color: black;"&gt; MunqInstanceProviderExtensionElement : BehaviorExtensionElement&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 2&lt;/span&gt;&amp;nbsp; &lt;span style="color: black;"&gt;    {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 3&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;override&lt;/span&gt;&lt;span style="color: black;"&gt; Type BehaviorType&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 4&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 5&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style="color: black;"&gt;            &lt;/span&gt;&lt;span style="color: blue;"&gt;get&lt;/span&gt;&lt;span style="color: black;"&gt; { &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;typeof&lt;/span&gt;&lt;span style="color: black;"&gt; (MunqServiceBehavior); }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 6&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 7&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 8&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;protected&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;override&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;object&lt;/span&gt;&lt;span style="color: black;"&gt; CreateBehavior()&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 9&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;10&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;new&lt;/span&gt;&lt;span style="color: black;"&gt; MunqServiceBehavior();&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;11&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;12&lt;/span&gt; &lt;span style="color: black;"&gt;    }&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;The relevant section of &lt;i&gt;Web.config&lt;/i&gt; is provided below and replaces the &lt;i&gt;&lt;system.servicemodel&gt;&lt;/system.servicemodel&gt;system.serviceModel&lt;/i&gt; section. Getting each element correct is important but the stumbling block for me was getting the service name correct and I couldn't figure out why none of my Munq classes were being hit.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color: teal;"&gt; 1&lt;/span&gt;&amp;nbsp; &lt;span style="color: black;"&gt;  &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;system&lt;/span&gt;&lt;span style="color: red;"&gt;.serviceModel&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 2&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;serviceHostingEnvironment &lt;/span&gt;&lt;span style="color: red;"&gt;aspNetCompatibilityEnabled&lt;/span&gt;&lt;span style="color: blue;"&gt;="true"&lt;/span&gt;&lt;span style="color: red;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 3&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: red;"&gt;      multipleSiteBindingsEnabled&lt;/span&gt;&lt;span style="color: blue;"&gt;="true"&lt;/span&gt;&lt;span style="color: red;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 4&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;services&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 5&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;      &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;service &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;="StillPearlingService.StillPearling"&lt;/span&gt;&lt;span style="color: red;"&gt; behaviorConfiguration&lt;/span&gt;&lt;span style="color: blue;"&gt;="MunqServiceBehavior"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;service&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 6&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;services&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 7&lt;/span&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;behaviors&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 8&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;      &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;serviceBehaviors&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 9&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;behavior &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;="MunqServiceBehavior"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;10&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;          &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;MunqInstanceProvider &lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;11&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;behavior&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;12&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;behavior &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=""&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;13&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;serviceMetadata &lt;/span&gt;&lt;span style="color: red;"&gt;httpGetEnabled&lt;/span&gt;&lt;span style="color: blue;"&gt;="true"&lt;/span&gt;&lt;span style="color: red;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;14&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;serviceDebug &lt;/span&gt;&lt;span style="color: red;"&gt;includeExceptionDetailInFaults&lt;/span&gt;&lt;span style="color: blue;"&gt;="false"&lt;/span&gt;&lt;span style="color: red;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;15&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;behavior&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;16&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;      &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;serviceBehaviors&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;17&lt;/span&gt; &amp;nbsp; &amp;nbsp; &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;behaviors&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;18&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;extensions&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;19&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;behaviorExtensions&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;20&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;add &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;="MunqInstanceProvider"&lt;/span&gt;&lt;span style="color: red;"&gt; type&lt;/span&gt;&lt;span style="color: blue;"&gt;="StillPearling.IOC.MunqInstanceProviderExtensionElement, StillPearling, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"&lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;21&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;      &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;behaviorExtensions&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;22&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;extensions&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;23&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;standardEndpoints&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;24&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;      &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;webHttpEndpoint&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;25&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: green;"&gt;&amp;lt;!--&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;26&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;            Configure the WCF REST service base address via the global.asax.cs file and the default endpoint &lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;27&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;            via the attributes on the &amp;lt;standardEndpoint&amp;gt; element below&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;28&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;--&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;29&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;standardEndpoint &lt;/span&gt;&lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;=""&lt;/span&gt;&lt;span style="color: red;"&gt; helpEnabled&lt;/span&gt;&lt;span style="color: blue;"&gt;="true"&lt;/span&gt;&lt;span style="color: red;"&gt; automaticFormatSelectionEnabled&lt;/span&gt;&lt;span style="color: blue;"&gt;="true"&lt;/span&gt;&lt;span style="color: red;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;30&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;      &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;webHttpEndpoint&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;31&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;standardEndpoints&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;32&lt;/span&gt; &lt;span style="color: black;"&gt;  &lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;system.serviceModel&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;So having completed the majority of the wiring there is still the small matter of declaring and instantiating the Munq DI container. This happens in Global.asax, along with registering other objects I want to wire into the container. In this case I have a &lt;i&gt;Model&lt;/i&gt; class that I use for accessing a database. Within my service I declare a &lt;i&gt;Model&lt;/i&gt; property with a public setter that is used as a hook for Munq to inject the correct &lt;i&gt;Model&lt;/i&gt; object. &lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color: teal;"&gt; 1&lt;/span&gt;&amp;nbsp; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;class&lt;/span&gt;&lt;span style="color: black;"&gt; Global : HttpApplication&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 2&lt;/span&gt;&amp;nbsp; &lt;span style="color: black;"&gt;    {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 3&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;private&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;static&lt;/span&gt;&lt;span style="color: black;"&gt; Logger logger &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; LogManager.GetCurrentClassLogger();&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 4&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;static&lt;/span&gt;&lt;span style="color: black;"&gt; Container Di { &lt;/span&gt;&lt;span style="color: blue;"&gt;get&lt;/span&gt;&lt;span style="color: black;"&gt;; &lt;/span&gt;&lt;span style="color: blue;"&gt;private&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;set&lt;/span&gt;&lt;span style="color: black;"&gt;; }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 5&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 6&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;void&lt;/span&gt;&lt;span style="color: black;"&gt; Application_Start(&lt;/span&gt;&lt;span style="color: blue;"&gt;object&lt;/span&gt;&lt;span style="color: black;"&gt; sender, EventArgs e)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 7&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 8&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;logger.Info(() &lt;/span&gt;&lt;span style="color: black;"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: maroon;"&gt;Application_Start&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 9&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;Di &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;new&lt;/span&gt;&lt;span style="color: black;"&gt; Container();&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;10&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            RegisterInterfaces();&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;11&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            RegisterRoutes();&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;12&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;13&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;14&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;private&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;static&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;void&lt;/span&gt;&lt;span style="color: black;"&gt; RegisterInterfaces()&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;15&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;16&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            logger.Debug(() &lt;/span&gt;&lt;span style="color: black;"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: maroon;"&gt;RegisterInterfaces&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;17&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            Di.Register&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: black;"&gt;IStillPearlingModel&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;(di &lt;/span&gt;&lt;span style="color: black;"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;new&lt;/span&gt;&lt;span style="color: black;"&gt; Model());&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;18&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            Di.Register(di &lt;/span&gt;&lt;span style="color: black;"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;new&lt;/span&gt;&lt;span style="color: black;"&gt; StillPearling { Model &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; di.Resolve&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: black;"&gt;IStillPearlingModel&lt;/span&gt;&lt;span style="color: black;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black;"&gt;(), });&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;19&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;20&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;21&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;private&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;static&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;void&lt;/span&gt;&lt;span style="color: black;"&gt; RegisterRoutes()&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;22&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;23&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            &lt;/span&gt;&lt;span style="color: green;"&gt;//&lt;/span&gt;&lt;span style="color: green;"&gt; Edit the base address of Service1 by replacing the "Service1" string below&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;24&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            RouteTable.Routes.Add(&lt;/span&gt;&lt;span style="color: blue;"&gt;new&lt;/span&gt;&lt;span style="color: black;"&gt; ServiceRoute(&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: maroon;"&gt;StillPearlingService&lt;/span&gt;&lt;span style="color: maroon;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;, &lt;/span&gt;&lt;span style="color: blue;"&gt;new&lt;/span&gt;&lt;span style="color: black;"&gt; WebServiceHostFactory(), &lt;/span&gt;&lt;span style="color: blue;"&gt;typeof&lt;/span&gt;&lt;span style="color: black;"&gt;(StillPearling)));&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;25&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;26&lt;/span&gt; &lt;span style="color: black;"&gt;    }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;27&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Note this was all done using Munq 1.0 and Munq 2.0 has recently been released. I don't expect any issues transitioning to version 2.0 but I'll try to provide an update if there are any potholes to be avoided. If you've read this far I appreciate it and I would further appreciate feedback on what I'm doing wrong. Finally I apologise for any formatting issues with the code above - I'm still looking for a good encoding tool that works with blogger.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-6038285139811064742?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/6038285139811064742/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=6038285139811064742' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/6038285139811064742'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/6038285139811064742'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2010/07/dependency-injection-using-munq.html' title='Dependency Injection using Munq'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-2294355532281030201</id><published>2010-07-22T01:00:00.000-07:00</published><updated>2010-07-22T01:55:51.835-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Machine.Specifications'/><category scheme='http://www.blogger.com/atom/ns#' term='MSpec'/><title type='text'>First things first?</title><content type='html'>Clearly if I want to play with F# &amp;amp; ASP.NET MVC I should get the &lt;a href="http://tomasp.net/articles/fsharp-mvc-web/FsWebApplication.vsi"&gt;Visual Studio 2010 project template&lt;/a&gt; from &lt;a href="http://cs.hubfs.net/blogs/tomasp/archive/2010/05/09/14050.aspx"&gt;Tomas Petricek.&lt;/a&gt; Then after installing in Visual Studio I get a new option to create a F# MVC Web Application. Mostly it just works but the reference in WebApplication.Core to the WebApplication.Data project needs to be updated for it to build. BTW, if you're looking for a quickstart C# MVC project check out Rob Conery's &lt;a href="http://blog.wekeroad.com/2010/04/19/tekpub-starter?utm_source=feedburner&amp;amp;utm_medium=feed&amp;amp;utm_campaign=Feed%3A+wekeroad%2FEeKc+%28Rob+Conery%29"&gt;Tekpub MVC 2.0 Starter&lt;/a&gt;, it has an associated starter video available free from &lt;a href="http://tekpub.com/production/starter"&gt;Tekpub&lt;/a&gt;. This is not that.&lt;br /&gt;&lt;br /&gt;So what about &lt;a href="http://github.com/machine/machine.specifications"&gt;MSpec&lt;/a&gt;? The latest release is available from &lt;a href="http://teamcity.codebetter.com/guestAuth/repository/download/bt188/.lastSuccessful/Machine.Specifications-net-4.0-Release.zip"&gt;TeamCity&lt;/a&gt;. I'm using &lt;a href="http://www.jetbrains.com/resharper/whatsnew/?dt40PnlNew=&amp;amp;"&gt;ReSharper 5.1&lt;/a&gt; so installing MSpec is just a matter of &lt;b&gt;unblocking zip file&lt;/b&gt; (aargh), unzipping, pathing to unzipped location and running the appropriate batch file - &amp;amp; '.\InstallResharperRunner.5.1 - VS2010.bat'&amp;nbsp; (why are we still using batch files).&lt;br /&gt;&lt;br /&gt;Now I have the pieces of the puzzle but I'm not entirely sure how I'm supposed to assemble them. Using a &lt;a href="http://elegantcode.com/2010/02/19/getting-started-with-machine-specifications-mspec/"&gt;post from Elegant Code&lt;/a&gt; as a starting point I added a test project to my solution and copied &lt;a href="http://elegantcode.com/author/jryswyck/"&gt;Jan&lt;/a&gt;'s sample into &lt;i&gt;UnitTest1.cs&lt;/i&gt;. Visual Studio doesn't know what is &lt;i&gt;[Subject("Making a customer preferred")]&lt;/i&gt; which is resolved by first creating a "libs" folder in my solution folder and adding &lt;i&gt;Machine.Specifications.dll&lt;/i&gt; to it, then adding a reference to that dll to my test project. Then in the interests of seeing some actual output I need to flesh out the sample code with sufficient code to allow the test to compile:&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color: teal; font-size: small;"&gt; &lt;span style="font-family: Verdana,sans-serif;"&gt;1&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;        [Subject(&lt;/span&gt;&lt;span style="color: maroon; font-family: Verdana,sans-serif; font-size: small;"&gt;"&lt;/span&gt;&lt;span style="color: maroon; font-family: Verdana,sans-serif; font-size: small;"&gt;Making a customer preferred&lt;/span&gt;&lt;span style="color: maroon; font-family: Verdana,sans-serif; font-size: small;"&gt;"&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;)]&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt; 2&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;        &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;public&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;class&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; when_a_regular_customer_is_made_preferred&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt; 3&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt; 4&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            Establish context &lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;=&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; () &lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt; 5&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt; 6&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;                &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;_order &lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;=&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;new&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; Order(&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;new&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;[] { &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;new&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; OrderItem(&lt;/span&gt;&lt;span style="color: purple; font-family: Verdana,sans-serif; font-size: small;"&gt;12&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;),&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt; 7&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;                                   &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;new&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; OrderItem(&lt;/span&gt;&lt;span style="color: purple; font-family: Verdana,sans-serif; font-size: small;"&gt;16&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;) });&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt; 8&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;                &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;_totalAmountWithoutDiscount &lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;=&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; _order.TotalAmount;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt; 9&lt;/span&gt; &lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;10&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;                &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;SUT &lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;=&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;new&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; Customer(&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;new&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;[] { _order });&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;11&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            };&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;12&lt;/span&gt; &lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;13&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            Because of &lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;=&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; () &lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;14&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;                SUT.MakePreferred();&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;15&lt;/span&gt; &lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;16&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            It should_mark_the_customer_as_preferred &lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;=&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; () &lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;17&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;                &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;SUT.IsPreferred.ShouldBeTrue();&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;18&lt;/span&gt; &lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;19&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            It should_apply_a_ten_percent_discount_to_all_outstanding_orders &lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;=&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; () &lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;20&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;                &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;_order.TotalAmount.ShouldEqual(_totalAmountWithoutDiscount &lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;*&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: purple; font-family: Verdana,sans-serif; font-size: small;"&gt;0.9&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;21&lt;/span&gt; &lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;22&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;private&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;static&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; Customer SUT;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;23&lt;/span&gt; &lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;24&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;private&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;static&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; Order _order;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;25&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;private&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;static&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; Double _totalAmountWithoutDiscount;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;26&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;        }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;27&lt;/span&gt; &lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;28&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;        &lt;/span&gt;&lt;span style="color: green; font-family: Verdana,sans-serif; font-size: small;"&gt;//&lt;/span&gt;&lt;span style="color: green; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;29&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: green; font-family: Verdana,sans-serif; font-size: small;"&gt;        &lt;/span&gt;&lt;span style="color: green; font-family: Verdana,sans-serif; font-size: small;"&gt;//&lt;/span&gt;&lt;span style="color: green; font-family: Verdana,sans-serif; font-size: small;"&gt; Subject under test&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;30&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: green; font-family: Verdana,sans-serif; font-size: small;"&gt;        &lt;/span&gt;&lt;span style="color: green; font-family: Verdana,sans-serif; font-size: small;"&gt;//&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;31&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;        &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;public&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;class&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; Customer&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;32&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;33&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;private&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;readonly&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; List&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;Order&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; _orders;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;34&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;public&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; Boolean IsPreferred { &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;get&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;private&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;set&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;; }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;35&lt;/span&gt; &lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;36&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;public&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; Customer(IEnumerable&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;Order&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; orders)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;37&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;38&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;                &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;_orders &lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;=&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;new&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; List&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;Order&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;(orders);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;39&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;40&lt;/span&gt; &lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;41&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;public&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;void&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; MakePreferred()&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;42&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;43&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;                &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;if&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; (IsPreferred)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;44&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;                    &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;return&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;45&lt;/span&gt; &lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;46&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;                IsPreferred &lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;=&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;true&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;47&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;                &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;_orders.ForEach(order &lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; order.ApplyDiscount(&lt;/span&gt;&lt;span style="color: purple; font-family: Verdana,sans-serif; font-size: small;"&gt;10&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;));&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;48&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;49&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;        }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;50&lt;/span&gt; &lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;51&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;        &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;public&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;class&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; Order&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;52&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;53&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;private&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; OrderItem[] orderItems;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;54&lt;/span&gt; &lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;55&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;public&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; Order(OrderItem[] orderItems)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;56&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;57&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;                &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: green; font-family: Verdana,sans-serif; font-size: small;"&gt;//&lt;/span&gt;&lt;span style="color: green; font-family: Verdana,sans-serif; font-size: small;"&gt; TODO: Complete member initialization&lt;/span&gt;&lt;span style="color: green; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;58&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;                &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;this&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;.orderItems &lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;=&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; orderItems;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;59&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;60&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;public&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;double&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; TotalAmount { &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;get&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;set&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;; }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;61&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;public&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;double&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; ApplyDiscount(&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;int&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; percentDiscount)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;62&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;63&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;                &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;return&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; TotalAmount&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;*&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;(&lt;/span&gt;&lt;span style="color: purple; font-family: Verdana,sans-serif; font-size: small;"&gt;100&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;-&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; percentDiscount)&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;/&lt;/span&gt;&lt;span style="color: purple; font-family: Verdana,sans-serif; font-size: small;"&gt;100&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;64&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;65&lt;/span&gt; &lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;66&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;        }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;67&lt;/span&gt; &lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;68&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;        &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;public&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;class&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; OrderItem&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;69&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;70&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;private&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; &lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;int&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; p;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;71&lt;/span&gt; &lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;72&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;public&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; OrderItem(&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;int&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; p)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;73&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;74&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;                &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: green; font-family: Verdana,sans-serif; font-size: small;"&gt;//&lt;/span&gt;&lt;span style="color: green; font-family: Verdana,sans-serif; font-size: small;"&gt; TODO: Complete member initialization&lt;/span&gt;&lt;span style="color: green; font-family: Verdana,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;75&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;                &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Verdana,sans-serif; font-size: small;"&gt;this&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;.p &lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;=&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt; p;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;76&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;            &lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal; font-family: Verdana,sans-serif; font-size: small;"&gt;77&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Verdana,sans-serif;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: Verdana,sans-serif; font-size: small;"&gt;        }&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Verdana,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;Now I can run the unit test using ReSharper and sure enough I get the correct output:&lt;br /&gt;&lt;blockquote&gt;Making a customer preferred, when a regular customer is made preferred&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; » should mark the customer as preferred&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; » should apply a ten percent discount to all outstanding orders&lt;/blockquote&gt;Obviously this is a contrived example but I have established that I can run MSpec tests in my solution. If at some point it no longer works I know it's my bad.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-2294355532281030201?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/2294355532281030201/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=2294355532281030201' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/2294355532281030201'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/2294355532281030201'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2010/07/first-things-first.html' title='First things first?'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-3734540993069896925</id><published>2010-07-21T17:14:00.000-07:00</published><updated>2010-07-21T17:14:57.936-07:00</updated><title type='text'>Exploring the ecosystem</title><content type='html'>There are a number of things on my todo list, including F#, ASP.NET MVC, &lt;a href="http://github.com/machine/machine.specifications"&gt;MSpec&lt;/a&gt;, &lt;a href="http://www.codeproject.com/Articles/43354/Using-Munq-IOC-with-ASP-NET-MVC-2-Preview-2.aspx"&gt;Munq&lt;/a&gt;, &lt;a href="http://code.google.com/p/moq/"&gt;Moq&lt;/a&gt; and maybe an alternative markup engine such as &lt;a href="http://code.google.com/p/string-template-view-engine-mvc/"&gt;StringTemplate&lt;/a&gt;. My other todo list includes HTML5, &lt;a href="http://wiki.phonegap.com/Getting+Started+with+PhoneGap+%28iPhone%29"&gt;PhoneGap&lt;/a&gt;, and iPhone development. My Amazon order showed up a couple of weeks ago including Douglas Crockford's excellent &lt;a href="http://www.amazon.com/JavaScript-Good-Parts-Douglas-Crockford/dp/0596517742?ie=UTF8&amp;amp;tag=stillp-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;JavaScript: The Good Parts&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=stillp-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596517742" style="border: medium none ! important; margin: 0px ! important; padding: 0px ! important;" width="1" /&gt;, &lt;a href="http://www.amazon.com/Building-iPhone-Apps-HTML-JavaScript/dp/0596805780?ie=UTF8&amp;amp;tag=stillp-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Building iPhone Apps with HTML, CSS, and JavaScript&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=stillp-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=0596805780" style="border: medium none ! important; margin: 0px ! important; padding: 0px ! important;" width="1" /&gt;, and &lt;a href="http://www.amazon.com/Expert-F-2-0-Don-Syme/dp/1430224312?ie=UTF8&amp;amp;tag=stillp-20&amp;amp;link_code=btl&amp;amp;camp=213689&amp;amp;creative=392969" target="_blank"&gt;Expert F# 2.0&lt;/a&gt;&lt;img alt="" border="0" height="1" src="http://www.assoc-amazon.com/e/ir?t=stillp-20&amp;amp;l=btl&amp;amp;camp=213689&amp;amp;creative=392969&amp;amp;o=1&amp;amp;a=1430224312" style="border: medium none ! important; margin: 0px ! important; padding: 0px ! important;" width="1" /&gt;.&lt;br /&gt;&lt;br /&gt;I will admit to being a long time fan of JavaScript and it's nice to see it finally getting mind-share. Crockford's book is dense and contains a lot of good stuff and as a consequence I'm still working my way through it. I'm also still not entirely comfortable with the idea of modifying the prototypes of the predefined objects such as Object, String, etc, guess I'll reserve judgment until I'm finished reading.&lt;br /&gt;&lt;br /&gt;As part of getting back up to date with JavaScript I've also started using&amp;nbsp;&lt;a href="http://docs.jquery.com/QUnit"&gt;QUnit&lt;/a&gt; to unit test a module I'm writing for accessing Safari's SQLite database. There are some excellent links &lt;a href="http://gist.github.com/299286"&gt;here&lt;/a&gt;, and &lt;a href="http://net.tutsplus.com/tutorials/javascript-ajax/how-to-test-your-javascript-code-with-qunit/"&gt;here&lt;/a&gt; (blog comments are particularly useful) re using QUnit for testing asynchronous calls. Calls to SQLite are all based on callbacks so being able to unit test asynchronously is essential.&lt;br /&gt;&lt;br /&gt;Below is a very early example of the database access code I'm working on. Clearly I've got a long way to go but it's a start and demonstrates the module pattern I use to hide the internals. I plan to replace the database version update code so I can seamlessly update the database when upgrading the application version. I'm still trying to get my head around the &lt;a href="http://en.wikipedia.org/wiki/Indent_style"&gt;K&amp;amp;R indenting&lt;/a&gt; which is now the most common indenting style in JavaScript. Having coded C++ for many years and subsequently C# I'm pretty committed to the Allman style indenting. But some of the reasons for using Allman style are no longer relevant and with LINQ in particular it is difficult (impossible?) to use Allman style consistently. In JavaScript there is at least one situation where using Allman style will result in code breaking. Douglas Crockford mentions this in his book:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;I always use K&amp;amp;R style, putting the { at the end of a line instead of the front, because it avoids a horrible design blunder in JavaScript's &lt;i&gt;return&lt;/i&gt; statement.&lt;/blockquote&gt;To really nail my Allman addiction I read a tweet recently from I think one of either &lt;a href="http://blog.wekeroad.com/"&gt;Rob Conery&lt;/a&gt; or &lt;a href="http://encosia.com/"&gt;Dave Ward&lt;/a&gt; to the effect that JavaScript written using Allman was not to be trusted (hmm maybe it was &lt;a href="http://daringfireball.net/"&gt;Gruber&lt;/a&gt;, can't find the reference). So I guess my first job is to reformat using the new hotness and once again feel like I am worthy.&lt;br /&gt;&lt;br /&gt;BTW, if anyone knows a good code formatter for Blogger I would be grateful, the one I used to produce the code below is not quite there.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span style="color: teal;"&gt; 1&lt;/span&gt; &lt;span style="color: blue;"&gt;var&lt;/span&gt;&lt;span style="color: black;"&gt; db &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;function&lt;/span&gt;&lt;span style="color: black;"&gt; ()&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 2&lt;/span&gt; &lt;span style="color: black;"&gt;{&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 3&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: green;"&gt;/*&lt;/span&gt;&lt;span style="color: green;"&gt;*&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 4&lt;/span&gt; &lt;span style="color: green;"&gt;    * private&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 5&lt;/span&gt; &lt;span style="color: green;"&gt;    &lt;/span&gt;&lt;span style="color: green;"&gt;*/&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 6&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt;&lt;span style="color: black;"&gt; CURRENT_VERSION &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: black;"&gt;1.01&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 7&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt;&lt;span style="color: black;"&gt; shortName &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: black;"&gt;'&lt;/span&gt;&lt;span style="color: black;"&gt;rtt&lt;/span&gt;&lt;span style="color: black;"&gt;'&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 8&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt;&lt;span style="color: black;"&gt; version;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt; 9&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt;&lt;span style="color: black;"&gt; displayName &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: black;"&gt;'&lt;/span&gt;&lt;span style="color: black;"&gt;Red Tomato Timesheet&lt;/span&gt;&lt;span style="color: black;"&gt;'&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;10&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt;&lt;span style="color: black;"&gt; maxSize &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: black;"&gt;65536&lt;/span&gt;&lt;span style="color: black;"&gt;; &lt;/span&gt;&lt;span style="color: green;"&gt;//&lt;/span&gt;&lt;span style="color: green;"&gt; bytes&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;11&lt;/span&gt; &lt;span style="color: green;"&gt;&lt;/span&gt;&lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt;&lt;span style="color: black;"&gt; database;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;12&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;13&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt;&lt;span style="color: black;"&gt; init &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;function&lt;/span&gt;&lt;span style="color: black;"&gt;(transaction) { console.info(&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;Updating database to version 1&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;); };&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;14&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;15&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt;&lt;span style="color: black;"&gt; success &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;function&lt;/span&gt;&lt;span style="color: black;"&gt;(){ console.info(&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;success&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;);};&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;16&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt;&lt;span style="color: black;"&gt; failure &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;function&lt;/span&gt;&lt;span style="color: black;"&gt;(error){ console.info(&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;fail: &lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: black;"&gt;+&lt;/span&gt;&lt;span style="color: black;"&gt; error);};&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;17&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;18&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt;&lt;span style="color: black;"&gt; up101 &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;function&lt;/span&gt;&lt;span style="color: black;"&gt;(t)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;19&lt;/span&gt; &lt;span style="color: black;"&gt;    {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;20&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;var&lt;/span&gt;&lt;span style="color: black;"&gt; sql &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;\&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;21&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;CREATE TABLE projects (\&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;22&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,\&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;23&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            name TEXT NOT NULL,\&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;24&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            description TEXT NOT NULL);&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;25&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;        console.info(&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;sql:&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: black;"&gt;+&lt;/span&gt;&lt;span style="color: black;"&gt; sql);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;26&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        t.executeSql( sql, [], &lt;/span&gt;&lt;span style="color: blue;"&gt;function&lt;/span&gt;&lt;span style="color: black;"&gt;(){ console.info(&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;version 1.0 -&amp;gt; 1.01 success&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;);});&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;27&lt;/span&gt; &lt;span style="color: black;"&gt;    };&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;28&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;29&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt;&lt;span style="color: black;"&gt; updateVersion &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;function&lt;/span&gt;&lt;span style="color: black;"&gt;()&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;30&lt;/span&gt; &lt;span style="color: black;"&gt;    {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;31&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        console.info(&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;Updating database to current version &lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: black;"&gt;+&lt;/span&gt;&lt;span style="color: black;"&gt; CURRENT_VERSION);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;32&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;try&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;33&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;34&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            &lt;/span&gt;&lt;span style="color: blue;"&gt;switch&lt;/span&gt;&lt;span style="color: black;"&gt;(version)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;35&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;36&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;                &lt;/span&gt;&lt;span style="color: blue;"&gt;case&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: black;"&gt;''&lt;/span&gt;&lt;span style="color: black;"&gt;  : database.changeVersion(&lt;/span&gt;&lt;span style="color: black;"&gt;''&lt;/span&gt;&lt;span style="color: black;"&gt;, &lt;/span&gt;&lt;span style="color: black;"&gt;'&lt;/span&gt;&lt;span style="color: black;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;'&lt;/span&gt;&lt;span style="color: black;"&gt;, init, failure, success);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;37&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;                &lt;/span&gt;&lt;span style="color: blue;"&gt;case&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt; : database.changeVersion(&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;, &lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;1.01&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;, up101, failure, success);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;38&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;39&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;40&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;catch&lt;/span&gt;&lt;span style="color: black;"&gt; (e)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;41&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;42&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;            console.error(&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;database.changeVersion failed &lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: black;"&gt;+&lt;/span&gt;&lt;span style="color: black;"&gt; e.message);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;43&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;        }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;44&lt;/span&gt; &lt;span style="color: black;"&gt;    };&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;45&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;46&lt;/span&gt; &lt;span style="color: black;"&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt;&lt;span style="color: black;"&gt; {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;47&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;48&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;        &lt;/span&gt;&lt;span style="color: green;"&gt;/*&lt;/span&gt;&lt;span style="color: green;"&gt;*&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;49&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;         *    open database&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;50&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;         &lt;/span&gt;&lt;span style="color: green;"&gt;*/&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;51&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;         open: &lt;/span&gt;&lt;span style="color: blue;"&gt;function&lt;/span&gt;&lt;span style="color: black;"&gt;()&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;52&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;         {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;53&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;             database &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; openDatabase(shortName, &lt;/span&gt;&lt;span style="color: black;"&gt;""&lt;/span&gt;&lt;span style="color: black;"&gt;, displayName, maxSize);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;54&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;             version &lt;/span&gt;&lt;span style="color: black;"&gt;=&lt;/span&gt;&lt;span style="color: black;"&gt; database.version;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;55&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;             console.info(&lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt;database: &lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: black;"&gt;+&lt;/span&gt;&lt;span style="color: black;"&gt; displayName &lt;/span&gt;&lt;span style="color: black;"&gt;+&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: black;"&gt;"&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: black;"&gt;+&lt;/span&gt;&lt;span style="color: black;"&gt; version);&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;56&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;             &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt;&lt;span style="color: black;"&gt; (version &lt;/span&gt;&lt;span style="color: black;"&gt;!=&lt;/span&gt;&lt;span style="color: black;"&gt; CURRENT_VERSION)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;57&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;             {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;58&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;                 updateVersion();&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;59&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;             }&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;60&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;         },&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;61&lt;/span&gt; &lt;span style="color: black;"&gt;         &lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;62&lt;/span&gt; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;span style="color: black;"&gt;         &lt;/span&gt;&lt;span style="color: green;"&gt;/*&lt;/span&gt;&lt;span style="color: green;"&gt;*&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;63&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;          * isOpen&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;64&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;          &lt;/span&gt;&lt;span style="color: green;"&gt;*/&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;65&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;          isOpen: &lt;/span&gt;&lt;span style="color: blue;"&gt;function&lt;/span&gt;&lt;span style="color: black;"&gt;()&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;66&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;          {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;67&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;              &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: blue;"&gt;null&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: black;"&gt;!=&lt;/span&gt;&lt;span style="color: black;"&gt; database;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;68&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;          },&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;69&lt;/span&gt; &lt;span style="color: black;"&gt;          &lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;70&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;          &lt;/span&gt;&lt;span style="color: green;"&gt;/*&lt;/span&gt;&lt;span style="color: green;"&gt;*&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;71&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;           * version&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;72&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: green;"&gt;           &lt;/span&gt;&lt;span style="color: green;"&gt;*/&lt;/span&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;73&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;          version: &lt;/span&gt;&lt;span style="color: blue;"&gt;function&lt;/span&gt;&lt;span style="color: black;"&gt;()&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;74&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;          {&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;75&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;              &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt;&lt;span style="color: black;"&gt; version;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;76&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: black;"&gt;          },&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;77&lt;/span&gt; &lt;span style="color: black;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;78&lt;/span&gt; &lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;79&lt;/span&gt; &lt;span style="color: black;"&gt;} ();&lt;br /&gt;&lt;/span&gt;&lt;span style="color: teal;"&gt;80&lt;/span&gt;&lt;br /&gt;&lt;span style="color: teal;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-3734540993069896925?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/3734540993069896925/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=3734540993069896925' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/3734540993069896925'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/3734540993069896925'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2010/07/exploring-ecosystem.html' title='Exploring the ecosystem'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-8837464927655634742</id><published>2010-06-23T19:52:00.000-07:00</published><updated>2010-06-24T04:17:43.674-07:00</updated><title type='text'>Been at the coalface</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Wow, it's been more than a year, time flies like the wind (&lt;a href="http://en.wikipedia.org/wiki/Time_flies_like_an_arrow;_fruit_flies_like_a_banana"&gt;fruit flies like bananas&lt;/a&gt;). Working is good and over the past year I've been hands on with Windows Mobile 6, developing a mobile application for &lt;a href="http://www.powerco.co.nz/"&gt;Powerco&lt;/a&gt;&lt;/span&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt; for field staff to test and record results for power industry assets like power poles, transformers, fuses, switches. Kind of weird to be back writing Windows Forms based apps after focusing on web apps for a long time and working with the shrunken version of .NET had some frustrations but I'm reasonably happy with the end result. Of course 20/20 hindsight is a wonderful thing and if I had it to do over again I would inevitably make some different choices.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p /&gt;&lt;br /&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;I like LINQ, &lt;a href="http://en.wikipedia.org/wiki/Data_Transfer_Object"&gt;DTO's&lt;/a&gt;, PowerShell ISE, Visual Studio 2010, and &lt;a href="http://en.wikipedia.org/wiki/Scrum_%28development%29"&gt;Scrum&lt;/a&gt;. &lt;a href="http://nettiers.com/"&gt;.netTiers&lt;/a&gt; not so much. &lt;a href="http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx"&gt;MSBuild&lt;/a&gt; (including the &lt;a href="http://msbuildtasks.tigris.org/"&gt;MSBuild Community Tasks&lt;/a&gt; and the&amp;nbsp;&lt;a href="http://msbuildextensionpack.codeplex.com/"&gt;MSBuild Extension Pack&lt;/a&gt;) was awesome for patching .netTiers code generation issues and for automating builds right through to outputting &lt;i&gt;.msi&lt;/i&gt; installers for each of the test, staging, and production environments. Getting consistent installs was a huge benefit and automating all the little tweaks required to get the .netTiers output to build reduced the code generation time from about a day down to just a few minutes.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p /&gt;&lt;br /&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;I'm not dissing .netTiers particularly, it's just prior to automating the tweaks they had all been done by hand with associated risk of transcription errors plus the time factor required. Many of the tweaks could also be applied directly to the templates so the code was generated correctly in the first place. Taking a long and often frustrating exercise and automating it meant we could effect database changes quickly and were far less concerned about having to regenerate the code if something wasn't quite right. Overall .netTiers is a fairly hefty tool and I still find it frustrating getting it to produce the desired results if the desired results don't conform to the standard output.&amp;nbsp;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;p /&gt;&lt;br /&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;I've also been doing some work for &lt;a href="http://webhost.base-2.co.nz/"&gt;base 2&lt;/a&gt; on their task management application. That app uses &lt;a href="http://www.subsonicproject.com/"&gt;SubSonic&lt;/a&gt; for data access and I really like the lighter weight of the tool. Generating code is fast and largely hassle-free. Of course it attempts to do a lot less than .netTiers which generates multiple data/service layers and I suppose each is a reasonable choice for its respective domain. Actually .netTiers was already part of the ecosystem when I joined that project and I can't imagine ever prescribing it for future work.&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-8837464927655634742?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/8837464927655634742/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=8837464927655634742' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/8837464927655634742'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/8837464927655634742'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2010/06/been-at-coalface.html' title='Been at the coalface'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-4822169210560531816</id><published>2009-03-18T17:48:00.000-07:00</published><updated>2009-03-18T17:49:58.232-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='craftsmanship'/><title type='text'>Software Craftsmanship</title><content type='html'>&lt;p&gt;I'm a fan and subscriber of &lt;a href="http://www.infoq.com"&gt;InfoQ&lt;/a&gt;. Lots of good stuff, a bit of dross, and the occasional &lt;a href="http://www.infoq.com/presentations/katz-couchdb-and-me;jsessionid=F94BA0E2042294997C7EEBFCF72B8EC5"&gt;jewel&lt;/a&gt;. The latest newsletter included news of the &lt;a href="http://www.infoq.com/news/2009/03/software_craftsmanship"&gt;Software Craftsmanship Manifesto: A Call to Arms&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;    &lt;p&gt;As aspiring Software Craftsmen we are raising the bar of professional software development by practicing it and helping others learn the craft. Through this work we have come to value:&lt;/p&gt;&lt;br /&gt; &lt;ul&gt;&lt;br /&gt;        &lt;li&gt;Not only working software, but also well-crafted software&lt;/li&gt;&lt;br /&gt;        &lt;li&gt;Not only responding to change, but also steadily adding value&lt;/li&gt;&lt;br /&gt;        &lt;li&gt;Not only individuals and interactions, but also a community of professionals&lt;/li&gt;&lt;br /&gt;        &lt;li&gt;Not only customer collaboration, but also productive partnerships&lt;/li&gt;&lt;br /&gt; &lt;/ul&gt;&lt;br /&gt;    &lt;p&gt;That is, in pursuit of the items on the left we have found the items on the right to be indispensable.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;    &lt;p&gt;&amp;copy; 2009, the undersigned. this statement may be freely copied in any form, but only in its entirety through this notice.&lt;/p&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;h2&gt;History Lesson&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;Many years ago, somewhat fresh out of school, I figured I was doing ok as a coder. The work I was involved in was generally interesting and I felt I was doing a pretty good job. That all changed dramatically a short time later when I was given the responsibility for designing and constructing from scratch the debit card PIN encryption and verification infrastructure for a &lt;a href="http://www.psis.co.nz"&gt;New Zealand household-name financial services provider&lt;/a&gt;. This involved writing C++ code to interface to the hardware encryption module locked into a rack in the computer room and communicating with PIN Pads and Encoders attached to computers in the branch network, plus a little GUI development to drive it all. These were the days before the emergence of Web Services and WCF; Windows NT was the target platform for both server and workstation &amp;mdash; there was a lot of low-level boilerplate that just didn't exist. Ultimately it all worked well, I was reasonably happy with the resulting code, and the system provided many years of reliable, low-maintenance service.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;However during the project I found myself in a deep hole with respect to a core aspect of the design. I was working for a vendor organisation at the time and when I asked for some assistance the silence was unnerving. I suspect there weren't any people in the organisation with relevant experience but what I needed was more peer review than technical assistance. Fortunately I'm not shy about asking for help when I need it. I finally got to sit down with another developer who pointed me towards the newly minted Component Object Model (COM).&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;Books&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;I started reading and haven't really ever stopped. One of the early books I read was Scott Meyers awesome &lt;a href="http://www.aristeia.com/books.html"&gt;Effective C++&lt;/a&gt;. Finding out how many things I had been doing incorrectly was painful but enlightening and really highlighted to me what a challenge it is to produce good quality C++.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Eric Meyer's &lt;a href="http://www.ericmeyeroncss.com/"&gt;Eric Meyer on CSS&lt;/a&gt; was another watershed moment for me. After an initial foray into writing code for the Web I finally began to understand how it could work. Lets face it, up until recently everything we've done on the Web is a hack. We pretend the browser is just a dumb &lt;a href="http://en.wikipedia.org/wiki/Computer_terminal"&gt;terminal&lt;/a&gt; and not a sophisticated development platform in its own right. With Web 2.0, AJAX, and REST we are beginning to see the browser platform being taken seriously with  good separation between client-side and server-side.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Jeffrey Friedl's excellent &lt;a href="http://oreilly.com/catalog/9780596002893/"&gt;Mastering Regular Expressions&lt;/a&gt; is another great book, David Flanagan's &lt;a href="http://oreilly.com/catalog/9780596101992/index.html"&gt;JavaScript: The Definitive Guide&lt;/a&gt;, Fowler's &lt;a href="http://books.google.co.nz/books?id=FyWZt5DdvFkC"&gt;Patterns of Enterprise Application Architecture&lt;/a&gt;, Andrew King's &lt;a href="http://www.websiteoptimization.com/speed/"&gt;Speed Up Your Site&lt;/a&gt;, Uncle Bob's (&amp;amp; son) &lt;a href="http://www.amazon.com/Principles-Patterns-Practices-Robert-Martin/dp/0131857258"&gt;Agile Principles, Patterns, and Practices in C#&lt;/a&gt;, Joe Celko's &lt;a href="http://www.amazon.com/Celkos-Programming-Kaufmann-Management-Systems/dp/0120887975"&gt;SQL Programming Style&lt;/a&gt;. Just a few of many great and often extremely readable tomes informing and affording better software craftmanship.&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;Voodoo&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;Having personally witnessed the likes of copy-paste coding, superstitious code, and &lt;a href="http://c2.com/cgi/wiki?VoodooChickenCoding"&gt;voodoo chicken coding&lt;/a&gt;, I've often found myself trying to raise the standard of the development efforts in which I've been involved. But I've also frequently found myself working without peer-review. It is that latter situation where the right book can be valuable, far more so than wading through pages of Google search results trying to identify the one nugget of information I'm looking for.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;I've rambled on long enough. Read the &lt;a href="http://www.infoq.com/news/2009/03/software_craftsmanship"&gt;article&lt;/a&gt;, sign the &lt;a href="http://manifesto.softwarecraftsmanship.org/main"&gt;manifesto&lt;/a&gt;, join the &lt;a href="http://www.linkedin.com/groups?about=&amp;gid=1845268"&gt;LinkedIn group&lt;/a&gt;, and raise the bar.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-4822169210560531816?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/4822169210560531816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=4822169210560531816' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/4822169210560531816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/4822169210560531816'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2009/03/software-craftsmanship.html' title='Software Craftsmanship'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-5673552691374587715</id><published>2009-03-12T21:08:00.001-07:00</published><updated>2009-03-16T14:35:02.146-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='NHibernate'/><category scheme='http://www.blogger.com/atom/ns#' term='LINQ'/><title type='text'>NHibernate.Linq</title><content type='html'>&lt;h2&gt;Hiatus&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;Right now I need to park my attempts at configuration of a new Windows Server 2008 r2 Core web server. I've effectively managed to hose my configuration, I hope temporarily, in the process of applying a security template using &lt;em&gt;secedit.exe&lt;/em&gt;. Not one of my best moments, particularly when I've had something similar occur previously. Unfortunately there just isn't a whole lot of info I can find about using secedit but I'll keep all those details for another post.&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;NHibernate&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;Having used the Java &lt;em&gt;Hibernate&lt;/em&gt; ORM tool previously, plus having an interest in LINQ and wanting to cut some actual code, I figured I would kill three birds using NHibernate.Linq. Of course once I started googling it became apparent that there are many interesting things occuring in the &lt;a href="http://altdotnet.org/"&gt;Alt.Net&lt;/a&gt; space, enough to get happily side-tracked for some time.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;I eventually found my way back and followed &lt;a href="http://www.hibernate.org/428.html"&gt;these instructions&lt;/a&gt; to build NHibernate from the latest subversion source. The mystery of the missing &lt;em&gt;assemblyinfo.cs&lt;/em&gt; files was quickly solved although I did have to install &lt;a href="http://nant.sourceforge.net/"&gt;NAnt&lt;/a&gt; and modify the &lt;em&gt;default.build&lt;/em&gt; NAnt file to correctly generate the missing file for the &lt;em&gt;NHibernate.ByteCode.Spring&lt;/em&gt; project. I think the entry had been removed to decouple NHibernate from Spring but the work may not have been complete at the point that I retrieved the source. The source has a comprehensive test suite which, apart from highlighting issues using NHibernate with my PostgreSQL database, is also a great starting point for information about using NHibernate.&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;PostgreSQL&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;As mentioned above, I'm using Postgres which happens to be installed on my MacBook Pro. I wanted to run the test suite against it from my Vista VM. Connecting to Postgres was actually pretty straight forward. I created a database user &lt;em&gt;nhibernate&lt;/em&gt; with a long random password (using &lt;em&gt;uuidgen&lt;/em&gt;) and modified the provided Postgres template, renaming it to &lt;em&gt;hibernate.cfg.xml&lt;/em&gt; (see below). Apart from setting the appropriate values for the user credentials and server, the connection string in the template incorrectly specified &lt;em&gt;"Initial Catalog"&lt;/em&gt; &amp;mdash; this needed to be changed to &lt;em&gt;"Database"&lt;/em&gt;. The Postgres driver is provided by the &lt;a href="http://www.mono-project.com/PostgreSQL"&gt;mono project&lt;/a&gt; which also contains good information about the connection string parameters. Two assemblies are required, &lt;em&gt;mono.security.dll&lt;/em&gt;, and the driver itself &lt;em&gt;Npgsql.dll&lt;/em&gt;. Once these things are in place, and assuming you already have the &lt;a href="http://nunit.org/index.php?p=download"&gt;nunit framework&lt;/a&gt; installed, the test suite runs quite happily against the Postgres database. A small percentage of tests fail, typically due to some feature difference between the target SQLServer database and Postgres, a good way to highlight those things that might bite later.&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;&amp;lt;!-- &lt;br /&gt;This template was written to work with NHibernate.Test.&lt;br /&gt;Copy the template to your NHibernate.Test project folder and rename it in hibernate.cfg.xml and change it &lt;br /&gt;for your own use before compile tests in VisualStudio.&lt;br /&gt;--&amp;gt;&lt;br /&gt;&amp;lt;hibernate-configuration  xmlns="urn:nhibernate-configuration-2.2" &amp;gt;&lt;br /&gt; &amp;lt;session-factory name="NHibernate.Test"&amp;gt;&lt;br /&gt;  &amp;lt;property name="connection.driver_class"&amp;gt;NHibernate.Driver.NpgsqlDriver&amp;lt;/property&amp;gt;&lt;br /&gt;  &amp;lt;property name="connection.connection_string"&amp;gt;&lt;br /&gt;      Server=mbp;Database=nhibernate;User ID=nhibernate;Password=D4F52CC8-5603-4C84-9147-3CC602EF359A;&lt;br /&gt;    &amp;lt;/property&amp;gt;&lt;br /&gt;  &amp;lt;property name="dialect"&amp;gt;NHibernate.Dialect.PostgreSQLDialect&amp;lt;/property&amp;gt;&lt;br /&gt;  &amp;lt;property name="proxyfactory.factory_class"&amp;gt;NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu&amp;lt;/property&amp;gt;&lt;br /&gt; &amp;lt;/session-factory&amp;gt;&lt;br /&gt;&amp;lt;/hibernate-configuration&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h2&gt;NHibernate.Linq&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;NHibernate.Linq is part of the &lt;a href="http://sourceforge.net/projects/nhcontrib/"&gt;NH Contrib&lt;/a&gt; project and the source is available from &lt;a href="https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib/trunk/"&gt;subversion&lt;/a&gt;. I replaced the NHibernate.dll with the one generated above. The test suite uses the &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=06616212-0356-46A0-8DA2-EEBC53A68034&amp;displaylang=en"&gt;NorthWind database&lt;/a&gt; so no joy testing against Postgres. I have SQLExpress installed in my Vista VM and with some jiggery pokery the tests will run successfully. First allow the user &lt;em&gt;Full control&lt;/em&gt; on folder &lt;em&gt;C:\SQL Server 2000 Sample Databases&lt;/em&gt; (or second in the event that attempting to attach the NorthWind database results in an error 5 exception). After starting SQLExpress if it isn't already running, it's necessary to attach the NorthWind database using the &lt;em&gt;sp_attach_db&lt;/em&gt; stored procedure. And might as well create the &lt;em&gt;Test&lt;/em&gt; database that is also required by the test suite.&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_cJJ7rUGFxBY/Sb7B1yBgSgI/AAAAAAAAADg/9Rc067eKDRg/s1600-h/AttachNorthWind.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 230px;" src="http://4.bp.blogspot.com/_cJJ7rUGFxBY/Sb7B1yBgSgI/AAAAAAAAADg/9Rc067eKDRg/s400/AttachNorthWind.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5313897740049074690" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;By default accessing SQLExpress is limited to the &lt;em&gt;Shared Memory&lt;/em&gt; protocol (some info and much joy can be found at &lt;a href="http://geekswithblogs.net/timh/archive/2006/01/30/67586.aspx"&gt;SQL Server 2005 SQLExpress error: ...provider:Named Pipes Provider, error 40 - Could not open connection to SQL Server&lt;/a&gt; &amp;mdash; fortunately I was already familiar with the issue, others obviously weren't so lucky). The NHibernate.Linq test suite uses &lt;em&gt;Named Pipes&lt;/em&gt; for connecting to the database and will choke if the protocol isn't enabled. Enabling &lt;em&gt;Named Pipes&lt;/em&gt; is straight forward using &lt;em&gt;SQLServer Configuration Manager&lt;/em&gt; and requires the service to be restarted.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_cJJ7rUGFxBY/Sb7CPh_BEHI/AAAAAAAAADo/oxeFhPjBhkQ/s1600-h/SQLServerConfigMgr.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 319px;" src="http://4.bp.blogspot.com/_cJJ7rUGFxBY/Sb7CPh_BEHI/AAAAAAAAADo/oxeFhPjBhkQ/s400/SQLServerConfigMgr.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5313898182420271218" /&gt;&lt;/a&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;The other trap to be aware of is the surface area configuration which needed to be modified to add my user as an administrator and ensure remote connections via named pipes are enabled. This is managed by the &lt;em&gt;SQL Server 2005 Surface Area Configuration&lt;/em&gt; tool.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_cJJ7rUGFxBY/Sb7CdRcpT5I/AAAAAAAAADw/8OEtb06vJ0o/s1600-h/SurfaceAreaConfig.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 302px;" src="http://3.bp.blogspot.com/_cJJ7rUGFxBY/Sb7CdRcpT5I/AAAAAAAAADw/8OEtb06vJ0o/s400/SurfaceAreaConfig.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5313898418499309458" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;em&gt;app.config&lt;/em&gt; file for the test suite also needs to be modified to connect to SQLExpress:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;br /&gt;&amp;lt;configuration&amp;gt;&lt;br /&gt; &amp;lt;connectionStrings&amp;gt;&lt;br /&gt;  &amp;lt;add name="Test"&lt;br /&gt;    connectionString="Data Source=.\SQLExpress;initial catalog=Test;Integrated Security=SSPI"/&amp;gt;&lt;br /&gt;  &amp;lt;add name="Northwind"&lt;br /&gt;    connectionString="Data Source=.\SQLExpress;Initial Catalog=NorthWind;Integrated Security=SSPI"/&amp;gt;&lt;br /&gt; &amp;lt;/connectionStrings&amp;gt;&lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h2&gt;Running&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;To actually run the tests, the &lt;em&gt;NHibernate.Linq.Test&lt;/em&gt; project needs to be the Startup Project and the project properties modified to use NUnit for testing.&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_cJJ7rUGFxBY/Sb7DKWDuZWI/AAAAAAAAAD4/-Gx8kj8oYhQ/s1600-h/NH.Linq.TestsProps.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 305px;" src="http://4.bp.blogspot.com/_cJJ7rUGFxBY/Sb7DKWDuZWI/AAAAAAAAAD4/-Gx8kj8oYhQ/s400/NH.Linq.TestsProps.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5313899192831075682" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Finally the tests run successfully. 46 of the tests are ignored which indicates there is some work yet to be completed but at least it is obvious where the work is required.&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_cJJ7rUGFxBY/Sb7DU3jQMtI/AAAAAAAAAEA/NrsXQnQ6wo0/s1600-h/NHibernate.Linq.Tests.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 234px;" src="http://4.bp.blogspot.com/_cJJ7rUGFxBY/Sb7DU3jQMtI/AAAAAAAAAEA/NrsXQnQ6wo0/s400/NHibernate.Linq.Tests.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5313899373620376274" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-5673552691374587715?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/5673552691374587715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=5673552691374587715' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/5673552691374587715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/5673552691374587715'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2009/03/nhibernatelinq.html' title='NHibernate.Linq'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_cJJ7rUGFxBY/Sb7B1yBgSgI/AAAAAAAAADg/9Rc067eKDRg/s72-c/AttachNorthWind.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-7576163568330307357</id><published>2009-02-26T20:00:00.000-08:00</published><updated>2009-02-28T12:48:34.488-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerShell'/><title type='text'>More PowerShell Remoting</title><content type='html'>&lt;p&gt;I have spent some time on forums inquiring about the ability to transfer files between machines using PowerShell Remoting. I have an inkling I've been asking the wrong question. Until I have PowerShell Remoting configured correctly I'm not going to be able to do any useful experimentation.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Now, there are some breaking changes to PowerShell in v2 CTP3. For example &lt;em&gt;Invoke-Expression&lt;/em&gt; no longer has a &lt;em&gt;ComputerName&lt;/em&gt; parameter; this is now the domain of &lt;em&gt;Invoke-Command&lt;/em&gt;. It makes searching for useful information on Remoting a little more interesting. So lets have a look at the result of issuing a remote &lt;em&gt;Get-Process&lt;/em&gt;:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PS C:\Windows\System32&gt; invoke-command -computername w2k8r2 {get-process}&lt;br /&gt;Invoke-Command : [w2k8r2] Connecting to remote server failed with the following error message : The WinRM client cannot process&lt;br /&gt;the request. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then&lt;br /&gt;HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting. Use&lt;br /&gt;winrm.cmd to configure TrustedHosts. You can get more information about that by running the following command: winrm help config.&lt;br /&gt;At line:1 char:15&lt;br /&gt;+ invoke-command &lt;&lt;&lt;&lt;  -computername w2k8r2 {get-process}&lt;br /&gt;    + CategoryInfo          : OpenError: (:) [Invoke-Command], PSRemotingTransportException&lt;br /&gt;    + FullyQualifiedErrorId : RemoteRunspaceStateBroken&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;Fair enough, neither the client nor the server is part of a domain. Adding the destination machine to the TrustedHosts configuration setting is generally accompanied by warnings not to use this option for a production environment. That leaves me the option of using HTTPS and that requires a certificate. For my purposes a self-signed certificate is going to be perfectly adequate.&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;Server Activation&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;As an aside, I've not been able to activate my new server. Whenever I tried I would get error 0x80072EE7. The penny finally dropped - without a DNS server there is no way to identify the IP address of the Microsoft site used for activation, doh. So lets get that out of the way. The product key for the server is available on the &lt;a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=85cfe4c9-34de-477c-b5ca-75edae3d57c5"&gt;Windows Server 2008 R2 Beta download page&lt;/a&gt;:&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;C:\Users\dave&gt;netsh interface ipv4 add dnsservers "Local Area Connection" 10.20.1.1&lt;br /&gt;The service has not been started.&lt;br /&gt;PS C:\Users\dave&gt; set-service dnscache -startupType automatic&lt;br /&gt;PS C:\Users\dave&gt; start-service dnscache&lt;br /&gt;PS C:\Users\dave&gt; cscript c:\windows\system32\slmgr.vbs -ipk FH4Y6-XGKH9-V6W22-YB7YT-HQDFB&lt;br /&gt;Microsoft (R) Windows Script Host Version 5.8&lt;br /&gt;Copyright (C) Microsoft Corporation. All rights reserved.&lt;br /&gt;&lt;br /&gt;Installed product key FH4Y6-XGKH9-V6W22-YB7YT-HQDFB successfully.&lt;br /&gt;&lt;br /&gt;PS C:\Users\dave&gt; cscript c:\windows\system32\slmgr.vbs -ato&lt;br /&gt;Microsoft (R) Windows Script Host Version 5.8&lt;br /&gt;Copyright (C) Microsoft Corporation. All rights reserved.&lt;br /&gt;&lt;br /&gt;Activating Windows(R) Web Server, ServerWebCore edition (220cd791-4e60-4412-8fcf-d605f54d3ae0) ...&lt;br /&gt;Product activated successfully.&lt;br /&gt;&lt;br /&gt;PS C:\Users\dave&gt; cscript c:\windows\system32\slmgr.vbs -xpr&lt;br /&gt;Microsoft (R) Windows Script Host Version 5.8&lt;br /&gt;Copyright (C) Microsoft Corporation. All rights reserved.&lt;br /&gt;&lt;br /&gt;Windows(R) Web Server, ServerWebCore edition:&lt;br /&gt;    The machine is permanently activated.&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h2&gt;MakeCert&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;Sweet, now back to the task at hand. I'm using information from Brian Ehlert's &lt;a href="http://itproctology.blogspot.com/2008/09/securing-hyper-v-winrm-with-self-signed_29.html"&gt;IT Proctology&lt;/a&gt; to configure WinRM with a self-signed certificate. I don't have a copy of &lt;em&gt;SelfSSL.exe&lt;/em&gt; but I do have two copies of &lt;em&gt;makecert.exe&lt;/em&gt;. Past experience tells me all &lt;em&gt;makecert.exe&lt;/em&gt;'s are not created equal and as usual the first one I try fails. So the version I'm using is &lt;em&gt;C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\makecert.exe&lt;/em&gt; which I suspect was installed with Visual Studio. Attempting to run makecert on my server doesn't work:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PS E:\&gt; .\makecert.exe&lt;br /&gt;Program 'makecert.exe' failed to execute: The subsystem needed to support the image type is not present&lt;br /&gt;At line:1 char:15&lt;br /&gt;+ .\makecert.exe &lt;&lt;&lt;&lt; .&lt;br /&gt;At line:1 char:1&lt;br /&gt;+  &lt;&lt;&lt;&lt; .\makecert.exe&lt;br /&gt;    + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException&lt;br /&gt;    + FullyQualifiedErrorId : NativeCommandFailed&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h2&gt;WoW64&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;Obviously I'm missing something. WoW64 support for 32 bit applications is now an optional feature in Server Core and isn't installed by default. I also have the 32-bit .Net Frameworks installed so I figure I might as well include support for that. And a restart is required.&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;C:\Users\dave&gt;start /w ocsetup ServerCore-WOW64&lt;br /&gt;C:\Users\dave&gt;Start /w ocsetup NetFx2-ServerCore-WOW64&lt;br /&gt;C:\Users\dave&gt;Start /w ocsetup NetFx3-ServerCore-WOW64&lt;br /&gt;C:\Users\dave&gt;shutdown /r /t 0&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h2&gt;Using PowerShell to eject CD/DVD&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;Another short aside, the Mac Mini I'm using for my web server doesn't have an eject button. As I mentioned way back &lt;a href="http://stillpearling.blogspot.com/2009/02/installing-windows-server-2008-core-on.html"&gt;here&lt;/a&gt; it is possible to eject media by holding down the left mouse button during a restart. Even for a non-server environment this isn't particularly practical. Googling turned up a lot of suggestions around scripting the Windows media player, not an option for Server Core. I finally tracked down a workable solution (and useful explanation) on the &lt;a href="http://www.vistax64.com/powershell/25943-how-can-i-eject-my-cd-rom.html"&gt;vistax64 PowerShell forum&lt;/a&gt;. Note in the script below there is no ampersand in the verb &lt;em&gt;Eject&lt;/em&gt;. This is contrary to the forum post and had me scratching my head for a while - I could hear the drive being accessed but the DVD wasn't being ejected. Notice also the call to &lt;em&gt;ReleaseComObject&lt;/em&gt; and &lt;em&gt;Remove-Variable&lt;/em&gt;, a little bit of tidying up to ensure the Shell.Application COM object is disposed of and the associated object reference is deleted:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PS C:\Users\dave\Documents&gt; $sa = new-object -com Shell.Application&lt;br /&gt;PS C:\Users\dave\Documents&gt; $sa.Namespace(17).ParseName("D:").InvokeVerb("Eject")&lt;br /&gt;PS C:\Users\dave\Documents&gt; [System.Runtime.Interopservices.Marshal]::ReleaseComObject($sa)&lt;br /&gt;PS C:\Users\dave\Documents&gt; Remove-Variable sa&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h2&gt;Creating a self-signed certificate&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;So lets see about creating a certificate. I need to create one that can be used for Server Authentication and because it's not from an existing Trusted Certificate Authority I'm going to also install it into the &lt;em&gt;Trusted Root Certification Authorities&lt;/em&gt; store using the command line utility &lt;em&gt;certutil.exe&lt;/em&gt;.&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PS C:\Users\dave&gt; .\makecert.exe -r -pe -n "CN=W2k8r2,O=Zebra Crossing Ltd" -e 01/01/2036 -eku 1.3.6.1.5.5.7.3.1 -ss my&lt;br /&gt;-sr localMachine -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 W2k8r2.cer&lt;br /&gt;Succeeded&lt;br /&gt;&lt;br /&gt;PS C:\Users\dave&gt; certutil -store "my" "W2k8r2"&lt;br /&gt;my&lt;br /&gt;================ Certificate 2 ================&lt;br /&gt;Serial Number: 18a1515e9f87bc8c4047985ca34ef87b&lt;br /&gt;Issuer: CN=W2k8r2, O=Zebra Crossing Ltd&lt;br /&gt; NotBefore: 27/02/2009 1:10 p.m.&lt;br /&gt; NotAfter: 1/01/2036 12:00 a.m.&lt;br /&gt;Subject: CN=W2k8r2, O=Zebra Crossing Ltd&lt;br /&gt;Signature matches Public Key&lt;br /&gt;Root Certificate: Subject matches Issuer&lt;br /&gt;Cert Hash(sha1): 3d bf 69 dc 88 c1 bd 68 bc b0 dc 7c af 4c 9f 44 4a fb 78 73&lt;br /&gt;  Key Container = 6755b6e3-4b68-4444-8478-f418c9bf58c8&lt;br /&gt;  Unique container name: ec9335511231310c09e44db4db78a25b_2515a01f-d083-4c9d-abf6-5ef325a4f5e5&lt;br /&gt;  Provider = Microsoft RSA SChannel Cryptographic Provider&lt;br /&gt;Encryption test passed&lt;br /&gt;CertUtil: -store command completed successfully.&lt;br /&gt;&lt;br /&gt;PS C:\Users\dave\Documents&gt; certutil -addstore root .\W2k8r2.cer&lt;br /&gt;root&lt;br /&gt;Signature matches Public Key&lt;br /&gt;Certificate "CN=W2k8r2, O=Zebra Crossing Ltd" added to store.&lt;br /&gt;CertUtil: -addstore command completed successfully.&lt;br /&gt;&lt;br /&gt;PS C:\Users\dave\Documents&gt; certutil -store root W2k8r2&lt;br /&gt;root&lt;br /&gt;================ Certificate 0 ================&lt;br /&gt;Serial Number: 5e4aae197bd461994867979c58549cff&lt;br /&gt;Issuer: CN=W2k8r2, O=Zebra Crossing Ltd&lt;br /&gt; NotBefore: 27/02/2009 1:37 p.m.&lt;br /&gt; NotAfter: 1/01/2036 12:00 a.m.&lt;br /&gt;Subject: CN=W2k8r2, O=Zebra Crossing Ltd&lt;br /&gt;Signature matches Public Key&lt;br /&gt;Root Certificate: Subject matches Issuer&lt;br /&gt;Cert Hash(sha1): da bd de a7 72 a8 6d 0d 1f d4 4b b5 37 d9 12 c6 49 a9 56 0d&lt;br /&gt;No key provider information&lt;br /&gt;Encryption test passed&lt;br /&gt;CertUtil: -store command completed successfully.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h2&gt;Configuring WinRM&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;The certificate hash from the previous step is the thumbprint required for setting up a new WinRM listener. Note in the next step we're not using PowerShell, just the standard command prompt. Trying to issue this same command in PowerShell gives &lt;em&gt;Error: Invalid use of command line. Type "winrm -?" for help&lt;/em&gt;. I figure there must be some escaping needed to get it to work in PowerShell, something to look at another day.&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;C:\Users\dave&gt;winrm create winrm/config/Listener?Address=*+Transport=HTTPS&lt;br /&gt;@{Hostname="W2k8r2";CertificateThumbprint="dabddea772a86d0d1fd44bb537d912c649a9560d"}&lt;br /&gt;ResourceCreated&lt;br /&gt;    Address = http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous&lt;br /&gt;    ReferenceParameters&lt;br /&gt;        ResourceURI = http://schemas.microsoft.com/wbem/wsman/1/config/listener&lt;br /&gt;        SelectorSet&lt;br /&gt;            Selector: Address = *, Transport = HTTPS&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;Time to test the configuration on the server.&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;C:\Users\dave&gt;winrs -r:https://W2k8r2 hostname&lt;br /&gt;W2k8r2&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;On the client &lt;em&gt;Invoke-Command&lt;/em&gt; can be used to make the same request. Of course the certificate on the server is not from a trusted Certificate Authority and the result is not pretty:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PS C:\Users\dave&gt; invoke-command -useSSl W2k8r2 {hostname}&lt;br /&gt;Invoke-Command : [W2k8r2] Connecting to remote server failed with the following error message : The server certificate on&lt;br /&gt;the destination computer (W2k8r2:443) has the following errors:    &lt;br /&gt;The SSL certificate is signed by an unknown certificate authority.&lt;br /&gt;At line:1 char:15&lt;br /&gt;+ invoke-command &lt;&lt;&lt;&lt;  -useSSl W2k8r2 {hostname}&lt;br /&gt;    + CategoryInfo          : OpenError: (:) [Invoke-Command], PSRemotingTransportException&lt;br /&gt;    + FullyQualifiedErrorId : RemoteRunspaceStateBroken&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;Fortunately there is an option to ignore the Certificate Authority check:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PS C:\Users\dave&gt; $so = New-WSManSessionOption -SkipCACheck&lt;br /&gt;PS C:\Users\dave&gt; invoke-command -useSSl -SessionOption $so W2k8r2 {hostname}&lt;br /&gt;&lt;br /&gt;W2k8r2&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;Cool, now lets see if I can get a file transferred between the server and my Vista VM. I specify a &lt;em&gt;-ReadCount&lt;/em&gt; argument of 0 to indicate the entire contents should  be sent at one time (the default is 1 line and for a binary file is extremely slow):&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PS C:\Users\dave&gt; invoke-command -useSSL -SessionOption $so W2k8r2 {get-content -encoding byte -ReadCount 0&lt;br /&gt;"C:/Users/dave/Documents/makecert.exe"} | set-content -encoding byte .\Documents\makecert.exe&lt;br /&gt;&lt;br /&gt;PS C:\Users\dave&gt; .\Documents\makecert.exe&lt;br /&gt;Error: Please either specify the outputCertificateFile or -ss option&lt;br /&gt;Usage: MakeCert [ basic|extended options] [outputCertificateFile]&lt;br /&gt;Basic Options&lt;br /&gt; -sk  &amp;lt;keyName&amp;gt;      Subject's key container name; To be created if not present&lt;br /&gt;[rest of output elided]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;Hooray. A little tweaking and I should be able to reliably transfer files over the WinRM connection to any path on the server that I have the authority to access.&lt;/p&gt;&lt;br /&gt;&lt;h2&gt;Not so fast&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;Not quite there yet, turns out the only time I can successfully connect using PowerShell Remoting is when I'm also logged in using Remote Desktop. &amp;lt;curses foiled="again"/&amp;gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-7576163568330307357?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/7576163568330307357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=7576163568330307357' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/7576163568330307357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/7576163568330307357'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2009/02/more-powershell-remoting.html' title='More PowerShell Remoting'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-7367405055038588725</id><published>2009-02-25T19:49:00.000-08:00</published><updated>2009-02-25T21:27:59.540-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><title type='text'>Installing Windows Server 2008 Core part 4</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_cJJ7rUGFxBY/SaYoKoOD-NI/AAAAAAAAACY/Lvbr1G10qzc/s1600-h/IIS+Manager.jpg"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 320px; height: 221px;" src="http://2.bp.blogspot.com/_cJJ7rUGFxBY/SaYoKoOD-NI/AAAAAAAAACY/Lvbr1G10qzc/s320/IIS+Manager.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5306973373962909906" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;p&gt;Remote management of IIS 7 would be nice. I spent some time trying to figure out why the IIS Management Console on Vista didn't have the option to add a new connection to my new Win2K8 server. Turns out I need &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=32c54c37-7530-4fc0-bd20-177a3e5330b7&amp;displaylang=en"&gt; Internet Information Services (IIS) 7.0 Manager&lt;/a&gt;. Installing and starting it displays a substantially different UI.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;On the server, the Web Management Service needs to be started. Also, checking the firewall configuration on the server reveals there is open access through the firewall for the service. I'm going to set the startup for the service to automatic and I'm also going to restrict incoming traffic to the local subnet:&lt;/p&gt;&lt;br /&gt;&lt;code&gt;C:\&gt; Netsh advfirewall firewall set rule name="Web Management Service (HTTP Traffic-In)" new remoteip=localsubnet&lt;/code&gt;&lt;br /&gt;&lt;p&gt;Now I can connect through the firewall but on my first connection attempt I get a &lt;em&gt;Server Certificate Alert&lt;/em&gt; because I don't have the servers self-signed certificate in my trusted certificate store. Viewing the certificate provides an option to install it into my local store which is nice. Sadly the remote server is not accepting connections. So how to enable remote management for IIS. Googling reveals any number of helpful pictures of where in the IIS Management Console to tick the box enabling remote management. Unfortunately there isn't any obvious information about how to do this on Core. I'm having a wee stab in the dark using regedit to modify the entry &lt;em&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WebManagement\Server\EnableRemoteManagement&lt;/em&gt;, changing the &lt;em&gt;REG_DWORD&lt;/em&gt; value from 0 to 1. Restart the &lt;em&gt;Web Management Service&lt;/em&gt; and I can now  successfully add the server as a new connection. Unfortunately when I open that connection there are only three options available to me; Feature Delegation; IIS Manager Permissions; and IIS Manager Permissions.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;After some toing and froing on &lt;a href="http://forums.iis.net/p/1155166/1894911.aspx#1894911"&gt;The Official Microsoft IIS Site&lt;/a&gt; I managed to get it sorted. The Official word from Anil Ruia is:&lt;/p&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;This is an issue with how clr looks for managed assemblies - in vista SP1, Microsoft.Web.Management.IisClient, version=7.0.0.0 (and AspnetClient) are also installed to the inetsrv directory along with being in the GAC - now when connecting to win7, version 7.5 of these dlls are downloaded, but when trying to load them, CLR first finds the 7.0 versions in the inetsrv directory and complains that the version does not match.  The fix in vista sp2 is just to make sure that the 7.0 versions are not installed to inetsrv directory.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;p&gt;I created a sub directory C:\Windows\System32\inetsrv\Microsoft.Web and moved Microsoft.Web.*.dll into that directory. I did have to take ownership of those particular files and then allow administrators full control. But, yes it does work and I now have access to the complete list of features in iis7 on my remote server.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-7367405055038588725?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/7367405055038588725/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=7367405055038588725' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/7367405055038588725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/7367405055038588725'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2009/02/installing-windows-server-2008-core.html' title='Installing Windows Server 2008 Core part 4'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_cJJ7rUGFxBY/SaYoKoOD-NI/AAAAAAAAACY/Lvbr1G10qzc/s72-c/IIS+Manager.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-9140658527374129848</id><published>2009-02-16T20:30:00.000-08:00</published><updated>2009-02-17T01:17:54.073-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerShell'/><title type='text'>More PowerShell Adventures</title><content type='html'>&lt;p&gt;The journey to administration of IIS 7 on Windows Web Server 2008 R2 Core has not been a happy time. Hopefully perseverance will eventually pay some dividends. So my objective right now is to install the IIS 7 PowerShell snap-in. I know where it is: &lt;a href="http://66.129.69.178/downloads/files/powershell/iis7psprov_x64_rc1.msi"&gt;http://66.129.69.178/downloads/files/powershell/iis7psprov_x64_rc1.msi&lt;/a&gt;. I just need to download it to my server. Note my server doesn't currently have a DNS entry which means providing a hostname is just not going to work, I need to replace &lt;em&gt;www.iis.net&lt;/em&gt; with the equivalent IP Address &lt;em&gt;66.129.69.178&lt;/em&gt;. Google throws up a number of &lt;em&gt;wget&lt;/em&gt; scripts; after trying various versions and failing to get anything to retrieve the file I went back to basics and used a page from &lt;a href="http://bartdesmet.net/blogs/bart/archive/2006/11/25/PowerShell-_2D00_-How-to-download-a-file_3F00_.aspx"&gt;B#.Net Blog&lt;/a&gt;. This uses .Net Framework class &lt;em&gt;System.Net.WebClient&lt;/em&gt; to retrieve the file. The problem with most of the scripts I found is that error reporting is generally left to the default PowerShell Exception report which by and large is not particularly useful:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient request."&lt;br /&gt;At line:1 char:21&lt;br /&gt;+ $client.DownloadFile &lt;&lt;&lt;&lt; ($url, $file)&lt;br /&gt;    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException&lt;br /&gt;    + FullyQualifiedErrorId : DotNetMethodException&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;In order to get a little more detail I need to trap the exception and delve into it to find out what caused it. This is relatively straight forward using the &lt;em&gt;trap&lt;/em&gt; mechanism. To begin with lets display the methods available on the Exception object.&lt;/p&gt;    &lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PS C:\Users\Administrator&gt; trap { $error[0].Exception | get-member } $client.DownloadFile($url,$file)&lt;br /&gt;&lt;br /&gt;   TypeName: System.Management.Automation.MethodInvocationException&lt;br /&gt;&lt;br /&gt;Name             MemberType Definition&lt;br /&gt;----             ---------- ----------&lt;br /&gt;Equals           Method     System.Boolean Equals(Object obj)&lt;br /&gt;GetBaseException Method     System.Exception GetBaseException()&lt;br /&gt;GetHashCode      Method     System.Int32 GetHashCode()&lt;br /&gt;GetObjectData    Method     System.Void GetObjectData(SerializationInfo info, StreamingContext c...&lt;br /&gt;GetType          Method     System.Type GetType()&lt;br /&gt;ToString         Method     System.String ToString()&lt;br /&gt;Data             Property   System.Collections.IDictionary Data {get;}&lt;br /&gt;ErrorRecord      Property   System.Management.Automation.ErrorRecord ErrorRecord {get;}&lt;br /&gt;HelpLink         Property   System.String HelpLink {get;set;}&lt;br /&gt;InnerException   Property   System.Exception InnerException {get;}&lt;br /&gt;Message          Property   System.String Message {get;}&lt;br /&gt;Source           Property   System.String Source {get;set;}&lt;br /&gt;StackTrace       Property   System.String StackTrace {get;}&lt;br /&gt;TargetSite       Property   System.Reflection.MethodBase TargetSite {get;}&lt;br /&gt;Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient re&lt;br /&gt;quest."&lt;br /&gt;At line:1 char:63&lt;br /&gt;+ trap { $error[0].Exception | get-member } $client.DownloadFile &lt;&lt;&lt;&lt; ($url,$file)&lt;br /&gt;    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException&lt;br /&gt;    + FullyQualifiedErrorId : DotNetMethodException&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;The &lt;em&gt;ToString&lt;/em&gt; method is reasonably useful but generates a fair amount of output, including a full stack trace. Time to see what it looks like:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PS C:\Users\Administrator&gt; $client = new-object System.Net.WebClient&lt;br /&gt;PS C:\Users\Administrator&gt; $url = "http://66.129.69.178/downloads/files/powershell/iis7psprov_x64_rc1.msi"&lt;br /&gt;PS C:\Users\Administrator&gt; $file = Join-Path $home Downloads\iis7psprov_x64_rc1.msi&lt;br /&gt;PS C:\Users\Administrator&gt; $file&lt;br /&gt;C:\Users\Administrator\Downloads\iis7psprov_x64_rc1.msi&lt;br /&gt;PS C:\Users\Administrator&gt; trap { $error[0].Exception.ToString() } $client.DownloadFile($url,$file)&lt;br /&gt;System.Management.Automation.MethodInvocationException: Exception calling "DownloadFile" with "2" a&lt;br /&gt;rgument(s): "An exception occurred during a WebClient request." ---&gt; System.Net.WebException: An ex&lt;br /&gt;ception occurred during a WebClient request. ---&gt; System.Configuration.ConfigurationErrorsException&lt;br /&gt;: Error creating the Web Proxy specified in the 'system.net/defaultProxy' configuration section. --&lt;br /&gt;-&gt; System.DllNotFoundException: Unable to load DLL 'rasapi32.dll': The specified module could not b&lt;br /&gt;e found. (Exception from HRESULT: 0x8007007E)&lt;br /&gt;   at System.Net.UnsafeNclNativeMethods.RasHelper.RasEnumConnections(RASCONN[] lprasconn, UInt32&amp; l&lt;br /&gt;pcb, UInt32&amp; lpcConnections)&lt;br /&gt;[full stack trace elided]&lt;br /&gt;   at System.Management.Automation.StatementListNode.ExecuteStatement(ParseTreeNode statement, Arra&lt;br /&gt;y input, Pipe outputPipe, ArrayList&amp; resultList, ExecutionContext context)&lt;br /&gt;Exception calling "DownloadFile" with "2" argument(s): "An exception occurred during a WebClient re&lt;br /&gt;quest."&lt;br /&gt;At line:1 char:61&lt;br /&gt;+ trap { $error[0].Exception.ToString() } $client.DownloadFile &lt;&lt;&lt;&lt; ($url,$file)&lt;br /&gt;    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException&lt;br /&gt;    + FullyQualifiedErrorId : DotNetMethodException&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;As I said, a fair amount of output. But it does contain some useful information - &lt;em&gt;Error creating the Web Proxy specified in the 'system.net/defaultProxy' configuration section. ---&gt; System.DllNotFoundException: Unable to load DLL 'rasapi32.dll'&lt;/em&gt;. I guess I should have read &lt;a href="http://download.microsoft.com/download/4/5/6/45605938-AC68-4FF7-A092-10AFF0F7E5C7/Windows%20Server%202008%20R2%20Beta%20Release%20Notes.htm"&gt;the release notes&lt;/a&gt;:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;If you run applications that use managed code that communicates with the Internet with autoproxy&lt;br /&gt;detection, the operation will fail with an unhandled exception that mentions an error creating the&lt;br /&gt;Web proxy because Rasapi32.dll could not be found.&lt;br /&gt;&lt;br /&gt;To correct this, open the Machine.config file (default location is&lt;br /&gt;C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG), locate the final closing &amp;lt;/configuration&amp;gt;&lt;br /&gt;tag, and append the following:&lt;br /&gt;&lt;br /&gt;&amp;lt;system.net&amp;gt; &amp;lt;defaultProxy&amp;gt; &amp;lt;proxy usesystemdefault="false" proxyaddress="&amp;lt;replace_with_proxy_address&amp;gt;"&lt;br /&gt;bypassonlocal="true" /&amp;gt; &amp;lt;/defaultProxy&amp;gt; &amp;lt;/system.net&amp;gt;&lt;br /&gt;&lt;br /&gt;where &amp;lt;replace_with_proxy_address&amp;gt; is the address and port, if needed, of the proxy server&lt;br /&gt;used by the client application to access the .NET application. For example, proxyaddress="&amp;lt;http://proxyserver:80&amp;gt;".&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;I'm not actually using a proxy server, what I want to do is avoid the system trying to load the &lt;em&gt;rasapi32.dll&lt;/em&gt;. What I need to do is somehow indicate that I don't wish to use the default proxy, whatever that is defined as, when I'm making my &lt;em&gt;WebClient.DownloadFile()&lt;/em&gt; request. The correct sequence of calls is then:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PS C:\Users\Administrator&gt; $client = new-object System.Net.WebClient&lt;br /&gt;PS C:\Users\Administrator&gt; $url = "http://66.129.69.178/downloads/files/powershell/iis7psprov_x64_rc1.msi"&lt;br /&gt;PS C:\Users\Administrator&gt; $file = Join-Path $home Downloads\iis7psprov_x64_rc1.msi&lt;br /&gt;PS C:\Users\Administrator&gt; [System.Net.GlobalProxySelection]::Select = [System.Net.GlobalProxySelection]::GetEmptyWebProxy()&lt;br /&gt;PS C:\Users\Administrator&gt; trap { $error[0].Exception.ToString() } $client.DownloadFile($url,$file)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;This next step ends up just being stupid, annoying, insulting, you get the picture, not happy. &lt;a href="http://learn.iis.net/page.aspx/429/installing-the-iis-70-powershell-snap-in/"&gt;Installing the IIS 7.0 PowerShell Snap-in&lt;/a&gt; effectively says "go get the installer and run the installer". So I've finally got the installer. I go ahead and run the installer and the installation fails with an error &lt;em&gt;IIS Version 7.0 or greater is required to install Microsoft Windows PowerShell provider for IIS 7.0&lt;/em&gt;. I'm running Windows Server 2008 r2, I've got IIS 7 installed. A &lt;a href="http://forums.iis.net/t/1154380.aspx"&gt;forum post&lt;/a&gt; adds fuel to the fire, particularly this post:&lt;/p&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;This is "by design". What you have in Win7 beta is practically the same code as RC of powershell snapin, which is for downlevel versions only.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;p&gt;Really sucks. If something like this is "by design" then it should be documented somewhere obvious. This is just a waste of time for anyone who is trying to get enthusiastic about using this stuff. The workaround is also documented in the thread (thanks 13xforever), change minor version of IIS from 5 to 0 in &lt;em&gt;HKLM:\SOFTWARE\Microsoft\InetStp&lt;/em&gt; (and back again after the installation is complete). Now I need to let PowerShell run scripts:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PS C:\Users\Administrator&gt; Get-ExecutionPolicy&lt;br /&gt;Restricted&lt;br /&gt;PS C:\Users\Administrator&gt; Set-ExecutionPolicy RemoteSigned&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;And to make my life easier on Core I've created $home\Bin\IIS.cmd containing the &lt;em&gt;Target:&lt;/em&gt; for the &lt;em&gt;IIS PowerShell Management Console&lt;/em&gt; menu item shortcut installed with the snap-in. Unfortunately I can't post that information because blogger thinks I'm doing something dodgy and removes the offending code and the rest of the post (I guess if you've read this far you might consider that a bonus). I've added the Bin folder to the &lt;em&gt;PATH&lt;/em&gt; environment variable. To avoid adding the Administrator's Bin folder to the path for all users it's first necessary to locate the appropriate registry key for the Administrator's environment variables. On my server it looks something like &lt;em&gt;HKEY_USERS\S-1-5-21-1234567890-1234567890-1234567890-500\Environment&lt;/em&gt;. Then it's just a case of adding a new &lt;em&gt;Expandable String Value&lt;/em&gt; called &lt;em&gt;PATH&lt;/em&gt; and giving it a value of &lt;em&gt;%PATH%;%UserProfile%\Bin&lt;/em&gt;. The command prompt needs to be restarted in order for the change to take effect.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;To cap off a fairly unproductive day, I've just been reminded that I shouldn't be using the Administrator account for administration. Absolutely correct and in fact the Administrator account should be renamed and disabled. Way back in &lt;a href="http://stillpearling.blogspot.com/2009/02/installing-windows-server-2008-core-on_09.html"&gt;Installing Windows Server 2008 Core part 2&lt;/a&gt; I created another administrative account. Time to start using it. This means I need to move my Bin directory and apply the registry changes to a different user profile. Finally:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;C:\Users\dave&gt;iis&lt;br /&gt;PS IIS:\&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-9140658527374129848?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/9140658527374129848/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=9140658527374129848' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/9140658527374129848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/9140658527374129848'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2009/02/more-powershell-adventures.html' title='More PowerShell Adventures'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-7173682005610002544</id><published>2009-02-15T16:18:00.000-08:00</published><updated>2009-02-15T16:35:17.175-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><category scheme='http://www.blogger.com/atom/ns#' term='PowerShell'/><title type='text'>PowerShell Adventures</title><content type='html'>&lt;p&gt;So I want to be able to administer IIS 7 remotely using PowerShell. Installation on W2K8r2 is easy via &lt;em&gt;start /w ocsetup MicrosoftWindowsPowerShell&lt;/em&gt;. And there is a &lt;a href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;g=6&amp;i=1665"&gt;PowerShell Snap-in for IIS 7.0&lt;/a&gt;. And in case you're wondering, the location of &lt;em&gt;powershell.exe&lt;/em&gt; is added to the path during installation, you just need to restart the console for it to take effect (i.e. there is no need to try to hack the registry in order to add the location of &lt;em&gt;powershell.exe&lt;/em&gt; to the &lt;em&gt;PATH&lt;/em&gt; environment variable). So a few common commands to get started:&lt;/p&gt;&lt;br /&gt;&lt;dl&gt;&lt;br /&gt;   &lt;dt&gt;Help&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Get help for a particular cmdlet, e.g. &lt;em&gt;help get-process&lt;/em&gt;.&lt;/dd&gt;&lt;br /&gt;   &lt;dt&gt;Get-Alias&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Returns a list of aliases for PowerShell cmdlets.&lt;/dd&gt;&lt;br /&gt;   &lt;dt&gt;Get-Command&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Returns a list of PowerShell cmdlets.&lt;/dd&gt;&lt;br /&gt;   &lt;dt&gt;Get-Process&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Returns a list of all the running processes&lt;/dd&gt;&lt;br /&gt;   &lt;dt&gt;Get-Service | sort status,name&lt;/dt&gt;&lt;br /&gt;   &lt;dt&gt;Get-Service | Where-object{$_.status -like "running"}&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Get a list of services - in the first case sort by status and name, in the second case filter output to include only running services&lt;/dd&gt;&lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;&lt;p&gt;Now it would be kind of cool to be able to use the new Windows PowerShell Integrated Scripting Environment to administer the server. Turns out in some cases it just works. Remoting however requires the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c913aeab-d7b4-4bb1-a958-ee6d7fe307bc&amp;DisplayLang=en"&gt; Windows PowerShell V2 Community Technology Preview 3 (CTP3)&lt;/a&gt; on your Vista box. Check out the help text related to remoting:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PS C:\&gt; help about_remote_requirements&lt;br /&gt;TOPIC&lt;br /&gt;    about_remote_requirements&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;    NOTE: Many cmdlets, including the Get-Service, Get-Process, Get-WMIObject,&lt;br /&gt;          Get-Eventlog and Get-Event cmdlets get objects from remote computers,&lt;br /&gt;          but they use .NET methods to retrieve the objects. They do not use the&lt;br /&gt;          Windows PowerShell remoting infrastructure. The requirements in this&lt;br /&gt;          document do not apply to these cmdlets.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;Currently the WinRM service is stopped on the server. Looks like I need to do some  configuration:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt; CONFIGURE WS-MANAGEMENT  &lt;br /&gt;&lt;br /&gt;    The remoting features of Windows PowerShell are supported by the WinRM service, which is &lt;br /&gt;    the Microsoft implementation of the WS-Management protocol. To use the remoting features,&lt;br /&gt;    you need to change the default configuration of WS-Management on the system. &lt;br /&gt;&lt;br /&gt;    Windows PowerShell provides a script to configure WS-Management. The script is located&lt;br /&gt;    in the Windows PowerShell installation directory ($pshome).&lt;br /&gt;&lt;br /&gt;    To run the configuration script:&lt;br /&gt;&lt;br /&gt;        1. Open Windows PowerShell with the "Run as Administrator" option.&lt;br /&gt;&lt;br /&gt;        2. At the command prompt, type:&lt;br /&gt;&lt;br /&gt;        &amp; $pshome\configure-wsman.ps1&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;Sadly there is no $pshome\configure-wsman.ps1 on either my Vista box or my server. What to do? I tracked down &lt;a href="http://msdn.microsoft.com/en-us/library/aa384372(VS.85).aspx"&gt; Installation and Configuration for Windows Remote Management&lt;/a&gt;. Following the instructions and running &lt;em&gt;PS C:\&gt; winrm quickconfig&lt;/em&gt; on the server gives me this:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PS C:\&gt; winrm quickconfig&lt;br /&gt;WinRM already is set up to receive requests on this machine.&lt;br /&gt;WinRM is not set up to allow remote access to this machine for management.&lt;br /&gt;The following changes must be made:&lt;br /&gt;&lt;br /&gt;Create a WinRM listener on HTTP://* to accept WS-Man requests to any IP on this machine.&lt;br /&gt;Enable the WinRM firewall exception.&lt;br /&gt;Configure LocalAccountTokenFilterPolicy to grant administrative rights remotely to local users.&lt;br /&gt;&lt;br /&gt;Make these changes [y/n]? y&lt;br /&gt;&lt;br /&gt;WinRM has been updated for remote management.&lt;br /&gt;&lt;br /&gt;Created a WinRM listener on HTTP://* to accept WS-Man requests to any IP on this machine.&lt;br /&gt;WinRM firewall exception enabled.&lt;br /&gt;Configured LocalAccountTokenFilterPolicy to grant administrative rights remotely to local users.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;Cool, that all looks good. If only the same thing worked on Vista:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PS C:\&gt; winrm quickconfig&lt;br /&gt;WinRM is not set up to allow remote access to this machine for management.&lt;br /&gt;The following changes must be made:&lt;br /&gt;&lt;br /&gt;Set the WinRM service type to delayed auto start. &lt;br /&gt;Start the WinRM service. &lt;br /&gt;Create a WinRM listener on HTTP://* to accept WS-Man requests to any IP on this machine. &lt;br /&gt;Enable the WinRM firewall exception.&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;Oh dear. I did however manage to locate &lt;a href="http://get-powershell.com/2009/01/14/powershell-remoting-on-windows-2008-r2-server-core/"&gt;PowerShell Remoting on Windows 2008 R2 Server Core&lt;/a&gt;. This indicates there is a built-in function called &lt;em&gt;Enable-PSRemoting&lt;/em&gt;. Running this in my Vista PowerShell reveals:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PS C: Enable-PSRemoting&lt;br /&gt;Windows PowerShell remoting features are not enabled or not supported on this machine.&lt;br /&gt;This may be because you do not have the correct version of WS-Management installed or this version of Windows does not support remoting currently.&lt;br /&gt; For more information, type 'get-help about_remote_requirements'.&lt;br /&gt;At line:13 char:37&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;But I know where to get the &lt;a href="https://connect.microsoft.com/wsman"&gt;WinRM CTP&lt;/a&gt;.  This is a Windows Update and requires a restart. Now things are looking up:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PS C:\Windows\System32&gt; enable-psremoting&lt;br /&gt;WinRM has been updated to receive requests.&lt;br /&gt;WinRM service type changed successfully. &lt;br /&gt;WinRM service started. &lt;br /&gt;Configured LocalAccountTokenFilterPolicy to grant administrative rights remotely to local users. &lt;br /&gt;&lt;br /&gt;WinRM has been updated for remote management.&lt;br /&gt;Created a WinRM listener on HTTP://* to accept WS-Man requests to any IP on this machine. &lt;br /&gt;WinRM firewall exception enabled. &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;But I'm not quite there yet:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PS C:\Windows\System32&gt; Enter-PSSession -computerName myServer&lt;br /&gt;Enter-PSSession : Connecting to remote server failed with the following error message : The WinRM client cannot process the reque&lt;br /&gt;st. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS tran&lt;br /&gt;sport must be used or the destination machine must be added to the TrustedHosts configuration setting. Use winrm.cmd to configure&lt;br /&gt; TrustedHosts. You can get more information about that by running the following command: winrm help config.&lt;br /&gt;At line:1 char:16&lt;br /&gt;+ Enter-PSSession &lt;&lt;&lt;&lt;  -computerName myServer&lt;br /&gt;    + CategoryInfo          : InvalidArgument: (myServer:String) [Enter-PSSession], PSRemotingTransportException&lt;br /&gt;    + FullyQualifiedErrorId : CreateRemoteRunspaceFailed,Microsoft.PowerShell.Commands.EnterPSSessionCommand&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;Checking my server listener configuration I have:&lt;/p&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;PS C:\Users\Administrator&gt; winrm enumerate winrm/config/listener&lt;br /&gt;Listener&lt;br /&gt;    Address = *&lt;br /&gt;    Transport = HTTP&lt;br /&gt;    Port = 80&lt;br /&gt;    Hostname&lt;br /&gt;    Enabled = true&lt;br /&gt;    URLPrefix = wsman&lt;br /&gt;    CertificateThumbprint&lt;br /&gt;    ListeningOn = 127.0.0.1, 10.20.1.251, ::1, fe80::100:7f:fffe%6, fe80::5efe:10.20.1.251%4, fe&lt;br /&gt;80::585e:792b:91b3:9876%3&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;So no joy. I need to remove the HTTP Listener and add an HTTPS Listener. I'm going to save that exercise for another post - this one's starting to go feral. Right now I'm more interested in getting the IIS PowerShell snap-in installed so I can start managing IIS. If you've read this far only to discover there is no resolution I apologise and I hope you appreciate that I share your frustration.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-7173682005610002544?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/7173682005610002544/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=7173682005610002544' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/7173682005610002544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/7173682005610002544'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2009/02/powershell-adventures.html' title='PowerShell Adventures'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-1574704855456071650</id><published>2009-02-10T01:38:00.000-08:00</published><updated>2009-02-10T14:25:28.184-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><title type='text'>Installing Windows Server 2008 Core part 3</title><content type='html'>&lt;p&gt;IIS 7.0. Time to have a look at the various options. A suggested commandline looks like the following. This is derived from &lt;a href="http://technet.microsoft.com/en-us/library/cc730716.aspx"&gt;Installing IIS 7.0 on Windows Server 2008&lt;/a&gt; and &lt;a href="http://technet.microsoft.com/en-us/library/cc748930.aspx"&gt;Windows Server 2008 Packages&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;&lt;code&gt;C:\&gt; start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-HttpErrors;IIS-HttpRedirect;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ODBCLogging;IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;IIS-URLAuthorization;IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;IIS-WebServerManagementTools;IIS-ManagementScriptingTools;IIS-ManagementService&lt;/code&gt;&lt;br /&gt;&lt;p&gt;Wading through each of the options should give some indication of what I need to install. Be warned that a sinlge misplaced character will cause the install to fail and tracking that sucker down can be a right pain. When the install has completed the last error can be checked to ensure the install was successful. An error code of 0 indicates success, an error code of -2146498548 indicates you might have accidentally typed an &lt;em&gt;s&lt;/em&gt; on the end of &lt;em&gt;IIS-ManagementService&lt;/em&gt; which annoyingly happens to be the last item in the command:&lt;/p&gt;&lt;br /&gt;&lt;code&gt;C:\&gt; echo %errorlevel%&lt;/code&gt;&lt;br /&gt;&lt;dl&gt;&lt;br /&gt;   &lt;dt&gt;IIS-WebServerRole&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;The Web server that provides the Web application infrastructure for all versions of the Windows operating system.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-WebServer&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Installs the IIS Web server, which enables support for HTML Web sites, and the optional support for ASP.NET, classic ASP, and Web server extensions.&lt;/dd&gt;&lt;br /&gt;&lt;br /&gt;   &lt;dt&gt;IIS-CommonHttpFeatures&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Installs support for static Web server content, such as for HTML and image files, for custom errors, and for redirections.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-StaticContent&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Serves the HTM, the HTML, and the image files from a Web site.&lt;/dd&gt;&lt;br /&gt;&lt;br /&gt;   &lt;dt&gt;IIS-DefaultDocument&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Enables the specification of a default file, which is loaded if a user does not specify a file in a request URL.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-HttpErrors&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Installs the HTTP error files and enables the customization of the error messages.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-HttpRedirect&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Supports client request redirections.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-ASPNET&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Enables support for ASP.NET applications.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-NetFxExtensibility&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Enables a Web server to support the .NET Framework-managed module extensions.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-ISAPIExtensions&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;ISAPI Extensions&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-ISAPIFilter&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Enables ISAPI filters to modify the behavior of a Web server.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-HealthAndDiagnostics&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Monitors and manages Web server, Web site, and Web application health.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-HttpLogging&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Enables the logging of Web site activity for a specified Web server.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-LoggingLibraries&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Installs the IIS logging tools and related scripts.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-RequestMonitor&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Monitors the health of Web servers, Web sites, and Web applications.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-HttpTracing&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Enables tracing support for ASP.NET applications and failed requests.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-CustomLogging&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Supports custom logging for Web servers, Web sites, and Web applications.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-ODBCLogging&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Supports logging to an ODBC-compliant database.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-Security&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Supports additional security protocols for Web servers, Web sites, Web applications, virtual directories, and files.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-BasicAuthentication&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Simple authentication that requires a valid Windows user name and password.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-WindowsAuthentication&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Authentication method that uses either NTLM or Kerberos to validate a user.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-DigestAuthentication&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Authentication method that sends a password hash value to the Windows domain controller.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-URLAuthorization&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Enables a client computer to access the URLs that exist within a Web application.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-RequestFiltering&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Configures the rules that block selected client requests.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-IPSecurity&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Enables or denies content access, based on an IP address or domain name.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-Performance&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Enables the compression of content before the information is returned to a client computer.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-HttpCompressionStatic&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Compresses static content before returning the information to a client computer.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-HttpCompressionDynamic&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Compresses dynamic content before returning the information to a client computer.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-ManagementScriptingTools&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Enables the management of a local Web server by using the IIS configuration scripts.&lt;/dd&gt;&lt;br /&gt;         &lt;br /&gt;   &lt;dt&gt;IIS-ManagementService&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;Enables a Web server to be managed remotely from another computer, by using the Web Server Management Console.&lt;/dd&gt;&lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;&lt;p&gt;Installing IIS adds the appropriate firewall rule so the proof in the pudding can be determined by opening my &lt;a href="http://www.mozilla.com/en-US/firefox/"&gt;preferred browser&lt;/a&gt; and pointing it at the new server. Hooray, it's the IIS7 welcome page.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-1574704855456071650?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/1574704855456071650/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=1574704855456071650' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/1574704855456071650'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/1574704855456071650'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2009/02/installing-windows-server-2008-core-on_10.html' title='Installing Windows Server 2008 Core part 3'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-269883617651793725</id><published>2009-02-09T17:24:00.000-08:00</published><updated>2009-02-10T14:25:04.057-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><title type='text'>Installing Windows Server 2008 Core part 2</title><content type='html'>&lt;p&gt;So not exactly square one but time to repeat a couple of steps including configuring an IP address, changing the computer name, and enabling Remote Desktop. And why does the command prompt disable QuickEdit Mode by default &amp;mdash; would anyone complain if Microsoft took it upon themselves to set some reasonable default settings?&lt;/p&gt;&lt;br /&gt;&lt;dl class="code"&gt;&lt;br /&gt;   &lt;dt&gt;Having installed R2, getting PowerShell is easy:&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; start /w ocsetup MicrosoftWindowsPowerShell&lt;/dd&gt;&lt;br /&gt;   &lt;dt&gt;And starting it:&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; windows\system32\windowspowershell\v1.0\powershell.exe&lt;/dd&gt;&lt;br /&gt;   &lt;dt&gt;The &lt;a href="http://blogs.technet.com/server_core/archive/2008/11/25/net-2-0-and-server-core-in-windows-server-2008-r2.aspx"&gt;TechNet blog&lt;/a&gt; indicates .Net 2.0 is an optional install on Core. It's required for PowerShell and it is installed along with PowerShell as a prereq if it isn't already installed. And while I'm doing the .Net thing I might as well install 3.0 and 3.5 (note the command prompt, not PowerShell):&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; start /w ocsetup NetFx3-ServerCore&lt;/dd&gt;&lt;br /&gt;   &lt;dt&gt;Set the date/time/timezone:&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; control timedate.cpl&lt;/dd&gt;&lt;br /&gt;   &lt;dt&gt;And the international settings:&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; control intl.cpl&lt;/dd&gt;&lt;br /&gt;   &lt;dt&gt;Allow the Event Viewer MMC snap-in to connect through the Windows Firewall. As an aside, I originally copied the following command from a TechNet webpage and when I ran it I was getting an error &lt;em&gt;Group cannot be specified with other identification conditions&lt;/em&gt;. It turns out the quotes used on the webpage were the issue; replacing them with the standard double quotes fixed the problem:&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; Netsh advfirewall firewall set rule group="Remote Event Log Management" new enable=yes&lt;/dd&gt;&lt;br /&gt;   &lt;dt&gt;And the same for &lt;em&gt;Services, Windows Firewall with Advanced Security&lt;/em&gt;. I would kind of like to know how to restrict the MMC connectivity to particular machines on the local network, something to add to my TODO list. Also note the group name &lt;em&gt;Remote Service Management&lt;/em&gt; has &lt;em&gt;Service&lt;/em&gt; singular. The sites I've been referencing, including TechNet, all have this as &lt;em&gt;Services&lt;/em&gt; plural:&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; Netsh advfirewall firewall set rule group="Remote Service Management" new enable=yes&lt;/dd&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; Netsh advfirewall firewall set rule group="Windows Firewall Remote Management" new enable=yes&lt;/dd&gt;&lt;br /&gt;   &lt;dt&gt;After some digging I believe I can now at least restrict MMC connectivity to my local subnet. This obviously isn't a panacaea but does adhere to the principle of defence in depth. Note these commands can't be applied to a rules group but must instead be applied to each individual rule in the group:&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; Netsh advfirewall firewall set rule name="Remote Event Log Management (NP-In)" new remoteip=localsubnet&lt;/dd&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; Netsh advfirewall firewall set rule name="Remote Event Log Management (RPC)" new remoteip=localsubnet&lt;/dd&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; Netsh advfirewall firewall set rule name="Remote Event Log Management (RPC-EPMAP)" new remoteip=localsubnet&lt;/dd&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; Netsh advfirewall firewall set rule name="Remote Service Management (NP-In)" new remoteip=localsubnet&lt;/dd&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; Netsh advfirewall firewall set rule name="Remote Service Management (RPC)" new remoteip=localsubnet&lt;/dd&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; Netsh advfirewall firewall set rule name="Remote Service Management (RPC-EPMAP)" new remoteip=localsubnet&lt;/dd&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; Netsh advfirewall firewall set rule name="Windows Firewall Remote Management (RPC)" new remoteip=localsubnet&lt;/dd&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; Netsh advfirewall firewall set rule name="Windows Firewall Remote Management (RPC-EPMAP)" new remoteip=localsubnet&lt;/dd&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; Netsh advfirewall firewall set rule name="Remote Desktop (TCP-In)" new remoteip=localsubnet&lt;/dd&gt;&lt;br /&gt;   &lt;dt&gt;Managing services remotely from my Vista VM using the &lt;em&gt;Services&lt;/em&gt; snap-in doesn't provide an option to specify alternate credentials and as a consequence the connection fails with &lt;em&gt;access denied&lt;/em&gt;. The convenient workaround for this is to add an administrative account with the same username and password as my Vista account to Win2K8:&lt;/dt&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; net user dave letmein /add&lt;/dd&gt;&lt;br /&gt;   &lt;dd&gt;C:\&gt; net localgroup Administrators /add dave&lt;/dd&gt;&lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;&lt;p&gt;So now I have convenient access to view the event log on the server and a familiar interface for managing services. So I might as well take the opportunity to disable &lt;em&gt;DHCP, DNS Client, TCP/IP NetBIOS Helper&lt;/em&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-269883617651793725?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/269883617651793725/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=269883617651793725' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/269883617651793725'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/269883617651793725'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2009/02/installing-windows-server-2008-core-on_09.html' title='Installing Windows Server 2008 Core part 2'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-3163225209439113503</id><published>2009-02-02T01:49:00.000-08:00</published><updated>2009-02-10T01:38:33.556-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows'/><title type='text'>Installing Windows Server 2008 Core on Mac Mini</title><content type='html'>&lt;p&gt;As a Mac-using Windows developer I have had for good measure a small and extremely low traffic OpenBSD web server running on an Apple Cube. It's been a fun project. The Cube happily runs headless on my shelf and lacking a fan is extremely quiet. I was intending to replace it with an Intel Mac Mini which is slightly louder but also a nice form factor and has a bit more grunt. Now I find myself needing to upskill my knowledge of Windows server products. I have in the past been responsible for maintaining and securing Internet-facing Windows 2003 servers. Time to transition to Windows Server 2008 Core Web.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;An iso for W2K8 Web Server is available for download &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=B1CB6D54-7268-4791-9C5D-CDB21516BF5A&amp;displaylang=en"&gt;here&lt;/a&gt;. Leopard's Disk Utility can be used to burn the iso to a DVD. Microsoft allows the use of the software for trial purposes for a period of 60 days and provides instructions to extend that for a further 180 days. The attraction of the Web edition of W2K8 is the lowish price compared to their other server products. The limitation is the inability to run any Microsoft server products except IIS. For my purposes the limitation is not an issue.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;So armed with the DVD, the next step is to partition the Mini using Boot Camp Assistant and boot from the install DVD. The install process is short and sweet, and fairly quickly the Windows login prompt is displayed. Unfortunately there's no indication what the initial username and password might be. Without referring to the documentation my first guess was that the initially entered values for username and password would be used as the identity for the administrator. No joy, no joy, fail. My second guess was correct, a username of &lt;em&gt;Administrator&lt;/em&gt; and a blank password were accepted and a &lt;em&gt;change password&lt;/em&gt; form displayed.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Having successfully signed on, the only UI provided with Core is a command prompt. Kind of daunting. First things first (apart from configuring the command prompt for useful defaults), how do I change the default computer name, configure an IP address, and access the Mini from my MBP using Microsoft&amp;copy; Remote Desktop Connection Client for Mac. &lt;/p&gt;&lt;br /&gt;&lt;dl class="code"&gt;&lt;br /&gt;  &lt;dt&gt;Change the name of the computer:&lt;/dt&gt;&lt;br /&gt;  &lt;dd&gt;C:\&gt; netdom renamecomputer {current name} /NewName:{new name} (minus the curly braces).&lt;/dd&gt;&lt;br /&gt;  &lt;dt&gt;Note a reboot is required before the new computer name will take effect:&lt;/dt&gt;&lt;br /&gt;  &lt;dd&gt;C:\&gt; shutdown /r /t 0&lt;/dd&gt;&lt;br /&gt;  &lt;dt&gt;Setting the network configuration:&lt;/dt&gt;&lt;br /&gt;  &lt;dd&gt;C:\&gt;netsh interface ipv4 set address name="Local Area Connection" source=static address=10.20.1.250 mask=255.255.255.0 gateway=10.20.1.1&lt;/dd&gt;&lt;br /&gt;  &lt;dt&gt;Allow access via RDC:&lt;/dt&gt;&lt;br /&gt;  &lt;dd&gt;C:\&gt; Cscript %windir%\system32\SCRegEdit.wsf /ar 0&lt;/dd&gt;&lt;br /&gt;&lt;/dl&gt;&lt;br /&gt;&lt;p&gt;So far so good. Unfortunately it's not as simple as unplugging the display, keyboard, and mouse from the Mini. The Mini requires a video signal in order to boot successfully. A simple hack using a resistor is required, details are available from &lt;a href="http://blackfriarsinc.com/blog/2007/04/how-to-keep-headless-mac-mini-happy"&gt;Blackfriars&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;OK, at this point I've just discovered that ASP.Net is not supported on Server Core. That seems like a fairly major oversight and a little googling reveals &lt;a href="http://blogs.technet.com/server_core/archive/2008/11/13/server-core-changes-in-windows-server-2008-r2.aspx"&gt;it will be supported in Windows Server 2008 R2&lt;/a&gt; which is currently in beta. So time to go back and &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=85CFE4C9-34DE-477C-B5CA-75EDAE3D57C5&amp;displaylang=en"&gt;download the beta&lt;/a&gt;, which succeeded finally after 4 failed attempts I can only ascribe to gremlins.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Hurdles coming thick and fast now. There's no eject button on a Mac Mini; how to extract the disk currently resident in the drive? Sadly there is no obvious mechanism to do this from a command prompt and there are many vb scripts that instantiate a media player and issue it a command to eject the drive &amp;mdash; not feasible on Windows 2008 Server Core. Fortunately there is a simple Mac mechanism that only requires the Mini to be restarted while holding down the left mouse button. Not exactly intuitive but achieves the desired result. Next, attempting to boot the Mini from the new disk displayed a prompt "Select CD-ROM Boot Type :" and no matter how hard I press either "1" or "2" the installation progresses no further. Without going into detail there is a solution. The first step is to download &lt;a href="http://sergiomcfly.googlepages.com/oscdimg.exe"&gt;oscdimg.exe&lt;/a&gt;. This &lt;em&gt;.exe&lt;/em&gt; is also available in the Windows Automated Installation Kit which is a &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=C7D4BC6D-15F3-4284-9123-679830D629F2&amp;displaylang=en&amp;Hash=bExapZI5zol09a%2bWq%2bRgqQ6aeYSeKbhuc50vdhNL8hQA1qmshj8kpSsmOK4AhUZOV81MqLRgpWdTl9C6Yhkn8Q%3d%3d"&gt;992.2 MB download&lt;/a&gt;. Next and using instructions borrowed from &lt;a href="http://sergiomcfly.blogspot.com/2008/04/select-cd-rom-boot-type-when-installing.html"&gt;Sergio Mcfly&lt;/a&gt;, assuming your Parallels Vista install maps &lt;em&gt;D:\&lt;/em&gt; to the DVD drive in your MBP, run the following command &lt;em&gt;oscdimg.exe -n -m -bd:\boot\etfsboot.com d:\ c:\w2k8r2Web.iso&lt;/em&gt;. Burn the resulting iso to a new DVD and the Mini now boots from the install disk.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;This time, with a clean install, I don't have to guess the &lt;em&gt;Administrator&lt;/em&gt; username. Instead I'm immediately prompted to set the password for &lt;em&gt;Administrator&lt;/em&gt; and I now have a command prompt and the desktop background informs me I'm running Windows Web Server 7 For testing purposes only. Build 7000.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-3163225209439113503?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/3163225209439113503/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=3163225209439113503' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/3163225209439113503'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/3163225209439113503'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2009/02/installing-windows-server-2008-core-on.html' title='Installing Windows Server 2008 Core on Mac Mini'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-3751148577579779351</id><published>2009-01-22T13:50:00.000-08:00</published><updated>2009-01-22T17:15:46.706-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='jQuery'/><title type='text'>Upgrading to jQuery 1.3</title><content type='html'>&lt;p&gt;Suddenly it's 2009 and jQuery 1.3 has just been released. Upgrading was largely a no-brainer but there were a couple of hurdles. First if using jQuery UI it is necessary to upgrade to version 1.6r5, i.e. a beta release. Hopefully a full release will be available shortly.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Having upgraded to jQuery UI 1.6r5, if you are using the tabs widget there is a bug in the code that is triggered when adding a new tab (ticket &lt;a href="http://ui.jquery.com/bugs/ticket/3875"&gt;#3875&lt;/a&gt;). This has just been &lt;a href="http://ui.jquery.com/bugs/changeset/1756"&gt;fixed in trunk&lt;/a&gt;. Basically when creating a tab the correct classes weren't being added and the contents of the newly created tab would be displayed on the page. Getting the latest ui.tabs.js from the subversion repository fixes the problem.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Up until now I've been using the &lt;a href="http://blog.threedubmedia.com/2008/10/jquerydelegate.html"&gt;jquery.delegate&lt;/a&gt; plugin to handle event delegation. I've now switched to using jQuery 1.3 &lt;a href="http://docs.jquery.com/Events/live#typefn"&gt;live events&lt;/a&gt;. This required some minor surgery on the code. Where previously I had something like:&lt;/p&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$("#someDiv).delegate('click change', ".hookAddReq", addRequirement);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;p&gt;I now have:&lt;/p&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$(".hookAddReq", "#someDiv").live("click", addRequirememnt);&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;p&gt;This bears a little more scrutiny. The class &lt;em&gt;.hookAddReq&lt;/em&gt; is assigned to a &amp;lt;select/&amp;gt; element. I have been adding the &lt;em&gt;hook&lt;/em&gt; prefix to class names that I use specifically for adding behaviour and I try to add behaviour using classes rather than attaching handlers to HTML elements. There are a couple of reasons for doing this. Firstly by having the &lt;em&gt;hook&lt;/em&gt; prefix I know immediately that there is behaviour attached to an element (to distinguish the class name from classes used purely for adding styles). Secondly, using a &lt;em&gt;hook&lt;/em&gt; class I can hopefully modify the structure of the HTML without breaking the behaviour.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;In the original code I was delegating both the &lt;em&gt;click&lt;/em&gt; and &lt;em&gt;change&lt;/em&gt; events. This came about because I was developing using Firefox and discovered during testing with IE that the &lt;em&gt;change&lt;/em&gt; event doesn't bubble in IE. I guess this is probably documented somewhere but I was scratching my head for a while. Having moved to jQuery 1.3 and actually reading the documentation, live events don't support the &lt;em&gt;change&lt;/em&gt; event regardless. I still wanted to be able to delegate those events and I was able to reuse the code I had already written to handle the &lt;em&gt;click&lt;/em&gt; events for IE (see below). Effectively just checking to see if the &lt;em&gt;selectedIndex&lt;/em&gt; is non-zero and setting it to zero to prevent more than one click event being processed.&lt;/p&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;   addRequirement = function()&lt;br /&gt;   {&lt;br /&gt;   &amp;nbsp;&amp;nbsp;&amp;nbsp;var selIdx = this.selectedIndex;&lt;br /&gt;   &amp;nbsp;&amp;nbsp;&amp;nbsp;if (selIdx)&lt;br /&gt;   &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.selectedIndex = 0;&lt;br /&gt;   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var control = this.options[ selIdx];&lt;br /&gt;   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$(view).trigger("addRequirementEvent", $this.control);&lt;br /&gt;   &amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;   };&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;The other plugin that broke is the excellent &lt;a href="http://plugins.jquery.com/project/Transform"&gt;jquery.transform&lt;/a&gt; that I use to convert XML from the server into HTML on the client. The version I was using still had the &lt;em&gt;@&lt;/em&gt; character in jQuery attribute selectors. This has been fixed in version 3.0.1 released on 20 January.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Finally, the jQuery UI skin needs to be updated. Get the latest from &lt;a href="http://ui.jquery.com/themeroller"&gt;jQuery ThemeRoller&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-3751148577579779351?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/3751148577579779351/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=3751148577579779351' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/3751148577579779351'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/3751148577579779351'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2009/01/upgrading-to-jquery-13.html' title='Upgrading to jQuery 1.3'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-3735121372960305052</id><published>2008-11-05T00:48:00.000-08:00</published><updated>2008-11-05T01:51:02.165-08:00</updated><title type='text'>Prototyping AJAX with Jaxer and jQuery</title><content type='html'>&lt;p&gt;So where did October go? Amazon kindly delivered a &lt;a href="http://www.amazon.com/C-Depth-What-need-master/dp/1933988363/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1225875357&amp;sr=1-1"&gt;bunch&lt;/a&gt; &lt;a href="http://www.amazon.com/jQuery-Action-Bear-Bibeault/dp/1933988355/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1225875405&amp;sr=1-1"&gt;of&lt;/a&gt; &lt;a href="http://www.amazon.com/Learning-Flex-Internet-Applications-Developer/dp/0596517327/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1225875455&amp;sr=1-1"&gt;great&lt;/a&gt; &lt;a href="http://www.amazon.com/Essential-ActionScript-3-0/dp/0596526946/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1225875489&amp;sr=1-1"&gt;books&lt;/a&gt;. So far I'm part way through &lt;em&gt;C# in Depth&lt;/em&gt; and &lt;em&gt;jQuery in Action&lt;/em&gt;, both &lt;a href="http://www.manning.com/"&gt;Manning&lt;/a&gt; books and good reading. As a developer it can be difficult to find books pitched at the right level and at least with these two books Manning got pretty close to the sweet spot.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Fortunately the biggest impact on my tech time apart from family is the three months work I've begun for a local SaaS outfit, &lt;a href="http://tenderlink.com"&gt;TenderLink.com&lt;/a&gt; (which is involved in tendering, not online dating). The work I'm doing is confidential but I wanted to talk about the tools I'm using for prototyping: &lt;a href="http://www.aptana.com/studio"&gt;Aptana Studio&lt;/a&gt;, &lt;a href="http://www.aptana.com/jaxer"&gt;Jaxer&lt;/a&gt;, and &lt;a href="http://jquery.com/"&gt;jQuery&lt;/a&gt;.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;So who isn't using jQuery, hell even Microsoft is getting in on the fun. If you're using jQuery you may have heard of Aptana. From their website:&lt;/p&gt;&lt;br /&gt;&lt;blockquote&gt;Aptana is about cutting-edge infrastructure for modern, Ajax-based web applications. We already have the leading Ajax IDE in the market (roughly 2 million downloads).&lt;/blockquote&gt;&lt;br /&gt;&lt;p&gt;Aptana Studio is based on Eclipse and you can either download the full application or if you're already using Eclipse, just download the plugin. Aptana Studio has great support for writing JavaScript code. If you've ever had to write JavaScript using the likes of older versions of Visual Studio you'll know that JavaScript, despite being the dynamic part of DHTML, has been a second class citizen for a long time. Aptana Studio really gives you the tools you would expect in order to be productive writing JavaScript, including support for all the major JavaScript frameworks. Aptana Studio is free open source software.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Aptana also integrate their Jaxer server product into Aptana Studio which has some really great possibilities. Jaxer is referred to as the world's first AJAX server. It's not necessarily a misnomer but the buzzword compliance doesn't begin to describe what a cool product it is. It uses the Mozilla engine so you get the latest versions of Mozilla JavaScript. And by tagging your script element with the &lt;em&gt;runat="server"&lt;/em&gt; attribute your familiar JavaScript code gets executed at the server. For the work I'm doing I'm leaning heavily on jQuery to handle the UX. The server-side will ultimately be provided by the &lt;a href="http://www.jadeworld.com"&gt;Jade&lt;/a&gt; enterprise object database. But for prototyping my jQuery client user experience, the Aptana Studio/Jaxer combination is exceptional.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-3735121372960305052?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/3735121372960305052/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=3735121372960305052' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/3735121372960305052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/3735121372960305052'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2008/11/prototyping-ajax-with-jaxer-and-jquery.html' title='Prototyping AJAX with Jaxer and jQuery'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-5334827643321201315</id><published>2008-09-17T16:52:00.001-07:00</published><updated>2008-09-17T21:08:14.502-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WebOrb'/><category scheme='http://www.blogger.com/atom/ns#' term='Flex'/><title type='text'>Flex and .Net</title><content type='html'>&lt;p&gt;I'm currently investing time in learning how to connect a Flex RIA to a .Net server. Having worked for many years on &lt;a href="https://www.psis.co.nz"&gt;web&lt;/a&gt; &lt;a href="http://www.familybanking.co.nz"&gt;applications&lt;/a&gt; in the finance and banking sector I am well acquainted with the trials associated with rendering forms and implementing user experience consistently on a variety of modern and vintage web browsers. The ability to design and code for a single runtime environment has strong appeal. The stumbling blocks for me have been a loathing for Flash-based advertising and poorly constructed Flash-based websites. Actually my loyalty to Firefox is due in part to the ability to selectively enable Flash via the &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/433"&gt;FlashBlock&lt;/a&gt; extension. And did I mention that I also dislike Adobe Reader? How can Adobe turn something so simple into an unwieldy bohemiath.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;However the biggest stumbling block is the lack of detail surrounding Flash/AIR session handling and caching. This is something that is well understood in browsers; an online banking site will typically store a session cookie in your browser cache and you can feel confident that cookie will be erased when the session is ended. I believe this isn't necessarily the case for Flash although I can't just now place my hands on the particular URL where this issue was being discussed. At the time it was enough to shelve my interest and it's an issue I need to revisit.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;So there are a number of ways to connect from an AIR application to a server application. An obvious one is via Web services. This has the enormous benefit on the server side that having written and published your Web service it is now available for any client-side or peer-to-peer technology that knows how to speak your particular flavour of Web service (SOAP/REST). A disadvantage of even a well-designed SOAP Web service can be the amount of XML data being shipped to the client. This is going to impact the responsiveness of an application even over a broadband connection. For AIR the alternative is to use Flash Remoting, the benefits of which according to &lt;a href="http://www.adobe.com/devnet/flex/articles/flextodotnet_remoteobject_print.html"&gt;this Mark Piller tutorial&lt;/a&gt; "include significant performance improvements, reduced development costs, and a more natural client/server integration". At this stage I'm just going to accept those claims, I don't have any good reason to dispute them.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Using Mark's tutorial turned out to be a reasonable place to start. There is a commercial &lt;a href="http://www.adobe.com/products/flashremoting/"&gt;Flash Remoting&lt;/a&gt; product but Mark's &lt;a href="http://www.themidnightcoders.com/"&gt;company&lt;/a&gt; gives away the previously commercial WebOrb Flash Remoting application. The tutorial had one unfortunate omission that had me scratching my head, I was consistently getting an error message &lt;em&gt;&amp;#8220;Destination 'GenericDestination' either does not exist or the destination has no channels defined (and the application does not define any default channels.)&amp;#8221;&lt;/em&gt;. I don't know if this occurred because I'm using Flex Builder 3 rather than version 2 as in Mark's tutorial. I found the resolution on one of the &lt;a href="http://www.themidnightcoders.com/forum/default.aspx?g=posts&amp;t=355"&gt;forum&lt;/a&gt; pages. I needed to provide the additional Flex Builder compiler argument &lt;code&gt;-services "services-config.xml"&lt;/code&gt; and copy the &lt;em&gt;services-config.xml&lt;/em&gt;, &lt;em&gt;remoting-config.xml&lt;/em&gt;, and &lt;em&gt;data-management.xml&lt;/em&gt; from &lt;em&gt;C:\inetpub\wwwroot\weborb30\WEB-INF\flex&lt;/em&gt; into the &lt;em&gt;src&lt;/em&gt; directory of my Flex Builder project.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;The need I have at the moment is to feel confident I can replicate this quickly in order to pitch for some work. That work entails integrating a Flash/Flex application with .Net server-side and some form of repository, all in a package I can distribute to a hosting environment. Trying to tie those strings together is where the tutorial unravels. &lt;em&gt;GenericDestination&lt;/em&gt; is not something I want to use for a production environment, it allows access to every deployed assembly in the .Net application. The tutorial even indicates that it shouldn't be used in a production environment. On the Web what is easy is often used by default, particularly by inexperienced developers. To identify the alternative configuration I need to dig deeper, I'm sure many wouldn't bother. This is a peeve, if you're going to go to the trouble of writing a tutorial, show me how to do the job correctly. In this case the easy way has serious security implications that may be ignored by developers who just want to get something out there.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;So now I want to start filling in the gaps. The above-mentioned &lt;em&gt;GenericDestination&lt;/em&gt; needs to be replaced with something appropriate. I need to understand what is required to deploy my application into a hosted environment. I need to integrate my application with some form of repository and I'm leaning towards &lt;a href="http://www.nhforge.org/"&gt;NHibernate&lt;/a&gt; largely because I had some recent exposure to its Java forebear Hibernate and I'm curious.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-5334827643321201315?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/5334827643321201315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=5334827643321201315' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/5334827643321201315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/5334827643321201315'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2008/09/flex-and-net.html' title='Flex and .Net'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-3866044347599901740</id><published>2008-09-03T18:57:00.000-07:00</published><updated>2008-09-05T02:31:49.659-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TortoiseSVN'/><category scheme='http://www.blogger.com/atom/ns#' term='subversion'/><category scheme='http://www.blogger.com/atom/ns#' term='Leopard'/><title type='text'>Installing Subversion on Leopard</title><content type='html'>&lt;p&gt;Having previously installed subversion on Linux without issue (&lt;em&gt;$ sudo yum install subversion&lt;/em&gt; and &lt;em&gt;$ sudo chkconfig --add svnserve&lt;/em&gt;) I was expecting a similarly happy experience with Mac OS X 10.5. Perhaps I wasn't paying as much attention the second time around which contributed to my woes. The &lt;a href="http://hivelogic.com/articles/2006/04/svn_on_os_x"&gt;various&lt;/a&gt; &lt;a href="http://turin.nss.udel.edu/programming/"&gt;instructions&lt;/a&gt; I used as reference all got me part of the way for which I'm grateful.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;As an aside, I'm also partway through the extraordinary &lt;a href="http://www.amazon.com/Flow-Psychology-Experience-Mihaly-Csikszentmihalyi/dp/0060920432"&gt;Flow: The Psychology of Optimal Experience&lt;/a&gt;. In this case installing and configuring subversion was definitely not a &lt;a href="http://en.wikipedia.org/wiki/Flow_%28psychology%29"&gt;flow&lt;/a&gt; activity for me. One of the precursors to achieving flow is being able to concentrate. Trying to find useful information on the Internet can be extremely frustrating. I know the information I'm looking for, I drop some search terms into Google, middle-click some likely links to open in new tabs, and then wade through the tabs looking for the good stuff. Effectively I've just broken my concentration to spend unproductive time looking for the answer to a question that can be difficult to phrase without trawling all manner of dead herrings (so to speak). Think about how good the MSDN documentation is and how easy it is to find not only the API you're looking for but also example code. Think about the code completion features in Visual Studio. These all contribute to getting you into a state of flow and keeping you there.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Getting back to my skirmish with subversion, here's how it all panned out. The first step is to install subversion (I know there are options that don't include compiling from source but I like to see the machinery working):&lt;/p&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ mkdir subversion&lt;br /&gt;$ cd subversion&lt;br /&gt;$ curl -O http://subversion.tigris.org/downloads/subversion-1.5.1.tar.gz&lt;br /&gt;$ curl -O http://subversion.tigris.org/downloads/subversion-deps-1.5.1.tar.gz&lt;br /&gt;$ # that's the letter O btw, not a number.&lt;br /&gt;$ tar xzf subversion-1.5.1.tar.gz&lt;br /&gt;$ tar xzf subversion-deps-1.5.1.tar.gz&lt;br /&gt;$ cd subversion-1.5.1/zlib&lt;br /&gt;$ ./configure&lt;br /&gt;$ sudo make install&lt;br /&gt;$ cd ..&lt;br /&gt;$ ./configure --prefix=/usr/local --with-ssl --with-zlib=/usr/local&lt;br /&gt;$ sudo make install&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;p&gt;Actually I was in something of a hurry and some of the suggested options were causing the configure step to fail. The instructions I was following didn't include the step to build and install zlib, and didn't include specifying the location of the library. Configure would fail when trying to locate the library and googling turned up a lot of information but not much of it useful. YMMV.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;So that takes care of &lt;em&gt;$ sudo yum install subversion&lt;/em&gt;. The next step is to get subversion to load at boot. On Mac OS X this is handled by &lt;em&gt;launchd&lt;/em&gt;. I've previously written a &lt;em&gt;launchd&lt;/em&gt; plist for PostgreSQL under OS X 10.4 where the data was stored on a firewire-attached RAID. I have a strong recollection that it was a PITA trying to get it to wait for the RAID to be initialised before starting postgres. I went back to &lt;a href="http://turin.nss.udel.edu/programming/"&gt;the freyside&lt;/a&gt; and used his sample plist. It was pretty close, but it didn't specify a username for running subversion. It turns out that there already exists a subversion account on Leopard, &lt;em&gt;_svn&lt;/em&gt;. The modified &lt;em&gt;/Library/LaunchDaemons/subversion.svnserve.plist&lt;/em&gt; is below. And the new service can be initialised without rebooting by &lt;em&gt;$ sudo launchctl load /Library/LaunchDaemons/subversion.svnserve.plist&lt;/em&gt;.&lt;/p&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;&amp;lt;!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"&lt;br /&gt;"http://www.apple.com/DTDs/PropertyList-1.0.dtd"&amp;gt;&lt;br /&gt;&amp;lt;plist version="1.0"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;lt;dict&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;key&amp;gt;Disabled&amp;lt;/key&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;false /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;key&amp;gt;UserName&amp;lt;/key&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;string&amp;gt;_svn&amp;lt;/string&amp;gt; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;key&amp;gt;Label&amp;lt;/key&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;string&amp;gt;subversion.svnserve&amp;lt;/string&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;key&amp;gt;ProgramArguments&amp;lt;/key&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;array&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;string&amp;gt;/usr/bin/svnserve&amp;lt;/string&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;string&amp;gt;--inetd&amp;lt;/string&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;string&amp;gt;--root=/Users/dave/develop/source&amp;lt;/string&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/array&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;key&amp;gt;ServiceDescription&amp;lt;/key&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;string&amp;gt;Subversion Standalone Server&amp;lt;/string&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;key&amp;gt;Sockets&amp;lt;/key&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;dict&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;key&amp;gt;Listeners&amp;lt;/key&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;array&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;dict&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;key&amp;gt;SockFamily&amp;lt;/key&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;string&amp;gt;IPv4&amp;lt;/string&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;key&amp;gt;SockServiceName&amp;lt;/key&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;string&amp;gt;svn&amp;lt;/string&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;key&amp;gt;SockType&amp;lt;/key&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;string&amp;gt;stream&amp;lt;/string&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/dict&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;dict&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;key&amp;gt;SockFamily&amp;lt;/key&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;string&amp;gt;IPv6&amp;lt;/string&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;key&amp;gt;SockServiceName&amp;lt;/key&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;string&amp;gt;svn&amp;lt;/string&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;key&amp;gt;SockType&amp;lt;/key&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;string&amp;gt;stream&amp;lt;/string&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/dict&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/array&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/dict&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;key&amp;gt;inetdCompatibility&amp;lt;/key&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;dict&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;key&amp;gt;Wait&amp;lt;/key&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;false /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/dict&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;lt;/dict&amp;gt;&lt;br /&gt;&amp;lt;/plist&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;p&gt;Nearly there. I'm using &lt;a href="http://tortoisesvn.net/"&gt;TortoiseSVN&lt;/a&gt; in Parallels to access my subversion repository (which is really not going to work if I use BootCamp). I created my repository via&lt;/p&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ svnadmin create /Users/dave/develop/source/&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;p&gt;Trying to access the repository using the TortoiseSVN Repo-browser from Parallels resulted in the error &lt;em&gt;expected FS format '2'; found format '3'&lt;/em&gt;. Turns out subversion 1.5 has a new repository format to support some new features. For some reason TortoiseSVN (1.5.3, Build 13783 - 32 Bit , 2008/08/30 20:59:46) on my system didn't want to talk to the new format. At this stage my repository is for personal use and I'm really OK with using the older format. I deleted my repository and started over. Note also that the _svn account needs to be able to write to the repository, it seemed reasonable to make _svn the owner of the repository:&lt;/p&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ svnadmin create --pre-1.5-compatible ~/develop/source/&lt;br /&gt;$ sudo chown -R _svn ~/develop/source&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;p&gt;Now to create the root for my c# code.&lt;/p&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;$ svn mkdir svn://localhost/csharp --username dave -m "c# source"&lt;br /&gt;svn: Authorization failed&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;p&gt;Duh, so after uncommenting the line &lt;em&gt;# password-db = passwd&lt;/em&gt; in &lt;em&gt;~/develop/source/conf/svnserve.conf&lt;/em&gt; and adding an appropriate entry to &lt;em&gt;~/develop/source/conf/passwd&lt;/em&gt; my subversion repository is alive and I can access it from Parallels using TortoiseSVN.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-3866044347599901740?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/3866044347599901740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=3866044347599901740' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/3866044347599901740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/3866044347599901740'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2008/09/installing-subversion-on-leopard.html' title='Installing Subversion on Leopard'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-7041211445817495307</id><published>2008-08-27T01:37:00.000-07:00</published><updated>2008-08-27T02:48:10.658-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='upgrades'/><category scheme='http://www.blogger.com/atom/ns#' term='scalability'/><title type='text'>The Great Migration</title><content type='html'>&lt;p&gt;We moved house 12 days ago, the house we were renting that was so great over summer turned into a cold and damp hole in winter. Moving is hard. My big mistake was assuming, given I knew there was an existing broadband connection at the new house, that it would be a simple task to switch my broadband connection from the old house to the new house. So after a week without internet connectivity and wanting to be connected to aid the Great Job Hunt, I was getting severe withdrawals and some filthy looks from my partner Anne who had earlier suggested I should perhaps make some arrangements to move the connection. Anne's a project manager in the real world.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;At the same time I had ordered a couple of gigs of RAM (to better run Vista under &lt;a href="http://www.parallels.com/"&gt;Parallels&lt;/a&gt;) and a &lt;a href="http://eshop.macsales.com/item/Seagate/ST9320421AS/"&gt;7200RPM 320GB drive&lt;/a&gt; for my MacBook Pro from &lt;a href="http://www.otherworldcomputing.com"&gt;Other World Computing&lt;/a&gt; plus a copy of &lt;a href="http://www.apple.com/macosx/"&gt;Leopard&lt;/a&gt; so I can run Boot Camp. Moving is hard. My big mistake was assuming I had a screwdriver that would be suitable for removing the screws from my laptop. After locating the screwdriver in the chaos of small children and boxes and establishing that it was not in fact suitable I had to wait another day before tackling the delicate task of dismantling my MBP. The screws aren't really a problem as long as you get all of them out, including the two torx screws hiding beneath the RAM cover. The problem is the clips and knowing when it's ok to keep pulling and when you should stop and have a look for those two screws you missed.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Ultimately it's all good and I'm enjoying the feeling of a lot of free space, much better performance, and a clean install. And with the restoration of our broadband connection I've been able to read an excellent &lt;a href="http://www.infoq.com/articles/scalability-worst-practices"&gt;article on scalability&lt;/a&gt; on &lt;a href="http://www.infoq.com"&gt;InfoQ&lt;/a&gt;.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-7041211445817495307?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/7041211445817495307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=7041211445817495307' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/7041211445817495307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/7041211445817495307'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2008/08/great-migration.html' title='The Great Migration'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-8014885317200856349</id><published>2008-08-05T16:33:00.000-07:00</published><updated>2008-08-06T02:11:22.823-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='extension methods'/><category scheme='http://www.blogger.com/atom/ns#' term='c#'/><title type='text'>C# 3.0 Extension Methods</title><content type='html'>&lt;p&gt;I'm getting stuck into C# 3.0 and really enjoying some of the new features. How often do you go looking for a class method to perform a specific task only to discover the method doesn't exist or exists but only does part of the job. Inevitably my programs contain methods I've created specifically to address this issue. One of the downsides of this approach is that there's often no obvious place to code the method, it just gets stuck close to where it is used or in a utility class if it is used in more than one location. And that is bad because it increases coupling/lowers cohesion for classes. Extension methods are a great way to address this situation.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;I have an ASP.Net application that began life as a real application. The version I use to explore new stuff now bears little resemblance to the original but when I wrote it I was surprised to find that &lt;em&gt;System.Web.UI.Control.FindControl()&lt;/em&gt; doesn't recurse down through the child controls. As a result I wrote the following method in the code-behind for a &lt;em&gt;MasterPage&lt;/em&gt;:&lt;/p&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;    private static Control LocateControl( Control Ctrl, string Id)&lt;br /&gt;    {&lt;br /&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;Control ctrlRet = Ctrl.FindControl( Id);&lt;br /&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;if (ctrlRet == null)&lt;br /&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for (int i = 0; i &lt; Ctrl.Controls.Count &amp;&amp; ctrlRet == null; i++)&lt;br /&gt;    &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ctrlRet = LocateControl( Ctrl.Controls[i], Id);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;return ctrlRet;&lt;br /&gt;    }&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Using extension methods I can now instead code a new class &lt;em&gt;ControlExtensions&lt;/em&gt;:&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;public static class ControlExtensions&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public static Control LocateControl(this Control Ctrl, string Id)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Control ctrlRet = Ctrl.FindControl(Id);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (null == ctrlRet)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;foreach (Control childCtrl in Ctrl.Controls)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;ctrlRet = childCtrl.LocateControl(Id);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (null != ctrlRet)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;break;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return ctrlRet;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;p&gt;Calling the original method is clunky &amp;mdash;&lt;/p&gt;&lt;br /&gt;&lt;code&gt;Control ctrl = LocateControl( parentControl, controlId);&lt;/code&gt;&lt;br /&gt;&lt;p&gt;when compared to the new extension method &amp;mdash;&lt;/p&gt;&lt;br /&gt;&lt;code&gt;Control ctrl = parentControl.LocateControl( controlId);&lt;/code&gt;&lt;br /&gt;&lt;p&gt;Very nice.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-8014885317200856349?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/8014885317200856349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=8014885317200856349' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/8014885317200856349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/8014885317200856349'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2008/08/c-30-extension-methods.html' title='C# 3.0 Extension Methods'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-8854552849778183309</id><published>2008-07-26T14:48:00.000-07:00</published><updated>2008-07-26T19:42:08.864-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='risk'/><category scheme='http://www.blogger.com/atom/ns#' term='internet'/><category scheme='http://www.blogger.com/atom/ns#' term='security'/><title type='text'>Quality, Security, and Risk</title><content type='html'>&lt;p&gt;Providing a quality service or application is often a good indication of an organisation that is paying attention to detail and as a result there is reason to suspect that they're also paying attention to security. A bit general perhaps but if you're looking for smells, I believe the quality of an organisation's public channels can provide some indication of the quality of that organisation's internal systems and processes.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;From the inside a good indication that attention is being paid to detail is the existence of a risk program. Assessing risk in information systems is a prerequisite for both quality and security. Assessing risk is really only expensive in time and that only for initialisation, once established it only requires a relatively small effort to maintain. The tool I've used previously is a spreadsheet and the process involves a round-table discussion with all involved parties to thrash out what risks can be identified in operations/systems/applications. The great bonus of this exercise is that everyone gets an opportunity to have some input in a neutral forum and issues that have been held close can be exposed to the light.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Once an agreed list of risks has been composed, the next step is to assign values representing the impact and likelihood of each risk on a scale from 1 to 5:&lt;/p&gt;&lt;br /&gt;&lt;table&gt;&lt;br /&gt;&lt;tr&gt;&lt;th style="text-align: left;"&gt;Impact&lt;/th&gt;&lt;th style="text-align: left;"&gt;Likelihood&lt;/th&gt;&lt;th style="text-align: left;"&gt;Gross Risk&lt;/th&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;5 (catastrophic)&lt;/td&gt;&lt;td&gt;5 (almost certain)&lt;/td&gt;&lt;td&gt;&lt;em&gt;E&lt;/em&gt; extreme/critical&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;4 (major)&lt;/td&gt;&lt;td&gt;4 (likely)&lt;/td&gt;&lt;td&gt;&lt;em&gt;H&lt;/em&gt; high risk&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;3 (moderate)&lt;/td&gt;&lt;td&gt;3 (moderate)&lt;/td&gt;&lt;td&gt;&lt;em&gt;M&lt;/em&gt; moderate risk&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;2 (minor)&lt;/td&gt;&lt;td&gt;2 (unlikely)&lt;/td&gt;&lt;td&gt;&lt;em&gt;L&lt;/em&gt; low risk&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;td&gt;1 (insignificant)&lt;/td&gt;&lt;td&gt;1 (rare)&lt;/td&gt;&lt;td&gt;&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;p&gt;Another table then provides a value for the gross risk assessment (see previous table for Gross Risk legend):&lt;/p&gt;&lt;br /&gt;&lt;table&gt;&lt;br /&gt;&lt;tr&gt;&lt;th&gt;&amp;nbsp;&lt;/th&gt;&lt;th colspan="4" style="text-align: left;"&gt;Likelihood&lt;/th&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;th&gt;Impact&lt;/th&gt;&lt;th style="text-align: left;"&gt;5&lt;/th&gt;&lt;th style="text-align: left;"&gt;4&lt;/th&gt;&lt;th style="text-align: left;"&gt;3&lt;/th&gt;&lt;th style="text-align: left;"&gt;2&lt;/th&gt;&lt;th style="text-align: left;"&gt;1&lt;/th&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;th&gt;5&lt;/th&gt;&lt;td&gt;E&lt;/td&gt;&lt;td&gt;E&lt;/td&gt;&lt;td&gt;E&lt;/td&gt;&lt;td&gt;H&lt;/td&gt;&lt;td&gt;H&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;th&gt;4&lt;/th&gt;&lt;td&gt;E&lt;/td&gt;&lt;td&gt;E&lt;/td&gt;&lt;td&gt;H&lt;/td&gt;&lt;td&gt;H&lt;/td&gt;&lt;td&gt;M&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;th&gt;3&lt;/th&gt;&lt;td&gt;H&lt;/td&gt;&lt;td&gt;H&lt;/td&gt;&lt;td&gt;M&lt;/td&gt;&lt;td&gt;M&lt;/td&gt;&lt;td&gt;L&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;th&gt;2&lt;/th&gt;&lt;td&gt;M&lt;/td&gt;&lt;td&gt;H&lt;/td&gt;&lt;td&gt;M&lt;/td&gt;&lt;td&gt;L&lt;/td&gt;&lt;td&gt;L&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;th&gt;1&lt;/th&gt;&lt;td&gt;L&lt;/td&gt;&lt;td&gt;H&lt;/td&gt;&lt;td&gt;M&lt;/td&gt;&lt;td&gt;L&lt;/td&gt;&lt;td&gt;L&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/table&gt;&lt;br /&gt;&lt;p&gt;The spreadsheet has a single row for each identified risk, and within that row there are columns for a &lt;em&gt;description&lt;/em&gt; of the risk, the &lt;em&gt;impact&lt;/em&gt; and &lt;em&gt;likelihood&lt;/em&gt; and the calculated &lt;em&gt;overall risk&lt;/em&gt;. Other columns include &lt;em&gt;accountability&lt;/em&gt; and the current &lt;em&gt;risk mitigation&lt;/em&gt; measures and &lt;em&gt;management comment&lt;/em&gt;. It becomes fairly obvious then what issues require immediate attention and which ones can be treated as routine. It is also a great way for highlighting to management issues that might otherwise not get the attention they deserve and ensuring that if something does go wrong that management had previously been made aware of the risk, accepted the risk and agreed to the mitigation measures that had been put in place, i.e. the principle of no surprises. Plus once it is in place it only requires a regular review to continue to be effective.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;This is not something I cooked up myself, it was a process established as part of a risk program and introduced by a third party organisation. I don't know where that third party sourced the process. I do know it is simple and effective.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-8854552849778183309?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/8854552849778183309/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=8854552849778183309' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/8854552849778183309'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/8854552849778183309'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2008/07/quality-security-and-risk.html' title='Quality, Security, and Risk'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7047850462274259068.post-4312256769103217561</id><published>2008-07-22T18:58:00.000-07:00</published><updated>2008-07-23T14:15:04.421-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='browsers'/><title type='text'>Dropping IE 6</title><content type='html'>&lt;p&gt;So &lt;a href="http://www.37signals.com/svn/posts/1072-apples-mobileme-drops-support-for-ie-6"&gt;37signals&lt;/a&gt; is reporting on Apple's decision to drop support for IE 6 in MobileMe. I'm sure there are many who would like to drop IE 6 from a great height. I will confess that in my current position as a web developer for a NZ bank, I have users connecting with IE 4 and NN 4 browsers. This is a situation I inherited and one I'm happy to relinquish when my notice period finishes in a couple of weeks time. One of the major issues is that there is no way to correlate the user with the browser. This means there is no way to contact users of older browsers and assist them to upgrade and as a result the bank's sites are all lowest-common-denominator HTML. Of course to get into this situation in the first place required a hefty portion of mediocrity which included very little cross-browser testing. The average user experience is likely be fairly average but only the user knows.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Which brings me to my prior position, also for a NZ financial organisation, where we did take a lot of care with the sites we published. There we also had users connecting with older browsers but we kept a record of which browsers a user connected with. As usage of older browsers dropped away we found we were able to contact the typically small (&amp;lt;100) number of users affected and arrange an upgrade. Feedback was generally really good, some folk were happy to have an excuse to upgrade, some folk had access to a supported browser at work (and sadly one old chap conveniently popped his clogs).&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Which left us still supporting users of IE 5.0 and Navigator 6.2. There are some inconvenient issues with DHTML on those browsers and they require a little extra work. Fortunately there is an enormous body of knowledge around what those issues are and how to work around or avoid them. We didn't need to be at the cutting edge which is where a lot of cross-browser issues can be crippling. I personally wanted to provide a good user experience for all our users and with a small team that was very doable. Looking to the future, I mandated the use of web standards and high quality JavaScript and as the usage of older browsers drops away it all just gets easier.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;I can appreciate that Apple wants to have absolute control of the user interface design and requiring a modern browser must make that easier. I had a quick look at the page info for MobileMe, there's a lot of stuff coming down the pipe to your browser, far more than I would allow for my web applications — most of my users are still on dial-up and the user experience would be dreadful.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7047850462274259068-4312256769103217561?l=stillpearling.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://stillpearling.blogspot.com/feeds/4312256769103217561/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7047850462274259068&amp;postID=4312256769103217561' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/4312256769103217561'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7047850462274259068/posts/default/4312256769103217561'/><link rel='alternate' type='text/html' href='http://stillpearling.blogspot.com/2008/07/dropping-ie-6.html' title='Dropping IE 6'/><author><name>David Clarke</name><uri>http://www.blogger.com/profile/12729448835995259373</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://3.bp.blogspot.com/_cJJ7rUGFxBY/SahWoBkwTSI/AAAAAAAAACg/BA-7z6Ccc5o/S220/dave.jpg'/></author><thr:total>0</thr:total></entry></feed>
