<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>RubyGreenBlue::Blog general</title>
    <link>http://blog.rubygreenblue.com/</link>
    <pubDate>Thu Mar 13 08:55:00 +1100 2008</pubDate>
    <description>RubyGreenBlue::Blog</description>
    <item>
      <title>New Photo Blog</title>
      <link>http://blog.rubygreenblue.com/blog/article/announcing_my_new_photo_blog</link>
      <description>&lt;p&gt;Not really Ruby related, but I'd like to announce the existence of my new &lt;a href="http://blog.keithrowell.com"&gt;photography weblog&lt;/a&gt;. Taking photos is a passion for me and I'm excited to have a new outlet for that passion in the form of a weblog. &lt;/p&gt;

&lt;p&gt;I look forward to posting images from shoots there as well as photography tips and whatever else it evolves into.&lt;/p&gt;</description>
      <pubDate>Thu Mar 13 08:55:00 +1100 2008</pubDate>
      <guid>http://blog.rubygreenblue.com/blog/article/announcing_my_new_photo_blog</guid>
      <author>keith</author>
    </item>
    <item>
      <title>External diff with Subversion using BBEdit</title>
      <link>http://blog.rubygreenblue.com/blog/article/subversion_external_diff</link>
      <description>&lt;p&gt;BBEdit has a great Find Differences function. You get a list of description of differences that you can click on to see the two affected files. You can also do things like apply the difference to either the new or the old file. &lt;/p&gt;

&lt;p&gt;Subversion's differences output is of course command-line only, but subversion does support using external diff tools.&lt;/p&gt;

&lt;p&gt;Enter &lt;a href="http://daringfireball.net/projects/bbdiff/"&gt;bbdiff&lt;/a&gt; from John Gruber.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;bbdiff&lt;/code&gt; is a command line interface to BBEdit's Find Differences command.&lt;/p&gt;

&lt;p&gt;Download &lt;a href="http://daringfireball.net/projects/bbdiff/"&gt;bbdiff&lt;/a&gt; from John Gruber's site, and follow his install instructions (very easy, copy it to where you want it and &lt;code&gt;chmod&lt;/code&gt; it to be executable)&lt;/p&gt;

&lt;p&gt;You will need to setup subversion to actually use an external diff command. To do this we will need to write a quick interface between the &lt;code&gt;svn diff&lt;/code&gt; command and the &lt;code&gt;bbdiff&lt;/code&gt; command as the argument lists do not match.&lt;/p&gt;

&lt;p&gt;The arguments we want from the &lt;code&gt;svn diff&lt;/code&gt; command are &lt;code&gt;$6&lt;/code&gt; (old file) and &lt;code&gt;$7&lt;/code&gt; (new file).&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;bbdiff&lt;/code&gt; usage states:&lt;/p&gt;

&lt;span class="ruby_source"&gt; &lt;pre&gt;&lt;span class="constant"&gt;Usage&lt;/span&gt;&lt;span class="punct"&gt;:&lt;/span&gt; &lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="regex"&gt;usr&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;local&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;bin&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;bbdiff&lt;/span&gt; &lt;span class="punct"&gt;[-&lt;/span&gt;&lt;span class="ident"&gt;b&lt;/span&gt; &lt;span class="punct"&gt;-&lt;/span&gt;&lt;span class="ident"&gt;i&lt;/span&gt; &lt;span class="punct"&gt;-&lt;/span&gt;&lt;span class="ident"&gt;s&lt;/span&gt;&lt;span class="punct"&gt;]&lt;/span&gt; &lt;span class="ident"&gt;oldfile&lt;/span&gt; &lt;span class="ident"&gt;newfile&lt;/span&gt;
&lt;span class="punct"&gt;-&lt;/span&gt;&lt;span class="ident"&gt;b&lt;/span&gt; &lt;span class="ident"&gt;keep&lt;/span&gt; &lt;span class="constant"&gt;BBEdit&lt;/span&gt; &lt;span class="keyword"&gt;in&lt;/span&gt; &lt;span class="ident"&gt;the&lt;/span&gt; &lt;span class="ident"&gt;background&lt;/span&gt;
&lt;span class="punct"&gt;-&lt;/span&gt;&lt;span class="ident"&gt;i&lt;/span&gt; &lt;span class="keyword"&gt;case&lt;/span&gt; &lt;span class="ident"&gt;insensitive&lt;/span&gt; &lt;span class="ident"&gt;comparison&lt;/span&gt;
&lt;span class="punct"&gt;-&lt;/span&gt;&lt;span class="ident"&gt;s&lt;/span&gt; &lt;span class="ident"&gt;ignore&lt;/span&gt; &lt;span class="ident"&gt;leading&lt;/span&gt; &lt;span class="keyword"&gt;and&lt;/span&gt; &lt;span class="ident"&gt;trailing&lt;/span&gt; &lt;span class="ident"&gt;whitespace&lt;/span&gt; &lt;span class="ident"&gt;on&lt;/span&gt; &lt;span class="ident"&gt;lines&lt;/span&gt;
&lt;/pre&gt;&lt;/span&gt;

&lt;p&gt;So we see that we need to pass in params &lt;code&gt;$6&lt;/code&gt; and &lt;code&gt;$7&lt;/code&gt; from the &lt;code&gt;svn diff&lt;/code&gt; command in the order that they appear. Write a script that calls &lt;code&gt;bbdiff&lt;/code&gt; with those params. Mine is called &lt;code&gt;svndiff2bbdiff&lt;/code&gt;:&lt;/p&gt;

&lt;span class="ruby_source"&gt; &lt;pre&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="regex"&gt;usr&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;local&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;bin&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;bbdiff&lt;/span&gt; &lt;span class="global"&gt;$6&lt;/span&gt; &lt;span class="global"&gt;$7&lt;/span&gt;
&lt;/pre&gt;&lt;/span&gt;

&lt;p&gt;Make sure you &lt;code&gt;chmod&lt;/code&gt; your &lt;code&gt;svndiff2bbdiff&lt;/code&gt; file to be executable (&lt;code&gt;chmod +x svndiff2bbdiff&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;In your &lt;code&gt;~/.subversion/config&lt;/code&gt; file, search for the &lt;code&gt;[helpers]&lt;/code&gt; section and create a line like:&lt;/p&gt;

&lt;span class="ruby_source"&gt; &lt;pre&gt;&lt;span class="ident"&gt;diff&lt;/span&gt;&lt;span class="punct"&gt;-&lt;/span&gt;&lt;span class="ident"&gt;cmd&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="regex"&gt;usr&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;local&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;bin&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;svndiff2bbdiff&lt;/span&gt;
&lt;/pre&gt;&lt;/span&gt;

&lt;p&gt;assuming your &lt;code&gt;svndiff2bbdiff&lt;/code&gt; is in &lt;code&gt;/usr/local/bin/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Test it out: &lt;code&gt;svn diff -r PREV &amp;lt;file_name&amp;gt;&lt;/code&gt;. &lt;/p&gt;</description>
      <pubDate>Thu Sep 14 01:02:18 +1000 2006</pubDate>
      <guid>http://blog.rubygreenblue.com/blog/article/subversion_external_diff</guid>
      <author>keith</author>
    </item>
    <item>
      <title>No Database? Sometimes it feels right.</title>
      <link>http://blog.rubygreenblue.com/blog/article/no_database</link>
      <description>&lt;p&gt;In &lt;a href="http://www.tbray.org/ongoing/When/200x/2006/07/17/No-Databases"&gt;No Database&lt;/a&gt;, Tim Bray talks about why he doesn't want to use a database for storing comments in a blog system.&lt;/p&gt;

&lt;p&gt;Tim says:&lt;/p&gt;

&lt;blockquote&gt;
    &lt;p&gt;...there is a psychology out there in our profession,which says: if you have data that you want to store and retrieve, that means you need a database. But sometimes you don&#8217;t. And sometimes you come out ahead on one or both of the less-work and runs-fast metrics by not having one.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I agree with Tim here. I'm not saying no databases, ever! I use databases almost all the time, but there are times when not using a database feels like the right way to do it. It's all a matter of the requirements and what you are modeling.&lt;/p&gt;

&lt;p&gt;This blog runs on a system that uses subversion to store it's data. To edit posts I don't need to use a web interface or some client talking to a database. I just edit files. &lt;/p&gt;

&lt;p&gt;This gives me the freedom to edit my posts in my &lt;a href="http://macromates.com"&gt;favourite text editor&lt;/a&gt; from anywhere I like. I just need a working copy of my blog repository. And of course with subversion I can edit offline.&lt;/p&gt;

&lt;p&gt;As Tim does, I like the semantics of the Unix filesystem and for writing blog articles, it just feels totally right for me.&lt;/p&gt;</description>
      <pubDate>Tue Aug 29 22:08:00 +1000 2006</pubDate>
      <guid>http://blog.rubygreenblue.com/blog/article/no_database</guid>
      <author>keith</author>
    </item>
    <item>
      <title>Public Key Authentication with SSH</title>
      <link>http://blog.rubygreenblue.com/blog/article/public_key_authentication</link>
      <description>&lt;p&gt;Here's how to setup public key authentication over ssh.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Generate the keys&lt;/p&gt;

&lt;p&gt;First create a directory on your local machine &lt;code&gt;~.ssh/&lt;/code&gt; if it is not already there.&lt;/p&gt;

&lt;span class="ruby_source"&gt; &lt;pre&gt;&lt;span class="ident"&gt;ssh&lt;/span&gt;&lt;span class="punct"&gt;-&lt;/span&gt;&lt;span class="ident"&gt;keygen&lt;/span&gt; &lt;span class="punct"&gt;-&lt;/span&gt;&lt;span class="ident"&gt;t&lt;/span&gt; &lt;span class="ident"&gt;dsa&lt;/span&gt;
&lt;span class="ident"&gt;ssh&lt;/span&gt;&lt;span class="punct"&gt;-&lt;/span&gt;&lt;span class="ident"&gt;keygen&lt;/span&gt; &lt;span class="punct"&gt;-&lt;/span&gt;&lt;span class="ident"&gt;t&lt;/span&gt; &lt;span class="ident"&gt;rsa&lt;/span&gt;
&lt;/pre&gt;&lt;/span&gt;

&lt;p&gt;ssh-keygen will ask for the filename to save to. Just press &lt;code&gt;ENTER&lt;/code&gt; to use the default values. It will then ask for a passphrase. A blank passphrase can be entered but this is obviously less secure and the same result can be achieved by using an ssh-agent.&lt;/p&gt;

&lt;p&gt;Private and public keys will then be generated. The public keys have a &lt;code&gt;.pub&lt;/code&gt; extension.&lt;/p&gt;

&lt;p&gt;Your private keys should be kept private so you should make sure they are only readable by you (&lt;code&gt;chmod 0600&lt;/code&gt;).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy the Keys&lt;/p&gt;

&lt;p&gt;Now you should copy the public keys to each machine you will want to connect to. The contents of the public key needs to be appended to &lt;code&gt;~.ssh/authorized_keys&lt;/code&gt; on the remote machine. You could upload them using scp then login to the remote machine and append the contents but these commands can do all of that from your local machine:&lt;/p&gt;

&lt;span class="ruby_source"&gt; &lt;pre&gt;&lt;span class="ident"&gt;cat&lt;/span&gt; &lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;ssh&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;id_dsa&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;pub&lt;/span&gt; &lt;span class="punct"&gt;|&lt;/span&gt; &lt;span class="ident"&gt;ssh&lt;/span&gt; &lt;span class="ident"&gt;username&lt;/span&gt;&lt;span class="attribute"&gt;@newmachine&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;cat &amp;gt;&amp;gt; .ssh/authorized_keys&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="ident"&gt;cat&lt;/span&gt; &lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;ssh&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;id_rsa&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;pub&lt;/span&gt; &lt;span class="punct"&gt;|&lt;/span&gt; &lt;span class="ident"&gt;ssh&lt;/span&gt; &lt;span class="ident"&gt;username&lt;/span&gt;&lt;span class="attribute"&gt;@newmachine&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;cat &amp;gt;&amp;gt; .ssh/authorized_keys&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;
&lt;/pre&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Configure the SSH daemon&lt;/p&gt;

&lt;p&gt;You need to make sure the SSH daemon (&lt;code&gt;sshd&lt;/code&gt;) is configured to allow the use of public keys.&lt;/p&gt;

&lt;span class="ruby_source"&gt; &lt;pre&gt;&lt;span class="ident"&gt;cd&lt;/span&gt; &lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;private&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;etc&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;
&lt;span class="ident"&gt;sudo&lt;/span&gt; &lt;span class="ident"&gt;vi&lt;/span&gt; &lt;span class="ident"&gt;sshd_config&lt;/span&gt;
&lt;/pre&gt;&lt;/span&gt;

&lt;p&gt;Make sure the &lt;code&gt;sshd_config&lt;/code&gt; file contains these options:&lt;/p&gt;

&lt;span class="ruby_source"&gt; &lt;pre&gt;&lt;span class="constant"&gt;PubkeyAuthentication&lt;/span&gt; &lt;span class="ident"&gt;yes&lt;/span&gt;
&lt;span class="constant"&gt;AuthorizedKeysFile&lt;/span&gt; &lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;ssh&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;authorized_keys&lt;/span&gt;
&lt;/pre&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Test it out:&lt;/p&gt;

&lt;span class="ruby_source"&gt; &lt;pre&gt;&lt;span class="ident"&gt;ssh&lt;/span&gt; &lt;span class="ident"&gt;username&lt;/span&gt;&lt;span class="attribute"&gt;@host&lt;/span&gt;
&lt;/pre&gt;&lt;/span&gt;

&lt;p&gt;You will now be asked for you passphrase (not your password for the remote machine). &lt;/p&gt;

&lt;p&gt;To avoid having to type in the passphrase, setup an ssh-agent which will effectively do that for you each time you connect to a remote machine that knows about public keys. If you're on a Mac, &lt;a href="http://www.mothersruin.com/software/SSHChain/"&gt;SSHChain&lt;/a&gt; is an excellent utility. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;</description>
      <pubDate>Fri Aug 25 21:08:00 +1000 2006</pubDate>
      <guid>http://blog.rubygreenblue.com/blog/article/public_key_authentication</guid>
      <author>keith</author>
    </item>
  </channel>
</rss>
