<?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>Jordan Brock &#187; Development</title>
	<atom:link href="http://jordanbrock.com/tag/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://jordanbrock.com</link>
	<description>Pith</description>
	<lastBuildDate>Tue, 17 Apr 2012 11:05:41 +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>Getting Rails, Git and Capistrano to work on a Joyent Accelerator</title>
		<link>http://jordanbrock.com/2008/04/08/getting-rails-git-and-capistrano-to-work-on-a-joyent-accelerator/</link>
		<comments>http://jordanbrock.com/2008/04/08/getting-rails-git-and-capistrano-to-work-on-a-joyent-accelerator/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 18:51:00 +0000</pubDate>
		<dc:creator>Jordan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[accelerator]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[joyent]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rubyonrails]]></category>

		<guid isPermaLink="false">http:///2008/04/08/getting-rails-git-and-capistrano-to-work-on-a-joyent-accelerator</guid>
		<description><![CDATA[After several days of repeatedly smashing my head into both a metaphorical and an all too real brick wall, I seem to have managed to get git and capistrano working happily together on my Joyent Accelerator. I&#8217;m also using github for my git hosting, which threw up it&#8217;s own little challenge mid-way through the entire [...]]]></description>
			<content:encoded><![CDATA[<p>After several days of repeatedly smashing my head into both a metaphorical and an all too real brick wall, I seem to have managed to get <a href="http://git.or.cz">git</a> and <a href="http://capify.org">capistrano</a> working happily together on my <a href="http://www.joyent.com/accelerator">Joyent Accelerator</a>. I&#8217;m also using <a href="http://github.org">github</a> for my git hosting, which threw up it&#8217;s own little challenge mid-way through the entire process.</p>
<p>Now, I should probably also say that I already had my site up and running using subversion, capistrano and my accelerator, so this article isn&#8217;t necessarily going to help with getting everything setup the first time. For that, you probably need to read this <a href="http://wiki.joyent.com/accelerators:deploying_rails_apps">wiki entry</a>.</p>
<h3>Things You Will Need</h3>
<ul>
<li>A github.org account</li>
<li>A dedicated Joyent Accelerator (I have no idea how to do all of this on a shared accelerator. Sorry.)</li>
<li>Also, I&#8217;m really only talking about RubyOnRails apps here &#8230; not too sure how applicable a lot of this is to other frameworks (it will probably help at least.)</li>
</ul>
<h3>Getting started</h3>
<p>Assuming that you have your project in a git repository, and have a <a href="http://github.org">github</a> account (and obviously an Accelerator) we can start.</p>
<h4>Compiling git on your accelerator</h4>
<p>Unfortunately, the first step in the process was, for me at least, a total nightmare. I&#8217;m not the biggest unix-head by any stretch, but I can do some basic tasks with a degree of proficiency. Unfortunately, I went into a dark place trying to get git compiled. One thing to note is that I&#8217;m talking about setting up the git client here, not a git server. Because capistrano executes scripts on your remote server, you need to have a copy of the client software setup for capistrano to call.</p>
<p>So what did I do? There are a couple of helpful threads on the Joyent Forums:</p>
<ul>
<li><a href="http://discuss.joyent.com/viewtopic.php?id=22094">Got git?</a></li>
<li><a href="http://discuss.joyent.com/viewtopic.php?pid=175313">Git and Cap 2.0</a></li>
<li><a href="http://discuss.joyent.com/viewtopic.php?pid=177469#p177469">Installing git</a></li>
</ul>
<p>Hopefully those threads will put you onto the path of successfully compiling and installing git onto your Accelerator.</p>
<h4>Setting up <span class="caps">SSH</span> keys with github and your accelerator</h4>
<p>When you setup your account on github, you need to setup an <span class="caps">SSH</span> key for authentication. github has a <a href="http://github.com/guides/providing-your-ssh-key">really good tutorial</a> on how to do this. I have a user defined on my accelerator that my website &#8220;runs&#8221; under, so what I did was to create a key for that user which gets stored into the ~/.ssh directory. I then added the contents of the id_rsa.pub key to my github account, which allows that user to access the repository.</p>
<p>Another tip: don&#8217;t forget your passphrase. It&#8217;s needed in the next step.</p>
<h4>Configuring capistrano</h4>
<p>Assuming that you have your capistrano deploy.rb file setup as outlined <a href="http://wiki.joyent.com/accelerators:deploying_rails_apps">here</a> there are a few changes that you will need to make to get things working with git.</p>
<p><em>I&#8217;m using Capistrano 2.2 at the moment. I don&#8217;t think it will work with earlier versions because of the relatively new git support.</em></p>
<p>Here&#8217;s my deploy.rb file:</p>
<pre>
  require 'erb'
  require 'config/accelerator/accelerator_tasks'

  set :application, "website"
  set :repository, "git@github.com:your_username/website.git" 

  default_run_options[:pty] = true
  set :domain, 'XX.XX.XX.XX' #Your Accelerators public IP address
  set :deploy_to, "/var/www/apps/#{application}"
  set :user, 'website_account_username'
  set :scm, :git
  set :scm_username, "github_username"
  set :scm_passphrase, "your passphrase here" 

  role :app, domain
  role :web, domain
  role :db,  domain, :primary =&gt; true

  set :server_name, "url.for.website"
  set :server_alias, "*.url.for.website" 

  # Example dependancies
  depend :remote, :command, :gem
  depend :remote, :gem, :money, '&gt;=1.7.1'
  depend :remote, :gem, :mongrel, '&gt;=1.0.1'
  depend :remote, :gem, :image_science, '&gt;=1.1.3'
  depend :remote, :gem, :rake, '&gt;=0.7'
  depend :remote, :gem, :BlueCloth, '&gt;=1.0.0'
  depend :remote, :gem, :RubyInline, '&gt;=3.6.3'

  ################################
  # Some tasks for the old server
  ################################

  task :after_deploy do
    # tasks to run after deploy
  end

  ################################
  # End tasks for the old server
  ################################

  deploy.task :restart do
    accelerator.smf_restart
    accelerator.restart_apache
  end

  deploy.task :start do
    accelerator.smf_start
    accelerator.restart_apache
  end

  deploy.task :stop do
    accelerator.smf_stop
    accelerator.restart_apache
  end

  after :deploy, 'deploy:cleanup'
</pre>
<p>It appears that the important line here is &#8217;  default_run_options[:pty] = true &#8217;. This means that capistrano can respond automatically for the request for the <span class="caps">SSH</span> Key passphrase that github replies with when you try to clone the repository.</p>
<p>If everything is working, you can type &#8216;cap deploy&#8217; and it should all deploy nicely. If you get this error:</p>
<p><code><br />
  [err] Permission denied (publickey).<br />
</code></p>
<p>then there&#8217;s a problem with your <span class="caps">SSH</span> key and your settings on github. Make sure the key you copied into your github account is the public key for the <span class="caps">SSH</span> in your .ssh directory.</p>
<p>Hopefully, you&#8217;ll be up and running. If you have any tips, recommendations or corrections, leave a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://jordanbrock.com/2008/04/08/getting-rails-git-and-capistrano-to-work-on-a-joyent-accelerator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upgrading to Capistrano 2</title>
		<link>http://jordanbrock.com/2007/09/14/upgrading-to-capistrano-2/</link>
		<comments>http://jordanbrock.com/2007/09/14/upgrading-to-capistrano-2/#comments</comments>
		<pubDate>Thu, 13 Sep 2007 23:17:00 +0000</pubDate>
		<dc:creator>Jordan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[rubyonrails]]></category>
		<category><![CDATA[snippets]]></category>

		<guid isPermaLink="false">http:///2007/09/14/upgrading-to-capistrano-2</guid>
		<description><![CDATA[For no other reason than this is something I need to remember on other projects, here is a list of the changes I made when I uninstalled deprec and upgraded to capistrano 2 for deployment. Things to do Do this once gem install mongrel_cluster then in the application directory capify . then remove &#8220;require &#8216;deprec/recipes&#8217; [...]]]></description>
			<content:encoded><![CDATA[<p>For no other reason than this is something I need to remember on other projects, here is a list of the changes I made when I uninstalled deprec and upgraded to <a href="http://capify.org">capistrano 2</a> for deployment.</p>
<h3>Things to do</h3>
<p>Do this once</p>
<p><code><br />
gem install mongrel_cluster<br />
</code></p>
<p>then in the application directory</p>
<p><code><br />
capify .<br />
</code></p>
<p>then remove &#8220;require &#8216;deprec/recipes&#8217; from the deploy.rb file</p>
<p>then put the following in to the deploy.rb file</p>
<p><code><br />
namespace :deploy do<br />
  task :start,    :roles =&gt; :app do start_mongrel_cluster end<br />
  task :stop,     :roles =&gt; :app do stop_mongrel_cluster end<br />
  task :restart,  :roles =&gt; :app do restart_mongrel_cluster end<br />
end<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://jordanbrock.com/2007/09/14/upgrading-to-capistrano-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maps, Geocoding and Great Timing</title>
		<link>http://jordanbrock.com/2007/02/10/maps-geocoding-and-great-timing/</link>
		<comments>http://jordanbrock.com/2007/02/10/maps-geocoding-and-great-timing/#comments</comments>
		<pubDate>Fri, 09 Feb 2007 19:17:00 +0000</pubDate>
		<dc:creator>Jordan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[geocoding]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubyonrails]]></category>

		<guid isPermaLink="false">http:///2007/02/10/maps-geocoding-and-great-timing</guid>
		<description><![CDATA[On one of the sites I&#8217;ve been working on for quite a while (SchoolSeek) we&#8217;ve been wanting to add the ability for users to find out how far a school is from their current location. There are services that have been able to geocode addresses for a while, but they were either based in the [...]]]></description>
			<content:encoded><![CDATA[<p>On one of the sites I&#8217;ve been working on for quite a while (<a href="http://www.schoolseek.com.au">SchoolSeek</a>) we&#8217;ve been wanting to add the ability for users to find out how far a school is from their current location. There are services that have been able to <a href="http://en.wikipedia.org/wiki/Geocode">geocode</a> addresses for a while, but they were either based in the US, or cost money. Not a lot of money, but free is always good.</p>
<p>A couple of years ago, <a href="http://maps.google.com">Google Maps</a> launched in the US and opened up a massive range of possibilities for programmers to develop cool &#8220;mashups&#8221;, which took information from one site, mashed it together with maps from google, and created a whole new website. They were all really cool, but unfortunately (at least for the non-US based of us) it was nothing more than something we could sit back and watch &#8211; which was kind of weird because the team of developers that built Google Maps was based in Sydney.</p>
<p>But <a href="http://googleblog.blogspot.com/2006/05/on-map-down-under.html">finally</a> the Australian version of google maps was released, and then recently integrated with Local Search, which means you can search on Pizza shotps near a particular address. Which is cool.</p>
<p>What is even cooler (if you&#8217;re a ruby developer), though, is the release of this: <a href="http://geokit.rubyforge.org/">GeoKit</a>. It integrates with all of the major geocoding/mapping services and provides a huge range of options and services. So now you can do stuff like this:</p>
<pre>
add_1=GeoKit::Geocoders::GoogleGeocoder.geocode("1 St Georges Terrace, Perth, Western Australia")
add_2=GeoKit::Geocoders::GoogleGeocoder.geocode("1 York St, Albany, Western Australia")

distance = add_1.distance_from(add_2, :units =&gt; :kms)
</pre>
<p>Which returns</p>
<p><code><br />
389.248018478531<br />
</code></p>
<p>which is, of course, how far it is between the main streets of Perth and Albany in Western Australia.</p>
<p>Sawwweeeeeet.</p>
<h3>Update</h3>
<p>Well, that didn&#8217;t take long at all. A quick loop over the existing schools in the <a href="http://www.schoolseek.com.au">SchoolSeek</a> database got the lat/long information for all the addresses. Then adding this line</p>
<pre>acts_as_mappable default_units =&gt; :kms</pre>
<p>to my Address model allows you to do this</p>
<pre>
@addresses = Address.find(:all, <img src='http://jordanbrock.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> rigin =&gt; "18 Bland St, Ashfield, New South Wales", :conditions =&gt; "distance &lt; 10")
</pre>
<p>which gives me all of the addresses within 10Kms of 18 Bland St, Ashfield. Nice.</p>
<p>So, basically GeoKit let me add distance searching to the site within about 45 minutes (allowing 25 minutes for me to read through the examples and such!)</p>
]]></content:encoded>
			<wfw:commentRss>http://jordanbrock.com/2007/02/10/maps-geocoding-and-great-timing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Smallest possible expenditure of intelligence</title>
		<link>http://jordanbrock.com/2006/07/11/smallest-possible-expenditure-of-intelligence/</link>
		<comments>http://jordanbrock.com/2006/07/11/smallest-possible-expenditure-of-intelligence/#comments</comments>
		<pubDate>Tue, 11 Jul 2006 18:51:00 +0000</pubDate>
		<dc:creator>Jordan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[intelligence]]></category>
		<category><![CDATA[users]]></category>

		<guid isPermaLink="false">http:///2006/07/11/smallest-possible-expenditure-of-intelligence</guid>
		<description><![CDATA[Intellectual Bargain Shopping, by Jeffrey Veen To predict the behavior of ordinary people in advance, you only have to assume that they will always try to escape a disagreeable situation with the smallest possible expenditure of intelligence. &#8211; Friedrich Nietzsche Still, to this day, I am presented with the tired old argument that &#8220;users are [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.veen.com/jeff/archives/000901.html">Intellectual Bargain Shopping, by Jeffrey Veen</a></p>
<blockquote>
<blockquote><p>To predict the behavior of ordinary people in advance, you only have to assume that they will always try to escape a disagreeable situation with the smallest possible expenditure of intelligence.     &#8211; Friedrich Nietzsche  </p></blockquote>
<p>Still, to this day, I am presented with the tired old argument that &#8220;users are stupid&#8221; &#8211; that the hubris of developers and designers somehow trumps investment in usable products.  I love how this quote turns the tables. Users aren&#8217;t stupid, they&#8217;re efficient. They&#8217;re spending the least amount of effort (i.e. intelligence) as they possible can on each step of the goal they&#8217;re trying to achieve. If you make them spend more, they&#8217;ll go somewhere else &#8211; it&#8217;s like intellectual bargain shopping.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://jordanbrock.com/2006/07/11/smallest-possible-expenditure-of-intelligence/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

