<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Brian Hartsock's Blog</title>
	
	<link>http://blog.brianhartsock.com</link>
	<description>The exciting life of a software developer and nerd</description>
	<lastBuildDate>Thu, 29 Jul 2010 02:40:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/BrianHartsocksBlog" /><feedburner:info uri="brianhartsocksblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>nu – Gems for .NET</title>
		<link>http://feedproxy.google.com/~r/BrianHartsocksBlog/~3/5vIKjdP57oQ/</link>
		<comments>http://blog.brianhartsock.com/2010/07/28/nu-gems-for-net/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 02:40:27 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[nu]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/?p=1492</guid>
		<description><![CDATA[Package management has been on my mind for months as one of the greatest short comings in .NET. If you spend two hours using Ruby and gems, you realize how much easier it is than finding the appropriate .NET assemblies to use. It also promotes using open source libraries, instead of re-inventing the wheel. nu [...]]]></description>
			<content:encoded><![CDATA[<p>Package management has been on my mind for months as one of the greatest short comings in .NET.  If you spend two hours using Ruby and gems, you realize how much easier it is than finding the appropriate .NET assemblies to use.  It also promotes using open source libraries, instead of re-inventing the wheel.</p>
<p><a href="http://codebetter.com/blogs/dru.sellers/archive/2010/07/17/nu.aspx">nu</a> aims to provide this for .NET.</p>
<p>I checked it out tonight.  Here is my experience.</p>
<p>First step is to install it, and ruby is the only pre-req.  The following commands show how to install and use it.</p>
<pre>
> gem install nu
> mkdir test
> cd test
> nu install nunit
> nu install nhibernate
</pre>
<p>Wow, that was easy.  <em>nu</em> downloaded nhibernate and nunit, and placed them in the lib folder (including all of NHibernate&#8217;s dependencies).  By the way, it literally took less than <strong>30s</strong> for me to do this.</p>
<p><a href="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-28-2010-10-18-47-PM.png"><img src="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-28-2010-10-18-47-PM-300x213.png" alt="" title="7-28-2010 10-18-47 PM" width="300" height="213" class="aligncenter size-medium wp-image-1495" /></a></p>
<p>So what do I think?</p>
<ul>
<li>It is an easy and fast delivery tool.</li>
<li>Using Ruby isn&#8217;t that big of a deal, but I think that is my opinion, not the community opinion.</li>
<li>It is new, so it has a ways to go in terms of functionality in discovery.  I can&#8217;t hate because at least they have released something and I have just dreamed about releasing something.</li>
<li>Build integration (and probably Visual Studio) is going to be key.  And by build, I don&#8217;t just mean NAnt and <a href="http://code.google.com/p/uppercut/">UppercuT</a>, but MSbuild too.</li>
<li>The biggest hurdle is building a &#8220;gem&#8221; community in .NET.  For some reason, <a href="http://devlicio.us/blogs/rob_reynolds/archive/2010/07/16/how-to-gems-and-net.aspx">creating a .NET gem</a> seems kind of awkward (even though it isn&#8217;t that hard).</li>
</ul>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+nu+%E2%80%93+Gems+for+.NET+http://bit.ly/cNjTAI" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2010/07/28/nu-gems-for-net/&amp;title=nu+%E2%80%93+Gems+for+.NET" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2010/07/28/nu-gems-for-net/&amp;t=nu+%E2%80%93+Gems+for+.NET" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2010/07/28/nu-gems-for-net/&amp;title=nu+%E2%80%93+Gems+for+.NET" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p><img src="http://feeds.feedburner.com/~r/BrianHartsocksBlog/~4/5vIKjdP57oQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2010/07/28/nu-gems-for-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.brianhartsock.com/2010/07/28/nu-gems-for-net/</feedburner:origLink></item>
		<item>
		<title>Data driving Ruby tests with meta-programming</title>
		<link>http://feedproxy.google.com/~r/BrianHartsocksBlog/~3/FApAqx_dbYI/</link>
		<comments>http://blog.brianhartsock.com/2010/07/17/data-driving-ruby-tests-with-meta-programming/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 17:51:05 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Meta-programming]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/?p=1484</guid>
		<description><![CDATA[Data driving ruby tests with meta-programming is one of the more elegant examples of meta-programming in my opinion. Understanding that class definitions are active, and you can add methods in a loop is very powerful. class LocationTest &#60; ActiveSupport::TestCase &#160; def setup @location = Location.new end &#160; &#123;:empty =&#62; '', :nil =&#62; nil&#125;.each do &#124;key, [...]]]></description>
			<content:encoded><![CDATA[<p>Data driving ruby tests with meta-programming is one of the more elegant examples of meta-programming in my opinion.  Understanding that class definitions are active, and you can add methods in a loop is very powerful.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> LocationTest <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#6666ff; font-weight:bold;">ActiveSupport::TestCase</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> setup
    <span style="color:#0066ff; font-weight:bold;">@location</span> = Location.<span style="color:#9900CC;">new</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#006600; font-weight:bold;">&#123;</span>:empty <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">''</span>, <span style="color:#ff3333; font-weight:bold;">:nil</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#0000FF; font-weight:bold;">nil</span><span style="color:#006600; font-weight:bold;">&#125;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>key, value<span style="color:#006600; font-weight:bold;">|</span>
    test <span style="color:#996600;">&quot;address can't be &quot;</span> <span style="color:#006600; font-weight:bold;">+</span> key  <span style="color:#9966CC; font-weight:bold;">do</span>
      <span style="color:#0066ff; font-weight:bold;">@location</span>.<span style="color:#9900CC;">address</span> = value
&nbsp;
      assert !@location.<span style="color:#9900CC;">valid</span>?
    <span style="color:#9966CC; font-weight:bold;">end</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>NUnit has the <a href="http://nunit.com/index.php?p=testCase&#038;r=2.5.5">ability to do the same thing</a>, but attributes and reflection just aren&#8217;t as elegant.</p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+Data+driving+Ruby+tests+with+meta-programming+http://bit.ly/drdTVa" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2010/07/17/data-driving-ruby-tests-with-meta-programming/&amp;title=Data+driving+Ruby+tests+with+meta-programming" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2010/07/17/data-driving-ruby-tests-with-meta-programming/&amp;t=Data+driving+Ruby+tests+with+meta-programming" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2010/07/17/data-driving-ruby-tests-with-meta-programming/&amp;title=Data+driving+Ruby+tests+with+meta-programming" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p><img src="http://feeds.feedburner.com/~r/BrianHartsocksBlog/~4/FApAqx_dbYI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2010/07/17/data-driving-ruby-tests-with-meta-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.brianhartsock.com/2010/07/17/data-driving-ruby-tests-with-meta-programming/</feedburner:origLink></item>
		<item>
		<title>A MSBuild convention proposal – Targets per assembly</title>
		<link>http://feedproxy.google.com/~r/BrianHartsocksBlog/~3/wormhaXGNpU/</link>
		<comments>http://blog.brianhartsock.com/2010/07/14/a-msbuild-convention-proposal/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 15:10:40 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MSBuild]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/?p=1471</guid>
		<description><![CDATA[MSBuild is a very powerful build tool. Unfortunately, in my experience, I have seen it utilized very little. Instead, developers rely entirely on Visual Studio for the build, which is a mistake. I think there are a couple reasons for this: Modifying the build feels like you are mucking in the internals of Visual Studio [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://msdn.microsoft.com/en-us/library/wea2sca5(VS.90).aspx">MSBuild</a> is a very powerful build tool.  Unfortunately, in my experience, I have seen it utilized very little.  Instead, developers rely entirely on Visual Studio for the build, which is a mistake.  I think there are a couple reasons for this:</p>
<ul>
<li>Modifying the build feels like you are mucking in the internals of Visual Studio</li>
<li>There is no convention based approaches for how to handle custom bulid targets</li>
</ul>
<p>Now, you could go the way of <a href="http://nant.sourceforge.net/">NAnt</a>, and have complete independence from Visual Studio.  I think this is a mistake as well.  Visual Studio, while being a royal pain much of the time, is still a very very very powerful tool.  I believe we should embrace it, while using MSBuild plus conventions to achieve ultimate flexibility.</p>
<h4>The proposal</h4>
<p>It&#8217;s actually quite simple.  Each assembly/project already has its own <em>*.csproj</em> file, which is in essence a partial MSBuild file.  The problem is <a href="http://blog.brianhartsock.com/2009/10/20/editing-csproj-files-within-visual-studio/">editing it</a> is weird and scary at times, because it is auto-generated by Visual Studio.</p>
<p>Just add the following to any or all your <em>csproj</em> files.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
  ... All the visual studio muck ...
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Import</span> <span style="color: #000066;">Project</span>=<span style="color: #ff0000;">&quot;$(MSBuildProjectName).targets&quot;</span> <span style="color: #000066;">Condition</span>=<span style="color: #ff0000;">&quot;Exists('$(MSBuildProjectName).targets')&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Then add a file with that name.  If your projects name is <em>Reference.Web</em>, then add a file named <em>Reference.Web.targets</em> and include it in the project.  The content could contain something like the following.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Project</span> <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://schemas.microsoft.com/developer/msbuild/2003&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ItemGroup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Files</span> <span style="color: #000066;">Include</span>=<span style="color: #ff0000;">&quot;$(SolutionDir)\configuration\$(Configuration)\$(AssemblyName).*.config&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Files</span> <span style="color: #000066;">Include</span>=<span style="color: #ff0000;">&quot;$(SolutionDir)\configuration\$(Configuration)\Common.*&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ItemGroup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Target</span> <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;InstallConfiguration&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>    
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Copy</span> <span style="color: #000066;">SourceFiles</span>=<span style="color: #ff0000;">&quot;@(Files)&quot;</span> <span style="color: #000066;">DestinationFolder</span>=<span style="color: #ff0000;">&quot;$(OutputPath)&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
  <span style="color: #808080; font-style: italic;">&lt;!-- Override the AfterBuild target --&gt;</span>
  <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Target</span> <span style="color: #000066;">Name</span>=<span style="color: #ff0000;">&quot;AfterBuild&quot;</span> <span style="color: #000066;">DependsOnTargets</span>=<span style="color: #ff0000;">&quot;InstallConfiguration&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Project<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Now you have a build file separate from the project that is really easy setup and use, straight for Visual Studio.<br />
<a href="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-13-2010-9-26-28-PM.png"><img src="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-13-2010-9-26-28-PM-300x182.png" alt="" title="7-13-2010 9-26-28 PM" width="300" height="182" class="aligncenter size-medium wp-image-1478" /></a></p>
<p>The only gotcha is <strong>Visual Studio won&#8217;t automatically notice the build file changes</strong>, so you still have to relad the assembly after you make a build file change.</p>
<h4><strong>UPDATE &#8211; More robust <em>Import</em> statement</strong></h4>
<p>Via <a href="http://twitter.com/sayedihashimi">@sayedihashimi</a></p>
<blockquote><p>
Even better would be a conditional import, and you should use the MSBuildProjectName property instead of AssemblyName.</p></blockquote>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+A+MSBuild+convention+proposal+%E2%80%93+Targets+per+assembly+http://bit.ly/cn7i34" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2010/07/14/a-msbuild-convention-proposal/&amp;title=A+MSBuild+convention+proposal+%E2%80%93+Targets+per+assembly" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2010/07/14/a-msbuild-convention-proposal/&amp;t=A+MSBuild+convention+proposal+%E2%80%93+Targets+per+assembly" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2010/07/14/a-msbuild-convention-proposal/&amp;title=A+MSBuild+convention+proposal+%E2%80%93+Targets+per+assembly" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p><img src="http://feeds.feedburner.com/~r/BrianHartsocksBlog/~4/wormhaXGNpU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2010/07/14/a-msbuild-convention-proposal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.brianhartsock.com/2010/07/14/a-msbuild-convention-proposal/</feedburner:origLink></item>
		<item>
		<title>Zero to Synergy+ in 5 minutes</title>
		<link>http://feedproxy.google.com/~r/BrianHartsocksBlog/~3/lVhInxanln4/</link>
		<comments>http://blog.brianhartsock.com/2010/07/13/zero-to-synergy-in-5-minutes/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 16:10:22 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Synergy]]></category>
		<category><![CDATA[Tip]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/?p=1443</guid>
		<description><![CDATA[Synergy+ is most easily described as a software KVM. In reality, it is much more than that. It is more like having multiple monitors, except each monitor is actually attached to its own computer. Synergy+ is a fork of the original project, which hasn&#8217;t been updated since 2006. Enough with the chit-chat, lets get it [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.google.com/p/synergy-plus/">Synergy+</a> is most easily described as a software KVM.  In reality, it is much more than that.  It is more like having multiple monitors, except each monitor is actually attached to its own computer.  Synergy+ is a fork of the <a href="http://synergy2.sourceforge.net/">original project</a>, which hasn&#8217;t been updated since 2006.  </p>
<p>Enough with the chit-chat, lets get it up and running on Windows in no time.</p>
<h4>Install</h4>
<p><a href="http://code.google.com/p/synergy-plus/downloads/list">Install</a> &#8211; Done.</p>
<h4>Configure &#8211; Server side</h4>
<p>This is the confusing part.  I will take you through the GUI, which doesn&#8217;t exist for the Mac or Linux as far as I could tell.</p>
<p>Start Synergy and select the <em>Share this computer&#8217;s keyboard and mouse (server)</em> option.  Then click <em>Configure</em>.<br />
<a href="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-12-2010-8-39-45-PM.png"><img src="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-12-2010-8-39-45-PM-300x231.png" alt="" title="7-12-2010 8-39-45 PM" width="300" height="231" class="aligncenter size-medium wp-image-1444" /></a></p>
<p>From there, the next step is adding the screens, which represent the different computers you want connected.  Click the <em>+</em> to get going.<br />
<a href="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-12-2010-9-00-20-PM.png"><img src="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-12-2010-9-00-20-PM-300x207.png" alt="" title="7-12-2010 9-00-20 PM" width="300" height="207" class="aligncenter size-medium wp-image-1451" /></a></p>
<p>First, enter your local computer information.  Seems weird that it didn&#8217;t add it by default, but it doesn&#8217;t.  Basically, all you need to enter is your computers name (which can be found/changed on the Synergy <em>Info</em> button on the main configuration screen).<br />
<a href="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-12-2010-8-40-34-PM.png"><img src="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-12-2010-8-40-34-PM-203x300.png" alt="" title="7-12-2010 8-40-34 PM" width="203" height="300" class="aligncenter size-medium wp-image-1445" /></a></p>
<p>Next, enter in the client computer&#8217;s names that you will be connecting.<br />
<a href="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-12-2010-8-40-53-PM.png"><img src="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-12-2010-8-40-53-PM-203x300.png" alt="" title="7-12-2010 8-40-53 PM" width="203" height="300" class="aligncenter size-medium wp-image-1446" /></a></p>
<p>From there you need to create links.  Links tell Synergy how one screen should be linked to another (seems obvious huh).  In our example we have two screens, so we need two links.  One link will connect Screen 1 to Screen 2, while the other does the reverse.</p>
<p>Configuring the link is a mind trip, so much so that I can&#8217;t even describe how to do it.  I suggest ignoring the size percentages, and create a sentence like <em>left of Screen 1 of Screen 2</em>.  Then click <em>+</em>.  After this, it becomes more obvious what you did (just trust me please).<br />
<a href="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-12-2010-8-42-11-PM.png"><img src="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-12-2010-8-42-11-PM-300x209.png" alt="" title="7-12-2010 8-42-11 PM" width="300" height="209" class="aligncenter size-medium wp-image-1447" /></a></p>
<p>Then the reverse.<br />
<a href="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-12-2010-8-42-52-PM.png"><img src="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-12-2010-8-42-52-PM-300x209.png" alt="" title="7-12-2010 8-42-52 PM" width="300" height="209" class="aligncenter size-medium wp-image-1448" /></a></p>
<p>Now just <em>Start</em> the server and your server config is basically done.<br />
<a href="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-12-2010-8-43-51-PM.png"><img src="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-12-2010-8-43-51-PM-300x231.png" alt="" title="7-12-2010 8-43-51 PM" width="300" height="231" class="aligncenter size-medium wp-image-1449" /></a></p>
<h4>Configure &#8211; Client</h4>
<p>The client really doesn&#8217;t require any configuration.  Just select the <em>Use another computer&#8217;s keyboard and mouse (client)</em> option, then enter the server name and click <em>Start</em><br />
<a href="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-12-2010-8-45-18-PM.png"><img src="http://blog.brianhartsock.com/wp-content/uploads/2010/07/7-12-2010-8-45-18-PM-300x231.png" alt="" title="7-12-2010 8-45-18 PM" width="300" height="231" class="aligncenter size-medium wp-image-1450" /></a></p>
<p>And now for my super sweet home-made video.</p>
<p><object width="400" height="300"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=13286527&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=13286527&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"></embed></object></p>
<h4>Next Steps</h4>
<p>Read through the <a href="http://code.google.com/p/synergy-plus/w/list">Synergy wiki</a>, which will help you on more complicated setups on Mac and Linux.</p>
<p>I also noticed a couple things that didn&#8217;t work too well.</p>
<ul>
<li>Mouse is sometimes laggy &#8211; I think this may be because my server is actually my oldest computer.  The lagginess isn&#8217;t bad enough for me to not use it however.</li>
<li><em>Print Screen</em> didn&#8217;t work too well, which made the capturing of the above screen shots a little cumbersome</li>
<li>If your computer locks automatically after a certain time and it isn&#8217;t the server, synergy can&#8217;t be used to unlock it.</li>
</ul>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+Zero+to+Synergy%2B+in+5+minutes+http://bit.ly/bOONGz" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2010/07/13/zero-to-synergy-in-5-minutes/&amp;title=Zero+to+Synergy%2B+in+5+minutes" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2010/07/13/zero-to-synergy-in-5-minutes/&amp;t=Zero+to+Synergy%2B+in+5+minutes" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2010/07/13/zero-to-synergy-in-5-minutes/&amp;title=Zero+to+Synergy%2B+in+5+minutes" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p><img src="http://feeds.feedburner.com/~r/BrianHartsocksBlog/~4/lVhInxanln4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2010/07/13/zero-to-synergy-in-5-minutes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.brianhartsock.com/2010/07/13/zero-to-synergy-in-5-minutes/</feedburner:origLink></item>
		<item>
		<title>My Home Mac Setup</title>
		<link>http://feedproxy.google.com/~r/BrianHartsocksBlog/~3/32tydpFC1zg/</link>
		<comments>http://blog.brianhartsock.com/2010/06/30/my-home-mac-setup/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 17:00:22 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/?p=1434</guid>
		<description><![CDATA[Ok, here is a list of software I have installed. It is a pretty good list for only a few days with the machine. Note this is for home, not for work. Otherwise the list would be way different. Eclipse &#8211; Android and Java tinkering Firefox &#8211; To test, not to use. Chrome &#8211; Best [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, here is a list of software I have installed.  It is a pretty good list for only a few days with the machine.  Note this is for home, not for work.  Otherwise the list would be way different.</p>
<ul>
<li><a href="http://www.eclipse.org/">Eclipse</a> &#8211; Android and Java tinkering</li>
<li><a href="http://www.mozilla.com/en-US/firefox/firefox.html">Firefox</a> &#8211; To test, not to use.</li>
<li><a href="http://www.google.com/chrome">Chrome</a> &#8211; Best browser out there, I promise!</li>
<li><a href="http://www.jungledisk.com/">JungleDisk Desktop</a> &#8211; Backups and synchronization are a must for any computer.</li>
<li><a href="http://www.skype.com/intl/en-us/home">Skype</a> &#8211; To see people far away in real time.</li>
<li><a href="http://adium.im/">Adium</a> &#8211; To chat to people far away or across the room, while also being able to ignore them.</li>
<li><a href="http://cord.sourceforge.net/">CoRD</a> &#8211; I still need to get on Windows boxes.</li>
<li><a href="http://www.macupdate.com/info.php/id/14831/quicksilver">Quicksilver</a> &#8211; App launchers are my hidden productivity tools.</li>
<li><a href="http://growl.info/">Growl</a> &#8211; Makes Adium have cool sounds I guess.</li>
<li><a href="http://macromates.com/">TextMate</a> &#8211; The most recommended Mac editor.  Not sold yet, vim is the bomb.</li>
<li><a href="http://www.openoffice.org/">Open Office</a> &#8211; Because it is free, and good enough (maybe?)</li>
<li><a href="http://www.atebits.com/tweetie-mac/">Tweetie</a> &#8211; My new favorite twitter client.  Warning, not for twitteraholics, but for casual users like myself.</li>
<li><a href="http://code.google.com/p/git-osx-installer/downloads/list?can=3">Git</a> &#8211; Git is a MUST if you develop software.  Even if your team uses SVN, you can <a href="http://www.lostechies.com/blogs/derickbailey/archive/2010/02/03/branch-per-feature-how-i-manage-subversion-with-git-branches.aspx">still use gi</a>t and should!</li>
<li><a href="http://www.mysql.com/">MySQL</a> &#8211; You always need a database on hand.</li>
<li><a href="http://rvm.beginrescueend.com/">RVM</a> &#8211; Nifty way to manage multiple Ruby versions.</li>
<li><a href="http://www.virtualbox.org/">Virtual Box</a> &#8211; Because you still might need to run a little Windows stuff here and there.</li>
<li><a href="http://cyberduck.ch/">CyberDuck</a> &#8211; Move files all over the place.</li>
<li>Windows 7 on Bootcamp &#8211; Just in case <img src='http://blog.brianhartsock.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
</ul>
<p>Whew!</p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+My+Home+Mac+Setup+http://bit.ly/dfZ0Lt" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2010/06/30/my-home-mac-setup/&amp;title=My+Home+Mac+Setup" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2010/06/30/my-home-mac-setup/&amp;t=My+Home+Mac+Setup" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2010/06/30/my-home-mac-setup/&amp;title=My+Home+Mac+Setup" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p><img src="http://feeds.feedburner.com/~r/BrianHartsocksBlog/~4/32tydpFC1zg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2010/06/30/my-home-mac-setup/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://blog.brianhartsock.com/2010/06/30/my-home-mac-setup/</feedburner:origLink></item>
		<item>
		<title>I’m a Mac user</title>
		<link>http://feedproxy.google.com/~r/BrianHartsocksBlog/~3/UdEt8RvDjG0/</link>
		<comments>http://blog.brianhartsock.com/2010/06/28/i-am-a-mac-user/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 01:43:57 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/?p=1419</guid>
		<description><![CDATA[I have officially switched my personal computer to a Mac (MacBook Pro to be specific). I&#8217;m sure some of you might be wondering, why did I switch to a Mac? Most of my blog is on .NET and Powershell related topics, which aren&#8217;t so prevalent on a Mac. Well, here are a few of the [...]]]></description>
			<content:encoded><![CDATA[<p>I have officially switched my personal computer to a Mac (MacBook Pro to be specific).  I&#8217;m sure some of you might be wondering, why did I switch to a Mac?  Most of my blog is on .NET and Powershell related topics, which aren&#8217;t so prevalent on a Mac.  Well, here are a few of the main reasons.</p>
<ul>
<li>Promoters &#8211; Mac <a href="http://twitter.com/marcrhodes/status/15288214018">owners</a> <a href="http://twitter.com/carlajo/status/15288235473">are</a> <a href="http://twitter.com/mattz62/status/15301958443">promoters</a>.  When I <a href="http://twitter.com/brianhartsock/status/15285724266">asked the Twitterverse</a> what I should do, all but one response was &#8220;Get a Mac!&#8221;.  Maybe I am hopping on the bandwagon, but people love Macs for a reason.</li>
<li>I missed my Linux roots.  If you go back far enough in my blog, you will see I used to be a PHP developer whose work, home, and school computers were running Ubuntu.</li>
<li>Windows &#8211; I can still run Windows on a VM and on Bootcamp.</li>
</ul>
<p>So far, I am pretty darn happy with the Mac.  There are some oddities, but overall it is a crisp, clean machine.</p>
<p>Now, enjoy the beauty that is my mac! (Ignore the Logitech nano dongle.  I need my ergonomic mouse so give me a break)</p>
<p><a href="http://blog.brianhartsock.com/wp-content/uploads/2010/06/DSC00662-800x600.jpg"><img src="http://blog.brianhartsock.com/wp-content/uploads/2010/06/DSC00662-800x600-300x225.jpg" alt="" title="DSC00662 (800x600)" width="300" height="225" class="aligncenter size-medium wp-image-1424" /></a></p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+I%E2%80%99m+a+Mac+user+http://bit.ly/bj6TdE" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2010/06/28/i-am-a-mac-user/&amp;title=I%E2%80%99m+a+Mac+user" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2010/06/28/i-am-a-mac-user/&amp;t=I%E2%80%99m+a+Mac+user" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2010/06/28/i-am-a-mac-user/&amp;title=I%E2%80%99m+a+Mac+user" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p><img src="http://feeds.feedburner.com/~r/BrianHartsocksBlog/~4/UdEt8RvDjG0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2010/06/28/i-am-a-mac-user/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.brianhartsock.com/2010/06/28/i-am-a-mac-user/</feedburner:origLink></item>
		<item>
		<title>Ruby video for non-ruby programmers</title>
		<link>http://feedproxy.google.com/~r/BrianHartsocksBlog/~3/C5yysv6GXd8/</link>
		<comments>http://blog.brianhartsock.com/2010/05/28/ruby-video-for-non-ruby-programmers/#comments</comments>
		<pubDate>Fri, 28 May 2010 17:43:29 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/?p=1387</guid>
		<description><![CDATA[This video is a must watch for experienced developers trying to learn Ruby. It will explain the magic of metaprogramming.]]></description>
			<content:encoded><![CDATA[<p>This <a href="http://www.infoq.com/presentations/metaprogramming-ruby">video </a>is a <strong>must</strong> watch for experienced developers trying to learn Ruby.  It will explain the magic of metaprogramming.</p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+Ruby+video+for+non-ruby+programmers+http://bit.ly/ch69gk" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2010/05/28/ruby-video-for-non-ruby-programmers/&amp;title=Ruby+video+for+non-ruby+programmers" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2010/05/28/ruby-video-for-non-ruby-programmers/&amp;t=Ruby+video+for+non-ruby+programmers" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2010/05/28/ruby-video-for-non-ruby-programmers/&amp;title=Ruby+video+for+non-ruby+programmers" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p><img src="http://feeds.feedburner.com/~r/BrianHartsocksBlog/~4/C5yysv6GXd8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2010/05/28/ruby-video-for-non-ruby-programmers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.brianhartsock.com/2010/05/28/ruby-video-for-non-ruby-programmers/</feedburner:origLink></item>
		<item>
		<title>Transitioning from svn to git</title>
		<link>http://feedproxy.google.com/~r/BrianHartsocksBlog/~3/3W4CMoL01b8/</link>
		<comments>http://blog.brianhartsock.com/2010/05/28/transitioning-from-svn-to-git/#comments</comments>
		<pubDate>Fri, 28 May 2010 12:59:22 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/?p=1389</guid>
		<description><![CDATA[Great post on git commands and their subversion equivalent. Very concise compared to most articles. (Sorry for all the links, but I have been catching up on Google Reader and finding some real gems)]]></description>
			<content:encoded><![CDATA[<p>Great <a href="http://yehudakatz.com/2010/05/13/common-git-workflows/">post </a>on git commands and their subversion equivalent.  Very concise compared to most articles.</p>
<p>(Sorry for all the links, but I have been catching up on Google Reader and finding some real gems)</p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+Transitioning+from+svn+to+git+http://bit.ly/cgie5u" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2010/05/28/transitioning-from-svn-to-git/&amp;title=Transitioning+from+svn+to+git" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2010/05/28/transitioning-from-svn-to-git/&amp;t=Transitioning+from+svn+to+git" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2010/05/28/transitioning-from-svn-to-git/&amp;title=Transitioning+from+svn+to+git" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p><img src="http://feeds.feedburner.com/~r/BrianHartsocksBlog/~4/3W4CMoL01b8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2010/05/28/transitioning-from-svn-to-git/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://blog.brianhartsock.com/2010/05/28/transitioning-from-svn-to-git/</feedburner:origLink></item>
		<item>
		<title>A better Start-Job cmdlet</title>
		<link>http://feedproxy.google.com/~r/BrianHartsocksBlog/~3/B1ZRu4iqNNg/</link>
		<comments>http://blog.brianhartsock.com/2010/05/22/a-better-start-job-cmdlet/#comments</comments>
		<pubDate>Sat, 22 May 2010 19:22:55 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/?p=1347</guid>
		<description><![CDATA[With Powershell 2, the Start-Job command was added, which allows statements to be executed in the background. There are a few oddities regarding script blocks that need to be understood first though. Powershell doesn&#8217;t support closures The current working directory isn&#8217;t preserved I confronted these issues first hand today while working with a Rails app. [...]]]></description>
			<content:encoded><![CDATA[<p>With Powershell 2, the <em><a href="http://technet.microsoft.com/en-us/library/dd347692.aspx">Start-Job</a></em> command was added, which allows statements to be executed in the background.  There are a few oddities regarding script blocks that need to be understood first though.</p>
<ul>
<li>Powershell doesn&#8217;t support closures</li>
<li>The current working directory isn&#8217;t preserved</li>
</ul>
<p>I confronted these issues first hand today while working with a Rails app.  I wanted to execute <em>ruby script\server</em> in a job, but it wasn&#8217;t working.</p>
<pre>
PS C:\Users\Brian\workspace\myapp> start-job { ruby script\server }

Id              Name            State      HasMoreData     Location             Command
--              ----            -----      -----------     --------             -------
3               Job3            Running    True            localhost             ruby script\server

PS C:\Users\Brian\workspace\myapp> receive-job 3
C:\Ruby19\bin\ruby.exe: No such file or directory -- script/server (LoadError)
    + CategoryInfo          : NotSpecified: (C:\Ruby19\bin\r...ver (LoadError):String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
</pre>
<p>For some reason, when executing the job, it is executing in a different working directory.  It is pretty easy to confirm.</p>
<pre>
PS C:\Users\Brian\workspace\myapp> start-job { get-location }

Id              Name            State      HasMoreData     Location             Command
--              ----            -----      -----------     --------             -------
3               Job3            Running    True            localhost             get-location

PS C:\Users\Brian\workspace\myapp> receive-job 3

Path
----
C:\Users\Brian\Documents
</pre>
<p>Knowing that the working directory was not preserved, I figured it would be easy enough to write my own function that added this functionality.  This was my first stab at it.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> start-jobhere<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>scriptblock<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #007800;">$block</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>
  start-job <span style="color: #660033;">-argumentlist</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>get-location<span style="color: #7a0874; font-weight: bold;">&#41;</span>,<span style="color: #007800;">$block</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> set-location <span style="color: #007800;">$args</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; . <span style="color: #007800;">$args</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>But, it didn&#8217;t work.</p>
<pre>
PS C:\Users\Brian\workspace\myapp> start-jobhere { ruby script\server }

Id              Name            State      HasMoreData     Location             Command
--              ----            -----      -----------     --------             -------
1               Job1            Running    True            localhost             set-location $args[0]...

PS C:\Users\Brian\workspace\myapp> receive-job 1
The term ' ruby script\server ' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    + CategoryInfo          : ObjectNotFound: ( ruby script\server :String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
</pre>
<p>I had a sneaking suspicsion that Powershell was serializing the scriptblock to a string, which I confirmed.</p>
<pre>
PS C:\Users\Brian\workspace\myapp> $sb = { "hello world "}
PS C:\Users\Brian\workspace\myapp> start-job -ArgumentList $sb { $args[0] | gm }

Id              Name            State      HasMoreData     Location             Command
--              ----            -----      -----------     --------             -------
15              Job15           Running    True            localhost             $args[0] | gm

PS C:\Users\Brian\workspace\myapp> receive-job 15

   TypeName: System.String

Name             MemberType            Definition
----             ----------            ----------
Clone            Method                System.Object Clone()
CompareTo        Method                int CompareTo(System.Object value), int CompareTo(string strB)
Contains         Method                bool Contains(string value)
CopyTo           Method                System.Void CopyTo(int sourceIndex, char[] destination, int destinationIndex,...
EndsWith         Method                bool EndsWith(string value), bool EndsWith(string value, System.StringCompari...
Equals           Method                bool Equals(System.Object obj), bool Equals(string value), bool Equals(string...
GetEnumerator    Method                System.CharEnumerator GetEnumerator()
GetHashCode      Method                int GetHashCode()
GetType          Method                type GetType()
GetTypeCode      Method                System.TypeCode GetTypeCode()
IndexOf          Method                int IndexOf(char value), int IndexOf(char value, int startIndex), int IndexOf...
IndexOfAny       Method                int IndexOfAny(char[] anyOf), int IndexOfAny(char[] anyOf, int startIndex), i...
Insert           Method                string Insert(int startIndex, string value)
IsNormalized     Method                bool IsNormalized(), bool IsNormalized(System.Text.NormalizationForm normaliz...
LastIndexOf      Method                int LastIndexOf(char value), int LastIndexOf(char value, int startIndex), int...
LastIndexOfAny   Method                int LastIndexOfAny(char[] anyOf), int LastIndexOfAny(char[] anyOf, int startI...
Normalize        Method                string Normalize(), string Normalize(System.Text.NormalizationForm normalizat...
PadLeft          Method                string PadLeft(int totalWidth), string PadLeft(int totalWidth, char paddingChar)
PadRight         Method                string PadRight(int totalWidth), string PadRight(int totalWidth, char padding...
Remove           Method                string Remove(int startIndex, int count), string Remove(int startIndex)
Replace          Method                string Replace(char oldChar, char newChar), string Replace(string oldValue, s...
Split            Method                string[] Split(Params char[] separator), string[] Split(char[] separator, int...
StartsWith       Method                bool StartsWith(string value), bool StartsWith(string value, System.StringCom...
Substring        Method                string Substring(int startIndex), string Substring(int startIndex, int length)
ToCharArray      Method                char[] ToCharArray(), char[] ToCharArray(int startIndex, int length)
ToLower          Method                string ToLower(), string ToLower(System.Globalization.CultureInfo culture)
ToLowerInvariant Method                string ToLowerInvariant()
ToString         Method                string ToString(), string ToString(System.IFormatProvider provider)
ToUpper          Method                string ToUpper(), string ToUpper(System.Globalization.CultureInfo culture)
ToUpperInvariant Method                string ToUpperInvariant()
Trim             Method                string Trim(Params char[] trimChars), string Trim()
TrimEnd          Method                string TrimEnd(Params char[] trimChars)
TrimStart        Method                string TrimStart(Params char[] trimChars)
Chars            ParameterizedProperty char Chars(int index) {get;}
Length           Property              System.Int32 Length {get;}
</pre>
<p>So, instead of invoking the scriptblock like your normally would, you need to call <em>Invoke-Expression</em> instead.  My function ended up looking like the this.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> start-jobhere<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>scriptblock<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #007800;">$block</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>
  start-job <span style="color: #660033;">-argumentlist</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>get-location<span style="color: #7a0874; font-weight: bold;">&#41;</span>,<span style="color: #007800;">$block</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> set-location <span style="color: #007800;">$args</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>; invoke-expression <span style="color: #007800;">$args</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>Now it works like a charm!</p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+A+better+Start-Job+cmdlet+http://bit.ly/anZdbH" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2010/05/22/a-better-start-job-cmdlet/&amp;title=A+better+Start-Job+cmdlet" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2010/05/22/a-better-start-job-cmdlet/&amp;t=A+better+Start-Job+cmdlet" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2010/05/22/a-better-start-job-cmdlet/&amp;title=A+better+Start-Job+cmdlet" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p><img src="http://feeds.feedburner.com/~r/BrianHartsocksBlog/~4/B1ZRu4iqNNg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2010/05/22/a-better-start-job-cmdlet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://blog.brianhartsock.com/2010/05/22/a-better-start-job-cmdlet/</feedburner:origLink></item>
		<item>
		<title>Why the hell can’t I delete that folder?</title>
		<link>http://feedproxy.google.com/~r/BrianHartsocksBlog/~3/oO6uHiwYjXA/</link>
		<comments>http://blog.brianhartsock.com/2010/05/11/why-the-hell-cant-i-delete-that-folder/#comments</comments>
		<pubDate>Tue, 11 May 2010 22:37:35 +0000</pubDate>
		<dc:creator>bhartsock</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.brianhartsock.com/?p=1337</guid>
		<description><![CDATA[The other day I heard a coworker cussing about the fact he couldn&#8217;t delete a folder. To give him credit, he dual boots Linux and Windows, and has just recently realized Windows is much better. But, Windows doesn&#8217;t have sudo rm -f (ignoring chattr +i which I didn&#8217;t know about until today). The problem is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.brianhartsock.com/wp-content/uploads/2010/05/5-11-2010-6-11-27-PM.png"><img src="http://blog.brianhartsock.com/wp-content/uploads/2010/05/5-11-2010-6-11-27-PM-300x166.png" alt="" title="5-11-2010 6-11-27 PM" width="300" height="166" class="aligncenter size-medium wp-image-1338" /></a></p>
<p>The other day I heard a coworker cussing about the fact he couldn&#8217;t delete a folder.  To give him credit, he dual boots Linux and Windows, and has just recently realized Windows is much better.  But, Windows doesn&#8217;t have <em>sudo rm -f</em> (ignoring <em>chattr +i</em> which I didn&#8217;t know about until today).</p>
<p>The problem is easy to solve though.  </p>
<ul>
<li>Download <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx">process explorer</a></li>
<li>Start it up and go to <em>Find -> Find Handle or DLL&#8230;</em></li>
</ul>
<p><a href="http://blog.brianhartsock.com/wp-content/uploads/2010/05/5-11-2010-6-18-38-PM.png"><img src="http://blog.brianhartsock.com/wp-content/uploads/2010/05/5-11-2010-6-18-38-PM-300x233.png" alt="" title="5-11-2010 6-18-38 PM" width="300" height="233" class="aligncenter size-medium wp-image-1340" /></a></p>
<ul>
<li>Search for the path of the folder, and you see the process/executable holding onto the file.</li>
</ul>
<p><a href="http://blog.brianhartsock.com/wp-content/uploads/2010/05/5-11-2010-6-19-39-PM.png"><img src="http://blog.brianhartsock.com/wp-content/uploads/2010/05/5-11-2010-6-19-39-PM-300x85.png" alt="" title="5-11-2010 6-19-39 PM" width="300" height="85" class="aligncenter size-medium wp-image-1341" /></a></p>
<p align="left"><a target="_blank" class="tt" href="http://twitter.com/home/?status=@brianhartsock+Why+the+hell+can%E2%80%99t+I+delete+that+folder%3F+http://bit.ly/aYGkgQ" title="Post to Twitter"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-twitter-micro3.png" alt="Post to Twitter" /></a> <a target="_blank" class="tt" href="http://digg.com/submit?url=http://blog.brianhartsock.com/2010/05/11/why-the-hell-cant-i-delete-that-folder/&amp;title=Why+the+hell+can%E2%80%99t+I+delete+that+folder%3F" title="Post to Digg"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-digg-micro3.png" alt="Post to Digg" /></a> <a target="_blank" class="tt" href="http://www.facebook.com/share.php?u=http://blog.brianhartsock.com/2010/05/11/why-the-hell-cant-i-delete-that-folder/&amp;t=Why+the+hell+can%E2%80%99t+I+delete+that+folder%3F" title="Post to Facebook"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-facebook-micro3.png" alt="Post to Facebook" /></a> <a target="_blank" class="tt" href="http://reddit.com/submit?url=http://blog.brianhartsock.com/2010/05/11/why-the-hell-cant-i-delete-that-folder/&amp;title=Why+the+hell+can%E2%80%99t+I+delete+that+folder%3F" title="Post to Reddit"><img class="nothumb" src="http://blog.brianhartsock.com/wp-content/plugins/tweet-this/icons/tt-reddit-micro3.png" alt="Post to Reddit" /></a></p><img src="http://feeds.feedburner.com/~r/BrianHartsocksBlog/~4/oO6uHiwYjXA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://blog.brianhartsock.com/2010/05/11/why-the-hell-cant-i-delete-that-folder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blog.brianhartsock.com/2010/05/11/why-the-hell-cant-i-delete-that-folder/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 1.783 seconds. --><!-- Cached page generated by WP-Super-Cache on 2010-07-28 22:40:37 -->
