<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>James Kovacs' Weblog</title>
  <link rel="alternate" type="text/html" href="http://www.jameskovacs.com/blog/" />
  <link rel="self" href="http://www.jameskovacs.com/blog/SyndicationService.asmx/GetAtom" />
  <icon>favicon.ico</icon>
  <updated>2010-02-23T22:43:45.9661619-07:00</updated>
  <author>
    <name>James Kovacs</name>
  </author>
  <subtitle />
  <id>http://www.jameskovacs.com/blog/</id>
  <generator uri="http://dasblog.info/" version="2.3.9074.18820">DasBlog</generator>
  <entry>
    <title>Prairie Developer Conference 2010</title>
    <link rel="alternate" type="text/html" href="http://www.jameskovacs.com/blog/PrairieDeveloperConference2010.aspx" />
    <id>http://www.jameskovacs.com/blog/PermaLink.aspx?guid=209539eb-5c41-48e0-ae0f-1bfd6cfcbfb2</id>
    <published>2010-03-01T15:00:00-07:00</published>
    <updated>2010-02-23T21:44:11.1892473-07:00</updated>
    <category term="Events" label="Events" scheme="http://www.jameskovacs.com/blog/CategoryView.aspx?category=Events" />
    <category term="Presentations" label="Presentations" scheme="http://www.jameskovacs.com/blog/CategoryView.aspx?category=Presentations" />
    <author>
      <name>James Kovacs</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://www.prairiedevcon.com" target="_blank">
            <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://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/PrairieDeveloperConference2010_11EC8/image%5B23%5D_a15b6198-88a2-4e00-b346-c457715cefd8.png" width="221" height="119" />
          </a>A
few months ago, my friend, <a href="http://geekswithblogs.net/dlussier/Default.aspx" target="_blank">D’Arcy
Lussier</a>, and I had the following conversation:
</p>
        <dl>
          <dt>
            <strong>D’Arcy:</strong>
            <dd>
Want to speak at a developer conference? <dt><strong>Me</strong>: 
<dd>
Sure. Sounds awesome! <dt><strong>D’Arcy</strong>: 
<dd>
It’ll be in Regina, Saskatchewan. <dt><strong>Me</strong>: 
<dd>
Sweet! <dt><strong>D’Arcy</strong>: 
<dd>
It’ll be in June. <dt><strong>Me</strong>: 
<dd>
Where do I sign up!?! 
</dd></dt></dd></dt></dd></dt></dd></dt></dd></dt></dd>
          </dt>
        </dl>
        <p>
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:
</p>
        <blockquote>
          <p>
"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!" 
<br />
-- D'Arcy Lussier, Prairie Developer Conference Chair
</p>
        </blockquote>
        <p>
The conference will take place June 2 &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.
</p>
        <h3>
          <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://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/PrairieDeveloperConference2010_11EC8/NHLogoSmall_5486f80a-e468-4478-8399-bf2029b373f3.gif" width="300" height="67" />NHibernate
Dojo
</h3>
        <p>
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. 
</p>
        <h3>
          <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://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/PrairieDeveloperConference2010_11EC8/image_aa005fe9-feeb-45b3-9645-3510967055be.png" width="215" height="53" />jQuery
Dojo
</h3>
        <p>
I should have called this session: <em>Dr. Weblove or How I Learned to Stop Worrying
and Love JavaScript</em>. 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.
</p>
        <p>
        </p>
        <p>
          <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://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/PrairieDeveloperConference2010_11EC8/image_5ac9650d-1c6f-41d2-bf9a-2badd90ae372.png" width="216" height="164" />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.
</p>
        <p>
        </p>
        <p>
          <a href="http://www.prairiedevcon.com/registration.aspx" target="_blank">Registration
is now open</a> at a price that won’t break your (or your employer’s) bank. Come check
it out.
</p>
        <img width="0" height="0" src="http://www.jameskovacs.com/blog/aggbug.ashx?id=209539eb-5c41-48e0-ae0f-1bfd6cfcbfb2" />
      </div>
    </content>
  </entry>
  <entry>
    <title>The Exec Problem</title>
    <link rel="alternate" type="text/html" href="http://www.jameskovacs.com/blog/TheExecProblem.aspx" />
    <id>http://www.jameskovacs.com/blog/PermaLink.aspx?guid=50162e32-c35e-4aaf-8429-755f359b16c0</id>
    <published>2010-02-25T15:00:00-07:00</published>
    <updated>2010-02-23T22:43:45.9661619-07:00</updated>
    <category term="PowerShell" label="PowerShell" scheme="http://www.jameskovacs.com/blog/CategoryView.aspx?category=PowerShell" />
    <author>
      <name>James Kovacs</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I must admit that I don’t much care for PowerShell's default behaviour with respect
to errors, which is to continue on error. It feels very VB6 “On Error Resume Next”-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
= ‘Stop’, 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.)
</p>
        <p>
Take the following simple script:
</p>
        <pre>'Starting script...'
$ErrorActionPreference = 'Stop'
ping -badoption
"Last Exit Code was: $LastExitCode"
rm nonexistent.txt
'Finished script'</pre>
        <p>
          <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://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/TheExecProblem_133DF/image_eb77e992-14de-41f9-b039-51a1cc609e12.png" width="696" height="456" />
        </p>
        <p>
Notice how execution continued after the ping command failed with an exit code of
one (1) even though we have $ErrorActionPreference set to ‘Stop’. Also notice that
the rm command, which is an alias for the PowerShell command, Remove-Item, did cause
execution to abort as expected and ‘Finished script’ 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’re calling – a PowerShell command
or an executable. The obvious solution is:
</p>
        <pre>'Starting script...'
$ErrorActionPreference = 'Stop'
ping -badoption
<strong><font color="#0000ff">if
($LastExitCode -ne 0) { throw 'An error has occured...' }</font></strong> rm nonexistent.txt
'Finished script'</pre>
        <p>
          <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://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/TheExecProblem_133DF/image_431eedb7-21c0-42ce-bedd-19eefe4025a9.png" width="696" height="456" />
        </p>
        <p>
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 <a href="http://code.google.com/p/psake/" target="_blank">psake</a> contributors
came up with this elegant helper function:
</p>
        <pre>function Exec([scriptblock]$cmd, [string]$errorMessage = "Error executing command: " + $cmd) { 
  &amp; $cmd 
  if ($LastExitCode -ne 0) {
    throw $errorMessage 
  } 
}</pre>
        <p>
Note the “&amp; $cmd” syntax. $cmd is a scriptblock and &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.)
</p>
        <pre>'Starting script...'
$ErrorActionPreference = 'Stop'
exec { ping -badoption }
rm nonexistent.txt
'Finished script'</pre>
        <p>
          <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://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/TheExecProblem_133DF/image_528109ea-24da-4bc4-af0b-89a890c10f95.png" width="696" height="456" />
        </p>
        <p>
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.
</p>
        <p>
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’t try to run unit tests if msbuild fails horribly. <img alt="smile_regular" src="http://spaces.live.com/rte/emoticons/smile_regular.gif" /></p>
        <p>
Happy Scripting!
</p>
        <img width="0" height="0" src="http://www.jameskovacs.com/blog/aggbug.ashx?id=50162e32-c35e-4aaf-8429-755f359b16c0" />
      </div>
    </content>
  </entry>
  <entry>
    <title>DevTeach Toronto 2010 Ultimate Edition</title>
    <link rel="alternate" type="text/html" href="http://www.jameskovacs.com/blog/DevTeachToronto2010UltimateEdition.aspx" />
    <id>http://www.jameskovacs.com/blog/PermaLink.aspx?guid=3f5ca82b-38be-4a51-b399-0711bae501c5</id>
    <published>2010-02-23T20:55:22.2125211-07:00</published>
    <updated>2010-02-23T20:55:22.2125211-07:00</updated>
    <category term=".NET General" label=".NET General" scheme="http://www.jameskovacs.com/blog/CategoryView.aspx?category=.NET+General" />
    <category term="Agile" label="Agile" scheme="http://www.jameskovacs.com/blog/CategoryView.aspx?category=Agile" />
    <category term="ASP.NET" label="ASP.NET" scheme="http://www.jameskovacs.com/blog/CategoryView.aspx?category=ASP.NET" />
    <category term="Courses" label="Courses" scheme="http://www.jameskovacs.com/blog/CategoryView.aspx?category=Courses" />
    <category term="Events" label="Events" scheme="http://www.jameskovacs.com/blog/CategoryView.aspx?category=Events" />
    <category term="Presentations" label="Presentations" scheme="http://www.jameskovacs.com/blog/CategoryView.aspx?category=Presentations" />
    <category term="Software Design" label="Software Design" scheme="http://www.jameskovacs.com/blog/CategoryView.aspx?category=Software+Design" />
    <author>
      <name>James Kovacs</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img style="border-right-width: 0px; margin: 0px 10px 10px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="DevTeach" border="0" alt="DevTeach" align="left" src="http://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/UpcomingSpeakingEngagements_11BDB/image_a8ef6494-2325-4707-b00a-46e86f3b4d8d.png" width="150" height="65" />
          <a href="http://www.devteach.com" target="_blank">DevTeach</a> is
heading back to Toronto in a few weeks (March 8-12, 2010)and you’ll get a bigger dose
of awesome than ever before. We’ve got a fantastic line-up of <a href="http://www.devteach.com/Speaker.aspx" target="_blank">top-notch,
internationally renowned speakers</a>. 6 tracks covering Agile, Web, Windows, Silverlight,
Architecture, and SharePoint. A metric ton of <a href="http://www.devteach.com/Session.aspx" target="_blank">sessions</a>.
(I’m both the Agile and Web Track Chairs and am really excited about the speakers
and sessions for each.)
</p>
        <p>
          <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="ee402630.VisualStudio_lg" border="0" alt="ee402630.VisualStudio_lg" align="right" src="http://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/UpcomingSpeakingEngagements_11BDB/ee402630.VisualStudio_lg_471af71f-11d9-43e0-ac8f-7df985a37248.png" width="55" height="55" />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!)
</p>
        <p>
          <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://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/UpcomingSpeakingEngagements_11BDB/image_c6cd6eb2-9123-4f63-826a-d1efbbe9f505.png" width="257" height="206" />And
if you can’t get enough of that <strike>Sugar Crisp</strike> James Kovacs,  I’ll
be there in full force with two sessions and a one-day post-con on agile development.
</p>
        <p>
        </p>
        <h3>Convention-over-Configuration in an Agile World
</h3>
        <p>
As developers, we spend an inordinate amount of time writing "glue code". 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'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. 
</p>
        <h3>Convention-over-Configuration in a Web World
</h3>
        <p>
As developers, we spend an inordinate amount of time writing "glue code". 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'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. 
</p>
        <h3>Agile Development with IoC and ORM (Post-Con)
</h3>
        <p>
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. 
</p>
        <p>
Hope to see you in Toronto! <img width="0" height="0" src="http://www.jameskovacs.com/blog/aggbug.ashx?id=3f5ca82b-38be-4a51-b399-0711bae501c5" /></p>
      </div>
    </content>
  </entry>
  <entry>
    <title>Releasing psake v1.00 &amp; psake v2.00</title>
    <link rel="alternate" type="text/html" href="http://www.jameskovacs.com/blog/ReleasingPsakeV100PsakeV200.aspx" />
    <id>http://www.jameskovacs.com/blog/PermaLink.aspx?guid=67421aa0-3548-4cf5-bf04-e0e80e4491e2</id>
    <published>2009-10-14T22:06:46.1734499-06:00</published>
    <updated>2009-10-14T22:06:46.1734499-06:00</updated>
    <category term=".NET Tools" label=".NET Tools" scheme="http://www.jameskovacs.com/blog/CategoryView.aspx?category=.NET+Tools" />
    <category term="PowerShell" label="PowerShell" scheme="http://www.jameskovacs.com/blog/CategoryView.aspx?category=PowerShell" />
    <author>
      <name>James Kovacs</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="image" border="0" alt="image" align="left" src="http://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/e08f92d1f8ab_129B9/image_17332e32-55b0-456d-9c98-702a78095f2e.png" width="128" height="55" />
        </p>
        <p>
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, <a href="http://ayende.com" target="_blank">Ayende</a>, has <a href="http://ayende.com/Blog/archive/2009/08/30/on-psake.aspx" target="_blank">a
great example</a> of converting Rhino Mocks build to use psake.
</p>
        <p>
          <a href="http://psake.googlecode.com/files/psake-v1.00.zip">http://psake.googlecode.com/files/psake-v1.00.zip</a>
        </p>
        <p>
We have released psake v2.01 (compatible with PowerShell 2.0). (This was formerly
called psake v0.24, "Jorge", and psake-ps2.) A big thanks to Jorge Matos for all his
work on psake v2.01.
</p>
        <p>
          <a href="http://psake.googlecode.com/files/psake-v2.01.zip">http://psake.googlecode.com/files/psake-v2.01.zip</a>
        </p>
        <p>
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:
</p>
        <p>
          <a href="http://github.com/JamesKovacs/psake">http://github.com/JamesKovacs/psake</a>
        </p>
        <p>
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.
</p>
        <p>
If you have some great idea, you can download the git repo from <a title="git://github.com/JamesKovacs/psake.git" href="git://github.com/JamesKovacs/psake.git">git://github.com/JamesKovacs/psake.git</a> or <a href="http://github.com/JamesKovacs/psake.git">http://github.com/JamesKovacs/psake.git</a>.
(msysgit is the Git package of choice for Windows. You can download it from <a title="http://code.google.com/p/msysgit/" href="http://code.google.com/p/msysgit/">http://code.google.com/p/msysgit/</a>.)
I would encourage you to read Jeremy Skinner’s <a href="http://mvccontrib.github.com/MvcContrib/" target="_blank">excellent
guide</a> for contributing to <a href="http://www.codeplex.com/MVCContrib" target="_blank">MvcContrib</a> via
GitHub. Just mentally replace “MvcContrib” with “psake”, though I’d encourage you
to contribute to MvcContrib too. :)
</p>
        <p>
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.
</p>
        <p>
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…
</p>
        <h4>What's New in psake v2.01? 
</h4>
        <h6>(from Jorge Matos)
</h6>
        <p>
The main difference is that psake v2.01 has been re-written as a module that contains
advanced functions.  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 "Modules"
folder in your profile directory (you may have to create it if it's not there) or
your machine-wide "Modules" directory: 
</p>
        <p>
i.e. Profile Directory: 
</p>
        <p>
C:\Users\Jorge\Documents\WindowsPowerShell\Modules\psake 
</p>
        <p>
i.e. Machine-wide Modules folder: 
</p>
        <p>
C:\Windows\System32\WindowsPowerShell\v1.0\Modules\psake 
</p>
        <p>
Once the psake folder is created and you've copied the psake.psm1 file into it - restart
PS and type "import-module psake" - PS will find the module and load it automatically. 
What I've done is add the "Import-Module psake" to my profile script so that it is
loaded everytime I startup PS. 
</p>
        <h5>Module Benefits: 
</h5>
        <ol>
          <li>
Build scripts don't need to know where psake is installed, they just call Invoke-psake
and it works. 
</li>
          <li>
Encapsulation… Global variables are no longer required since they can be private to
a module unless explicitly exported (I haven't gotten around to actually changing
the psake code to not use global variables yet). 
</li>
          <li>
Modules can be unloaded if needed which removes all the code and variables from memory.</li>
        </ol>
        <h5>Advanced Functions: 
</h5>
        <p>
The other big difference is that the "Invoke-psake" and "Task" 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.
</p>
        <h5>Minor changes: 
</h5>
        <ol>
          <li>
Coding style is different. 
</li>
          <li>
Try/Catch is used instead of the "Trap" statement. 
</li>
          <li>
Got rid of the "exec" function. 
</li>
          <li>
You can now define "Pre" and "Post" actions for a task. 
</li>
          <li>
You can define how the task name will be formatted. 
</li>
          <li>
You can define a "TaskSetup" function that will be executed before every task (took
that from NUnit). 
</li>
          <li>
You can define a "TaskTearDown" function that will be executed after every task (took
that from NUnit too). 
</li>
          <li>
Create a global variable called "psake_buildSucceeded" that will be set to true if
the build succeeds - scripts can check this. 
</li>
          <li>
Also added a "$noexit" 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). 
</li>
          <li>
The psake-buildTester.ps1 had to be changed slightly in order for it to call the Invoke-psake
function. 
</li>
          <li>
Added more examples in the .\examples folder for POST conditions, PRE and POST Actions,
etc.</li>
        </ol>
        <p>
Happy (build) scripting!
</p>
        <img width="0" height="0" src="http://www.jameskovacs.com/blog/aggbug.ashx?id=67421aa0-3548-4cf5-bf04-e0e80e4491e2" />
      </div>
    </content>
  </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="http://www.jameskovacs.com/blog/TIPHowToRunProgramsAsADomainUserFromANondomainComputer.aspx" />
    <id>http://www.jameskovacs.com/blog/PermaLink.aspx?guid=395869e2-efab-43df-b334-efcbb24a924b</id>
    <published>2009-10-11T20:06:30.6902746-06:00</published>
    <updated>2009-10-11T20:06:30.6902746-06:00</updated>
    <category term="Miscellaneous" label="Miscellaneous" scheme="http://www.jameskovacs.com/blog/CategoryView.aspx?category=Miscellaneous" />
    <author>
      <name>James Kovacs</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
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.
</p>
        <p>
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.
</p>
        <p>
net use \\server /user:domain\username /persistent:yes
</p>
        <p>
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.
</p>
        <p>
I’ve tried seemingly everything. NET USE doesn’t help here because NET USE is specifically
for network shares.
</p>
        <p>
net use \\sql-server-name /user:domain\username # DOES NOT WORK - Only provides the
domain credentials when accessing shares
</p>
        <p>
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.
</p>
        <p>
runas /user:domain\username “C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe”
</p>
        <p>
 <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/78bd8e997379_11797/image_e30f4280-3389-420f-b2c5-8e62a27f770a.png" width="1029" height="194" /></p>
        <p>
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.)
</p>
        <p>
runas <strong>/netonly</strong> /user:domain\username “C:\Program Files (x86)\Microsoft
SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe”
</p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
          <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/78bd8e997379_11797/image_a7c66c0a-6ed9-454d-969f-54fa2df2ed35.png" width="1029" height="194" />
        </p>
        <p>
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.
</p>
        <p>
          <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/78bd8e997379_11797/image_20f95292-2b68-4151-9369-b1e10d8d9924.png" width="673" height="561" />
        </p>
        <p>
          <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/78bd8e997379_11797/image_fed0b1b3-d8a4-4f2b-8598-4b38b2c45326.png" width="479" height="558" />
        </p>
        <p>
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.
</p>
        <img width="0" height="0" src="http://www.jameskovacs.com/blog/aggbug.ashx?id=395869e2-efab-43df-b334-efcbb24a924b" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Edmonton Code Camp Wrap-up: Doing More with Less</title>
    <link rel="alternate" type="text/html" href="http://www.jameskovacs.com/blog/EdmontonCodeCampWrapupDoingMoreWithLess.aspx" />
    <id>http://www.jameskovacs.com/blog/PermaLink.aspx?guid=9206ac28-2798-45fb-8c6c-a83d18d56359</id>
    <published>2009-09-20T19:27:23.3261574-06:00</published>
    <updated>2009-09-20T19:27:23.3261574-06:00</updated>
    <category term="Presentations" label="Presentations" scheme="http://www.jameskovacs.com/blog/CategoryView.aspx?category=Presentations" />
    <author>
      <name>James Kovacs</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="Darth Vader" border="0" alt="Darth Vader" align="right" src="http://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/EdmontonCodeCampWrapupDoingMorewithLess_110AA/image5_9ef1ec30-8969-4c10-b969-817339d5e4b0.png" width="240" height="193" />The <a href="http://edmontoncodecamp.com/" target="_blank">Edmonton
Code Camp</a> was a lot of fun. It was wonderful to catch up with friends – old and
new – over lunch and dinner. Thanks to <a href="http://www.haveyougotwoods.com/" target="_blank">Dave
Woods</a> for inviting me.
</p>
        <p>
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.
</p>
        <ul>
          <li>
            <a href="http://www.fluentnhibernate.org" target="_blank">Fluent NHibernate</a>
          </li>
          <li>
            <a href="http://nhforge.org" target="_blank">NHForge </a>
          </li>
          <li>
            <a href="http://www.codeplex.com/AutoMapper" target="_blank">AutoMapper </a>
          </li>
          <li>
            <a href="http://castleproject.org" target="_blank">Castle Windsor </a>
          </li>
          <li>
            <a href="http://asp.net/mvc" target="_blank">ASP.NET MVC</a>
          </li>
          <li>
            <a href="http://jquery.com" target="_blank">jQuery</a> &amp; <a href="http://jqueryui.com" target="_blank">jQuery
UI </a></li>
        </ul>
        <p>
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:
</p>
        <p>
          <a href="http://jameskovacs.com/downloads/DoingMoreWithLess.pptx" target="_blank">PPTX</a> | <a href="http://jameskovacs.com/downloads/DoingMoreWithLess-FakeVader.zip" target="_blank">Code</a></p>
        <img width="0" height="0" src="http://www.jameskovacs.com/blog/aggbug.ashx?id=9206ac28-2798-45fb-8c6c-a83d18d56359" />
      </div>
    </content>
  </entry>
  <entry>
    <title>PowerShell Tip: Providers</title>
    <link rel="alternate" type="text/html" href="http://www.jameskovacs.com/blog/PowerShellTipProviders.aspx" />
    <id>http://www.jameskovacs.com/blog/PermaLink.aspx?guid=35fe9649-1eff-4172-8ec0-438be45aaae6</id>
    <published>2009-09-14T22:47:44.044261-06:00</published>
    <updated>2009-09-14T22:47:44.044261-06:00</updated>
    <category term="PowerShell" label="PowerShell" scheme="http://www.jameskovacs.com/blog/CategoryView.aspx?category=PowerShell" />
    <author>
      <name>James Kovacs</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
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’t anything new as they’ve been there since v1. So I’m not the first
– nor will I be the last – to blog about them, but hopefully some folks starting out
with PowerShell find this useful…)
</p>
        <p>
We’ll start with a simple example using “ls” to list the contents of a directory:
</p>
        <p>
ls c:\
</p>
        <p>
Now “ls” is just a two-letter version of “dir” and both are aliases for “Get-ChildItem”.
How do I know that?
</p>
        <p>
ls alias:
</p>
        <p>
          <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/PowerShellProviders_C8DC/image_31b63a7e-e40b-4505-8af9-7f0e10fb08bc.png" width="781" height="379" />
        </p>
        <p>
This prints out all current aliases. That funky “alias:” is a PowerShell provider.
If you want a specific alias, you can “ls alias:ls” or “ls alias:dir”.
</p>
        <p>
          <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/PowerShellProviders_C8DC/image_6c78cab1-6aa6-4503-8114-8b6562aee871.png" width="733" height="295" />
        </p>
        <p>
To get a list of currently installed PowerShell providers, you can use <strong>Get-PSProvider</strong>:
</p>
        <p>
          <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/PowerShellProviders_C8DC/image_827bbdd5-a9b7-4400-9435-0e712a60e90f.png" width="781" height="283" />
        </p>
        <p>
You should notice a few interesting entries there. You want a list of environment
variables? The Environment provider does the trick:
</p>
        <p>
          <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/PowerShellProviders_C8DC/image_6be74221-d00d-4d7b-8737-2d5130bad4cc.png" width="1029" height="662" />
        </p>
        <p>
Note that providers aren’t read-only. Let’s say you want to temporarily add a directory
to your path. In cmd.exe, you would do the following:
</p>
        <p>
set PATH = %PATH%;&lt;EXTRA_DIR&gt;;
</p>
        <p>
In PowerShell, you use the Environment provider:
</p>
        <p>
$env:PATH += ";&lt;EXTRA_DIR&gt;";"
</p>
        <p>
Notice the env: prefix that tells PowerShell that the variable is handled by the Environment
provider. (Notice above that “Env” is listed as the “drive” for the Environment provider.)
</p>
        <p>
Let’s explore some more…
</p>
        <p>
 
</p>
        <p>
          <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/PowerShellProviders_C8DC/image_b4f1d0c9-ddb5-4521-bece-02ca951a09f6.png" width="1029" height="614" />
        </p>
        <p>
Notice that changing drive letters is actually handled by the Function provider and
are just commands.
</p>
        <p>
It gets more interesting with the Registry provider through which you can access HKEY_LOCAL_MACHINE
via hklm: and HKEY_CURRENT_USER via hkcu:.
</p>
        <p>
          <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/PowerShellProviders_C8DC/image_38a35500-6041-46af-8921-39f5927dce2c.png" width="573" height="331" />
        </p>
        <p>
You even get tab completion while typing. (Try ls hkcu:&lt;TAB&gt;&lt;TAB&gt;&lt;TAB&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!
</p>
        <p>
PowerShell providers aren’t limited to those shipped by Microsoft. You can in fact <a href="http://msdn.microsoft.com/en-us/library/ms714636(VS.85).aspx" target="_blank">write
your own</a>, though I’ve never tried it. People have written their own providers
for everything from SharePoint to Subversion.
</p>
        <p>
So go check out PowerShell providers. Happy Scripting!
</p>
        <img width="0" height="0" src="http://www.jameskovacs.com/blog/aggbug.ashx?id=35fe9649-1eff-4172-8ec0-438be45aaae6" />
      </div>
    </content>
  </entry>
  <entry>
    <title>.NET Rocks #475: James Kovacs on Convention-over-Configuration</title>
    <link rel="alternate" type="text/html" href="http://www.jameskovacs.com/blog/NETRocks475JamesKovacsOnConventionoverConfiguration.aspx" />
    <id>http://www.jameskovacs.com/blog/PermaLink.aspx?guid=71d94924-61c3-4251-ad7b-76a28d776241</id>
    <published>2009-08-25T21:14:02.8573366-06:00</published>
    <updated>2009-08-25T21:14:02.8573366-06:00</updated>
    <category term="Podcast" label="Podcast" scheme="http://www.jameskovacs.com/blog/CategoryView.aspx?category=Podcast" />
    <author>
      <name>James Kovacs</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title=".NET Rocks" border="0" alt=".NET Rocks" align="right" src="http://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/d7d.NETRocks475JamesKovacsonConventionov_1271F/image_be9dff48-d03a-4ed8-9d54-c185e35e4136.png" width="472" height="128" />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 <a href="http://www.dotnetrocks.com/default.aspx?showNum=475" target="_blank">.NET
Rocks #475</a> featuring yours truly!
</p>
        <img width="0" height="0" src="http://www.jameskovacs.com/blog/aggbug.ashx?id=71d94924-61c3-4251-ad7b-76a28d776241" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Wrap-up: Doing More with Less</title>
    <link rel="alternate" type="text/html" href="http://www.jameskovacs.com/blog/WrapupDoingMoreWithLess.aspx" />
    <id>http://www.jameskovacs.com/blog/PermaLink.aspx?guid=5e514e33-5a57-4224-bfc7-0c54243ee842</id>
    <published>2009-08-19T22:05:02.3255184-06:00</published>
    <updated>2009-08-19T22:05:02.3255184-06:00</updated>
    <category term="Presentations" label="Presentations" scheme="http://www.jameskovacs.com/blog/CategoryView.aspx?category=Presentations" />
    <author>
      <name>James Kovacs</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <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://www.jameskovacs.com/blog/content/binary/WindowsLiveWriter/WrapupDoingMorewithLess_12FA4/image_212f1b35-1552-4fc8-a41e-163d5c7a0419.png" width="240" height="193" /> Thanks
to everyone who came out to <a href="http://www.jameskovacs.com/blog/DoingMoreWithLessAcceleratingDevelopmentUsingConventionoverConfiguration.aspx" target="_blank">my
presentation</a> 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.
</p>
        <ul>
          <li>
            <a href="http://www.fluentnhibernate.org" target="_blank">Fluent NHibernate</a>
          </li>
          <li>
            <a href="http://nhforge.org" target="_blank">NHForge </a>
          </li>
          <li>
            <a href="http://www.codeplex.com/AutoMapper" target="_blank">AutoMapper </a>
          </li>
          <li>
            <a href="http://castleproject.org" target="_blank">Castle Windsor </a>
          </li>
          <li>
            <a href="http://asp.net/mvc" target="_blank">ASP.NET MVC</a>
          </li>
          <li>
            <a href="http://jquery.com" target="_blank">jQuery</a> &amp; <a href="http://jqueryui.com" target="_blank">jQuery
UI </a></li>
        </ul>
        <p>
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:
</p>
        <p>
          <a href="http://jameskovacs.com/downloads/DoingMoreWithLess.pptx" target="_blank">PPTX</a> | <a href="http://jameskovacs.com/downloads/DoingMoreWithLess-FakeVader.zip" target="_blank">Code</a></p>
        <img width="0" height="0" src="http://www.jameskovacs.com/blog/aggbug.ashx?id=5e514e33-5a57-4224-bfc7-0c54243ee842" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Doing More With Less: Accelerating Development Using Convention-over-Configuration</title>
    <link rel="alternate" type="text/html" href="http://www.jameskovacs.com/blog/DoingMoreWithLessAcceleratingDevelopmentUsingConventionoverConfiguration.aspx" />
    <id>http://www.jameskovacs.com/blog/PermaLink.aspx?guid=58105629-fc3c-487c-94a3-f5b745c856c7</id>
    <published>2009-08-13T03:49:25.528465-06:00</published>
    <updated>2009-08-13T03:49:25.528465-06:00</updated>
    <category term="Presentations" label="Presentations" scheme="http://www.jameskovacs.com/blog/CategoryView.aspx?category=Presentations" />
    <author>
      <name>James Kovacs</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
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. 
</p>
        <table>
          <tbody>
            <tr>
              <td>
Topic:</td>
              <td>
                <strong>Doing More With Less: Accelerating Development Using Convention-over-Configuration</strong>
              </td>
            </tr>
            <tr>
              <td>
Speaker:</td>
              <td>
James Kovacs</td>
            </tr>
            <tr>
              <td>
Date:</td>
              <td>
18-August-2009</td>
            </tr>
            <tr>
              <td>
Location:</td>
              <td>
Nexen Conference Center<br />
801-7th Ave. S.W., Calgary, AB. (Plus 15 level)<br /><a href="http://maps.google.com/maps?f=q&amp;hl=en&amp;geocode=&amp;time=&amp;date=&amp;ttype=&amp;q=801+7+Avenue+S.W.+Calgary+Alberta&amp;sll=51.04507,-114.06319&amp;sspn=0.299599,0.914612&amp;ie=UTF8&amp;om=1&amp;ll=51.046628,-114.077826&amp;spn=0.009362,0.028582&amp;z=16&amp;iwloc=addr">Map</a></td>
            </tr>
            <tr>
              <td>
Registration:</td>
              <td>
5:00 pm - 5:30 pm</td>
            </tr>
            <tr>
              <td>
Presentation:</td>
              <td>
5:30 pm - ???</td>
            </tr>
          </tbody>
        </table>
        <h3>Abstract
</h3>
        <p>
As developers, we spend an inordinate amount of time writing "glue code". 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'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.
</p>
        <img width="0" height="0" src="http://www.jameskovacs.com/blog/aggbug.ashx?id=58105629-fc3c-487c-94a3-f5b745c856c7" />
      </div>
    </content>
  </entry>
</feed>