<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://codebetter.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">James Kovacs</title><subtitle type="html" /><id>http://codebetter.com/blogs/james.kovacs/atom.aspx</id><link rel="alternate" type="text/html" href="http://codebetter.com/blogs/james.kovacs/default.aspx" /><link rel="self" type="application/atom+xml" href="http://codebetter.com/blogs/james.kovacs/atom.aspx" /><generator uri="http://communityserver.org" version="4.1.31106.3070">Community Server</generator><updated>2009-03-17T12:56:06Z</updated><entry><title>Prairie Developer Conference 2010</title><link rel="alternate" type="text/html" href="/blogs/james.kovacs/archive/2010/03/01/prairie-developer-conference-2010.aspx" /><id>/blogs/james.kovacs/archive/2010/03/01/prairie-developer-conference-2010.aspx</id><published>2010-03-01T15:00:00Z</published><updated>2010-03-01T15:00:00Z</updated><content type="html">&lt;p&gt;&lt;a href="http://www.prairiedevcon.com" target="_blank"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;margin-left:0px;border-left-width:0px;margin-right:0px;" title="Prairie Developer Conference" border="0" alt="Prairie Developer Conference" align="right" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image23_5F00_5E957EDB.png" width="221" height="119" /&gt;&lt;/a&gt;A few months ago, my friend, &lt;a href="http://geekswithblogs.net/dlussier/Default.aspx" target="_blank"&gt;D’Arcy Lussier&lt;/a&gt;, and I had the following conversation:&lt;/p&gt; &lt;dl&gt;&lt;dt&gt;&lt;strong&gt;D’Arcy:&lt;/strong&gt;&lt;/dt&gt;&lt;dd&gt;Want to speak at a developer conference? &lt;/dd&gt;&lt;dt&gt;&lt;strong&gt;Me&lt;/strong&gt;:&lt;/dt&gt;&lt;dd&gt;Sure. Sounds awesome! &lt;/dd&gt;&lt;dt&gt;&lt;strong&gt;D’Arcy&lt;/strong&gt;:&lt;/dt&gt;&lt;dd&gt;It’ll be in Regina, Saskatchewan. &lt;/dd&gt;&lt;dt&gt;&lt;strong&gt;Me&lt;/strong&gt;:&lt;/dt&gt;&lt;dd&gt;Sweet! &lt;/dd&gt;&lt;dt&gt;&lt;strong&gt;D’Arcy&lt;/strong&gt;:&lt;/dt&gt;&lt;dd&gt;It’ll be in June. &lt;/dd&gt;&lt;dt&gt;&lt;strong&gt;Me&lt;/strong&gt;:&lt;/dt&gt;&lt;dd&gt;Where do I sign up!?! &lt;/dd&gt;&lt;/dl&gt;  &lt;p&gt;All joking aside, D’Arcy is putting together what looks to be a great regional conference. I think D’Arcy’s explanation of how this conference came to be describes it best:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;quot;Having lived my life between Manitoba and Saskatchewan, I saw an opportunity to create an event to bring high calibre presenters and sessions to the talented technology professionals of the Canadian prairies, and thus the Prairie Developer Conference was born!&amp;quot;      &lt;br /&gt;-- D&amp;#39;Arcy Lussier, Prairie Developer Conference Chair&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The conference will take place June 2 &amp;amp; 3, 2010 in Regina, Saskatchewan. I’ll be giving two dojos, one on jQuery and the other on NHibernate. If you’ve been wanting to learn these technologies, I’ll be walking you through them – dojo-style – so you can follow along with your own laptops.&lt;/p&gt;  &lt;h3&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;margin-left:0px;border-left-width:0px;margin-right:0px;" title="NHibernate" border="0" alt="NHibernate" align="right" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/NHLogoSmall_5F00_7D6BF2B9.gif" width="300" height="67" /&gt;NHibernate Dojo&lt;/h3&gt;  &lt;p&gt;I’ll be covering NHibernate fundamentals, mapping with Fluent NHibernate, and querying with LINQ to NHibernate. This session is intended to be very interactive with attendees working examples on their own laptops and asking questions. &lt;/p&gt;  &lt;h3&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;margin-left:0px;border-left-width:0px;margin-right:0px;" title="jQuery" border="0" alt="jQuery" align="right" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_47F33094.png" width="215" height="53" /&gt;jQuery Dojo&lt;/h3&gt;  &lt;p&gt;I should have called this session: &lt;em&gt;Dr. Weblove or How I Learned to Stop Worrying and Love JavaScript&lt;/em&gt;. In this dojo, I’ll take you on a tour of jQuery and show you that JavaScript is anything but a toy language. JavaScript is a powerful functional language and jQuery allows you to harness that power with truly amazing results. Come learn about selectors, effects, DOM manipulation, CSS, AJAX, eventing, and much more.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;margin-left:0px;border-left-width:0px;margin-right:0px;" title="image" border="0" alt="image" align="right" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_0750E425.png" width="216" height="164" /&gt;In addition to my two dojos and sessions by many other speakers, my friend, Donald “IglooCoder” Belcham will be giving a post-con on “Making the Most of Brownfield Application Development”. If you’ve got a legacy codebase that needs taming – and who doesn’t? – this is a great post-con to check out.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.prairiedevcon.com/registration.aspx" target="_blank"&gt;Registration is now open&lt;/a&gt; at a price that won’t break your (or your employer’s) bank. Come check it out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=652035" width="1" height="1"&gt;</content><author><name>james.kovacs</name><uri>http://codebetter.com/members/james.kovacs/default.aspx</uri></author><category term=".NET" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/.NET/default.aspx" /><category term="Agile" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Agile/default.aspx" /><category term="Events" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Events/default.aspx" /><category term="Presentations" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Presentations/default.aspx" /></entry><entry><title>The Exec Problem</title><link rel="alternate" type="text/html" href="/blogs/james.kovacs/archive/2010/02/25/the-exec-problem.aspx" /><id>/blogs/james.kovacs/archive/2010/02/25/the-exec-problem.aspx</id><published>2010-02-25T15:00:00Z</published><updated>2010-02-25T15:00:00Z</updated><content type="html">&lt;p&gt;I must admit that I don&amp;rsquo;t much care for PowerShell&amp;#39;s default behaviour with respect to errors, which is to continue on error. It feels very VB6 &amp;ldquo;On Error Resume Next&amp;rdquo;-ish. Given that it is a shell scripting language, I can understand why the PowerShell team chose this as a default. Fortunately you can change the default by setting $ErrorActionPreference = &amp;lsquo;Stop&amp;rsquo;, which terminates execution by throwing an exception. (The default value is Continue, which means the script prints the error and continues executing.) Unfortunately this only works for PowerShell commands and not external executables that return non-zero error codes. (In the shell world, a return code of zero (0) indicates success and anything else indicates failure.)&lt;/p&gt;
&lt;p&gt;Take the following simple script:&lt;/p&gt;
&lt;pre&gt;&amp;#39;Starting script...&amp;#39;&lt;br /&gt;$ErrorActionPreference = &amp;#39;Stop&amp;#39;&lt;br /&gt;ping -badoption&lt;br /&gt;&amp;quot;Last Exit Code was: $LastExitCode&amp;quot;&lt;br /&gt;rm nonexistent.txt&lt;br /&gt;&amp;#39;Finished script&amp;#39;&lt;/pre&gt;
&lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_643DEF5B.png" border="0" height="456" width="696" /&gt; &lt;/p&gt;
&lt;p&gt;Notice how execution continued after the ping command failed with an exit code of one (1) even though we have $ErrorActionPreference set to &amp;lsquo;Stop&amp;rsquo;. Also notice that the rm command, which is an alias for the PowerShell command, Remove-Item, did cause execution to abort as expected and &amp;lsquo;Finished script&amp;rsquo; was never printed to the console. The discrepancy in error handling between PowerShell commands and executables is annoying and forces us to constantly think about what we&amp;rsquo;re calling &amp;ndash; a PowerShell command or an executable. The obvious solution is:&lt;/p&gt;
&lt;pre&gt;&amp;#39;Starting script...&amp;#39;&lt;br /&gt;$ErrorActionPreference = &amp;#39;Stop&amp;#39;&lt;br /&gt;ping -badoption&lt;br /&gt;&lt;b&gt;&lt;span style="color:#0000ff;"&gt;if ($LastExitCode -ne 0) { throw &amp;#39;An error has occured...&amp;#39; }&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;rm nonexistent.txt&lt;br /&gt;&amp;#39;Finished script&amp;#39;&lt;/pre&gt;
&lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_7A445AED.png" border="0" height="456" width="696" /&gt;&lt;/p&gt;
&lt;p&gt;The error handling code adds a lot of noise, IMHO, and feels like a throwback to COM and HRESULTs. Can we do better? Jorge Matos, one of the &lt;a href="http://code.google.com/p/psake/" target="_blank"&gt;psake&lt;/a&gt; contributors came up with this elegant helper function:&lt;/p&gt;
&lt;pre&gt;function Exec([scriptblock]$cmd, [string]$errorMessage = &amp;quot;Error executing command: &amp;quot; + $cmd) { &lt;br /&gt;  &amp;amp; $cmd &lt;br /&gt;  if ($LastExitCode -ne 0) {&lt;br /&gt;    throw $errorMessage &lt;br /&gt;  } &lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;Note the &amp;ldquo;&amp;amp; $cmd&amp;rdquo; syntax. $cmd is a scriptblock and &amp;amp; is used to execute the scriptblock. We can now re-write our original script as follows. (N.B. Exec function is elided for brevity.)&lt;/p&gt;
&lt;pre&gt;&amp;#39;Starting script...&amp;#39;&lt;br /&gt;$ErrorActionPreference = &amp;#39;Stop&amp;#39;&lt;br /&gt;exec { ping -badoption }&lt;br /&gt;rm nonexistent.txt&lt;br /&gt;&amp;#39;Finished script&amp;#39;&lt;/pre&gt;
&lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_176A02F8.png" border="0" height="456" width="696" /&gt;&lt;/p&gt;
&lt;p&gt;The script now terminates when the bad ping command is executed. We do have to remember to surround executables with exec {}, but this is less noise IMHO than having to check $LastExitCode and throwing an exception.&lt;/p&gt;
&lt;p&gt;For those of you using psake for your builds, the Exec helper function is included in the latest versions of the psake module. So you can use it in your build tasks to ensure that you don&amp;rsquo;t try to run unit tests if msbuild fails horribly. &lt;img alt="smile_regular" src="http://spaces.live.com/rte/emoticons/smile_regular.gif" /&gt;&lt;/p&gt;
&lt;p&gt;Happy Scripting!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=652044" width="1" height="1"&gt;</content><author><name>james.kovacs</name><uri>http://codebetter.com/members/james.kovacs/default.aspx</uri></author><category term="PowerShell" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/PowerShell/default.aspx" /></entry><entry><title>DevTeach Toronto 2010 Ultimate Edition</title><link rel="alternate" type="text/html" href="/blogs/james.kovacs/archive/2010/02/23/devteach-toronto-2010-ultimate-edition.aspx" /><id>/blogs/james.kovacs/archive/2010/02/23/devteach-toronto-2010-ultimate-edition.aspx</id><published>2010-02-24T03:53:00Z</published><updated>2010-02-24T03:53:00Z</updated><content type="html">&lt;p&gt;&lt;img style="border-bottom:0px;border-left:0px;margin:0px 10px 10px 0px;display:inline;border-top:0px;border-right:0px;" title="DevTeach" alt="DevTeach" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_0F5B3FF6.png" align="left" border="0" height="65" width="150" /&gt;&lt;a href="http://www.devteach.com" target="_blank"&gt;DevTeach&lt;/a&gt; is heading back to Toronto in a few weeks (March 8-12, 2010)and you&amp;rsquo;ll get a bigger dose of awesome than ever before. We&amp;rsquo;ve got a fantastic line-up of &lt;a href="http://www.devteach.com/Speaker.aspx" target="_blank"&gt;top-notch, internationally renowned speakers&lt;/a&gt;. 6 tracks covering Agile, Web, Windows, Silverlight, Architecture, and SharePoint. A metric ton of &lt;a href="http://www.devteach.com/Session.aspx" target="_blank"&gt;sessions&lt;/a&gt;. (I&amp;rsquo;m both the Agile and Web Track Chairs and am really excited about the speakers and sessions for each.)&lt;/p&gt;
&lt;p&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;margin-left:0px;border-top:0px;margin-right:0px;border-right:0px;" title="ee402630.VisualStudio_lg" alt="ee402630.VisualStudio_lg" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/ee402630.VisualStudio_5F00_lg_5F00_674890D6.png" align="right" border="0" height="55" width="55" /&gt;Microsoft Canada is a platinum sponsor and every attendee receives a full copy of Visual Studio Professional with MSDN Premium. (N.B. Conference registration costs less than this subscription alone!)&lt;/p&gt;
&lt;p&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;margin-left:0px;border-top:0px;margin-right:0px;border-right:0px;" title="image" alt="image" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_25CDDE7D.png" align="right" border="0" height="206" width="257" /&gt;And if you can&amp;rsquo;t get enough of that &lt;span style="text-decoration:line-through;"&gt;Sugar Crisp&lt;/span&gt; James Kovacs,&amp;nbsp; I&amp;rsquo;ll be there in full force with two sessions and a one-day post-con on agile development.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Convention-over-Configuration in an Agile World&lt;/h3&gt;
&lt;p&gt;As developers, we spend an inordinate amount of time writing &amp;quot;glue code&amp;quot;. We write code to transform database rows to domain objects... domain objects to view-models or DTOs... We write code to configure inversion of control containers and wire dependencies together. We write code to style our UIs and respond to UI events. Wouldn&amp;#39;t it be nice if this could happen automagically for us? This session will look at using convention-based approaches using Fluent NHibernate and Castle Windsor to reduce the amount of repetitive code and accelerate application development.&lt;/p&gt;
&lt;h3&gt;Convention-over-Configuration in a Web World&lt;/h3&gt;
&lt;p&gt;As developers, we spend an inordinate amount of time writing &amp;quot;glue code&amp;quot;. We write code to transform database rows to domain objects... domain objects to view-models or DTOs... We write code to configure inversion of control containers and wire dependencies together. We write code to style our UIs and respond to UI events. Wouldn&amp;#39;t it be nice if this could happen automagically for us? This session will look at using convention-based approaches using AutoMapper and jQuery to reduce the amount of repetitive code and accelerate application development.&lt;/p&gt;
&lt;h3&gt;Agile Development with IoC and ORM (Post-Con)&lt;/h3&gt;
&lt;p&gt;As developers we now have powerful tools in our toolbox, such inversion of control containers and object-relational mappers. But how can we use these tools to rapidly build maintainable and flexible applications? In this pre-con, we will look at advanced techniques such as convention-over-configuration in IoC containers and automapping ORMs to quickly build applications that can evolve over time. We will use test-driven development (TDD) to design and evolve a complete working application with supporting infrastructure during this one-day workshop.&lt;/p&gt;
&lt;p&gt;Hope to see you in Toronto!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=652029" width="1" height="1"&gt;</content><author><name>james.kovacs</name><uri>http://codebetter.com/members/james.kovacs/default.aspx</uri></author><category term=".NET" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/.NET/default.aspx" /><category term="Agile" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Agile/default.aspx" /><category term="Events" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Events/default.aspx" /><category term="Presentations" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Presentations/default.aspx" /><category term="Courses" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Courses/default.aspx" /></entry><entry><title>Releasing psake v1.00 &amp; psake v2.00</title><link rel="alternate" type="text/html" href="/blogs/james.kovacs/archive/2009/10/14/releasing-psake-v1-00-amp-psake-v2-00.aspx" /><id>/blogs/james.kovacs/archive/2009/10/14/releasing-psake-v1-00-amp-psake-v2-00.aspx</id><published>2009-10-15T04:07:02Z</published><updated>2009-10-15T04:07:02Z</updated><content type="html">&lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;margin-left:0px;border-left-width:0px;margin-right:0px;" title="image" border="0" alt="image" align="left" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_7EBD74CA.png" width="128" height="55" /&gt;&lt;/p&gt;  &lt;p&gt;A few announcements… First the big one. Many people have been using psake - both the PowerShell 1.0- and 2.0-compatible versions - in production without any significant issues. For that reason, we have released psake v1.00 (compatible with PowerShell 1.0). The only difference between psake v1.00 and psake v0.23 is the version number. My friend, &lt;a href="http://ayende.com" target="_blank"&gt;Ayende&lt;/a&gt;, has &lt;a href="http://ayende.com/Blog/archive/2009/08/30/on-psake.aspx" target="_blank"&gt;a great example&lt;/a&gt; of converting Rhino Mocks build to use psake.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://psake.googlecode.com/files/psake-v1.00.zip"&gt;http://psake.googlecode.com/files/psake-v1.00.zip&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;We have released psake v2.01 (compatible with PowerShell 2.0). (This was formerly called psake v0.24, &amp;quot;Jorge&amp;quot;, and psake-ps2.) A big thanks to Jorge Matos for all his work on psake v2.01.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://psake.googlecode.com/files/psake-v2.01.zip"&gt;http://psake.googlecode.com/files/psake-v2.01.zip&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;A few minor changes... The source code for psake has been moved to GitHub and the SVN repository at Google Code has been retired. We will still be using Google Code for bug tracking, wiki pages, etc. If you want the latest source code, you can always download a zip file for master (aka trunk in SVN terms) - or any tags/branches - from:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://github.com/JamesKovacs/psake"&gt;http://github.com/JamesKovacs/psake&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Note that there is no need to install Git to download the latest package as GitHub will create the appropriate zip file on the fly.&lt;/p&gt;  &lt;p&gt;If you have some great idea, you can download the git repo from &lt;a title="git://github.com/JamesKovacs/psake.git"&gt;git://github.com/JamesKovacs/psake.git&lt;/a&gt; or &lt;a href="http://github.com/JamesKovacs/psake.git"&gt;http://github.com/JamesKovacs/psake.git&lt;/a&gt;. (msysgit is the Git package of choice for Windows. You can download it from &lt;a title="http://code.google.com/p/msysgit/" href="http://code.google.com/p/msysgit/"&gt;http://code.google.com/p/msysgit/&lt;/a&gt;.) I would encourage you to read Jeremy Skinner’s &lt;a href="http://mvccontrib.github.com/MvcContrib/" target="_blank"&gt;excellent guide&lt;/a&gt; for contributing to &lt;a href="http://www.codeplex.com/MVCContrib" target="_blank"&gt;MvcContrib&lt;/a&gt; via GitHub. Just mentally replace “MvcContrib” with “psake”, though I’d encourage you to contribute to MvcContrib too. :)&lt;/p&gt;  &lt;p&gt;I would like to offer lots of kudos to my collaborators/conspirators on the project. Jorge Matos has been instrumental in updating/improving psake to use the new PowerShell v2 features. Thanks to Shaun Becker for patches and answering newsgroup questions. And thanks to Eric Hexter for his assistance in moderating the psake-users Google Group. I am heartened and thankful for the willing collaboration on this project and am excited to watch it grow. If you have any questions, please do not hesitate to ask.&lt;/p&gt;  &lt;p&gt;Going forward, we are retiring psake v1.00 and focusing on psake v2.00. If there is demand for a PowerShell v1-compatible version of psake, we will create a branch based on the v1.00 tag, but we will mostly be focused on the PowerShell v2-compatible version (aka psake v2.00). So your next question probably is…&lt;/p&gt;  &lt;h4&gt;What&amp;#39;s New in psake v2.01? &lt;/h4&gt;  &lt;h6&gt;(from Jorge Matos)&lt;/h6&gt;  &lt;p&gt;The main difference is that psake v2.01 has been re-written as a module that contains advanced functions.&amp;#160; Someone using the module could either run the import-module command with the path to the module file (i.e. import-module .\psake.psm1) or (my preference) you can copy the psake.psm1 into a folder called psake into the &amp;quot;Modules&amp;quot; folder in your profile directory (you may have to create it if it&amp;#39;s not there) or your machine-wide &amp;quot;Modules&amp;quot; directory: &lt;/p&gt;  &lt;p&gt;i.e. Profile Directory: &lt;/p&gt;  &lt;p&gt;C:\Users\Jorge\Documents\WindowsPowerShell\Modules\psake &lt;/p&gt;  &lt;p&gt;i.e. Machine-wide Modules folder: &lt;/p&gt;  &lt;p&gt;C:\Windows\System32\WindowsPowerShell\v1.0\Modules\psake &lt;/p&gt;  &lt;p&gt;Once the psake folder is created and you&amp;#39;ve copied the psake.psm1 file into it - restart PS and type &amp;quot;import-module psake&amp;quot; - PS will find the module and load it automatically.&amp;#160; What I&amp;#39;ve done is add the &amp;quot;Import-Module psake&amp;quot; to my profile script so that it is loaded everytime I startup PS. &lt;/p&gt;  &lt;h5&gt;Module Benefits: &lt;/h5&gt;  &lt;ol&gt;   &lt;li&gt;Build scripts don&amp;#39;t need to know where psake is installed, they just call Invoke-psake and it works. &lt;/li&gt;    &lt;li&gt;Encapsulation… Global variables are no longer required since they can be private to a module unless explicitly exported (I haven&amp;#39;t gotten around to actually changing the psake code to not use global variables yet). &lt;/li&gt;    &lt;li&gt;Modules can be unloaded if needed which removes all the code and variables from memory. &lt;/li&gt; &lt;/ol&gt;  &lt;h5&gt;Advanced Functions: &lt;/h5&gt;  &lt;p&gt;The other big difference is that the &amp;quot;Invoke-psake&amp;quot; and &amp;quot;Task&amp;quot; functions have been converted into Advanced Functions which basically means you can take advantage of comment help which means you can type help invoke-psake and you will get back real help with examples.&lt;/p&gt;  &lt;h5&gt;Minor changes: &lt;/h5&gt;  &lt;ol&gt;   &lt;li&gt;Coding style is different. &lt;/li&gt;    &lt;li&gt;Try/Catch is used instead of the &amp;quot;Trap&amp;quot; statement. &lt;/li&gt;    &lt;li&gt;Got rid of the &amp;quot;exec&amp;quot; function. &lt;/li&gt;    &lt;li&gt;You can now define &amp;quot;Pre&amp;quot; and &amp;quot;Post&amp;quot; actions for a task. &lt;/li&gt;    &lt;li&gt;You can define how the task name will be formatted. &lt;/li&gt;    &lt;li&gt;You can define a &amp;quot;TaskSetup&amp;quot; function that will be executed before every task (took that from NUnit). &lt;/li&gt;    &lt;li&gt;You can define a &amp;quot;TaskTearDown&amp;quot; function that will be executed after every task (took that from NUnit too). &lt;/li&gt;    &lt;li&gt;Create a global variable called &amp;quot;psake_buildSucceeded&amp;quot; that will be set to true if the build succeeds - scripts can check this. &lt;/li&gt;    &lt;li&gt;Also added a &amp;quot;$noexit&amp;quot; switch to Run-Psake so that the function will not use the exit() function so that you can test a build script at the command line without PS closing down (the default behavior when the build fails is to call exit(1) so that the calling code can determine if the build failed or not). &lt;/li&gt;    &lt;li&gt;The psake-buildTester.ps1 had to be changed slightly in order for it to call the Invoke-psake function. &lt;/li&gt;    &lt;li&gt;Added more examples in the .\examples folder for POST conditions, PRE and POST Actions, etc. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Happy (build) scripting!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=380334" width="1" height="1"&gt;</content><author><name>james.kovacs</name><uri>http://codebetter.com/members/james.kovacs/default.aspx</uri></author><category term=".NET" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/.NET/default.aspx" /><category term="Tools" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Tools/default.aspx" /><category term="PowerShell" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/PowerShell/default.aspx" /></entry><entry><title>TIP: How to Run Programs as a Domain User from a Non-domain Computer</title><link rel="alternate" type="text/html" href="/blogs/james.kovacs/archive/2009/10/11/tip-how-to-run-programs-as-a-domain-user-from-a-non-domain-computer.aspx" /><id>/blogs/james.kovacs/archive/2009/10/11/tip-how-to-run-programs-as-a-domain-user-from-a-non-domain-computer.aspx</id><published>2009-10-12T02:06:47Z</published><updated>2009-10-12T02:06:47Z</updated><content type="html">&lt;p&gt;As many of you know, I am an independent consultant and use my own laptop when possible. I’ve got all my tools set up the way I like them and everything else that I need to be productive. Given that I work for multiple clients, I can’t join my laptop to any particular client’s domain. First is the hassle factor, especially when switching between different clients within a week. Each domain join requires a domain admin to authorize the join by typing in his/her credentials when prompted on my laptop. Second I don’t want a client’s Group Policy being applied to my laptop. Third – and more importantly – is the non-disclosure agreements that I sign with clients. If I join my laptop to a domain, the domain admins have full rights to my machine and hence data from other clients. So domain joining just isn’t an option.&lt;/p&gt;  &lt;p&gt;In most cases, not being joined to a client’s domain doesn’t make one iota of difference. You need to access a network share or printer, browser to it and you will be prompted for domain credentials. The fact that you’re using different domain credentials to access the resource from those that you logged in with doesn’t matter one bit. If you want to expedite the process and not wait for an authentication time-out, you can utilize NET USE from the command line to tell Windows which credentials you want to use when accessing certain computers. You can even make them persistent or roll the whole thing into a batch script that you can execute whenever at a particular client.&lt;/p&gt;  &lt;p&gt;net use \\server /user:domain\username /persistent:yes&lt;/p&gt;  &lt;p&gt;Unfortunately this doesn’t work in all cases. One of my longstanding development pet peeves has been certain tools – I’m looking at you SQL Server Management Studio and SQL Query Analyzer – that don’t allow you to specify alternate domain credentials for authentication. For example, SQL Server Management Studio allows you to log into a SQL Server instance using Windows Authentication or SQL Server Authentication. If the SQL instance requires Windows Authentication – the recommended configuration – SQL Server Management Studio uses your logged in credentials. This works well if your computer is part of the domain, but fails horribly if not. It doesn’t let you specify alternate credentials or even prompt you for alternate credentials if the log-in fails.&lt;/p&gt;  &lt;p&gt;I’ve tried seemingly everything. NET USE doesn’t help here because NET USE is specifically for network shares.&lt;/p&gt;  &lt;p&gt;net use \\sql-server-name /user:domain\username # DOES NOT WORK - Only provides the domain credentials when accessing shares&lt;/p&gt;  &lt;p&gt;RUNAS also fails – either the SHIFT right-click variety or command line – as it tries to run the command locally as the domain user, who is unknown by your computer because you’re not part of the domain.&lt;/p&gt;  &lt;p&gt;runas /user:domain\username “C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe”&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" border="0" alt="image" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_1490ED13.png" width="1029" height="194" /&gt; &lt;/p&gt;  &lt;p&gt;For years (yes, years) I have resorted to using Remote Desktop to log into a domain computer so that I could run SQL Server Management Studio, used a domain-joined virtual machine, or begged co-workers to run commands for me. Now I feel foolish because I stumbled upon a solution that has been built into Windows for years. It is a simple command line switch for the RUNAS command that I never noticed: /netonly. (Note that the /netonly flag is not accessible via the SHIFT right-click menu, only via the command line.)&lt;/p&gt;  &lt;p&gt;runas &lt;strong&gt;/netonly&lt;/strong&gt; /user:domain\username “C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe”&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" border="0" alt="image" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_15D585F2.png" width="1029" height="194" /&gt;&lt;/p&gt;  &lt;p&gt;Success! And SQL Server Management Studio running using /netonly domain credentials. The command is run as my local user, but uses the supplied domain credentials only when accessing the network.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" border="0" alt="image" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_3015EF16.png" width="673" height="561" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" border="0" alt="image" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_329F20D4.png" width="479" height="558" /&gt; &lt;/p&gt;  &lt;p&gt;I can access remote SQL Servers using Windows Authentication without problem now! (You’ll have to take my word for it or try it yourself as it would be impolite for me to show screenshots of me accessing a client’s SQL Server.) Hopefully this makes some other consultant’s life a little bit easier.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=372068" width="1" height="1"&gt;</content><author><name>james.kovacs</name><uri>http://codebetter.com/members/james.kovacs/default.aspx</uri></author><category term="Miscellaneous" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Miscellaneous/default.aspx" /></entry><entry><title>Edmonton Code Camp Wrap-up: Doing More with Less</title><link rel="alternate" type="text/html" href="/blogs/james.kovacs/archive/2009/09/20/edmonton-code-camp-wrap-up-doing-more-with-less.aspx" /><id>/blogs/james.kovacs/archive/2009/09/20/edmonton-code-camp-wrap-up-doing-more-with-less.aspx</id><published>2009-09-21T01:27:00Z</published><updated>2009-09-21T01:27:00Z</updated><content type="html">&lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;margin-left:0px;border-left-width:0px;margin-right:0px;" title="Darth Vader" border="0" alt="Darth Vader" align="right" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image5_5F00_2AA0D7E3.png" width="240" height="193" /&gt;The &lt;a href="http://edmontoncodecamp.com/" target="_blank"&gt;Edmonton Code Camp&lt;/a&gt; was a lot of fun. It was wonderful to catch up with friends – old and new – over lunch and dinner. Thanks to &lt;a href="http://www.haveyougotwoods.com/" target="_blank"&gt;Dave Woods&lt;/a&gt; for inviting me.&lt;/p&gt;  &lt;p&gt;I have been enjoying sharing my ideas about convention-over-configuration and how it can simplify software development. You expend some serious brain power over figuring out how to enable your application-specific conventions, but everything after that flows easily and without repetition. You end up doing more with less code. During the talk, I demonstrated how frameworks like Fluent NHibernate, AutoMapper, Castle Windsor, ASP.NET MVC, and jQuery support this style of development. (Links below.) I only scratched the surface though. Other frameworks like StructureMap and FubuMVC also are heavily convention-based. With a bit of creative thinking, you can use these techniques in your own code to reduce duplication and increase flexibility.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.fluentnhibernate.org" target="_blank"&gt;Fluent NHibernate&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://nhforge.org" target="_blank"&gt;NHForge &lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.codeplex.com/AutoMapper" target="_blank"&gt;AutoMapper &lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://castleproject.org" target="_blank"&gt;Castle Windsor &lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://asp.net/mvc" target="_blank"&gt;ASP.NET MVC&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://jquery.com" target="_blank"&gt;jQuery&lt;/a&gt; &amp;amp; &lt;a href="http://jqueryui.com" target="_blank"&gt;jQuery UI &lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;For those of you who attended, you’ll realize why Darth Vader accompanies this post. For everyone else, you’ll have to check out the slidedeck and code:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://jameskovacs.com/downloads/DoingMoreWithLess.pptx" target="_blank"&gt;PPTX&lt;/a&gt; | &lt;a href="http://jameskovacs.com/downloads/DoingMoreWithLess-FakeVader.zip" target="_blank"&gt;Code&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=357499" width="1" height="1"&gt;</content><author><name>james.kovacs</name><uri>http://codebetter.com/members/james.kovacs/default.aspx</uri></author><category term="Presentations" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Presentations/default.aspx" /></entry><entry><title>PowerShell Tip: Providers</title><link rel="alternate" type="text/html" href="/blogs/james.kovacs/archive/2009/09/14/powershell-tip-providers.aspx" /><id>/blogs/james.kovacs/archive/2009/09/14/powershell-tip-providers.aspx</id><published>2009-09-15T04:48:00Z</published><updated>2009-09-15T04:48:00Z</updated><content type="html">&lt;p&gt;At first glance, PowerShell appears to be yet another command shell with the interesting twist that you pipe objects between commands rather than strings. But there is more to PowerShell than that. One fascinating area is PowerShell Providers. (PowerShell Providers aren&amp;rsquo;t anything new as they&amp;rsquo;ve been there since v1. So I&amp;rsquo;m not the first &amp;ndash; nor will I be the last &amp;ndash; to blog about them, but hopefully some folks starting out with PowerShell find this useful&amp;hellip;)&lt;/p&gt;
&lt;p&gt;We&amp;rsquo;ll start with a simple example using &amp;ldquo;ls&amp;rdquo; to list the contents of a directory:&lt;/p&gt;
&lt;p&gt;ls c:\&lt;/p&gt;
&lt;p&gt;Now &amp;ldquo;ls&amp;rdquo; is just a two-letter version of &amp;ldquo;dir&amp;rdquo; and both are aliases for &amp;ldquo;Get-ChildItem&amp;rdquo;. How do I know that?&lt;/p&gt;
&lt;p&gt;ls alias:&lt;/p&gt;
&lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_170D8450.png" border="0" height="379" width="781" /&gt; &lt;/p&gt;
&lt;p&gt;This prints out all current aliases. That funky &amp;ldquo;alias:&amp;rdquo; is a PowerShell provider. If you want a specific alias, you can &amp;ldquo;ls alias:ls&amp;rdquo; or &amp;ldquo;ls alias:dir&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_239B316C.png" border="0" height="295" width="733" /&gt; &lt;/p&gt;
&lt;p&gt;To get a list of currently installed PowerShell providers, you can use &lt;b&gt;Get-PSProvider&lt;/b&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_5B6D758F.png" border="0" height="283" width="781" /&gt; &lt;/p&gt;
&lt;p&gt;You should notice a few interesting entries there. You want a list of environment variables? The Environment provider does the trick:&lt;/p&gt;
&lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_6F1A5F23.png" border="0" height="662" width="1029" /&gt; &lt;/p&gt;
&lt;p&gt;Note that providers aren&amp;rsquo;t read-only. Let&amp;rsquo;s say you want to temporarily add a directory to your path. In cmd.exe, you would do the following:&lt;/p&gt;
&lt;p&gt;set PATH = %PATH%;&amp;lt;EXTRA_DIR&amp;gt;;&lt;/p&gt;
&lt;p&gt;In PowerShell, you use the Environment provider:&lt;/p&gt;
&lt;p&gt;$env:PATH += &amp;quot;;&amp;lt;EXTRA_DIR&amp;gt;&amp;quot;;&amp;quot;&lt;/p&gt;
&lt;p&gt;Notice the env: prefix that tells PowerShell that the variable is handled by the Environment provider. (Notice above that &amp;ldquo;Env&amp;rdquo; is listed as the &amp;ldquo;drive&amp;rdquo; for the Environment provider.)&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s explore some more&amp;hellip;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_7F46271C.png" border="0" height="614" width="1029" /&gt; &lt;/p&gt;
&lt;p&gt;Notice that changing drive letters is actually handled by the Function provider and are just commands.&lt;/p&gt;
&lt;p&gt;It gets more interesting with the Registry provider through which you can access HKEY_LOCAL_MACHINE via hklm: and HKEY_CURRENT_USER via hkcu:.&lt;/p&gt;
&lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_447E7E46.png" border="0" height="331" width="573" /&gt; &lt;/p&gt;
&lt;p&gt;You even get tab completion while typing. (Try ls hkcu:&amp;lt;TAB&amp;gt;&amp;lt;TAB&amp;gt;&amp;lt;TAB&amp;gt; to see various subkeys for HKEY_CURRENT_USER.) And assuming that you have write permission to the registry keys, you can set them too!&lt;/p&gt;
&lt;p&gt;PowerShell providers aren&amp;rsquo;t limited to those shipped by Microsoft. You can in fact &lt;a href="http://msdn.microsoft.com/en-us/library/ms714636(VS.85).aspx" target="_blank"&gt;write your own&lt;/a&gt;, though I&amp;rsquo;ve never tried it. People have written their own providers for everything from SharePoint to Subversion.&lt;/p&gt;
&lt;p&gt;So go check out PowerShell providers. Happy Scripting!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=346088" width="1" height="1"&gt;</content><author><name>james.kovacs</name><uri>http://codebetter.com/members/james.kovacs/default.aspx</uri></author><category term="PowerShell" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/PowerShell/default.aspx" /></entry><entry><title>.NET Rocks #475: James Kovacs on Convention-over-Configuration</title><link rel="alternate" type="text/html" href="/blogs/james.kovacs/archive/2009/08/25/net-rocks-475-james-kovacs-on-convention-over-configuration.aspx" /><id>/blogs/james.kovacs/archive/2009/08/25/net-rocks-475-james-kovacs-on-convention-over-configuration.aspx</id><published>2009-08-26T03:14:00Z</published><updated>2009-08-26T03:14:00Z</updated><content type="html">&lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;margin-left:0px;border-left-width:0px;margin-right:0px;" title=".NET Rocks" alt=".NET Rocks" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_5A30EB38.png" align="right" border="0" height="128" width="472" /&gt;A few weeks ago Richard and Carl invited me to appear on .NET Rocks again and I jumped at the chance. I had a great time talking to them about doing more with less (writing less, but smarter code) and how convention-over-configuration changes the way that we develop software for the better. Check it out &lt;a href="http://www.dotnetrocks.com/default.aspx?showNum=475" target="_blank"&gt;.NET Rocks #475&lt;/a&gt; featuring yours truly!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=320785" width="1" height="1"&gt;</content><author><name>james.kovacs</name><uri>http://codebetter.com/members/james.kovacs/default.aspx</uri></author><category term="Podcast" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Podcast/default.aspx" /></entry><entry><title>Wrap-up: Doing More with Less</title><link rel="alternate" type="text/html" href="/blogs/james.kovacs/archive/2009/08/19/wrap-up-doing-more-with-less.aspx" /><id>/blogs/james.kovacs/archive/2009/08/19/wrap-up-doing-more-with-less.aspx</id><published>2009-08-20T04:04:00Z</published><updated>2009-08-20T04:04:00Z</updated><content type="html">&lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;margin-left:0px;border-left-width:0px;margin-right:0px;" title="image" alt="image" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_1400694B.png" align="right" border="0" height="193" width="240" /&gt; Thanks to everyone who came out to &lt;a href="http://www.jameskovacs.com/blog/DoingMoreWithLessAcceleratingDevelopmentUsingConventionoverConfiguration.aspx" target="_blank"&gt;my presentation&lt;/a&gt; last night at the Calgary .NET User Group. I enjoyed talking using convention-over-configuration techniques for doing more with less code. I demonstrated how frameworks like Fluent NHibernate, AutoMapper, Castle Windsor, ASP.NET MVC, and jQuery support this style of development. (Links below.) I only scratched the surface though. Other frameworks like StructureMap and FubuMVC also are heavily convention-based. With a bit of creative thinking, you can use these techniques in your own code to reduce duplication and increase flexibility.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.fluentnhibernate.org" target="_blank"&gt;Fluent NHibernate&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://nhforge.org" target="_blank"&gt;NHForge &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeplex.com/AutoMapper" target="_blank"&gt;AutoMapper &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://castleproject.org" target="_blank"&gt;Castle Windsor &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://asp.net/mvc" target="_blank"&gt;ASP.NET MVC&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://jquery.com" target="_blank"&gt;jQuery&lt;/a&gt; &amp;amp; &lt;a href="http://jqueryui.com" target="_blank"&gt;jQuery UI &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For those of you who attended, you&amp;rsquo;ll realize why Darth Vader accompanies this post. For everyone else, you&amp;rsquo;ll have to check out the slidedeck and code:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://jameskovacs.com/downloads/DoingMoreWithLess.pptx" target="_blank"&gt;PPTX&lt;/a&gt; | &lt;a href="http://jameskovacs.com/downloads/DoingMoreWithLess-FakeVader.zip" target="_blank"&gt;Code&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=309389" width="1" height="1"&gt;</content><author><name>james.kovacs</name><uri>http://codebetter.com/members/james.kovacs/default.aspx</uri></author><category term="Presentations" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Presentations/default.aspx" /></entry><entry><title>Doing More With Less: Accelerating Development Using Convention-over-Configuration</title><link rel="alternate" type="text/html" href="/blogs/james.kovacs/archive/2009/08/12/doing-more-with-less-accelerating-development-using-convention-over-configuration.aspx" /><id>/blogs/james.kovacs/archive/2009/08/12/doing-more-with-less-accelerating-development-using-convention-over-configuration.aspx</id><published>2009-08-13T03:48:47Z</published><updated>2009-08-13T03:48:47Z</updated><content type="html">&lt;p&gt;I’ll be presenting at the Calgary .NET User Group next week. Come out for a fun discussion and lively discussion on improving your application development using convention-over-configuration techniques. &lt;/p&gt;  &lt;table&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td&gt;Topic:&lt;/td&gt;        &lt;td&gt;&lt;strong&gt;Doing More With Less: Accelerating Development Using Convention-over-Configuration&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;Speaker:&lt;/td&gt;        &lt;td&gt;James Kovacs&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;Date:&lt;/td&gt;        &lt;td&gt;18-August-2009&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;Location:&lt;/td&gt;        &lt;td&gt;Nexen Conference Center          &lt;br /&gt;801-7th Ave. S.W., Calgary, AB. (Plus 15 level)           &lt;br /&gt;&lt;a href="http://maps.google.com/maps?f=q&amp;amp;hl=en&amp;amp;geocode=&amp;amp;time=&amp;amp;date=&amp;amp;ttype=&amp;amp;q=801+7+Avenue+S.W.+Calgary+Alberta&amp;amp;sll=51.04507,-114.06319&amp;amp;sspn=0.299599,0.914612&amp;amp;ie=UTF8&amp;amp;om=1&amp;amp;ll=51.046628,-114.077826&amp;amp;spn=0.009362,0.028582&amp;amp;z=16&amp;amp;iwloc=addr"&gt;Map&lt;/a&gt; &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;Registration:&lt;/td&gt;        &lt;td&gt;5:00 pm - 5:30 pm&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;Presentation:&lt;/td&gt;        &lt;td&gt;5:30 pm - ???&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Abstract&lt;/h3&gt;  &lt;p&gt;As developers, we spend an inordinate amount of time writing &amp;quot;glue code&amp;quot;. We write code to transform database rows to domain objects... domain objects to view-models or DTOs... We write code to configure inversion of control containers and wire dependencies together. We write code to style our UIs and respond to UI events. Wouldn&amp;#39;t it be nice if this could happen automagically for us? This session will look at using convention-based approaches using Fluent NHibernate, AutoMapper, Castle Windsor, and jQuery to reduce the amount of repetitive code and accelerate application development.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=289557" width="1" height="1"&gt;</content><author><name>james.kovacs</name><uri>http://codebetter.com/members/james.kovacs/default.aspx</uri></author><category term="Presentations" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Presentations/default.aspx" /></entry><entry><title>Top 10 Reasons to Attend DevTeach Vancouver</title><link rel="alternate" type="text/html" href="/blogs/james.kovacs/archive/2009/05/25/top-10-reasons-to-attend-devteach-vancouver.aspx" /><id>/blogs/james.kovacs/archive/2009/05/25/top-10-reasons-to-attend-devteach-vancouver.aspx</id><published>2009-05-26T01:17:48Z</published><updated>2009-05-26T01:17:48Z</updated><content type="html">&lt;p&gt;&lt;a href="http://www.devteach.com" target="_blank"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;margin-left:0px;border-left-width:0px;margin-right:0px;" title="DevTeach.com" border="0" alt="DevTeach.com" align="right" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_54178265.png" width="300" height="250" /&gt;&lt;/a&gt; &lt;a href="http://www.devteach.com/" target="_blank"&gt;DevTeach&lt;/a&gt; is my favourite conference of the year and it’s happening again in Vancouver on June 8-12, 2009. No, it’s not my favourite conference because I’m one of the &lt;a href="http://www.devteach.com/TechChair.aspx" target="_blank"&gt;Tech Chairs&lt;/a&gt;. It’s the other way around. I’m a Tech Chair because DevTeach is my favourite conference. For the curious, Tech Chairs do not receive an honorarium or other compensation. We do it because we love DevTeach and the community it brings together. Here are my Top 10 Reasons to attend DevTeach Vancouver.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;It’s got a dedicated &lt;a href="http://www.devteach.com/Session.aspx#122" target="_blank"&gt;Agile Track&lt;/a&gt;, baby! 18 sessions of agile goodness. &lt;/li&gt;    &lt;li&gt;The Agile Track has more TLAs than any other track, including TDD, BDD, DDD, ORM, IoC, and DSL! &lt;/li&gt;    &lt;li&gt;Internationally renowned speakers, including Oren Eini (aka Ayende Rahien), David Laribee, Michael Stiefel, Greg Young, Eric Renaud, Francois Tanguay, Claudio Lassala, Hamilton Verissimo, Owen Rogers, Donald Belcham, and me. And that’s just the Agile Track! &lt;/li&gt;    &lt;li&gt;More IoC than you can shake a stick at with sessions by Oren Eini (current maintainer of Castle Windsor), Hamilton Verissimo (creator of Castle Windsor and Microsoft PM on MEF), and me. (I feel so outclassed in that line-up.) &lt;/li&gt;    &lt;li&gt;1-day pre-conference session on &lt;a href="http://www.devteach.com/PreConference.aspx#PreAgile" target="_blank"&gt;Agile Development with IoC and ORM&lt;/a&gt; with James Kovacs and Oren Eini. &lt;a href="http://www.devteach.com/wconnect/wc.dll?FournierTransformation~1,10,4,94" target="_blank"&gt;Register now!&lt;/a&gt; ($399 CAD) Spend an intense day of coding with Oren and me learning about how to build applications with Fluent NHibernate, Windsor, AutoMapper, and other agile-friendly technologies. &lt;/li&gt;    &lt;li&gt;&lt;a href="http://altnetconfcanada.com/" target="_blank"&gt;ALT.NET Canada&lt;/a&gt; happening June 12-14, 2009 at the same hotel. &lt;a href="http://altnetconfcanada.com/registration/index.castle" target="_blank"&gt;Register now!&lt;/a&gt; (FREE!) (DevTeach is a major sponsor of ALT.NET Canada. Thank you, JR!) &lt;/li&gt;    &lt;li&gt;.NET Rocks will be in the house again! Carl and Richard always provide lively discussion and entertainment. DevTeach Vancouver will be no different with a &lt;a href="http://www.devteach.com/BonusSession.aspx" target="_blank"&gt;.NET Rocks-hosted Visual Studio 2010 Beta 1 InstallFest&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;At DevTeach, speakers don’t hide in the Speakers Lounge. You get to meet them face-to-face and ask them questions. &lt;/li&gt;    &lt;li&gt;DevTeach Education Stimulus Package! In difficult times, DevTeach trying to help out by providing three registrations for the price of two. You can find details on the &lt;a href="http://www.devteach.com/Register.aspx" target="_blank"&gt;Registration page&lt;/a&gt;. &lt;/li&gt;    &lt;li&gt;DevTeach is a conference where speakers go to learn. Unlike other conferences, speakers actually go to each other’s sessions and participate. This results in lively discussions that are fun for speakers and attendees alike. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Hope to see you at &lt;a href="http://www.devteach.com/Register.aspx" target="_blank"&gt;DevTeach Vancouver&lt;/a&gt;! Don’t forget to register for &lt;a href="http://www.devteach.com/wconnect/wc.dll?FournierTransformation~1,10,4,94" target="_blank"&gt;the day-long Oren/James extravaganza of agile fun&lt;/a&gt;. Or &lt;a href="http://altnetconfcanada.com/registration/index.castle" target="_blank"&gt;ALT.NET Canada&lt;/a&gt;!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=237296" width="1" height="1"&gt;</content><author><name>james.kovacs</name><uri>http://codebetter.com/members/james.kovacs/default.aspx</uri></author><category term="Agile" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Agile/default.aspx" /><category term="Events" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Events/default.aspx" /><category term="Courses" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Courses/default.aspx" /></entry><entry><title>Extreme ASP.NET Makeover – Getting Your House in Order</title><link rel="alternate" type="text/html" href="/blogs/james.kovacs/archive/2009/05/10/extreme-asp-net-makeover-getting-your-house-in-order.aspx" /><id>/blogs/james.kovacs/archive/2009/05/10/extreme-asp-net-makeover-getting-your-house-in-order.aspx</id><published>2009-05-11T05:13:33Z</published><updated>2009-05-11T05:13:33Z</updated><content type="html">&lt;p&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;margin-left:0px;border-left-width:0px;margin-right:0px;" title="Sand Zen Garden" border="0" alt="Sand Zen Garden" align="right" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_35588A9A.png" width="300" height="199" /&gt; A few months back, &lt;a href="http://www.jameskovacs.com/blog/MSDNMagazineSeriesFromWebDevToRIADev.aspx" target="_blank"&gt;I announced&lt;/a&gt; that I was doing a series of articles for MSDN Magazine on improving a “classic” ASP.NET application with modern tooling and frameworks. As an application, I chose &lt;a href="http://www.screwturn.eu" target="_blank"&gt;ScrewTurn Wiki 3.0&lt;/a&gt; to use as my example throughout. The first article, &lt;a href="http://msdn.microsoft.com/en-us/magazine/dd758790.aspx" target="_blank"&gt;Extreme ASP.NET Makeover – Getting Your House in Order&lt;/a&gt;, went live a few days ago. The article is purposefully a different format for MSDN Magazine than “traditional” articles in that it incorporates short screencasts where appropriate rather than just code snippets and pictures. (Code snippets and pictures are included too, though!) I tried to make the screencasts an integral part of the narrative where actually showing something was easier than text, pictures, or code. I would love to hear your feedback on the format and content.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Nitpickers Corner:&lt;/strong&gt; In the series, I use MSBuild as the build tool. Yes, I wrote my own PowerShell-based build tool, &lt;a href="http://code.google.com/p/psake/" target="_blank"&gt;psake&lt;/a&gt;. Yes, I use NAnt on many of my projects for clients. (They’re already using NAnt and PowerShell is a new skillset for them.) So why MSBuild for the series? Because it is installed by default with .NET 2.0 and above. Not my first choice, but a pragmatic choice for a series focused on improving what you have.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=221781" width="1" height="1"&gt;</content><author><name>james.kovacs</name><uri>http://codebetter.com/members/james.kovacs/default.aspx</uri></author><category term=".NET" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/.NET/default.aspx" /><category term="Agile" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Agile/default.aspx" /><category term="Screencast" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Screencast/default.aspx" /></entry><entry><title>psake at VAN Wrap-up</title><link rel="alternate" type="text/html" href="/blogs/james.kovacs/archive/2009/04/09/psake-at-van-wrap-up.aspx" /><id>/blogs/james.kovacs/archive/2009/04/09/psake-at-van-wrap-up.aspx</id><published>2009-04-10T00:05:00Z</published><updated>2009-04-10T00:05:00Z</updated><content type="html">&lt;p&gt;&lt;img title="psake" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;margin-left:0px;margin-right:0px;border-right-width:0px;" alt="psake" src="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/psake_5F00_2982E6D7.png" align="right" border="0" height="86" width="200" /&gt; Last night I gave a presentation on psake and PowerShell to the &lt;a href="http://groups.google.com/group/virtualaltnet" target="_blank"&gt;Virtual ALT.NET (VAN) group&lt;/a&gt;. I had a fun time demonstrating how to write a psake build script, examining some psake internals, discussing the current state of the project, and generally making a fool of myself by showing how much of a PowerShell noob I really am. I believe that the presentation was recorded and will be posted online in the next few days. Then you too can see me fumbling around trying to remember PowerShell syntax. I consider myself a professional developer when it comes to many areas, but in terms of PowerShell I am a hack who learns just enough to get the job done.&lt;/p&gt;
&lt;p&gt;As promised, here are the links from the meeting&amp;hellip;&lt;/p&gt;
&lt;h3&gt;psake Resources&lt;/h3&gt;
&lt;p&gt;&lt;a href="http://code.google.com/p/psake/" target="_blank"&gt;Project Homepage&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://groups.google.com/group/psake-users" target="_blank"&gt;Users mailing list&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://groups.google.com/group/psake-dev" target="_blank"&gt;Dev mailing list&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;PowerShell Resources&lt;/h3&gt;
&lt;p&gt;&lt;a href="http://tinyurl.com/ceydkd" target="_blank"&gt;PowerShell Cheat Sheet&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.manning.com/payette/" target="_blank"&gt;Windows PowerShell in Action&lt;/a&gt; (book)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.msdn.com/powershell/" target="_blank"&gt;Windows PowerShell Team Blog&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;On Twitter, I have a search for #psake. If you have a question, comment, or quibble about psake, you can use the #psake hashtag or @JamesKovacs to get my attention.&lt;/p&gt;
&lt;p&gt;P.S. A number of people expressed interest in some of my dev-related PowerShell scripts, such as removing unversioned files from a SVN working copy, updating all SVN working copies off a common directory, cleaning a solution, &amp;hellip; I&amp;rsquo;ll be putting them in a publicly accessible location soon and blogging about those scripts. So please be patient and don&amp;rsquo;t adjust your sets.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=192028" width="1" height="1"&gt;</content><author><name>james.kovacs</name><uri>http://codebetter.com/members/james.kovacs/default.aspx</uri></author><category term="Presentations" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/Presentations/default.aspx" /><category term="PowerShell" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/PowerShell/default.aspx" /></entry><entry><title>MSDN Magazine Series: From Web Dev to RIA Dev</title><link rel="alternate" type="text/html" href="/blogs/james.kovacs/archive/2009/03/20/msdn-magazine-series-from-web-dev-to-ria-dev.aspx" /><id>/blogs/james.kovacs/archive/2009/03/20/msdn-magazine-series-from-web-dev-to-ria-dev.aspx</id><published>2009-03-20T23:26:00Z</published><updated>2009-03-20T23:26:00Z</updated><content type="html">&lt;p&gt;I don&amp;rsquo;t have to remind everyone that we&amp;rsquo;re in the middle of a world-wide economic &lt;span style="text-decoration:line-through;"&gt;depression&lt;/span&gt; downturn. When the economy is good, it is&lt;a href="http://codebetter.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_c6f73465_2D00_725c_2D00_4743_2D00_a182_2D00_d48b6a46f0cd.png"&gt;&lt;img style="border:0;float:right;" src="http://codebetter.com/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/james.kovacs/image_5F00_c6f73465_2D00_725c_2D00_4743_2D00_a182_2D00_d48b6a46f0cd.png" border="0" alt="" /&gt;&lt;/a&gt; hard enough to convince your boss to re-build an application from scratch. When the economy is bad, it is bloody near impossible. In the coming months (and potentially years), I expect that as developers we&amp;rsquo;re going to be seeing more and more &lt;a href="http://www.manning.com/baley/"&gt;brownfield projects&lt;/a&gt;, rather than greenfield ones. We&amp;rsquo;re going to see more push for evolutionary development of applications rather than wholesale replacement. We will be called upon to improve existing codebases, implement new features, and take these projects in initially unforeseen directions. We will have to learn how to be &lt;i&gt;&lt;a href="http://www.amazon.com/gp/product/0131177052?ie=UTF8&amp;amp;tag=jamkovweb-20&amp;amp;link_code=as3&amp;amp;camp=211189&amp;amp;creative=373489&amp;amp;creativeASIN=0131177052"&gt;Working Effectively with Legacy Code&lt;/a&gt;&lt;/i&gt;. (Took some effort to coerce the title of Michael Feathers&amp;rsquo; excellent book into that last sentence.) A lot of companies have tremendous investment in existing &amp;ldquo;classic&amp;rdquo; ASP.NET websites, but there is a desire to evolve these sites rather than replace them, especially given these tough economic times. &lt;a href="http://codebetter.com/blogs/howard.dierking"&gt;Howard Dierking&lt;/a&gt;, editor of MSDN Magazine, has asked me to write a 9-week series entitled &lt;a href="http://blogs.msdn.com/msdnmagazine/archive/2009/03/18/9489211.aspx"&gt;&lt;i&gt;From Web Dev to RIA Dev&lt;/i&gt;&lt;/a&gt; where we will explore refactoring an existing &amp;ldquo;classic&amp;rdquo; ASP.NET site. We want to improve an existing ASP.NET using new technologies, such as AJAX, jQuery, and ASP.NET MVC. We want to show that you can adopt better practices, such as continuous integration, web testing (e.g. WatiN, WatiR, Selenium), integration testing, separation of concerns, layering, and more.&lt;/p&gt;
&lt;p&gt;So I have two questions for you, Dear Reader&amp;hellip;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Can you think of a representative &amp;ldquo;classic&amp;rdquo; ASP.NET website (or websites) for the project? &lt;/li&gt;
&lt;li&gt;What topics would you like to see covered? &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I should clarify what I mean&amp;hellip;&lt;/p&gt;
&lt;h5&gt;&amp;ldquo;Classic&amp;rdquo; ASP.NET Applications&lt;/h5&gt;
&lt;p&gt;I&amp;rsquo;m currently considering PetShop, IBuySpy, DasBlog, SubText, and ScrewTurn Wiki. I&amp;rsquo;m not looking for one riff with bad practices. Just an ASP.NET project in need of some TLC &amp;ndash; one that doesn&amp;rsquo;t have a decent build script, isn&amp;rsquo;t under CI, a bit shy on the testing, little to no AJAX, etc. The code should be typical of what you would see in a typical ASP.NET application. (For that reason, I am probably going to discount IBuySpy as it is built using a funky webpart-like framework, which is not typical of most ASP.NET applications.) Some of the ASP.NET applications that I just mentioned don&amp;rsquo;t exactly qualify because they do have build scripts, tests, and other features that I would like to demonstrate. I will get permission from the project owner(s) before embarking on this quest and plan to contribute any code back to the project. Needless to say that the project must have source available to be considered for this article series. So please make some suggestions!&lt;/p&gt;
&lt;h5&gt;Topics&lt;/h5&gt;
&lt;p&gt;I have a lot of ideas of technologies and techniques to explore including proper XHTML/CSS layout, jQuery, QUnit, AJAX, HTTP Modules/Handlers, build scripts, continuous integration (CI), ASP.NET MVC, web testing (probably WatiN or Selenium), refactoring to separate domain logic from codebehind/sprocs, &amp;hellip; I will cover one major topic per week over the 9-week series. So I&amp;rsquo;ve got lots of room for cool ideas. What would you like to see? What do you think is the biggest bang for your buck in terms of improving an existing ASP.NET application?&lt;/p&gt;
&lt;p&gt;Depending on the topics covered (based on your feedback here), I might use one site for the entire series or different sites to cover each topic. It would add some continuity to the series to use a single site over the 9 weeks, but after a brief inspection of the codebases mentioned above, I am having my doubts about finding a single representative site. We&amp;rsquo;ll have to see. Please leave your suggestions in the comments below. Thanks in advance!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=189539" width="1" height="1"&gt;</content><author><name>james.kovacs</name><uri>http://codebetter.com/members/james.kovacs/default.aspx</uri></author><category term=".NET" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/.NET/default.aspx" /></entry><entry><title>Confusion about PowerShell Script Signing</title><link rel="alternate" type="text/html" href="/blogs/james.kovacs/archive/2009/03/17/confusion-about-powershell-script-signing.aspx" /><id>/blogs/james.kovacs/archive/2009/03/17/confusion-about-powershell-script-signing.aspx</id><published>2009-03-17T18:56:06Z</published><updated>2009-03-17T18:56:06Z</updated><content type="html">&lt;p&gt;I’ve been having fun writing about my adventures in PowerShell. I would like to thank everyone for their encouragement and feedback. Something that I haven’t explicitly stated – which should go without saying as this is a blog – is that I am not a PowerShell expert. This is one man’s journey learning about PowerShell. I consider myself an expert on C#, .NET, and many other things, but as for PowerShell, I am a hacker. I learn enough to get the job done.&lt;/p&gt;  &lt;p&gt;Yes, I wrote &lt;a href="http://code.google.com/p/psake/"&gt;psake&lt;/a&gt;, which is a cool little PowerShell-based build tool, if I do say so myself. I wrote it in part to learn more about PowerShell and what was possible. (I surprised myself that I was able to write a task-based build system in a few hours with about 100 lines of PowerShell, ignoring comments.)&lt;/p&gt;  &lt;p&gt;If you’re looking for PowerShell gospel, I would recommend checking out the &lt;a href="http://blogs.msdn.com/powershell/default.aspx"&gt;Windows PowerShell Blog&lt;/a&gt; (the blog of Jeffrey Snover and the rest of the PowerShell team), &lt;a href="http://www.amazon.com/gp/product/1932394907?ie=UTF8&amp;amp;tag=jamkovweb-20&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=1932394907"&gt;&lt;em&gt;Windows PowerShell in Action&lt;/em&gt;&lt;/a&gt; by Bruce Payette, the PowerScripting Podcast, or any of the myriad PowerShell MVP blogs. They are the experts. I’m just a hacker having fun.&lt;/p&gt;  &lt;p&gt;With that disclaimer, I hope that by documenting my PowerShell learnings in public, I will help other developers learn PowerShell. I know that I am learning great things about PowerShell from my readers. In &lt;a href="http://www.jameskovacs.com/blog/GettingStartedWithPowerShellDeveloperEdition.aspx"&gt;Getting Started with PowerShell - Developer Edition&lt;/a&gt;, I lamented the lack of grep. My friend, &lt;a href="http://www.tavaresstudios.com/"&gt;Chris Tavares&lt;/a&gt; – known for his work on Unity and ASP.NET MVC - pointed out that Select-String can perform similar functions. Awesome! Then in &lt;a href="http://www.jameskovacs.com/blog/PowerShellProcessesAndPiping.aspx"&gt;PowerShell, Processes, and Piping&lt;/a&gt;, Jeffrey Snover himself pointed out that PowerShell supports KB, MB, and GB – with TB and PB in v2 – so that you can write:&lt;/p&gt;  &lt;p&gt;get-process | where { $_.PrivateMemorySize –gt 200MB }&lt;/p&gt;  &lt;p&gt;rather than having to translate 200MB into 200*1024*1024 as I originally did. Fantastic!&lt;/p&gt;  &lt;p&gt;In &lt;a href="http://www.jameskovacs.com/blog/WritingReusableScriptsWithPowerShell.aspx"&gt;Writing Re-usable Scripts with PowerShell&lt;/a&gt;, &lt;a href="http://wekempf.spaces.live.com/"&gt;wekempf&lt;/a&gt;, &lt;a href="http://www.pseale.com/blog/"&gt;Peter&lt;/a&gt;, and &lt;a href="http://www.josheinstein.com/"&gt;Josh&lt;/a&gt; discussed the merits of setting your execution policy to Unrestricted. I corrected the post to use RemoteSigned, which means that downloaded PowerShell scripts have to be unblocked before running, but local scripts can run without requiring signing/re-signing. Thanks, guys. I agree that RemoteSigned is a better option.&lt;/p&gt;  &lt;p&gt;Let’s talk security for a second. I am careful about security. I run as a normal user on Vista and have a separate admin account. When setting up &lt;a href="http://teamcity.codebetter.com"&gt;teamcity.codebetter.com&lt;/a&gt;, the build agent runs under a least privilege account, which is why we can’t run NCover on the build server yet. (NCover currently requires admin privs, though Gnoso is working on fixing that in short order.) (Imagine if we did run builds as an Administrator or Local System. Someone could write a unit test that added a new user with admin privs to the box, log in remotely and start installing bots, malware, and other evil.) So I tend to be careful about security.&lt;/p&gt;  &lt;p&gt;Now for my real question… What is the threat model for PowerShell that requires script signing? Maybe I’m being really dense here, but I don’t get it. Let’s say I want to do something really evil like formatting your hard drive. I create a PowerShell script with “format c:” in it, exploit a security vulnerability to drop it onto your box, and exploit another security vulnerability to launch PowerShell to execute the script. (Or I name it the same as a common script, but earlier in your search path, and wait for you to execute it.) But you’ve been anal-retentive about security and only allow signed scripts. So the script won’t execute. Damn! Foiled again! But wait! Let me just rename it from foo.ps1 to foo.cmd or foo.bat and execute it from cmd.exe. If I can execute code on your computer, there are easier ways for me to do bad things than writing PowerShell scripts. Given that we can’t require signing for *.cmd and *.bat files as this would horribly break legacy compatibility, what is the advantage of requiring PowerShell scripts to be signed by default? Dear readers, please enlighten me!&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;UPDATE:&lt;/strong&gt; &lt;a href="http://huddledmasses.org/"&gt;Joel “Jaykul” Bennett&lt;/a&gt; provided a good explanation in the comments. I would recommend reading:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://blogs.msdn.com/powershell/archive/2008/09/30/powershell-s-security-guiding-principles.aspx" href="http://blogs.msdn.com/powershell/archive/2008/09/30/powershell-s-security-guiding-principles.aspx"&gt;http://blogs.msdn.com/powershell/archive/2008/09/30/powershell-s-security-guiding-principles.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;as it exlains the PowerShell Team’s design decision. The intention wasn’t to force everyone to sign scripts, but to disable script execution for most users (as they won’t use PowerShell), but allow PowerShell users to opt into RemoteSigned or Unrestricted as they so choose. Script signing is meant for administrators to set group policy and use signed scripts for administration (as one example use case of script signing).&lt;/p&gt;  &lt;p&gt;Thanks again, Joel! That was faster than sifting through the myriad posts on script signing trying to find the reasoning behind it. Once again, the advantages of learning as a community!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=189416" width="1" height="1"&gt;</content><author><name>james.kovacs</name><uri>http://codebetter.com/members/james.kovacs/default.aspx</uri></author><category term="PowerShell" scheme="http://codebetter.com/blogs/james.kovacs/archive/tags/PowerShell/default.aspx" /></entry></feed>