<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	>

<channel>
	<title>Code Nomad</title>
	<atom:link href="http://jasonkarns.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://jasonkarns.com/blog</link>
	<description>Tales of a Transient Programmer</description>
	<lastBuildDate>Thu, 19 Jan 2012 02:38:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Subdirectory Checkouts with git sparse-checkout</title>
		<link>http://jasonkarns.com/blog/subdirectory-checkouts-with-git-sparse-checkout/</link>
		<comments>http://jasonkarns.com/blog/subdirectory-checkouts-with-git-sparse-checkout/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 22:17:20 +0000</pubDate>
		<dc:creator>jasonkarns</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[read-tree]]></category>
		<category><![CDATA[sparse-checkout]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://jasonkarns.com/blog/?p=297</guid>
		<description><![CDATA[If there is one thing I miss about SVN having switched to git (and trust me, it’s the only thing), it is the ability to checkout only a sub-tree of a repository. As of version 1.7, you can check out just a sub-tree in git as well! Now not only does git support checking out [...]]]></description>
			<content:encoded><![CDATA[<p>If there is one thing I miss about SVN having switched to git (and trust me, it’s the only thing), it is the ability to checkout only a sub-tree of a repository. As of version 1.7, you can check out just a sub-tree in git as well! Now not only does git support checking out sub-directories, it does it better than subversion!</p>
<h2>New Repository</h2>
<p>There is a bit of a catch-22 when doing a sub-tree checkout for a new repository. In order to only checkout a sub-tree, you’ll need to have the <kbd>core.sparsecheckout</kbd> option set to <kbd>true</kbd>. Of course, you need to have a git repository before you can enable sparse-checkout. So, rather than doing a <kbd>git clone</kbd>, you’ll need to start with <kbd>git init</kbd>.</p>
<ol>
<li>
<p>Create and initialize your new repository:</p>
<pre class="shell">mkdir &lt;repo&gt; &amp;&amp; cd &lt;repo&gt;
git init
git remote add –f &lt;name&gt; &lt;url&gt;</pre>
</li>
<li>
<p>Enable sparse-checkout:</p>
<pre class="shell">git config core.sparsecheckout true</pre>
</li>
<li>
<p>Configure sparse-checkout by listing your desired sub-trees in <kbd>.git/info/sparse-checkout</kbd>: </p>
<pre class="shell">echo some/dir/ &gt;&gt; .git/info/sparse-checkout
echo another/sub/tree &gt;&gt; .git/info/sparse-checkout</pre>
</li>
<li>
<p>Checkout from the remote:</p>
<pre class="shell">git pull &lt;remote&gt; &lt;branch&gt;</pre>
</li>
</ol>
<h2>Existing Repository</h2>
<p>If you already have a repository, simply enable and configure sparse-checkout as above and do <kbd>git read-tree</kbd>.</p>
<ol>
<li>
<p>Enable sparse-checkout:</p>
<pre class="shell">git config core.sparsecheckout true</pre>
</li>
<li>
<p>Configure sparse-checkout by listing your desired sub-trees in <kbd>.git/info/sparse-checkout</kbd>: </p>
<pre class="shell">echo some/dir/ &gt;&gt; .git/info/sparse-checkout
echo another/sub/tree &gt;&gt; .git/info/sparse-checkout</pre>
</li>
<li>
<p>Update your working tree:</p>
<pre class="shell">git read-tree -mu HEAD</pre>
</li>
</ol>
<h2>Modifying sparse-checkout sub-trees</h2>
<p>If you later decide to change which directories you would like checked out, simply edit the sparse-checkout file and run <kbd>git read-tree</kbd> again as above.</p>
<p>Be sure to read the <a href="http://schacon.github.com/git/git-read-tree.html#_sparse_checkout">documentation on read-tree/sparse-checkout</a>. The sparse-tree file accepts file patterns similar to .gitignore. It also accepts negations—enabling you to specify certain directories or files to <strong>not</strong> checkout.</p>
<p>Now there isn’t <em>anything</em> that svn does better than git!</p>
]]></content:encoded>
			<wfw:commentRss>http://jasonkarns.com/blog/subdirectory-checkouts-with-git-sparse-checkout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JRuby on MSYS &#124; MinGW</title>
		<link>http://jasonkarns.com/blog/jruby-on-msys-mingw/</link>
		<comments>http://jasonkarns.com/blog/jruby-on-msys-mingw/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 19:14:35 +0000</pubDate>
		<dc:creator>jasonkarns</dc:creator>
				<category><![CDATA[jruby]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[mingw]]></category>
		<category><![CDATA[msys]]></category>

		<guid isPermaLink="false">http://jasonkarns.com/blog/?p=266</guid>
		<description><![CDATA[For many Windows users, like myself, the easiest way to get up and running with Ruby is to install JRuby. If you&#8217;re like me, then you may also be a Git user. Now this is just a hunch, but I would wager that if you&#8217;re a git user and interested in ruby, then there is [...]]]></description>
			<content:encoded><![CDATA[<p>For many Windows users, like myself, the easiest way to get up and running with Ruby is to install JRuby. If you&#8217;re like me, then you may also be a Git user. Now this is just a hunch, but I would wager that if you&#8217;re a git user and interested in ruby, then there is a high probability that you&#8217;re also a fan of proper *nix shells. If all of the above hold true, keep reading.</p>
<p>As a Windows user without access to a proper command line shell (and too tired of fighting with cygwin), I was delighted to have a bash shell at my command after installing msysgit. The subsystem beneath msysgit is MSYS | MinGW. According to their site, MinGW (&#8220;Minimalistic GNU for Windows&#8221;) is a collection of freely available and freely distributable Windows specific header files and import libraries combined with GNU toolsets that allow one to produce native Windows programs that do not rely on any 3rd-party C runtime DLLs.[<a href="http://www.mingw.org/wiki/MinGW">1</a>] In addition to MinGW, MSYS is a collection of GNU utilities such as bash, make, gawk and grep to allow building of applications and programs which depend on traditionally UNIX tools to be present. It is intended to supplement MinGW and the deficiencies of the cmd shell. [<a href="http://www.mingw.org/wiki/MSYS">2</a>] In simplest terms, MSYS | MinGW is a lightweight Cygwin. It is &#8216;lightweight&#8217; because it doesn&#8217;t provide *nix system calls or a POSIX emulation layer. However, if you&#8217;re looking for the standard *nix toolsets on Windows, MSYS | MinGW is a great utility.</p>
<h2>NoClassDefFoundError: org/jruby/Main</h2>
<p>With MinGW installed along with msysgit, I&#8217;ve returned to the bash shell as my primary shell on Windows. However, because MinGW is not quite *nix, nor is it really Windows, the standard JRuby installation doesn&#8217;t work out of the box. After running the JRuby installer, you pop open a bash shell and run <kbd>jruby -v</kbd> to verify the jruby/ruby version. Or you try to run <kbd>irb</kbd> or <kbd>jirb</kbd> to get a ruby console. Or you try to install a gem via <kbd>gem install</kbd>. Up pops an giant error:</p>
<pre>Exception in thread "main" java.lang.NoClassDefFoundError: org/jruby/Main
Caused by: java.lang.ClassNotFoundException: org.jruby.Main
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: org.jruby.Main.  Program will exit.</pre>
<h2>Of Shells and Executables</h2>
<p>So what&#8217;s the problem? The JRuby installer for Windows includes quite a bit of stuff in the bin directory. First and foremost is jruby.exe. This is the real executable for Windows. You&#8217;ll also see jruby.bat. This is just a wrapper which calls jruby.exe. (I assume this is an backwards-compatibility artifact from before the jruby.exe launcher existed.) You&#8217;ll also notice an extension-less jruby shell script. When you execute any of these jruby commands (<kbd>jruby</kbd>, <kbd>irb</kbd>, <kbd>jirb</kbd>, <kbd>gem</kbd>, etc) from a Windows command prompt, it will fire off jruby.exe or jruby.bat because those are the file extensions it is configured to look for. However, the MinGW bash shell prefers the jruby shell script and executes that first. Near the top of this shell script, you&#8217;ll find a block of code that determines the OS the shell is running under.</p>
<pre class="shell"># ----- Identify OS we are running under ---------------
case "`uname`" in
  CYGWIN*) cygwin=true;;
  Darwin) darwin=true;;
esac</pre>
<p>The shell script assumes we&#8217;re either *nix, CYGWIN or Darwin (Mac). This is understandable as the Windows Command Prompt will not attempt to execute this script. However, now that we&#8217;re using a proper bash shell with MinGW, we need to tell JRuby to expect MinGW.</p>
<h2>The Fix(es)</h2>
<p>The simplest fix is to delete the shell script. This way, when MinGW searches for an executable, the first it finds is jruby.exe. Alternatively, you can add the following line to the case statement in the jruby script:</p>
<pre class="shell">MINGW*) jruby.exe "$@"; exit $?;;</pre>
<p>This line simply checks if running on MinGW and, if so, executes jruby.exe passing along any parameters. The shell script returns with the same exit code as jruby.exe. Now the case statement should look like:</p>
<pre class="shell"># ----- Identify OS we are running under ---------------
case "`uname`" in
  CYGWIN*) cygwin=true;;
  Darwin) darwin=true;;
  MINGW*) jruby.exe "$@"; exit $?;;
esac</pre>
<h2>OSS and GitHub to the Rescue</h2>
<p>Thanks to JRuby being an Open Source project, and GitHub for having awesome collaboration tools, <a href="https://github.com/jasonkarns/jruby/commit/8766f84b774ae5ae68204931bd4eab61b81a2056">this patch</a> was <a href="https://github.com/jruby/jruby/pull/37">submitted</a> and <a href="https://github.com/jruby/jruby/pull/42#commits-ref-eed8778">accepted</a> to <a href="https://github.com/jruby/jruby">the JRuby project on GitHub</a>. Future installations of JRuby should work on MinGW out of the box.</p>
]]></content:encoded>
			<wfw:commentRss>http://jasonkarns.com/blog/jruby-on-msys-mingw/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubiquity in Firefox 5</title>
		<link>http://jasonkarns.com/blog/ubiquity-in-firefox-5/</link>
		<comments>http://jasonkarns.com/blog/ubiquity-in-firefox-5/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 17:08:59 +0000</pubDate>
		<dc:creator>jasonkarns</dc:creator>
				<category><![CDATA[ubiquity]]></category>
		<category><![CDATA[firefox]]></category>

		<guid isPermaLink="false">http://jasonkarns.com/blog/?p=261</guid>
		<description><![CDATA[As may be clear by my ubiquitycommands github repository, I am an avid Ubiquity user. So much so, in fact, that I delayed upgrading to Firefox 5 until I was able to find a version of Ubiquity that works with Firefox 5. Wonder of wonders, I have found that version. Satyr Murky continues to work [...]]]></description>
			<content:encoded><![CDATA[<p>As may be clear by <a href="https://github.com/jasonkarns/ubiquitycommands">my ubiquitycommands github repository</a>, I am an avid Ubiquity user. So much so, in fact, that I delayed upgrading to Firefox 5 until I was able to find a version of Ubiquity that works with Firefox 5. Wonder of wonders, I have found that version.</p>
<p>Satyr Murky continues to work on a <a href="https://bitbucket.org/satyr/ubiquity">community-maintained fork</a> of the <a href="http://mozillalabs.com/ubiquity">original Mozilla.org version</a> of Ubiquity. Luckily for us, it works in Firefox 5.</p>
<p>Thank you, <a href="https://bitbucket.org/satyr">Satyr</a>!</p>
<p>Download: <a href="https://bitbucket.org/satyr/ubiquity/downloads">Ubiquity</a> (<a href="https://bitbucket.org/satyr/ubiquity/downloads/tip.xpi">tip.xpi</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://jasonkarns.com/blog/ubiquity-in-firefox-5/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Test Your Transformations</title>
		<link>http://jasonkarns.com/blog/test-your-transformations/</link>
		<comments>http://jasonkarns.com/blog/test-your-transformations/#comments</comments>
		<pubDate>Tue, 28 Jun 2011 01:19:09 +0000</pubDate>
		<dc:creator>jasonkarns</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[transforms]]></category>
		<category><![CDATA[web.config]]></category>

		<guid isPermaLink="false">http://jasonkarns.com/blog/?p=241</guid>
		<description><![CDATA[Web.config transforms are a really great tool for setting up environment-specific configuration files. However, the transform syntax can be a bit obscure, and tracking down configuration bugs is just painful. For this, there is a great testing tool hosted on AppHarbor. Paste in your web.config contents in one box, drop in your transform in another [...]]]></description>
			<content:encoded><![CDATA[<p>Web.config transforms are a really great tool for setting up environment-specific configuration files. However, the transform syntax can be a bit obscure, and tracking down configuration bugs is just painful.</p>
<p>For this, there is a <a href="http://webconfigtransformationtester.apphb.com/">great testing tool hosted on AppHarbor</a>. Paste in your web.config contents in one box, drop in your transform in another and out comes the transformed web.config. Never waste time messing with your web.config transforms again!</p>
<p><img src="http://jasonkarns.com/blog/wp-content/uploads/2011/06/webconfig.png" alt="screenshot of the web.config transform tester service" title="Web.config Transform Tester" width="524" height="550" class="alignnone size-full wp-image-251" /></p>
]]></content:encoded>
			<wfw:commentRss>http://jasonkarns.com/blog/test-your-transformations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Calendar &gt; Lotus Notes</title>
		<link>http://jasonkarns.com/blog/google-calendar-lotus-notes/</link>
		<comments>http://jasonkarns.com/blog/google-calendar-lotus-notes/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 12:00:53 +0000</pubDate>
		<dc:creator>jasonkarns</dc:creator>
				<category><![CDATA[productivity]]></category>
		<category><![CDATA[calendar]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[lotusnotes]]></category>

		<guid isPermaLink="false">http://jasonkarns.com/blog/?p=211</guid>
		<description><![CDATA[Are you forced to use Lotus Notes at work? Do you prefer Google Calendar? Would you like to have your Lotus Notes calendar synced to your Google calendar? Solution: CalSync! CalSync is a great little utility that runs in the background and automatically syncs your Lotus Notes calendar with Google Calendar. You can download it [...]]]></description>
			<content:encoded><![CDATA[<p>Are you forced to use Lotus Notes at work? Do you prefer Google Calendar? Would you like to have your Lotus Notes calendar synced to your Google calendar? Solution: CalSync!</p>
<p>CalSync is a great little utility that runs in the background and automatically syncs your Lotus Notes calendar with Google Calendar. You can <a href="http://sourceforge.net/projects/lntogoogle/">download it from SourceForge</a>. It&#8217;s a standalone application that doesn&#8217;t require installation. Simply extract the zip file into a directory of your choosing and open the executable. You&#8217;ll need to provide you Lotus Notes account information, as well as your Google account information. (I recommend using Google&#8217;s 2-factor authentication and setting up an application-specific password for CalSync.)</p>
<p><img src="http://jasonkarns.com/blog/wp-content/uploads/2011/06/calsync-account-300x245.png" alt="screenshot of calsync account info dialog" title="CalSync Account Info" width="300" height="245" class="alignnone size-medium wp-image-229" /></p>
<p>After providing your account information, you can configure how you would like it to sync with Google Calendar. Personally, I recommend creating a new Google Calendar that is dedicated to syncing with your Lotus Notes calendar.</p>
<p><img src="http://jasonkarns.com/blog/wp-content/uploads/2011/06/calsync-acct_options-243x300.png" alt="screenshot of calsync account options dialog" title="CalSync Account Options" width="243" height="300" class="alignnone size-medium wp-image-230" /></p>
<p>There are plenty of additional configuration options to customize how/when your calendar items are synced. And, of course, to have it start with windows, simply add a shortcut to CalSync to your Startup folder. Now you can get your Lotus Notes work calendar on your smartphone via Google!</p>
]]></content:encoded>
			<wfw:commentRss>http://jasonkarns.com/blog/google-calendar-lotus-notes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Userscripts, Userstyles and Ubiquity</title>
		<link>http://jasonkarns.com/blog/userscripts-userstyles-and-ubiquity/</link>
		<comments>http://jasonkarns.com/blog/userscripts-userstyles-and-ubiquity/#comments</comments>
		<pubDate>Thu, 16 Jun 2011 23:45:57 +0000</pubDate>
		<dc:creator>jasonkarns</dc:creator>
				<category><![CDATA[ubiquity]]></category>
		<category><![CDATA[userscripts]]></category>
		<category><![CDATA[userstyles]]></category>

		<guid isPermaLink="false">http://jasonkarns.com/blog/?p=214</guid>
		<description><![CDATA[A while ago I described how to merge two git repositories into one. I discovered how to do this as I was attempting to consolidate a number of git repositories that I have on GitHub. Previously, I had a separate git repository for each user script, user style and ubiquity command that I&#8217;ve written. It [...]]]></description>
			<content:encoded><![CDATA[<p>A while ago I described how to <a href="http://jasonkarns.com/blog/merge-two-git-repositories-into-one/">merge two git repositories into one</a>. I discovered how to do this as I was attempting to consolidate a number of git repositories that I have on GitHub. Previously, I had a separate git repository for each user script, user style and ubiquity command that I&#8217;ve written. It was getting unmanageable so I decided to create a single git repository for my <a href="https://github.com/jasonkarns/userscripts">user scripts</a>, another for my <a href="https://github.com/jasonkarns/userstyles">user styles</a>, and a third for my <a href="https://github.com/jasonkarns/ubiquitycommands">ubiquity commands</a>. You can now find my them all on GitHub.</p>
<h3>Userscripts</h3>
<p>[<a href="https://github.com/jasonkarns/userscripts">GitHub repository</a>]</p>
<dl>
<dt><a href="https://github.com/jasonkarns/userscripts/tree/master/tweetapaper">Tweetapaper</a></dt>
<dd>adds &#8216;Tweet&#8217; links to articles in your Instapaper queue. [<a href="http://userscripts.org/scripts/show/93786">install from Userscripts.org</a>]</dd>
<dt><a href="https://github.com/jasonkarns/userscripts/tree/master/instasubmit">Instasubmit</a></dt>
<dd>auto-submits the Instapaper Add form when loaded via Google Reader&#8217;s Send To Instapaper action. [<a href="http://userscripts.org/scripts/show/98861">install from Userscripts.org</a>]</dd>
<dt><a href="https://github.com/jasonkarns/userscripts/tree/master/radapaper">Radapaper</a></dt>
<dd>adds &#8216;Radbox&#8217; links to articles in your Instapaper queue. [<a href="http://userscripts.org/scripts/show/98864">install from Userscripts.org</a>]</dd>
<dt><a href="https://github.com/jasonkarns/userscripts/tree/master/treasurydirect_login">TreasuryDirect Login</a></dt>
<dd>makes the password field editable so that you can use the keyboard to log in. [<a href="http://userscripts.org/scripts/show/98865">install from Userscripts.org</a>]</dd>
</dl>
<h3>Userstyles</h3>
<p>[<a href="https://github.com/jasonkarns/userstyles">GitHub repository</a>]</p>
<dl>
<dt><a href="https://github.com/jasonkarns/userstyles/tree/master/gmail_smime_icons">Gmail &#8211; Icons for S/Mime Messages</a></dt>
<dd>adds icons to messages in Gmail which have been digitally signed or encrypted using S/MIME. [<a href="http://userstyles.org/styles/14323">install from Userscripts.org</a>]</dd>
<dt><a href="https://github.com/jasonkarns/userstyles/tree/master/tab_notifier">Tab Notifier</a></dt>
<dd>highlights any open Gmail, Google Reader, Google Voice, and Facebook tab when there are unread items. [<a href="http://userstyles.org/styles/14571">install from Userscripts.org</a>]</dd>
</dl>
<h3>Ubiquity Commands</h3>
<p>[<a href="https://github.com/jasonkarns/ubiquitycommands">GitHub repository</a>]</p>
<dl>
<dt><a href="https://github.com/jasonkarns/ubiquitycommands/tree/master/claimid">ClaimID</a></dt>
<dd>easily claim URLs under your ClaimID account. [<a href="http://jasonkarns.github.com/ubiquitycommands/claimid/">install from GitHub</a>]</dd>
<dt><a href="https://github.com/jasonkarns/ubiquitycommands/tree/master/wishlistr">Wishlistr</a></dt>
<dd>easily add items to a Wishlistr wishlist. [<a href="http://jasonkarns.github.com/ubiquitycommands/wishlistr/">install from GitHub</a>]</dd>
</dl>
]]></content:encoded>
			<wfw:commentRss>http://jasonkarns.com/blog/userscripts-userstyles-and-ubiquity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Merge Two Git Repositories Into One</title>
		<link>http://jasonkarns.com/blog/merge-two-git-repositories-into-one/</link>
		<comments>http://jasonkarns.com/blog/merge-two-git-repositories-into-one/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 01:14:27 +0000</pubDate>
		<dc:creator>jasonkarns</dc:creator>
				<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://jasonkarns.com/blog/?p=174</guid>
		<description><![CDATA[A few weeks ago I tweeted: &#8220;Just did 2 subtree merges in order to combine 2 partially-related git repos into a single repo and still maintain history. #gitrocks&#8221; Wanna learn how to do it? Here we go&#8230; TL;DR # create new project as the parent $ mkdir new_parent_project $ cd new_parent_project $ git init $ [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago I <a href="https://twitter.com/jasonkarns/status/45888163079663616">tweeted</a>: &#8220;Just did 2 subtree merges in order to combine 2 partially-related git repos into a single repo and still maintain history. #gitrocks&#8221; Wanna learn how to do it? Here we go&#8230;</p>
<h2>TL;DR</h2>
<pre class="sh"><code># create new project as the parent
$ mkdir new_parent_project
$ cd new_parent_project
$ git init
$ touch .gitignore
$ git ci -am "initial commit"

# merge project A into subdirectory A
$ git remote add -f projA /path/to/projA
$ git merge -s ours --no-commit projA/master
$ git read-tree --prefix=subdirA/ -u projA/master
$ git ci -m "merging projA into subdirA"

# merge project B into subdirectory B
$ git remote add -f projB /path/to/projB
$ git merge -s ours --no-commit projB/master
$ git read-tree --prefix=subdirB/ -u projB/master
$ git ci -m "merging projB into subdirB"
</code></pre>
<p>The most common use case for sub-tree merges, that I&#8217;m aware of, is to merge another git repository into a subdirectory in an existing repository. There are quite a few tutorials which cover these steps. In fact, the second two sets of commands above do exactly that. However, I discovered that in order to merge two repositories into a new repository, the new repository must already have a prior commit in it. Otherwise, the sub-tree merges will not work as planned. So, as in the first set of commands above, be sure to create at least one initial commit prior to doing the sub-tree merges. It can be as trivial as committing an empty file. But without it, the merges will not work correctly. Armed with this knowledge, you can follow the <a href="http://help.github.com/subtree-merge">tutorial</a> on GitHub on merging sub-trees. Or you can follow along with me here.</p>
<h3>Create Parent Repo</h3>
<p>First, create a new, empty project to act as the parent project for our two existing repositories.</p>
<pre class="sh"><code>Jason@BRUTUS ~/dev
$ mkdir parent

Jason@BRUTUS ~/dev
$ cd parent/

Jason@BRUTUS ~/dev/parent
$ git init
Initialized empty Git repository in ~/dev/parent/.git/
</code></pre>
<p>Now we need to create the initial commit. This is essential.</p>
<pre class="sh"><code>Jason@BRUTUS ~/dev/parent (master #)
$ touch .gitignore

Jason@BRUTUS ~/dev/parent (master #)
$ git ci -am "initial commit"
[master (root-commit) fc6f5ad] initial commit
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 .gitignore
</code></pre>
<h3>Merge Project A Into Subdirectory</h3>
<p>Next, we add a remote to the first project we&#8217;d like to import. We&#8217;ll give the remote a name (<var>projectA</var>) and pass the <kbd>-f</kbd> option so that it will fetch the contents of this remote immediately.</p>
<pre class="sh"><code>Jason@BRUTUS ~/dev/parent (master)
$ git remote add -f projectA /path/to/projectA
Updating projectA
warning: no common commits
remote: Counting objects: 16, done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 16 (delta 7), reused 0 (delta 0)
Unpacking objects: 100% (16/16), done.
From /path/to/projectA
 * [new branch]      master     -> projectA/master
</code></pre>
<p>Now, let&#8217;s run a merge but not commit the result (<kbd>--no-commit</kbd> flag). We also need to specify the merge strategy <var>ours</var> with the <kbd>-s</kbd> switch.</p>
<pre class="sh"><code>Jason@BRUTUS ~/dev/parent (master)
$ git merge -s ours --no-commit projectA/master
Automatic merge went well; stopped before committing as requested
</code></pre>
<p>Now that we are in merging mode, we&#8217;ll read in the tree from the remote, taking care to provide a subdirectory into which the subproject will go. This is specified with with <kbd>--prefix</kbd> switch. Also, add the <kbd>-u</kbd> flag to update the working tree with our changes.</p>
<pre class="sh"><code>Jason@BRUTUS ~/dev/parent (master|MERGING)
$ git read-tree --prefix=projA/ -u projectA/master
</code></pre>
<p>The remote has been merged into its own subdirectory and the changes have been staged. Now we can simply commit them.</p>
<pre class="sh"><code>Jason@BRUTUS ~/dev/parent (master +|MERGING)
$ git ci -m "merging project A into subdirectory"
[master 4d2d50d] merging project A into subdirectory
</code></pre>
<h3>Merge Project B Into Subdirectory</h3>
<p>At this point, we have Project A merged into its own subdirectory within our new parent project. Merging in Project B uses the same simple steps as above.</p>
<pre class="sh"><code>Jason@BRUTUS ~/dev/parent (master)
$ git remote add -f projectB /path/to/projectB
Updating projectB
warning: no common commits
remote: Counting objects: 47, done.
remote: Compressing objects: 100% (47/47), done.
remote: Total 47 (delta 23), reused 0 (delta 0)
Unpacking objects: 100% (47/47), done.
From /path/to/projectB
 * [new branch]      master     -> projectB/master

Jason@BRUTUS ~/dev/parent (master)
$ git merge -s ours --no-commit projectB/master
Automatic merge went well; stopped before committing as requested

Jason@BRUTUS ~/dev/parent (master|MERGING)
$ git read-tree --prefix=projB/ -u projectB/master

Jason@BRUTUS ~/dev/parent (master +|MERGING)
$ git ci -m "merging project B into subdirectory"
[master 8f41792] merging project B into subdirectory
</code></pre>
<h3>Pulling In Updates</h3>
<p>If the original repositories (Projects A and B in this example) continue to live on elsewhere as separate projects, you can easily pull in updates to your new parent repo. Using the sub-tree merge strategy, the updates will be applied properly to the applicable subdirectory.</p>
<pre class="sh"><code>Jason@BRUTUS ~/dev/parent (master)
$ git pull -s subtree projectA master
</code></pre>
<p>However, if you no longer have any need for the original repositories, they can be deleted and the remotes in your new parent project can safely be removed.</p>
<p>Below is a screenshot of a repository after two sub-tree merges. The repositories that I merged were two separate userstyles: one for using tab color for notifications (gtab) and another for adding S/MIME icons to gmail&#8217;s inbox (gmail). Each of these two projects have their own history that was maintained after the merge. Now they are each in their own subdirectory in a common <em>userstyles</em> git repository. As you can see, the two projects each have their own lines of development that do not include any common ancestry until the merge point.</p>
<p><a href="http://jasonkarns.com/blog/wp-content/uploads/2011/03/merging.png"><img src="http://jasonkarns.com/blog/wp-content/uploads/2011/03/merging.png" alt="" title="GitK After Subtree Merge" width="545" height="331" class="alignnone size-full wp-image-187" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://jasonkarns.com/blog/merge-two-git-repositories-into-one/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Keeping Tabs On Your Credit Report</title>
		<link>http://jasonkarns.com/blog/keeping-tabs-on-your-credit-report/</link>
		<comments>http://jasonkarns.com/blog/keeping-tabs-on-your-credit-report/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 16:39:56 +0000</pubDate>
		<dc:creator>jasonkarns</dc:creator>
				<category><![CDATA[finance]]></category>

		<guid isPermaLink="false">http://jasonkarns.com/blog/?p=168</guid>
		<description><![CDATA[Regardless of which financial blogger or author you follow, it is generally agreed that keeping tabs on your credit report is sound advice. By federal law, you are entitled to a free credit report from each of the 3 primary credit reporting agencies every 12 months. (See annualcreditreport.com and avoid all the credit report scams) [...]]]></description>
			<content:encoded><![CDATA[<p>Regardless of which financial blogger or author you follow, it is generally agreed that keeping tabs on your credit report is sound advice. By federal law, you are entitled to a free credit report from each of the 3 primary credit reporting agencies every 12 months. (See <a href="http://annualcreditreport.com">annualcreditreport.com</a> and avoid all the credit report scams) Of course, that means in the worst case scenario you could potentially have incorrect or adverse information on your credit report for up to a year before it&#8217;s detected. A strategy that I employ to lessen this risk is to stagger each of my credit reports every 4 months. An example schedule could be ordering your TransUnion credit report every January, Experian every May, and Equifax every September.</p>
<p>Of course, there&#8217;s no guarantee that each of these reporting agencies will have the same information. Which means it&#8217;s possible that adverse information only exists on a single report. In which case, you&#8217;re back to the original situation of detecting this information up to 12 months after it&#8217;s added to your report. However, the odds are in our favor that adverse information is added to more than one of the different reports. This means, in the best case, you can detect adverse information at most 4 months after it&#8217;s added to your report.</p>
<p>In order to keep my schedule straight, I have scheduled a Google Calendar reminder for each of the three credit reports. Each reminder repeats annually and sends me an email notice so that I know from which agency the report should be ordered. It&#8217;s also a good idea to order a report for your spouse on the same schedule. So far, I like this method for keeping up on my credit health and lessening the risk that incorrect or adverse information negatively impacts my credit.</p>
]]></content:encoded>
			<wfw:commentRss>http://jasonkarns.com/blog/keeping-tabs-on-your-credit-report/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CodeMash Recap</title>
		<link>http://jasonkarns.com/blog/codemash-recap/</link>
		<comments>http://jasonkarns.com/blog/codemash-recap/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 21:28:59 +0000</pubDate>
		<dc:creator>jasonkarns</dc:creator>
				<category><![CDATA[conferences]]></category>
		<category><![CDATA[codemash]]></category>

		<guid isPermaLink="false">http://jasonkarns.com/blog/?p=156</guid>
		<description><![CDATA[I can&#8217;t honestly call this a recap or an overview because there is just too much good stuff to do CodeMash proper justice. And I clearly waited too long to do a &#8216;best of&#8217; or &#8216;highlights&#8217; post. However, after attempting to give a recap of CodeMash to my fellow CSGers, I had a list of [...]]]></description>
			<content:encoded><![CDATA[<p>I can&#8217;t honestly call this a recap or an overview because there is just too much good stuff to do CodeMash proper justice. And I clearly waited too long to do a &#8216;best of&#8217; or &#8216;highlights&#8217; post. However, after attempting to give a recap of CodeMash to my fellow <abbr title="Cardinal Solutions Group-ers">CSGers</abbr>, I had a list of talking points and recommended resources that shouldn&#8217;t be put to waste. I&#8217;m omitting the two mini-demos that I gave during my recap: git-bisect and BDD/Cucumber. So you&#8217;ll have to research those on your own. Seriously, go try git-bisect. It&#8217;s cool.</p>
<p>So it was clearly impossible to recap 72 hours of awesome in 1 hour. Not to  mention the drinking, water slides, etc. So here are a few resources you ought  to check out while you&#8217;re sitting on the couch with your wife suffering through  American Idol this season.</p>
<h2>Reasons why CodeMash is awesome</h2>
<ol>
<li>The tiki hut/bars.</li>
<li>Waterslides. In Sandusky. In January.</li>
<li>Hot-tub snowball fights; lacking only a time machine.</li>
<li>Aside from the numerous presentations, there are great open spaces that spring up. These lead to great discussions and they&#8217;re completely ad-hoc. I participated in one covering node.js (check out the #nodemash tag on Twitter)</li>
<li>You&#8217;ll see people pairing all over the place in corners, empty rooms, hallway couches. They&#8217;re working on mini-projects, trying out demos, and  generally experimenting; usually inspired by a talk, keynote, or open  space.</li>
<li>You can attend a deep dive on Parallel Programming in .NET and then  see an intro to UX design, followed by BDD with Cucumber, topped off with HTML5  and offline webdev. One of the best things about CodeMash is the range of  languages, platforms, and technologies. You can meet people doing awesome stuff  in Java or Flex, and pick up a few testing tricks from the Ruby dudes. Even within just the .NET world, there was VB, C#, F#, and IronRuby.</li>
<li>Did I  mention the after-parties?</li>
</ol>
<h2>Things to check out</h2>
<ul>
<li>Suggested during  Chad Fowler&#8217;s (of the Pragmatic Programmers) &#8216;Quality&#8217; keynote, read &#8216;Zen and  the Art of Motorcycle Maintenance&#8217;. Since hearing Chad mention it during his keynote, I&#8217;ve heard this book recommended 3 other times. It&#8217;s definitely on my to-read list.</li>
<li>Slightly related to Scott Chacon&#8217;s (of  GitHub) <a href="http://schacon.github.com/ddd/#1">keynote</a>, be sure to watch the  <a href="http://www.ted.com/talks/dan_pink_on_motivation.html">&#8216;Surprising Science Behind Motivation&#8217; TED talk</a></li>
<li>Step-by-step introduction to Git by EdgeCase: <a href="http://library.edgecase.com/git_immersion/">Git Immersion</a></li>
<li><a href="http://stevesmithblog.s3.amazonaws.com/CodeMash2011PrecompilerSoftwareCraftsmanship.zip">Try your hand  at a few Katas</a> used in the Craftsmanship PreCompiler.<br />
For an extra challenge, try them in  a few different languages. For instance, during the PreCompiler I did the  PrimeFactors Kata in JavaScript, Java, and C#</li>
<li>A good number of talks have <a href="http://blog.alner.net/archive/2011/01/17/codemash_slide_links.aspx">posted links to their slides and/or demos</a>. I recommend:
<ul>
<li><a href="http://billwagner.cloudapp.net/Home/Item/SlidesandDemosfrommyCodeMashtalkCPuzzlers">C# Puzzlers</a></li>
<li><a href="http://msdn.microsoft.com/en-us/magazine/ee309512.aspx">Functional Programming for Everyday .NET Development</a></li>
<li><a href="http://tinyurl.com/TakingWebAppsOffline">Taking Web Applications Offline with HTML5, Silverlight and AIR</a></li>
<li> <a href="https://github.com/timwingfield/SlideDecks/tree/master/Codemash.2011">Executable  Requirements: Testing in the Language of the Business</a></li>
<li><a href="https://github.com/jimweirich/presentation_testing_why_dont_we_do_it_like_this">Are You Satisfied With Your  Tests?</a></li>
</ul>
</li>
</ul>
<p>If you&#8217;re interested in going next  year, be prepared. They sold out in just 3 days this year. That&#8217;s right: the conference itself lasted longer than the ticket sales.</p>
]]></content:encoded>
			<wfw:commentRss>http://jasonkarns.com/blog/codemash-recap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Networked PDF printer? Yes, please.</title>
		<link>http://jasonkarns.com/blog/networked-pdf-printer-yes-please/</link>
		<comments>http://jasonkarns.com/blog/networked-pdf-printer-yes-please/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 22:28:25 +0000</pubDate>
		<dc:creator>jasonkarns</dc:creator>
				<category><![CDATA[home network]]></category>
		<category><![CDATA[home networking]]></category>
		<category><![CDATA[whs]]></category>

		<guid isPermaLink="false">http://jasonkarns.com/blog/?p=135</guid>
		<description><![CDATA[Need an awesome solution for printing to PDF? Have multiple home machines and prefer a network solution? Read on! My setup involves PDFCreator installed in server mode on my Windows Home Server box. The printer is shared so other machines on the network can print to it. PDFCreator saves the PDF on the server under [...]]]></description>
			<content:encoded><![CDATA[<p>Need an awesome solution for printing to PDF? Have multiple home machines and prefer a network solution? Read on!</p>
<p>My setup involves <a href="http://sourceforge.net/projects/pdfcreator/">PDFCreator</a> installed in server mode on my Windows Home Server box. The printer is shared so other machines on the network can print to it. PDFCreator saves the PDF on the server under the user&#8217;s Documents folder. Using Windows 7 Libraries, a user&#8217;s Documents folder on the server is added to their local Documents Library so they have quick access to their printed PDFs.</p>
<h2>Step by step process:</h2>
<ol>
<li>Download and initiate the <a href="http://sourceforge.net/projects/pdfcreator/">PDFCreator installer from Sourceforge</a> on your home server box. Be sure to select <kbd>Server Installation</kbd> during setup and choose the remaining options as you please.</li>
<li>Once installed, start PDFCreator and choose <kbd>Printer -&gt; Options</kbd> from the menu. Open the Auto-Save settings and enable Auto-Save mode. Choose your auto-save file name and location (file name/location tokens available in the select box).<br/> I chose the save location: <code>D:\shares\Users\<var>&lt;REDMON_USER&gt;</var>\PDFs\</code></li>
<li>Now you can minimize PDFCreator (minimizes to the system tray) and go to your Printers control panel to share the PDFCreator printer. Right-click on the PDFCreator printer, choose <kbd>Sharing</kbd> and check <kbd>Share this printer</kbd>.</li>
<li>On each of your networked machines, you can now go through the Add Printer wizard and add the PDFCreator printer by using the path: <code>\\<var>&lt;server&gt;</var>\PDFCreator</code></li>
<li>As an optional step (for Windows 7 users), you can add the user&#8217;s Documents folder (on the server) to their local Documents library. On any networked Windows 7 machine, open the user&#8217;s Documents library. Under the heading <kbd>Documents library</kbd> heading, click the link <kbd>Includes <var>X</var> locations</kbd>. Click <kbd>Add</kbd> and browse to the user&#8217;s Documents folder on your server.</li>
</ol>
<p>At this point, your user&#8217;s can easily print to PDF. The generated PDF is saved on the server in their own user folder and is accessible through their Windows 7 Documents library. However, there is a catch. The PDFCreator monitor must be running to auto-save print jobs to PDF. If it is not running, the jobs will simply queue up and execute the next time someone logs into the server. (The PDFCreator monitor is added as a shortcut to your Startup folder.) To get around this issue, we simply need to turn PDFCreator into a Windows service.</p>
<ol>
<li>Download and install the <a href="http://www.microsoft.com/downloads/en/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&amp;displaylang=en">Windows Server 2003 Resource Kit Tools</a>.</li>
<li>Download and install <a href="http://www.megaupload.com/?d=O3TOOFWL">Any Service Installer</a>.</li>
<li>Fire up Any Service Installer and switch to <kbd>Advanced</kbd> from the mode menu.
<ul>
<li>Fill out the location of your Windows 2003 Resource Kit installation<br/> (<code>C:\Program Files\Windows Resource Kits\Tools</code>)</li>
<li> Select PDFCreator as the application you want to make a service<br/> (<code>C:\Program Files\PDFCreator\PDFCreator.exe</code>)</li>
<li>Enter your WHS Administrator <var>username</var> and <var>password</var></li>
</ul>
</li>
</ol>
<p>Now you&#8217;re done and you can remove PDFCreator from your startup folder! Users can print freely and the print jobs will execute immediately.</p>
<p>I used two different step by step guides in the process of getting my PDF printer set up: the first for simply <a href="http://www.thefreewarejunkie.com/2008/02/network-admin-tip-create-shared-pdf.html">installing PDFCreator on a server</a> and the second for <a href="http://wiki.wegotserved.com/index.php?title=PDFCreator_on_WHS">turning PDFCreator into a Windows service</a>. If anyone has any other PDF printing, Windows Home Server or home networking tips, be sure to share in the comments. I&#8217;d love to hear about any WHS tricks you might have come across.</p>
]]></content:encoded>
			<wfw:commentRss>http://jasonkarns.com/blog/networked-pdf-printer-yes-please/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

