<?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>I ticked the wrong box &#187; ruby</title>
	<atom:link href="http://hamishrickerby.com/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://hamishrickerby.com</link>
	<description>Computer says...</description>
	<lastBuildDate>Fri, 23 Jul 2010 07:46:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Passenger (Ruby on Rails) + PHP on OSX</title>
		<link>http://hamishrickerby.com/2009/08/15/passenger-ruby-on-rails-php-on-osx/</link>
		<comments>http://hamishrickerby.com/2009/08/15/passenger-ruby-on-rails-php-on-osx/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 10:06:53 +0000</pubDate>
		<dc:creator>Hamish Rickerby</dc:creator>
				<category><![CDATA[apple]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://hamishrickerby.com/?p=391</guid>
		<description><![CDATA[I&#8217;ve spent the last hour or so trying various things out to get passenger and PHP to play nicely together on my mac under OS X (Leopard) and apache2. The situation I was finding was that PHP apps would run, but only if you explicitly call the script (ie index.php) rather than just the directory. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve spent the last hour or so trying various things out to get passenger and PHP to play nicely together on my mac under OS X (Leopard) and apache2.</p>
<p>The situation I was finding was that PHP apps would run, but only if you explicitly call the script (ie <tt>index.php</tt>) rather than just the directory.  If you called the directory, passenger would take over and give me a rails routing error.</p>
<p>The issue was to do with the passenger vhosts configuration.  On my machine I have an number of ruby on rails apps configured with the passenger preferences pane (creating vhost entries within <tt>/private/etc/apache2/passenger_pane_vhosts/</tt>.  I have enabled user_dirs, so that the users of my machine&#8217;s pages (and other apps) are served from their <tt>~username/Sites</tt> directory.</p>
<p>My users configuration info for apache is installed in <tt>/private/etc/apache2/users/</tt>, and the instructions to load the configuration from that directory is stored within <tt>/private/etc/apache2/extra/httpd-userdir.conf</tt> (content below).</p>
<pre class="brush: bash;">
# Settings for user home directories
#
# Required module: mod_userdir
#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.  Note that you must also set
# the default access control for these directories, as in the example below.
#
UserDir Sites
#
# Users might not be in /Users/*/Sites, so use user-specific config files.
#
Include /private/etc/apache2/users/*.conf
</pre>
<p>To get everything working together nicely, I merely wrapped this inside a vhosts configuration directive, and gave it a ServerName of localhost &#8211; so that this vhost would be the one that responds to requests for localhost, rather than some random passenger vhost assuming it was the boss of everything.  New <tt>/private/etc/apache2/extra/httpd-userdir.conf</tt> below.</p>
<pre class="brush: bash;">
&lt;VirtualHost *:80&gt;
  ServerName localhost
  UserDir Sites
  Include /private/etc/apache2/users/*.conf
&lt;/VirtualHost&gt;
</pre>
<p>Thanks to this, all of my rails apps are served under passenger, and I can have static HTML, PHP and camping apps (previously configured &#8211; nothing to do with the above) all served from within my <tt>~username/Sites</tt> directory.</p>
<p>Hope this helps someone.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-2696058307997556";
/* 468x60, created 29/07/09 */
google_ad_slot = "3174546356";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://hamishrickerby.com/2009/08/15/passenger-ruby-on-rails-php-on-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Undefined method rewind and rails 2.3.3</title>
		<link>http://hamishrickerby.com/2009/08/04/undefined-method-rewind-and-rails-2-3-3/</link>
		<comments>http://hamishrickerby.com/2009/08/04/undefined-method-rewind-and-rails-2-3-3/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 19:06:29 +0000</pubDate>
		<dc:creator>Hamish Rickerby</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://hamishrickerby.com/?p=381</guid>
		<description><![CDATA[Today I updated a project I&#8217;m working on from rails 2.2.something to 2.3.3. Then, I started getting the following wacky error. undefined method `rewind' for #&#60;TCPSocket:0x3631e58&#62; Turns out if you see this after a rails 2.3.3 update, you might just need a phusion passenger update (I was on passenger 2.1.3, apparently this error happens on [...]]]></description>
			<content:encoded><![CDATA[<p>Today I updated a project I&#8217;m working on from rails 2.2.something to 2.3.3.  Then, I started getting the following wacky error.</p>
<p><code><br />
undefined method `rewind' for #&lt;TCPSocket:0x3631e58&gt;<br />
</code></p>
<p>Turns out if you see this after a rails 2.3.3 update, you might just need a phusion passenger update (I was on passenger 2.1.3, apparently this error happens on passenger 2.1.2 too)</p>
<p><code><br />
sudo gem update passenger<br />
sudo passenger-install-apache2-module<br />
</code></p>
<p>Put the lines recommended by the install script in your apache config file, restart apache and you&#8217;re good to go.</p>
<p>Hope this helps someone.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-2696058307997556";
/* 468x60, created 29/07/09 */
google_ad_slot = "3174546356";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://hamishrickerby.com/2009/08/04/undefined-method-rewind-and-rails-2-3-3/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Feedzirra</title>
		<link>http://hamishrickerby.com/2009/03/20/feedzirra/</link>
		<comments>http://hamishrickerby.com/2009/03/20/feedzirra/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 07:51:46 +0000</pubDate>
		<dc:creator>Hamish Rickerby</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://hamishrickerby.com/?p=313</guid>
		<description><![CDATA[Feedzirra is an RSS feed fetching and parsing library that I quite like. For a project I&#8217;m working on with a mate we need to be able to parse and receive updates from (potentially) a large number of RSS feeds. Feedzirra seemed the ticket, but didn&#8217;t have support for itunes style RSS feeds &#8211; so [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://github.com/pauldix/feedzirra/tree/master">Feedzirra</a> is an RSS feed fetching and parsing library that I quite like.  For a project I&#8217;m working on with a mate we need to be able to parse and receive updates from (potentially) a large number of RSS feeds.  Feedzirra seemed the ticket, but didn&#8217;t have support for itunes style RSS feeds &#8211; so I added it.  </p>
<p>This was basically my first (well, second, but that wasn&#8217;t public) go with github, and first contribution to an open source project.  <a href="http://www.pauldix.net/2009/03/feedzirra-release-adds-simple-custom-parsing-and-more.html">Paul Dix accepted my code</a>, and I&#8217;m oddly excited about it all.</p>
<p>AND to make things even better, someone has already started to enhance my contribution.  Woo hoo!</p>
]]></content:encoded>
			<wfw:commentRss>http://hamishrickerby.com/2009/03/20/feedzirra/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dealing with SemanticHacker in Ruby</title>
		<link>http://hamishrickerby.com/2009/02/26/dealing-with-semantichacker-in-ruby/</link>
		<comments>http://hamishrickerby.com/2009/02/26/dealing-with-semantichacker-in-ruby/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 19:42:04 +0000</pubDate>
		<dc:creator>Hamish Rickerby</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://hamishrickerby.com/?p=292</guid>
		<description><![CDATA[I&#8217;m having a bit of a play with SemanticHacker at the moment, seeing what their service thinks of some text I&#8217;m poking at it. To make this a bit simpler I created a small ruby lib that wraps their API to make my life a little easier. And hopefully it&#8217;ll make someone elses life easier [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m having a bit of a play with <a href="http://www.semantichacker.com/">SemanticHacker</a> at the moment, seeing what their service thinks of some text I&#8217;m poking at it.  To make this a bit simpler I created a small ruby lib that wraps their API to make my life a little easier.  And hopefully it&#8217;ll make someone elses life easier &#8211; enjoy.</p>
<p>(It requires <a href="http://github.com/why/hpricot/tree/master">hpricot</a> for XML parsing &#8211; make sure it&#8217;s installed)</p>
<pre class="brush: ruby;">
require 'rubygems'
require 'hpricot'
require 'cgi'
require 'open-uri'

class SemanticHacker

  URL = &quot;http://api.semantichacker.com&quot;
  attr_accessor :token, :doc, :content

  def initialize(token)
    @token = token
  end

  def get_signature(content)
    @content = ::CGI::escape(content)
    url = &quot;#{URL}/#{@token}/signature?content=#{@content}&quot;
    @doc = Hpricot.XML(open(url))
  end

  def get_concepts(content)
    @content = ::CGI::escape(content)
    url = &quot;#{URL}/#{@token}/concept?content=#{@content}&quot;
    @doc = Hpricot.XML(open(url))
  end

  def get_categories(content)
    @content = ::CGI::escape(content)
    url = &quot;#{URL}/#{@token}/category?content=#{@content}&quot;
    @doc = Hpricot.XML(open(url))
  end

  def type
    (doc/:response/:about/:systemType).inner_html
  end

  def config_id
    (doc/:response/:about/:configId).inner_html
  end

  def categories
    response = []
    (doc/:response/:categorizer/:categorizerResponse/:categories/:category).each do |item|
      response &lt;&lt; {:id =&gt; item.attributes['id'], :weight =&gt; item.attributes['weight']}
    end
    response
  end

  def concepts
    response = []
    (doc/:response/:conceptExtractor/:conceptExtractorResponse/:concepts/:concept).each do |item|
      response &lt;&lt; {:label =&gt; item.attributes['label'], :weight =&gt; item.attributes['weight']}
    end
    response
  end

  def signatures
    response = []
    (doc/:response/:siggen/:siggenResponse/:signature/:dimension).each do |item|
      response &lt;&lt; {:index =&gt; item.attributes['index'], :weight =&gt; item.attributes['weight']}
    end
    response
  end

end
</pre>
<p>And to make things happen</p>
<pre class="brush: ruby;">
sh = SemanticHacker.new("mysecrettoken")
sh.get_signature("Wow!  Some semantic analysis on my text")
puts sh.signatures.inspect
#returns an array of hashes with the weights and indexes of the categories
</pre>
]]></content:encoded>
			<wfw:commentRss>http://hamishrickerby.com/2009/02/26/dealing-with-semantichacker-in-ruby/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Firefox 3.0.3 and 500 Internal Errors with Javascript</title>
		<link>http://hamishrickerby.com/2008/10/26/firefox-303-and-500-internal-errors-with-javascript/</link>
		<comments>http://hamishrickerby.com/2008/10/26/firefox-303-and-500-internal-errors-with-javascript/#comments</comments>
		<pubDate>Sun, 26 Oct 2008 11:20:27 +0000</pubDate>
		<dc:creator>Hamish Rickerby</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://hamishrickerby.com/?p=259</guid>
		<description><![CDATA[I had a very confusing situation today with a multipart form that was for uploading a picture to a new web service I&#8217;m working on. In Safari the form upload worked. Even in Internet Explorer 6 the form upload worked (after I fixed the dodgy MIME-type that IE passes through for JPG images &#8211; image/pjpeg for [...]]]></description>
			<content:encoded><![CDATA[<p>I had a very confusing situation today with a multipart form that was for uploading a picture to a new web service I&#8217;m working on.</p>
<p>In Safari the form upload worked. Even in Internet Explorer 6 the form upload worked (after I fixed the dodgy MIME-type that IE passes through for JPG images &#8211; image/pjpeg for those interested).</p>
<p>The form I was trying to submit had the multipart attribute set correctly, and also had some javascript to disable the file selection, form submission button, and show a spinner to indicate that something is happening, and they don&#8217;t try and submit the file twice if they&#8217;re sending in a large image.</p>
<p>My submit tag orginally looked like this (Ruby on Rails)</p>
<pre class="brush: ruby;">

&lt;%= submit_tag 'Upload Photo', :class =&gt; &quot;formbutton&quot;, :id =&gt; &quot;submit-button&quot;, <img src='http://hamishrickerby.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> nClick =&gt; &quot;$('upload-form').submit();Form.disable('upload-form');Effect.toggle('footnote', 'appear', {duration: 0});Effect.toggle('spinner', 'appear', {duration: 0});&quot; %&gt;
</pre>
<p>I was very confused as it did work in those other browsers, but not in Firefox.</p>
<p>The key to fixing this was to add return false; to the end of the javascript statement&#8230;</p>
<pre class="brush: ruby;">

&lt;%= submit_tag 'Upload Photo', :class =&gt; &quot;formbutton&quot;, :id =&gt; &quot;submit-button&quot;, <img src='http://hamishrickerby.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> nClick =&gt; &quot;$('upload-form').submit();Form.disable('upload-form');Effect.toggle('footnote', 'appear', {duration: 0});Effect.toggle('spinner', 'appear', {duration: 0});return false;&quot; %&gt;
</pre>
<p>What I find particularly confusing about this is that everything I read on the &#8220;return false;&#8221; statement leads me to believe that this form should not be submitted &#8211; however &#8211; return true does not work (500 Internal Server Error returned). But what the hey &#8211; it works.</p>
]]></content:encoded>
			<wfw:commentRss>http://hamishrickerby.com/2008/10/26/firefox-303-and-500-internal-errors-with-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Radiant CMS Tutorial &#8211; Custom Javascript in Admin Pages</title>
		<link>http://hamishrickerby.com/2008/08/15/radiant-cms-tutorial-custom-javascript-in-admin-pages/</link>
		<comments>http://hamishrickerby.com/2008/08/15/radiant-cms-tutorial-custom-javascript-in-admin-pages/#comments</comments>
		<pubDate>Fri, 15 Aug 2008 19:00:45 +0000</pubDate>
		<dc:creator>Hamish Rickerby</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://hamishrickerby.com/?p=245</guid>
		<description><![CDATA[At the moment I&#8217;m working on a fairly complex extension for Radiant CMS. In creating the administrative pages I want to use a javascript library that is not distributed with the core radiant code. This post will describe how to implement your own extension that can use an external javascript library, without playing around with any [...]]]></description>
			<content:encoded><![CDATA[<p>At the moment I&#8217;m working on a fairly complex extension for <a href="http://radiantcms.org/" target="_blank">Radiant CMS</a>. In creating the administrative pages I want to use a javascript library that is not distributed with the core radiant code. This post will describe how to implement your own extension that can use an external javascript library, without playing around with any of the core radiant files to inject the javascript into the administrative layout.</p>
<p>It&#8217;s actually really easy to do.  If you haven&#8217;t created a Radiant extension before I&#8217;d recommend following <a href="http://wiki.radiantcms.org/Creating_Radiant_Extensions" target="_blank">this tutorial</a> on the <a href="http://wiki.radiantcms.org" target="_blank">Radiant wiki</a>.</p>
<p>Inside the Radiant GEM, the standard page layout resides at app/views/layouts/application.html.haml</p>
<p>The lines of code that insert the javascript tags are:</p>
<pre class="brush: ruby;">
- @javascripts.uniq.each do |javascript|
  = javascript_include_tag javascript
</pre>
<p>The @javascripts variable is populated from inside the app/controllers/application_controller.rb file. The culprit is below.</p>
<pre class="brush: ruby;">
def include_javascript(script)
  @javascripts &lt;&lt; script
end
</pre>
<p>Pretty simple huh? So, all you need to do, is call this method from within your new controller, because all controllers inherit from the application_controller.rb file, so they have access to this method, and you can have different javascript included for each method if you so wish. In (assuming the example LinkRoll extension was built as linked above) vendor/extensions/link_roll/app/controllers/admin/links_controller.rb</p>
<pre class="brush: ruby;">
def index
  include_javascript(&quot;admin/mootools-1.2-core-yc.js&quot;)
  @links = Link.find(:all)
end
</pre>
<p>That will insert a link to admin/mootools-1.2-core-yc.js inside the admin/links/index page. Righto, so now the only thing left to do is get the mootools-1.2-core-yc.js file into the actual public/javascripts/admin directory within the project. What you want to do is alter the vendor/extensions/link_roll/link_roll_extension.rb file so that within the activate method the file is copied over. I&#8217;d recommend making a public/javascripts/admin directory within your extension folder, and putting the file in there. Then, when activate is called on the link_roll_extension.rb file, the activate method will copy the file over to the projects public/javascripts/admin directory. You should also delete the file when the deactivate method is called in the link_roll_extension.rb file.</p>
<p>Questions and comments please!</p>
]]></content:encoded>
			<wfw:commentRss>http://hamishrickerby.com/2008/08/15/radiant-cms-tutorial-custom-javascript-in-admin-pages/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mnemonic Password Generator &#8211; a la Ruby</title>
		<link>http://hamishrickerby.com/2008/05/31/mnemonic-password-generator-a-la-ruby/</link>
		<comments>http://hamishrickerby.com/2008/05/31/mnemonic-password-generator-a-la-ruby/#comments</comments>
		<pubDate>Sat, 31 May 2008 16:34:49 +0000</pubDate>
		<dc:creator>Hamish Rickerby</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://hamishrickerby.com/work/2008/05/31/mnemonic-password-generator-a-la-ruby/</guid>
		<description><![CDATA[I wanted to have a mnenonic password generator for a little application that I&#8217;m writing in ruby, and couldn&#8217;t find one out there. So, I rolled my own. Actually, it&#8217;s a knock-off of a Python one I found, but that doesn&#8217;t really matter. Do with this what you will. Hope it&#8217;s useful to someone. def [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to have a mnenonic password generator for a little application that I&#8217;m writing in ruby, and couldn&#8217;t find one out there.  So, I rolled my own.  Actually, it&#8217;s a knock-off of a <a href="http://homework.nwsnet.de/">Python one I found</a>, but that doesn&#8217;t really matter.</p>
<p>Do with this what you will.  Hope it&#8217;s useful to someone.</p>
<pre class="brush: ruby;">
def generateMnemonicPassword(letters=8, digits=4)
consonants = &quot;bdfghklmnprstvwz&quot;
vowels = &quot;aeiou&quot;
password = &quot;&quot;
(1 .. letters).each do |i|
range = i%2 == 1 ? consonants : vowels
password = password + range[rand(range.length), 1]
end
(1 .. digits).each do |i|
password = password + rand(10).to_s
end
password
end
</pre>
<p>It outputs fun and pronounceable passwords such as tepelopu8058, vonobuba6145 and kipowetu0270.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://hamishrickerby.com/2008/05/31/mnemonic-password-generator-a-la-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Time for the big upgrade</title>
		<link>http://hamishrickerby.com/2008/01/30/time-for-the-big-upgrade/</link>
		<comments>http://hamishrickerby.com/2008/01/30/time-for-the-big-upgrade/#comments</comments>
		<pubDate>Wed, 30 Jan 2008 21:33:50 +0000</pubDate>
		<dc:creator>Hamish Rickerby</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://hamishrickerby.com/play/2008/01/30/time-for-the-big-upgrade/</guid>
		<description><![CDATA[Righto, I&#8217;ve been putting it off long enough. Got the GiST has been running on rails 1.1.6 almost since it has been launched, and I&#8217;d like to take advantage on some of that RESTful 2.0 goodness. So, I&#8217;ve decided it&#8217;s time to upgrade it. I&#8217;ve got a couple of issues though. I currently use (shhhh, [...]]]></description>
			<content:encoded><![CDATA[<p>Righto, I&#8217;ve been putting it off long enough.  <a href="http://gotthegist.co.nz">Got the GiST</a> has been running on rails 1.1.6 almost since it has been launched, and I&#8217;d like to take advantage on some of that RESTful 2.0 goodness.  So, I&#8217;ve decided it&#8217;s time to upgrade it.</p>
<p>I&#8217;ve got a couple of issues though.  I currently use (shhhh, I&#8217;m about to say a dirty word) <em>Engines</em> to handle my user logins and roles&#8230;  They don&#8217;t work with much past rails 1.1.6.  I also don&#8217;t have good admin screens on the application, and whenever I need to do maintenance (which is very rare) I need to go and edit the database directly <img src='http://hamishrickerby.com/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> </p>
<p>So, there are a number of things that I want to do to the app.</p>
<ol>
<li>Upgrade to Rails 2.0.2</li>
<li>Convert my user login goodies to use <a href="http://technoweenie.stikipad.com/plugins/show/Acts+as+Authenticated">acts_as_authenticated</a></li>
<li>Get another way to handle roles</li>
<li>Implement <a href="http://streamlinedframework.org/">Streamlined</a> for admin screens</li>
<li>Write some tests &#8211; I&#8217;ve was a bit slack when I initially wrote <a href="http://gotthegist.co.nz">Got the GiST</a></li>
<li>Refactor my code &#8211; this goes without saying &#8211; some of it is a bit shabby</li>
</ol>
<p>The main issue I have is that I&#8217;m not sure what order I want to do this in.  The issue that I have is there are a number of dependencies.  For example, old-style Engines doesn&#8217;t work past 1.1.6 &#8211; and I have my complete login and role system built around that.  <a href="http://streamlinedframework.org/">streamlined</a> don&#8217;t appear to work with Rails 1.1.x.  <a href="http://technoweenie.stikipad.com/plugins/show/Acts+as+Authenticated">acts_as_authenticated</a> requires a simple bit of script hackery to work with 1.1.6, so that might be able to come early&#8230;  </p>
<p>I think what I&#8217;m going to do is drop Engines ASAP.  That&#8217;s the main cause of my pain.  I need to recreate with acts_as_authenticated essentially the same methods for authentication as login_engine currently has, as well as find a (perhaps temporary) solution to my roles issues.  Then I&#8217;ll set about writing tests.  Next step I think could be to upgrade to 1.2.6, and then implement <a href="http://streamlinedframework.org/">streamlined</a>. I think I&#8217;ll then be ready for a migration to Rails 2.0.</p>
<p>Unless someone else has a much better suggestion!</p>
]]></content:encoded>
			<wfw:commentRss>http://hamishrickerby.com/2008/01/30/time-for-the-big-upgrade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>scRUBYt &#8211; Hot, New Ruby Web-Scraping Toolkit Released</title>
		<link>http://hamishrickerby.com/2007/02/06/scrubyt-hot-new-ruby-web-scraping-toolkit-released/</link>
		<comments>http://hamishrickerby.com/2007/02/06/scrubyt-hot-new-ruby-web-scraping-toolkit-released/#comments</comments>
		<pubDate>Tue, 06 Feb 2007 21:43:05 +0000</pubDate>
		<dc:creator>Hamish Rickerby</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://hamishrickerby.com/blog/2007/02/06/scrubyt-hot-new-ruby-web-scraping-toolkit-released/</guid>
		<description><![CDATA[scRUBYt &#8211; Hot, New Ruby Web-Scraping Toolkit Released Peter Cooper over at rubyinside.com has recently blogged about scRUBYt &#8211; a new ruby based web scraping toolkit. It looks super-powerful. Basically, you define an extractor, which can pull HTML (even including posting form data, such as product searches), click on links, pull content from the page [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.rubyinside.com/scrubyt-hot-new-ruby-web-scraping-toolkit-released-378.html">scRUBYt &#8211; Hot, New Ruby Web-Scraping Toolkit Released<br />
</a><br />
Peter Cooper over at <a href="http://rubyinside.com">rubyinside.com</a> has recently blogged about <a href="http://scrubyt.org/">scRUBYt</a> &#8211; a new ruby based web scraping toolkit.</p>
<p>It looks super-powerful.</p>
<p>Basically, you define an extractor, which can pull HTML (even including posting form data, such as product searches), click on links, pull content from the page and create XML with it.</p>
<p>What I particularly like about this is now this gives developers the ability to <em>very simply</em> include content from sites that aren&#8217;t mashup-friendly (ie, REST or SOAP APIs).  I mean, it was of course possible before, but this just seems so much easier.  No-ones content is safe!</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-2696058307997556";
/* 468x60, created 29/07/09 */
google_ad_slot = "3174546356";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://hamishrickerby.com/2007/02/06/scrubyt-hot-new-ruby-web-scraping-toolkit-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lonely, lonely classes</title>
		<link>http://hamishrickerby.com/2007/01/12/lonely-lonely-classes/</link>
		<comments>http://hamishrickerby.com/2007/01/12/lonely-lonely-classes/#comments</comments>
		<pubDate>Fri, 12 Jan 2007 23:19:15 +0000</pubDate>
		<dc:creator>Hamish Rickerby</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://hamishrickerby.com/blog/2007/01/12/lonely-lonely-classes/</guid>
		<description><![CDATA[I just had my most pleasant experience with Singletons ever. I had a little problem I was trying to solve in ruby, and I contacted a friend of mine who is quite a good developer. He suggested I should be looking at global variables, to static (class) variables, or singletons. I gave globals a go, [...]]]></description>
			<content:encoded><![CDATA[<p>I just had my most pleasant experience with Singletons ever.  I had a little problem I was trying to solve in ruby, and I contacted a friend of mine who is quite a good developer.  He suggested I should be looking at global variables, to static (class) variables, or singletons.  I gave globals a go, and they didn&#8217;t give me the love I expected, so I said &#8220;bye bye&#8221; to them &#8211; probably never to be used again.  I next tried Singletons.</p>
<p>Ruby defines a Singleton module.  This is mixin&#8217;d with your code thusly:</p>
<pre class="brush: ruby;">
class Lonely
include Singleton
end
</pre>
<p>Easy peasy.</p>
<p>That, creates a singleton of Lonely for you.  The include modifies the signatures of the new and allocate Class methods (Lonely.new and Lonely.allocate) to be private, and creates (or modifies) some other methods to provide some loveliness (gory details to be found at <a href="http://www.ruby-doc.org/stdlib/libdoc/singleton/rdoc/index.html">http://www.ruby-doc.org/stdlib/libdoc/singleton/rdoc/index.html</a>).</p>
<p>Basically, then all you need to do is call the instance method of the class you have created.</p>
<pre class="brush: ruby;">
m = Lonely.instance
</pre>
<p>And then you can use m as you like.  You can create more</p>
<pre class="brush: ruby;">
m = Lonely.instance
n = Lonely.instance
</pre>
<p>And m and n refer to the same instance.  Nice Singleton.  No need for me to check out class variables.  I think my Singleton will be more portable.  BTW &#8211; Don&#8217;t try to .new your class &#8211; you&#8217;ll get a NoMethodError thrown as the new method has been made private by the mixin.</p>
<p>Ruby rocks.</p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-2696058307997556";
/* 468x60, created 29/07/09 */
google_ad_slot = "3174546356";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>
]]></content:encoded>
			<wfw:commentRss>http://hamishrickerby.com/2007/01/12/lonely-lonely-classes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
