<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US">
  <id>tag:www.unwwwired.net,2005:/posts</id>
  <link type="text/html" rel="alternate" href="http://www.unwwwired.net" />
  
  <title>unwwwritten</title>
  <updated>2009-02-23T16:58:06-05:00</updated>
  <link>http://www.unwwwired.net/posts</link>
  <link rel="self" href="http://feeds.feedburner.com/unwwwritten/atom" type="application/atom+xml" /><entry>
    <id>tag:www.unwwwired.net,2005:Post/1068423053</id>
    <published>2009-02-23T16:58:06-05:00</published>
    <updated>2009-02-23T16:58:50-05:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/misguided_neatness" />
    <title>misguided neatness</title>
    <content type="html">&lt;p&gt;A minor complaint to get things going again...&lt;/p&gt;

&lt;p&gt;Why is it that programmers feel the need to line a series of assignments up in columns?&lt;/p&gt;

&lt;pre class="mac_classic"&gt;&lt;span class="line-numbers"&gt;   1 &lt;/span&gt; a.&lt;span class="FunctionName"&gt;id&lt;/span&gt;      &lt;span class="Keyword"&gt;=&lt;/span&gt; b.&lt;span class="FunctionName"&gt;id&lt;/span&gt;
&lt;span class="line-numbers"&gt;   2 &lt;/span&gt; a.&lt;span class="FunctionName"&gt;foo&lt;/span&gt;     &lt;span class="Keyword"&gt;=&lt;/span&gt; b.&lt;span class="FunctionName"&gt;foo&lt;/span&gt;
&lt;span class="line-numbers"&gt;   3 &lt;/span&gt; a.&lt;span class="FunctionName"&gt;baz&lt;/span&gt;     &lt;span class="Keyword"&gt;=&lt;/span&gt; b.&lt;span class="FunctionName"&gt;baz&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;This is a completely misguided effort.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/F8LQp2V7Oe4" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/1068423051</id>
    <published>2008-10-30T14:49:08-04:00</published>
    <updated>2008-10-30T15:02:36-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/the_chairman_of_the_bored" />
    <title>The chairman of the bored</title>
    <content type="html">&lt;p&gt;I bore easily.&lt;/p&gt;

&lt;p&gt;When doing something like watching TV, I tend to either channel surf, or hack, or program, or even read a book.&lt;/p&gt;

&lt;p&gt;So, when a (relatively) new technology that I have little or no exposure to seems to solve a problem that I have... I am drawn to it.&lt;/p&gt;

&lt;p&gt;In this case, I'm talking about &lt;a href="http://github.com/bmizerany/sinatra"&gt;sinatra&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Rails seemed to be serious overkill for one of my small side-projects, so I'm playing again.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/HUXViGEV60s" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/1068423050</id>
    <published>2008-10-16T05:20:41-04:00</published>
    <updated>2008-10-16T05:21:49-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/a_method_to_my_madness" />
    <title>A method to my madness</title>
    <content type="html">&lt;p&gt;Sorry for not posting more frequently of late, but between the basement flood and the house renovations, and numerous other excuses, I just have not had the time.&lt;/p&gt;

&lt;p&gt;Anyway, here's a few quick things...&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Spammers suck. Why do I need to deal with spam in my inbox?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Comment spammers suck even more. Why should my blog have to deal with spammers? I shouldn't have to add filters and moderation to my comments in order to keep blog comments to worthwhile posts only.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;github rocks! (still) I'm loving the collaborative aspect of it and the ease with which I can post things I'm working on. I especially love how easy it is to submit suggested changes to someone else's projects - I wish it were a bit easier to merge changes when someone submits them to my projects though, but that's probably my newb-ness with git in general.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;vi (vim) is still an awesome editor. However, something still is not quite right when it comes to projects, multiple files, find in project, etc. - I find myself with both vi and TextMate open to manage multiple contexts, for example a find in project in one and editing the unit tests in another.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I suspect a problem if you stumble upon the following pattern in your code...&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;pre class="mac_classic"&gt;&lt;span class="line-numbers"&gt;   1 &lt;/span&gt; &lt;span class="LibraryFunction"&gt;model&lt;/span&gt;.&lt;span class="FunctionName"&gt;method&lt;/span&gt; &lt;span class="Keyword"&gt;if&lt;/span&gt; &lt;span class="LibraryFunction"&gt;model&lt;/span&gt;.&lt;span class="FunctionName"&gt;is_a?&lt;/span&gt;(&lt;span class="Variable"&gt;ModelClass&lt;/span&gt;)
&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/wPIVBP5v86g" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/1068423049</id>
    <published>2008-09-11T05:54:47-04:00</published>
    <updated>2008-09-11T06:13:58-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/has_many_problems_with_validations" />
    <title>has_many problems with validations</title>
    <content type="html">&lt;p&gt;Today's gotcha has to do with using has_many and validations within the child model.&lt;/p&gt;

&lt;p&gt;In my use-case I need to create a parent record with one or more children.&lt;/p&gt;

&lt;p&gt;The parent is not valid without children and a child is not valid without a parent.&lt;/p&gt;

&lt;pre class="mac_classic"&gt;&lt;span class="line-numbers"&gt;   1 &lt;/span&gt; &lt;span class="Keyword"&gt;class&lt;/span&gt; &lt;span class="TypeName"&gt;Parent&lt;span class="InheritedClassName"&gt; &lt;span class="InheritedClassName"&gt;&amp;lt;&lt;/span&gt; ActiveRecord::Base&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;   2 &lt;/span&gt;   &lt;span class="LibraryFunction"&gt;has_many&lt;/span&gt; &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;children&lt;/span&gt;, &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;dependent&lt;/span&gt; =&amp;gt; &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;destroy&lt;/span&gt;
&lt;span class="line-numbers"&gt;   3 &lt;/span&gt;   &lt;span class="LibraryFunction"&gt;validate&lt;/span&gt; &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;must_have_children&lt;/span&gt;
&lt;span class="line-numbers"&gt;   4 &lt;/span&gt; &lt;span class="Keyword"&gt;protected&lt;/span&gt;
&lt;span class="line-numbers"&gt;   5 &lt;/span&gt;   &lt;span class="Keyword"&gt;def&lt;/span&gt; &lt;span class="FunctionName"&gt;must_have_children&lt;/span&gt;
&lt;span class="line-numbers"&gt;   6 &lt;/span&gt;     errors.&lt;span class="FunctionName"&gt;add_to_base&lt;/span&gt;(&lt;span class="String"&gt;&lt;span class="String"&gt;'&lt;/span&gt;must have at least one child&lt;span class="String"&gt;'&lt;/span&gt;&lt;/span&gt;) &lt;span class="Keyword"&gt;if&lt;/span&gt; children.&lt;span class="FunctionName"&gt;blank?&lt;/span&gt;
&lt;span class="line-numbers"&gt;   7 &lt;/span&gt;   &lt;span class="Keyword"&gt;end&lt;/span&gt;
&lt;span class="line-numbers"&gt;   8 &lt;/span&gt; &lt;span class="Keyword"&gt;end&lt;/span&gt;
&lt;span class="line-numbers"&gt;   9 &lt;/span&gt; 
&lt;span class="line-numbers"&gt;  10 &lt;/span&gt; &lt;span class="Keyword"&gt;class&lt;/span&gt; &lt;span class="TypeName"&gt;Child&lt;span class="InheritedClassName"&gt; &lt;span class="InheritedClassName"&gt;&amp;lt;&lt;/span&gt; ActiveRecord::Base&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;  11 &lt;/span&gt;   &lt;span class="LibraryFunction"&gt;belongs_to&lt;/span&gt; &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;parent&lt;/span&gt;
&lt;span class="line-numbers"&gt;  12 &lt;/span&gt;   &lt;span class="LibraryFunction"&gt;validates_presence_of&lt;/span&gt; &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;parent_id&lt;/span&gt;
&lt;span class="line-numbers"&gt;  13 &lt;/span&gt; &lt;span class="Keyword"&gt;end&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;So, how do you create them (taking into account the circular validation dependency above)?&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/GQCo8k3DjpQ" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/1068423048</id>
    <published>2008-09-10T14:50:39-04:00</published>
    <updated>2008-09-10T15:00:23-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/sti_ck_to_it" />
    <title>STI(ck) to it</title>
    <content type="html">&lt;p&gt;Single Table Inheritance is a handy feature of rails to take advantage of. Unfortunately, there are many pitfalls waiting for you should you choose to use it.&lt;/p&gt;

&lt;p&gt;One of these (pitfalls), is that the column used by default for the type of the record is... "type". In case you haven't figured it out yet, the problem is that "type" is also a deprecated synonym for the Object#class method.&lt;/p&gt;

&lt;p&gt;So, if you try to put the type attribute on your form you &lt;strong&gt;will&lt;/strong&gt; have problems (when type returns the class for the model instead of the name of the class). You'll get something like...&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;wrong argument type String (expected Module)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Working around this is easy. Just shove the following code into an initializer...&lt;/p&gt;

&lt;pre class="mac_classic"&gt;&lt;span class="line-numbers"&gt;   1 &lt;/span&gt; &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt; type is a deprecated synonym for Object#class,&lt;/span&gt;
&lt;span class="line-numbers"&gt;   2 &lt;/span&gt; &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt; but it gets in the way of accessing the STI inheritance column,&lt;/span&gt;
&lt;span class="line-numbers"&gt;   3 &lt;/span&gt; &lt;span class="Comment"&gt;&lt;span class="Comment"&gt;#&lt;/span&gt; so undefine it&lt;/span&gt;
&lt;span class="line-numbers"&gt;   4 &lt;/span&gt; &lt;span class="LibraryObject"&gt;Object&lt;/span&gt;.&lt;span class="FunctionName"&gt;class_eval&lt;/span&gt; &lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;undef :type&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/OTXWABfDN-A" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/1068423047</id>
    <published>2008-09-10T02:51:24-04:00</published>
    <updated>2008-09-10T02:52:12-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/a_good_helper_is_hard_to_test" />
    <title>A good helper is hard to test</title>
    <content type="html">&lt;p&gt;So, you want to test your helpers?&lt;/p&gt;

&lt;p&gt;I had been using the "helper_test" plugin, as &lt;a href="http://nubyonrails.com/articles/test-your-helpers"&gt;described on nubyonrails.com&lt;/a&gt;. However, when I ran into a problem with that recently I dug into action_view to see how things were tested deep in the heart of rails country, and guess what?&lt;/p&gt;

&lt;p&gt;Rails has that too. Go figure.&lt;/p&gt;

&lt;p&gt;First, add &lt;code&gt;require 'action_view/test_case'&lt;/code&gt; to test/test_helper.rb.&lt;/p&gt;

&lt;p&gt;Then, test away...&lt;/p&gt;

&lt;pre class="mac_classic"&gt;&lt;span class="line-numbers"&gt;   1 &lt;/span&gt; &lt;span class="Keyword"&gt;require&lt;/span&gt; &lt;span class="LibraryObject"&gt;File&lt;/span&gt;.&lt;span class="FunctionName"&gt;dirname&lt;/span&gt;(&lt;span class="Variable"&gt;__FILE__&lt;/span&gt;) &lt;span class="Keyword"&gt;+&lt;/span&gt; &lt;span class="String"&gt;&lt;span class="String"&gt;'&lt;/span&gt;/../../test_helper&lt;span class="String"&gt;'&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;   2 &lt;/span&gt; 
&lt;span class="line-numbers"&gt;   3 &lt;/span&gt; &lt;span class="Keyword"&gt;class&lt;/span&gt; &lt;span class="TypeName"&gt;ApplicationHelperTest&lt;span class="InheritedClassName"&gt; &lt;span class="InheritedClassName"&gt;&amp;lt;&lt;/span&gt; ActionView::TestCase&lt;/span&gt;&lt;/span&gt;
&lt;span class="line-numbers"&gt;   4 &lt;/span&gt;   tests &lt;span class="Variable"&gt;ApplicationHelper&lt;/span&gt;
&lt;span class="line-numbers"&gt;   5 &lt;/span&gt; 
&lt;span class="line-numbers"&gt;   6 &lt;/span&gt;   &lt;span class="Keyword"&gt;def&lt;/span&gt; &lt;span class="FunctionName"&gt;test_should_render_sidebar&lt;/span&gt;
&lt;span class="line-numbers"&gt;   7 &lt;/span&gt;     expected &lt;span class="Keyword"&gt;=&lt;/span&gt; &lt;span class="FunctionName"&gt;read_fixture&lt;/span&gt;(&lt;span class="String"&gt;&lt;span class="String"&gt;'&lt;/span&gt;sidebar&lt;span class="String"&gt;'&lt;/span&gt;&lt;/span&gt;)
&lt;span class="line-numbers"&gt;   8 &lt;/span&gt;     assert_equal expected, &lt;span class="FunctionName"&gt;sidebar&lt;/span&gt;(&lt;span class="String"&gt;&lt;span class="String"&gt;'&lt;/span&gt;test&lt;span class="String"&gt;'&lt;/span&gt;&lt;/span&gt;).&lt;span class="FunctionName"&gt;split&lt;/span&gt;(&lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;span class="StringInterpolation"&gt;\n&lt;/span&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)
&lt;span class="line-numbers"&gt;   9 &lt;/span&gt;   &lt;span class="Keyword"&gt;end&lt;/span&gt;
&lt;span class="line-numbers"&gt;  10 &lt;/span&gt;   
&lt;span class="line-numbers"&gt;  11 &lt;/span&gt; &lt;span class="Keyword"&gt;protected&lt;/span&gt;
&lt;span class="line-numbers"&gt;  12 &lt;/span&gt;   &lt;span class="Keyword"&gt;def&lt;/span&gt; &lt;span class="FunctionName"&gt;read_fixture&lt;/span&gt;(&lt;span class="FunctionParameter"&gt;fixture&lt;/span&gt;)
&lt;span class="line-numbers"&gt;  13 &lt;/span&gt;     &lt;span class="Variable"&gt;IO&lt;/span&gt;.&lt;span class="FunctionName"&gt;readlines&lt;/span&gt;(&lt;span class="LibraryObject"&gt;File&lt;/span&gt;.&lt;span class="FunctionName"&gt;join&lt;/span&gt;(&lt;span class="Variable"&gt;RAILS_ROOT&lt;/span&gt;, &lt;span class="String"&gt;&lt;span class="String"&gt;'&lt;/span&gt;test&lt;span class="String"&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class="String"&gt;&lt;span class="String"&gt;'&lt;/span&gt;fixtures&lt;span class="String"&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class="String"&gt;&lt;span class="String"&gt;'&lt;/span&gt;application_helper&lt;span class="String"&gt;'&lt;/span&gt;&lt;/span&gt;, fixture)).&lt;span class="FunctionName"&gt;collect&lt;/span&gt;(&lt;span class="Keyword"&gt;&amp;amp;&lt;/span&gt;&lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;chomp&lt;/span&gt;)
&lt;span class="line-numbers"&gt;  14 &lt;/span&gt;   &lt;span class="Keyword"&gt;end&lt;/span&gt;
&lt;span class="line-numbers"&gt;  15 &lt;/span&gt; 
&lt;span class="line-numbers"&gt;  16 &lt;/span&gt; &lt;span class="Comment"&gt;  &lt;span class="Comment"&gt;#&lt;/span&gt; to prevent undefined method when forms are involved&lt;/span&gt;
&lt;span class="line-numbers"&gt;  17 &lt;/span&gt;   &lt;span class="Keyword"&gt;def&lt;/span&gt; &lt;span class="FunctionName"&gt;protect_against_forgery?&lt;/span&gt;
&lt;span class="line-numbers"&gt;  18 &lt;/span&gt;     &lt;span class="BuiltInConstant"&gt;false&lt;/span&gt;
&lt;span class="line-numbers"&gt;  19 &lt;/span&gt;   &lt;span class="Keyword"&gt;end&lt;/span&gt;
&lt;span class="line-numbers"&gt;  20 &lt;/span&gt; &lt;span class="Keyword"&gt;end&lt;/span&gt;
&lt;span class="line-numbers"&gt;  21 &lt;/span&gt; 
&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/-RGlYQLx2Tg" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/1068423046</id>
    <published>2008-09-02T08:10:29-04:00</published>
    <updated>2008-09-02T08:10:29-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/one_or_the_other_but_not_both" />
    <title>One or the other (but not both)</title>
    <content type="html">&lt;p&gt;I ran into a validation today that rails didn't handle for me... or if it does, I didn't see how...&lt;/p&gt;

&lt;p&gt;I wanted a model to contain field values that were exclusive of one another.&lt;/p&gt;

&lt;p&gt;For example, an event model could have a schedule which ended either on a specific date or after a given number of repetitions, but not both.&lt;/p&gt;

&lt;p&gt;In essence, I wanted...&lt;/p&gt;

&lt;pre class="mac_classic"&gt;&lt;span class="line-numbers"&gt;   1 &lt;/span&gt; validates_one_of &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;repetitions&lt;/span&gt;, &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;repeat_until&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;So, I built it...&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/0T5JEGXS2fU" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/1068423045</id>
    <published>2008-08-29T03:27:09-04:00</published>
    <updated>2008-09-01T04:08:49-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/capistrano_rocks" />
    <title>Capistrano rocks!</title>
    <content type="html">&lt;p&gt;A few years ago, I stopped playing golf. Not really as a conscious decision, I just didn't quite have the time (or money) for it. &lt;strike&gt;If&lt;/strike&gt; When I do return to it, I intend on taking lessons as if I had never played -- I actually used to play a LOT. The reasoning for this is that, I want to make sure I'm doing things right... and my current swing is borne out of a whole lot of self-teaching, so it is full of problems. If Tiger Woods can re-invent his swing over and over, so can I right? So, why not start from the beginning.&lt;/p&gt;

&lt;p&gt;Why am I talking about my (horrible) golf swing? Read on...&lt;/p&gt;

&lt;p&gt;As I worked on deploying the beginnings of a side-project I'm working on, I once again decided to use &lt;a href="http://www.capify.org/"&gt;Capistrano&lt;/a&gt;. I say "decided", because, well... really there's no choice (for me). Capistrano does what it does well. It works. I already know how to use it. Enough reasons?&lt;/p&gt;

&lt;p&gt;Well, I recently saw a post where &lt;a href="http://weblog.jamisbuck.org"&gt;Jamis Buck&lt;/a&gt; (the author) announced that the documentation for Capistrano was going to receive some loving, and that he was working on a &lt;a href="http://capify.org/getting-started/from-the-beginning"&gt;From the Beginning&lt;/a&gt; document. So, despite my previous statement that I "know" how to use Capistrano, I decided to start "from the beginning".&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/GrOY8vim9e0" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/1068423044</id>
    <published>2008-08-20T15:05:30-04:00</published>
    <updated>2008-08-25T18:40:40-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/colour_with_a_u_and_a_v" />
    <title>Colour with a U (and a v)</title>
    <content type="html">&lt;p&gt;Despite the fact that some of you may consider my spelling of the word colour an abomination, I hope that there are more of you that understand my insistence on using Canadian (or British) spelling on this blog.&lt;/p&gt;

&lt;p&gt;In any event, this post is about my implementation of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;syntax colouring for code excerpts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In one of my past efforts at blogging I used &lt;a href="http://www.simplelog.net"&gt;SimpleLog&lt;/a&gt;. During that experiment, I used &lt;a href="http://www.daikini.com/past/2007/6/14/simplehighlight_syntax_highlighting_for_simplelog/"&gt;SimpleHighlight&lt;/a&gt; to colour (highlight) code included in my posts.&lt;/p&gt;

&lt;p&gt;When it came time to add the same functionality to my blog this time around, I took a look at what made SimpleHighlight tick - the &lt;a href="http://ultraviolet.rubyforge.org/"&gt;UltraViolet&lt;/a&gt; Syntax Highlighting Engine.&lt;/p&gt;

&lt;p&gt;Quoting the RubyForge page, &amp;ldquo;Ultraviolet is a syntax highlighting engine based on &lt;a href="http://textpow.rubyforge.org/"&gt;Textpow&lt;/a&gt;. Since it uses Textmate syntax files, it offers out of the box syntax highlighting for more than 50 languages and 20 themes.&amp;rdquo;&lt;/p&gt;

&lt;p&gt;The code to support this library follow (and as you can see, was pretty minimal).&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/JDM6A0A3LTk" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/1068423043</id>
    <published>2008-08-19T02:58:25-04:00</published>
    <updated>2008-08-25T18:40:37-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/authentication_publication_and_lockification" />
    <title>Authentication, publication and lockification</title>
    <content type="html">&lt;p&gt;Not much to talk about here... although I'm sure I'll come up with more about these topics in a future post (especially user authentication).&lt;/p&gt;

&lt;p&gt;For now, this is just a quick status update. A few other things on the list that I've "done" already are...&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;user authentication with admin and author roles&lt;/li&gt;
&lt;li&gt;published and unpublished blog posts&lt;/li&gt;
&lt;li&gt;lock blog posts to prevent further comments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;User authentication is taken care of using &lt;a href="http://github.com/technoweenie/restful-authentication/tree/master"&gt;restful-authentication&lt;/a&gt; by &lt;a href="http://weblog.techno-weenie.net"&gt;Rick Olson&lt;/a&gt; (aka technoweenie).&lt;/p&gt;

&lt;p&gt;On top of the authentication is a really simple role system. In my application controller I added:&lt;/p&gt;

&lt;pre class="mac_classic"&gt;&lt;span class="Keyword"&gt;class&lt;/span&gt; &lt;span class="TypeName"&gt;&lt;span class="Variable"&gt;&lt;span class="Variable"&gt;&amp;lt;&amp;lt;&lt;/span&gt; self&lt;/span&gt;&lt;/span&gt;
  &lt;span class="Keyword"&gt;def&lt;/span&gt; &lt;span class="FunctionName"&gt;require_role&lt;/span&gt;(&lt;span class="FunctionParameter"&gt;&lt;span class="Keyword"&gt;*&lt;/span&gt;roles&lt;/span&gt;)
    options &lt;span class="Keyword"&gt;=&lt;/span&gt; roles.&lt;span class="FunctionName"&gt;last&lt;/span&gt;.&lt;span class="FunctionName"&gt;is_a?&lt;/span&gt;(&lt;span class="Variable"&gt;Hash&lt;/span&gt;) &lt;span class="Keyword"&gt;?&lt;/span&gt; roles.&lt;span class="FunctionName"&gt;pop&lt;/span&gt; : {}
    method_name &lt;span class="Keyword"&gt;=&lt;/span&gt; roles.&lt;span class="FunctionName"&gt;collect&lt;/span&gt; { |&lt;span class="Variable"&gt;role&lt;/span&gt;| role.&lt;span class="FunctionName"&gt;titleize&lt;/span&gt;.&lt;span class="FunctionName"&gt;gsub&lt;/span&gt;(&lt;span class="String"&gt;&lt;span class="String"&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class="String"&gt; &lt;/span&gt;&lt;span class="String"&gt;&lt;span class="String"&gt;/&lt;/span&gt;&lt;/span&gt;, &lt;span class="String"&gt;&lt;span class="String"&gt;'&lt;/span&gt;&lt;span class="String"&gt;'&lt;/span&gt;&lt;/span&gt;).&lt;span class="FunctionName"&gt;underscore&lt;/span&gt; }.&lt;span class="FunctionName"&gt;join&lt;/span&gt;(&lt;span class="String"&gt;&lt;span class="String"&gt;'&lt;/span&gt;_or_&lt;span class="String"&gt;'&lt;/span&gt;&lt;/span&gt;) &lt;span class="Keyword"&gt;+&lt;/span&gt; &lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;_role_required&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
    &lt;span class="FunctionName"&gt;define_method&lt;/span&gt;(method_name) { access_denied &lt;span class="Keyword"&gt;and&lt;/span&gt; &lt;span class="Keyword"&gt;return&lt;/span&gt; &lt;span class="BuiltInConstant"&gt;false&lt;/span&gt; &lt;span class="Keyword"&gt;unless&lt;/span&gt; logged_in? &lt;span class="Keyword"&gt;&amp;amp;&amp;amp;&lt;/span&gt; current_user.&lt;span class="FunctionName"&gt;roles&lt;/span&gt;.&lt;span class="FunctionName"&gt;any?&lt;/span&gt; { |&lt;span class="Variable"&gt;r&lt;/span&gt;| roles.&lt;span class="FunctionName"&gt;include?&lt;/span&gt;(r.&lt;span class="FunctionName"&gt;name&lt;/span&gt;) } }
    &lt;span class="LibraryFunction"&gt;before_filter&lt;/span&gt; method_name.&lt;span class="FunctionName"&gt;to_sym&lt;/span&gt;, options
  &lt;span class="Keyword"&gt;end&lt;/span&gt;
&lt;span class="Keyword"&gt;end&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;Then, in any controller where I want to secure things I add something like the following:&lt;/p&gt;

&lt;pre class="mac_classic"&gt;&lt;span class="LibraryFunction"&gt;before_filter&lt;/span&gt; &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;login_required&lt;/span&gt;, &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;except&lt;/span&gt; =&amp;gt; [ &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;index&lt;/span&gt;, &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;show&lt;/span&gt;, &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;summary&lt;/span&gt; ]
&lt;span class="LibraryFunction"&gt;after_filter&lt;/span&gt; &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;store_location&lt;/span&gt;, &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;only&lt;/span&gt; =&amp;gt; [ &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;index&lt;/span&gt;, &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;show&lt;/span&gt;, &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;summary&lt;/span&gt; ]
require_role &lt;span class="String"&gt;&lt;span class="String"&gt;'&lt;/span&gt;Author&lt;span class="String"&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;only&lt;/span&gt; =&amp;gt; [ &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;new&lt;/span&gt;, &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;create&lt;/span&gt; ]
&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/siqJRvvNtdo" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/1068423040</id>
    <published>2008-08-16T06:13:51-04:00</published>
    <updated>2008-08-25T18:40:36-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/your_comments_please" />
    <title>Your comments, please</title>
    <content type="html">&lt;p&gt;So, next on &lt;a href="http://www.unwwwired.net/posts/writing_the_unwwwritten"&gt;the list&lt;/a&gt; is...&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;comments&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As a database developer, I'm used to normalizing the hell out of my data. So, when it came time to implement my blog, I was convinced that posts and comments were the same thing. A comment was just a post with a parent post. One advantage of this, was that it inherently supported threaded comments... ie. replying to comments rather than the original post.&lt;/p&gt;

&lt;p&gt;However, when I attempted to do it that way, I realized that I lost a lot of the simplicity that is in Rails. For example, when generating a url to create a comment, it would instead generate the url to create a new post (since, the object being posted was in fact a Post).&lt;/p&gt;

&lt;p&gt;I could solve this a couple of different ways.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/F8OUi1PUVLo" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/1068423039</id>
    <published>2008-08-09T07:23:36-04:00</published>
    <updated>2008-08-25T18:40:36-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/taking_a_rest_and_making_friends" />
    <title>Taking a rest and making friends</title>
    <content type="html">&lt;p&gt;So, what's next on the list?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;each blog entry will be referenced by a friendly link (rather than its id)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In my last post, I mentioned that I had considered using a single BlogController to handle all requests for my blog... I didn't. First off, the blog consists of Posts and Comments. Now, from a data (or model) point of view these may be the same, but as far as usage goes they get handled a bit differently. Plus, since I ultimately want to have some sort of RESTful API for the blog, and possibly the site in general, I think it makes more sense to divide the work up into two separate controllers (with a nested route).&lt;/p&gt;

&lt;p&gt;So, now I've got a PostsController and a CommentsController with the following route(s)...&lt;/p&gt;

&lt;pre class="mac_classic"&gt;map.&lt;span class="FunctionName"&gt;resources&lt;/span&gt; &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;posts&lt;/span&gt; &lt;span class="Keyword"&gt;do &lt;/span&gt;|&lt;span class="Variable"&gt;post&lt;/span&gt;|
  post.&lt;span class="FunctionName"&gt;resources&lt;/span&gt; &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;comments&lt;/span&gt;
&lt;span class="Keyword"&gt;end&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;For anyone who hasn't seen a nested route before, they let you access nice RESTful resources like &lt;code&gt;/posts/1/comments&lt;/code&gt;. Now, I don't like the default implementation of some of the nesting, but I'll talk about that in another post (if you just can't wait, you can check out my &lt;a href="http://www.github.com/sbfaulkner/selective_mapper"&gt;selective_mapper project&lt;/a&gt; on &lt;a href="http:www.github.com"&gt;github&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;To access a specific post, the generated show, edit, update and delete actions  for the PostsController all reference the posts by id... not the friendliest  way of linking to a post. Luckily for us, it's &lt;em&gt;really&lt;/em&gt; easy change that behaviour.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/IQAhRjCEHB4" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/1068423038</id>
    <published>2008-08-08T08:55:09-04:00</published>
    <updated>2008-08-25T18:40:23-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/a_bunch_of_pages" />
    <title>A bunch of pages</title>
    <content type="html">&lt;p&gt;In my last &lt;a href="http://www.unwwwired.net/posts/writing_the_unwwwritten"&gt;post&lt;/a&gt;, I enumerated the "requirements" for this site/blog. While there is still a lot to do, a number of items have already been completed.&lt;/p&gt;

&lt;p&gt;I'm going to take the time, over the next several posts, to actually talk about most (if not all) of these features and try to find something interesting in the implementation.&lt;/p&gt;

&lt;p&gt;Some of these may be old news for you Rails "veterans", but hopefully I'm touching on some new ground too.&lt;/p&gt;

&lt;p&gt;First on my list was...&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a fully integrated site with multiple pages (including a home page, a project portfolio, an about page and, of course, the blog)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, how to tie it all together? I don't want a bunch of completely static pages, and I don't want HomeController, ProjectsController, BlogController and AboutController... yech...&lt;/p&gt;

&lt;p&gt;So, I used a method inspired by a &lt;a href="http://blog.hasmanythrough.com/2008/4/2/simple-pages"&gt;post on Josh Susser's blog&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/fXNukZn38bc" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/1068423037</id>
    <published>2008-08-06T14:10:16-04:00</published>
    <updated>2008-08-25T18:40:33-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/writing_the_unwwwritten" />
    <title>writing the unwwwritten</title>
    <content type="html">&lt;p&gt;The first time around, I played with typo, but I never really wrote anything on that blog.&lt;/p&gt;

&lt;p&gt;The next time, I settled on simplelog... at the time it fit the bill, and I actually wrote several blog entries. However, hosting my site on hostmonster.com only seemed like a good idea for a little while. Eventually, I got tired of the downtime and the deployment issues.&lt;/p&gt;

&lt;p&gt;This time around, I'm on &lt;a href="http://www.heroku.com"&gt;Heroku&lt;/a&gt; and, while simplelog does what it should, I've decided to follow the route recommended by &lt;a href="http://nubyonrails.com/articles/about-this-blog-memcached"&gt;Geoffrey Grosenbach&lt;/a&gt;. I may not be a Rails beginner, but I think there's still a lot of lessons to be learned from the exercise.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/4_By-LENWTc" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/1068423036</id>
    <published>2008-07-24T15:43:04-04:00</published>
    <updated>2008-08-25T18:40:32-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/a_new_beginning" />
    <title>A New Beginning</title>
    <content type="html">&lt;p&gt;unwwwritten is back.

I finally got around to putting my blog back online. It's still a work in progress, but at least it resembles a blog now.

I've got a number of ideas that have been spinning around in my head and in order to share them and all the work I've been doing for the last year, I needed to get this going again...

Stay tuned to your local station.

Cheers.
&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/xW3YW3SBsRQ" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/432388345</id>
    <published>2007-11-07T20:24:00-05:00</published>
    <updated>2008-08-25T18:40:31-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/on_being_constant" />
    <title>On being CONSTANT</title>
    <content type="html">&lt;p&gt;So, I'm working on the syncer and stumbled upon something that surprised me (probably due to my C and C++ background). Constants are not constant in ruby. What I mean is that there is little to no protection against modifying them. Now, this is apparently a known fact in php too, but I was not aware of it in ruby. Truth be told, I guess it's not completely true in C or C++ either. A simple cast can make almost anything volatile, unless of course the compiler and/or platform uses memory protection to &lt;em&gt;really&lt;/em&gt; make things const.&lt;/p&gt;

&lt;p&gt;However, on this occasion, I got a little surprise. Given the following code:&lt;/p&gt;

&lt;pre class="mac_classic"&gt;&lt;span class="Keyword"&gt;class&lt;/span&gt; &lt;span class="TypeName"&gt;Base&lt;/span&gt;
  &lt;span class="Variable"&gt;DEFAULT&lt;/span&gt; &lt;span class="Keyword"&gt;=&lt;/span&gt; [ &lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;DEFAULT VALUE&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; ]
&lt;span class="Keyword"&gt;end&lt;/span&gt;

&lt;span class="Keyword"&gt;class&lt;/span&gt; &lt;span class="TypeName"&gt;A&lt;span class="InheritedClassName"&gt; &lt;span class="InheritedClassName"&gt;&amp;lt;&lt;/span&gt; Base&lt;/span&gt;&lt;/span&gt;
  &lt;span class="Keyword"&gt;def&lt;/span&gt; &lt;span class="FunctionName"&gt;initialize&lt;/span&gt;
    &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;@&lt;/span&gt;array&lt;/span&gt; &lt;span class="Keyword"&gt;=&lt;/span&gt; &lt;span class="Variable"&gt;DEFAULT&lt;/span&gt;
    &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;@&lt;/span&gt;array&lt;/span&gt; &lt;span class="Keyword"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;A&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
    puts &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;@&lt;/span&gt;array&lt;/span&gt;.&lt;span class="FunctionName"&gt;inspect&lt;/span&gt;
  &lt;span class="Keyword"&gt;end&lt;/span&gt;
&lt;span class="Keyword"&gt;end&lt;/span&gt;

&lt;span class="Keyword"&gt;class&lt;/span&gt; &lt;span class="TypeName"&gt;B&lt;span class="InheritedClassName"&gt; &lt;span class="InheritedClassName"&gt;&amp;lt;&lt;/span&gt; Base&lt;/span&gt;&lt;/span&gt;
  &lt;span class="Keyword"&gt;def&lt;/span&gt; &lt;span class="FunctionName"&gt;initialize&lt;/span&gt;
    &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;@&lt;/span&gt;array&lt;/span&gt; &lt;span class="Keyword"&gt;=&lt;/span&gt; &lt;span class="Variable"&gt;DEFAULT&lt;/span&gt;
    &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;@&lt;/span&gt;array&lt;/span&gt; &lt;span class="Keyword"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;B&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
    puts &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;@&lt;/span&gt;array&lt;/span&gt;.&lt;span class="FunctionName"&gt;inspect&lt;/span&gt;
  &lt;span class="Keyword"&gt;end&lt;/span&gt;
&lt;span class="Keyword"&gt;end&lt;/span&gt;

a &lt;span class="Keyword"&gt;=&lt;/span&gt; &lt;span class="Variable"&gt;A&lt;/span&gt;.&lt;span class="FunctionName"&gt;new&lt;/span&gt;
b &lt;span class="Keyword"&gt;=&lt;/span&gt; &lt;span class="Variable"&gt;B&lt;/span&gt;.&lt;span class="FunctionName"&gt;new&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;I did not expect this:&lt;/p&gt;

&lt;pre class="mac_classic"&gt;[&lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;DEFAULT VALUE&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;A&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;]
[&lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;DEFAULT VALUE&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;A&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;B&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;]
&lt;/pre&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/XWXD6szu67o" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/42778703</id>
    <published>2007-11-05T10:53:00-05:00</published>
    <updated>2008-08-25T18:40:24-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/domain_specific_languages" />
    <title>Domain Specific Languages</title>
    <content type="html">&lt;p&gt;So, &lt;a href="http://work.rowanhick.com"&gt;the kiwi&lt;/a&gt; that worked with me (until last week) and I have been working on a mechanism for synchronising a legacy FileMaker database and a MySQL database.&lt;/p&gt;

&lt;p&gt;Our reasons for doing this include the fact that we're using &lt;a href="http://rubyonrails.org"&gt;Ruby on Rails&lt;/a&gt; to run our website and the company currently runs most of its day-to-day operations in FileMaker. We're also considering moving &lt;strong&gt;everything&lt;/strong&gt; over to RoR and MySQL, but the data will have to live both places for quite a while yet.&lt;/p&gt;

&lt;p&gt;So, meanwhile, Rowan bashed together acts_as_syncable, to do as much of the heavy lifting as possible. So far, things are working pretty well (even if it's not live yet). We use ActiveRecord to interact with MySQL on the Rails side, and rubyodbc to access the FileMaker data through ODBC. Pulling data over to the MySQL side with transformations occurring for much of the legacy data (cleaning it up on the fly) we're getting about 200,000 records per hour.&lt;/p&gt;

&lt;p&gt;Now, on to the fun part. As I move forward with this project, we've got about 3 tables synchronizing... &lt;strong&gt;leaving over 150 more to contend with&lt;/strong&gt;. The trick at this point is implementing the transformations for all the miscellaneous noise in the FileMaker database.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/c0geBUaRpfs" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/339013923</id>
    <published>2007-09-09T19:00:00-04:00</published>
    <updated>2008-08-25T18:40:29-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/bend_it_to_your_will_episode" />
    <title>Bend it to your will - Episode III</title>
    <content type="html">&lt;p&gt;In order to hook our plugin up to the ApplicationController (or any other controller class) we currently need to include the SimpleNav module into our class:&lt;/p&gt;

&lt;pre class="mac_classic"&gt;&lt;span class="Keyword"&gt;include&lt;/span&gt; &lt;span class="Variable"&gt;SimpleNav&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;Pretty simple, but still one line of code added to SimpleLog means that I can't just update the application to a new version without redoing that change (and any others that I've made). Also, if you install my plugin into SimpleLog, you need to update your copy of the ApplicationController too.&lt;/p&gt;

&lt;p&gt;Now, if I were extending ActionController::Base we could deal with this part of the process by automatically including SimpleNav from within the plugin (as many plugins do) by adding the following to the end of lib/simple_nav.rb:&lt;/p&gt;

&lt;pre class="mac_classic"&gt;&lt;span class="LibraryObject"&gt;ActionController&lt;/span&gt;::&lt;span class="FunctionName"&gt;Base&lt;/span&gt;.&lt;span class="FunctionName"&gt;class_eval&lt;/span&gt; &lt;span class="Keyword"&gt;do&lt;/span&gt;
  &lt;span class="Keyword"&gt;include&lt;/span&gt; &lt;span class="Variable"&gt;SimpleNav&lt;/span&gt;
&lt;span class="Keyword"&gt;end&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;This might work, but would mean that &lt;strong&gt;every&lt;/strong&gt; controller class in our application would install our filter (and every controller action would load the page array).&lt;/p&gt;

&lt;p&gt;What if we change the class from ActionController::Base to ApplicationController? Then, at least it's only those controller classes... but the entire SimpleLog admin section does not need to use SimpleNav. Plus, as you'll see in the following brief discussion of loading, it's not quite that simple anyway.&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/ukM7NF7CRhU" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/878310619</id>
    <published>2007-09-09T12:27:00-04:00</published>
    <updated>2008-08-25T18:40:32-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/bend_it_to_your_will" />
    <title>Bend it to your will - Episode II</title>
    <content type="html">&lt;p&gt;Last time, we looked at a helper that I wanted to add to the &lt;a href="http://simplelog.net"&gt;SimpleLog&lt;/a&gt; Site class. In order to use it in that form, I would have to modify all the appropriate controller classes individually. They would each have to perform a Page.find before rendering the view or layout which would make the call to out nifty little navigation link generator.&lt;/p&gt;

&lt;p&gt;However, my goal here is that I can update SimpleLog at any time without worrying about what changes I've made to the source. So, plugins or patches would be a preferred way of hooking it up. In addition, if someone else wanted the functionality that I'm implementing, plugins would be easier to distribute and/or support than patches.&lt;/p&gt;

&lt;p&gt;So, the question then became "How do I implement this as a plugin?"&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/0fQwYo1uscc" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/320905950</id>
    <published>2007-09-08T05:08:00-04:00</published>
    <updated>2008-09-13T07:30:28-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/bend_it_to_your_will_again" />
    <title>Bend it to your will</title>
    <content type="html">&lt;p&gt;So, you've found an open source &lt;a href="http://rubyonrails.org"&gt;Ruby on Rails&lt;/a&gt; application that your think does something you need (say a weblog application). You install it on your server (or shared hosting environment) and you're generally quite happy with the way it works, but...&lt;/p&gt;

&lt;p&gt;There's always a but isn't there?&lt;/p&gt;

&lt;p&gt;I installed &lt;a href="http://simplelog.net"&gt;SimpleLog&lt;/a&gt; a little while ago, and for the most part it does it's job. It's simple, it looks how I want it to (with the help of the theme support) and, most importantly, it lets me publish my blog.&lt;/p&gt;

&lt;p&gt;Now, as I was building a couple of themes for &lt;a href="http://blog.unwwwired.net"&gt;my blog&lt;/a&gt; I thought that SimpleLog should have a way to generate navigation links to any active pages in the blog.&lt;/p&gt;

&lt;p&gt;Following the example of the methods defined in the Site helper class, I decided that a call similar to the following  would be appropriate (in a view or layout):&lt;/p&gt;

&lt;pre class="mac_classic"&gt;&lt;span class="MarkupTag"&gt;&lt;span class="MarkupTag"&gt;&amp;lt;&lt;/span&gt;&lt;span class="MarkupNameOfTag"&gt;div&lt;/span&gt; &lt;span class="MarkupTag"&gt;&lt;span class="MarkupTagAttribute"&gt;id&lt;/span&gt;&lt;span class="MarkupTag"&gt;=&lt;/span&gt;&lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;span class="String"&gt;nav&lt;/span&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="MarkupTag"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class="MarkupTag"&gt;&lt;span class="MarkupTag"&gt;&amp;lt;&lt;/span&gt;&lt;span class="MarkupNameOfTag"&gt;ul&lt;/span&gt;&lt;span class="MarkupTag"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
    &lt;span class="EmbeddedSource"&gt;&lt;span class="EmbeddedSource"&gt;&amp;lt;%=&lt;/span&gt; &lt;span class="LibraryObject"&gt;Site&lt;/span&gt;&lt;span class="EmbeddedSource"&gt;&lt;span class="EmbeddedSource"&gt;.&lt;/span&gt;&lt;span class="FunctionName"&gt;nav_pages_linked&lt;/span&gt;&lt;/span&gt; &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;@&lt;/span&gt;pages&lt;/span&gt; &lt;span class="EmbeddedSource"&gt;%&amp;gt;&lt;/span&gt;&lt;/span&gt;
  &lt;span class="MarkupTag"&gt;&lt;span class="MarkupTag"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="MarkupNameOfTag"&gt;ul&lt;/span&gt;&lt;span class="MarkupTag"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class="MarkupTag"&gt;&lt;span class="MarkupTag"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="MarkupNameOfTag"&gt;div&lt;/span&gt;&lt;span class="MarkupTag"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;I'm not going to go into any of the basics of plugin creation and mix-ins to extend the functionality of a class using a plugin. The following code in vendor/plugins/simple_nav/lib/simple_nav.rb adds a couple of helper methods to the Site class. These helpers add the necessary helpers to generate the actual navigation links in the views or layouts.&lt;/p&gt;

&lt;pre class="mac_classic"&gt;&lt;span class="Keyword"&gt;class&lt;/span&gt; &lt;span class="TypeName"&gt;Site&lt;/span&gt;
  &lt;span class="Keyword"&gt;class&lt;/span&gt; &lt;span class="Keyword"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="Variable"&gt;self&lt;/span&gt;
    &lt;span class="Keyword"&gt;def&lt;/span&gt; &lt;span class="FunctionName"&gt;nav_page_linked&lt;/span&gt;(&lt;span class="FunctionParameter"&gt;title&lt;span class="FunctionParameter"&gt;,&lt;/span&gt; url&lt;span class="FunctionParameter"&gt;,&lt;/span&gt; is_current &lt;span class="Keyword"&gt;=&lt;/span&gt; &lt;span class="BuiltInConstant"&gt;false&lt;/span&gt;&lt;/span&gt;)
      nav &lt;span class="Keyword"&gt;=&lt;/span&gt; &lt;span class="String"&gt;&lt;span class="String"&gt;%Q(&lt;/span&gt;&amp;lt;li&lt;span class="StringInterpolation"&gt;&lt;span class="StringInterpolation"&gt;#{&lt;/span&gt;&lt;span class="String"&gt;&lt;span class="String"&gt;'&lt;/span&gt; id=&amp;quot;current&amp;quot;&lt;span class="String"&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class="Keyword"&gt;if&lt;/span&gt; is_current&lt;span class="StringInterpolation"&gt;}&lt;/span&gt;&lt;/span&gt;&amp;gt;&lt;span class="String"&gt;)&lt;/span&gt;&lt;/span&gt;
      nav &lt;span class="Keyword"&gt;+=&lt;/span&gt; &lt;span class="String"&gt;&lt;span class="String"&gt;%Q(&lt;/span&gt;&amp;lt;a href=&amp;quot;&lt;span class="StringInterpolation"&gt;&lt;span class="StringInterpolation"&gt;#{&lt;/span&gt;url&lt;span class="StringInterpolation"&gt;}&lt;/span&gt;&lt;/span&gt;&amp;quot;&amp;gt;&lt;span class="StringInterpolation"&gt;&lt;span class="StringInterpolation"&gt;#{&lt;/span&gt;title&lt;span class="StringInterpolation"&gt;}&lt;/span&gt;&lt;/span&gt;&amp;lt;/a&amp;gt;&lt;span class="String"&gt;)&lt;/span&gt;&lt;/span&gt;
      nav &lt;span class="Keyword"&gt;+=&lt;/span&gt; &lt;span class="String"&gt;&lt;span class="String"&gt;%Q(&lt;/span&gt;&lt;span class="String"&gt;)&lt;/span&gt;&lt;/span&gt;
    &lt;span class="Keyword"&gt;end&lt;/span&gt;
    &lt;span class="Keyword"&gt;def&lt;/span&gt; &lt;span class="FunctionName"&gt;nav_pages_linked&lt;/span&gt;(&lt;span class="FunctionParameter"&gt;pages&lt;/span&gt;)
      nav &lt;span class="Keyword"&gt;=&lt;/span&gt; &lt;span class="String"&gt;&lt;span class="String"&gt;'&lt;/span&gt;&lt;span class="String"&gt;'&lt;/span&gt;&lt;/span&gt;
      nav &lt;span class="Keyword"&gt;+=&lt;/span&gt; &lt;span class="FunctionName"&gt;nav_page_linked&lt;/span&gt;(&lt;span class="String"&gt;&lt;span class="String"&gt;'&lt;/span&gt;Home&lt;span class="String"&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class="LibraryObject"&gt;Site&lt;/span&gt;.&lt;span class="FunctionName"&gt;full_url&lt;/span&gt;, is_home_page)
      pages.&lt;span class="FunctionName"&gt;each&lt;/span&gt; &lt;span class="Keyword"&gt;do &lt;/span&gt;|&lt;span class="Variable"&gt;p&lt;/span&gt;|
        url &lt;span class="Keyword"&gt;=&lt;/span&gt; &lt;span class="LibraryObject"&gt;Site&lt;/span&gt;.&lt;span class="FunctionName"&gt;link_to_page&lt;/span&gt;(p.&lt;span class="FunctionName"&gt;permalink&lt;/span&gt;)
        is_current &lt;span class="Keyword"&gt;=&lt;/span&gt; &lt;span class="FunctionName"&gt;page_is&lt;/span&gt;(&lt;span class="String"&gt;&lt;span class="String"&gt;'&lt;/span&gt;pages/&lt;span class="String"&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span class="Keyword"&gt;+&lt;/span&gt;p.&lt;span class="FunctionName"&gt;permalink&lt;/span&gt;)
        nav &lt;span class="Keyword"&gt;+=&lt;/span&gt; &lt;span class="FunctionName"&gt;nav_page_linked&lt;/span&gt;(p.&lt;span class="FunctionName"&gt;title&lt;/span&gt;, url, is_current)
      &lt;span class="Keyword"&gt;end&lt;/span&gt; &lt;span class="Keyword"&gt;unless&lt;/span&gt; pages.&lt;span class="FunctionName"&gt;nil?&lt;/span&gt;
      nav
    &lt;span class="Keyword"&gt;end&lt;/span&gt;
  &lt;span class="Keyword"&gt;end&lt;/span&gt;
&lt;span class="Keyword"&gt;end&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;Of course, this would require that every controller and action with a view or layout using it have loaded the appropriate instance variable with something like this:&lt;/p&gt;

&lt;pre class="mac_classic"&gt;  &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;@&lt;/span&gt;pages&lt;/span&gt; &lt;span class="Keyword"&gt;=&lt;/span&gt; &lt;span class="LibraryObject"&gt;Page&lt;/span&gt;.&lt;span class="FunctionName"&gt;find&lt;/span&gt;(&lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;all&lt;/span&gt;, &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;conditions&lt;/span&gt; =&amp;gt; &lt;span class="String"&gt;&lt;span class="String"&gt;'&lt;/span&gt;is_active = true&lt;span class="String"&gt;'&lt;/span&gt;&lt;/span&gt;)
&lt;/pre&gt;

&lt;p&gt;To test the helpers, I simply added that line of code to the before_filter of the PostController and PageController classes as well as to the handle_unknown_request method of the ApplicationController.&lt;/p&gt;

&lt;p&gt;In my next post, I'll explore how I was able to avoid modifying the controller classes to get the desired result.&lt;/p&gt;

&lt;p&gt;Cheers.&lt;/p&gt;

&lt;p&gt;--Brent&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/_PWhM1po4HE" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/73114962</id>
    <published>2007-09-06T19:27:00-04:00</published>
    <updated>2008-08-25T18:40:23-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/tweak_it_tweak_it_goooood" />
    <title>Tweak it, tweak it goooood</title>
    <content type="html">&lt;p&gt;Okay... slight depression setting in due to the drubbing that the Saints are taking at the hands of the Colts tonight, but it wasn't entirely unexpected.&lt;/p&gt;

&lt;p&gt;I've tweaked the theme (again). Now I've got the unwwwired green back and the logo is again present. I've also widened the columns and completely use em measurements for my vertical sizes.&lt;/p&gt;

&lt;p&gt;No big deal, right?&lt;/p&gt;

&lt;p&gt;On to some real content, now.&lt;/p&gt;

&lt;p&gt;Cheers.&lt;/p&gt;

&lt;p&gt;--Brent&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/kGalHXzes-I" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/913573050</id>
    <published>2007-09-03T07:01:00-04:00</published>
    <updated>2008-09-13T07:18:09-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/deep_red_simplelog_theme" />
    <title>Deep Red SimpleLog Theme</title>
    <content type="html">&lt;p&gt;I'm closer to picking the look for this site. I've ported another WordPress theme to SimpleLog.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://www.unwwwired.net/images/deep_red.jpg" alt="Deep Red Screenshot"/&gt;&lt;/p&gt;

&lt;p&gt;You can download Deep Red from &lt;a href="http://downloads.unwwwired.net/deep_red.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I'll be basing my own site's theme on this one... with a few changes to the colours and the column sizes.&lt;/p&gt;

&lt;p&gt;Cheers.&lt;/p&gt;

&lt;p&gt;--Brent&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/ga6Y-vAssmM" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/453229117</id>
    <published>2007-09-01T11:17:00-04:00</published>
    <updated>2008-09-13T07:13:07-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/simplelog_grid_focus_theme" />
    <title>SimpleLog Grid Focus Theme</title>
    <content type="html">&lt;p&gt;For today anyway, I've changed my theme to Grid Focus, which I've just ported from WordPress (mostly as an exercise to see how much work it was).&lt;/p&gt;

&lt;p&gt;&lt;img src="http://www.unwwwired.net/images/grid_focus.jpg" alt="Grid Focus Screenshot"/&gt;&lt;/p&gt;

&lt;p&gt;A &lt;a href="http://work.rowanhick.com"&gt;friend of mine&lt;/a&gt; happens to be using the &lt;a href="http://5thirtyone.com/grid-focus/"&gt;WordPress Grid Focus theme by Derek Punsalan&lt;/a&gt; on his own blog, so I won't be continuing to use it. I've only turned it on for now, to make sure I got it right... so, please ignore the placeholder links, etc. scattered about the page.&lt;/p&gt;

&lt;p&gt;If you want to get a copy of the ported theme for your own use you can download it from &lt;a href="http://downloads.unwwwired.net/grid_focus.zip"&gt;http://downloads.unwwwired.net/grid_focus.zip&lt;/a&gt;...&lt;/p&gt;

&lt;p&gt;Cheers.&lt;/p&gt;

&lt;p&gt;--Brent&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/9PKfzQ1KsFU" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/1068423035</id>
    <published>2007-08-26T18:54:00-04:00</published>
    <updated>2008-08-25T18:40:32-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/helping_improve_a_good_thing" />
    <title>Helping Improve a Good Thing</title>
    <content type="html">&lt;p&gt;A couple of posts ago I talked a bit about SimpleHighlight. Today, I beat up the code a bit to support setting a couple of options for each code block. I e-mailed my changes to the author of SimpleHighlight and am happy to announce that as of today you can start a code block with a tag like the following...&lt;/p&gt;

&lt;pre class="mac_classic"&gt;&lt;span class="Keyword"&gt;&amp;lt;&lt;/span&gt;code theme&lt;span class="Keyword"&gt;=&lt;/span&gt;&lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;all_hallows_eve&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; numbers&lt;span class="Keyword"&gt;=&lt;/span&gt;&lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;no&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span class="Keyword"&gt;&amp;gt;&lt;/span&gt;
  insert code here...
&lt;span class="Keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="Keyword"&gt;/&lt;/span&gt;code&lt;span class="Keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;The options supported currently are:&lt;/p&gt;

&lt;p&gt;language="..." -- specify language of code block
(the legacy option class="..." is still supported too)&lt;/p&gt;

&lt;p&gt;theme="..." -- specify theme for code block&lt;/p&gt;

&lt;p&gt;numbers="..." -- specify whether or not to show line numbers&lt;/p&gt;

&lt;p&gt;Just to show the flexibility of this, here are a few more examples...&lt;/p&gt;

&lt;p&gt;&lt;b&gt;&amp;lt;code language="html" theme="twilight"&amp;gt;&lt;/b&gt;&lt;/p&gt;

&lt;pre class="twilight"&gt;&lt;span class="MetaTagAll"&gt;&lt;span class="MetaTagAll"&gt;&amp;lt;&lt;/span&gt;&lt;span class="MetaTagAll"&gt;div&lt;/span&gt; &lt;span class="MetaTagAll"&gt;&lt;span class="MetaTagAll"&gt;id&lt;/span&gt;&lt;span class="MetaTagAll"&gt;=&lt;/span&gt;&lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;span class="String"&gt;sample&lt;/span&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="MetaTagAll"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="MetaTagAll"&gt;&lt;span class="MetaTagAll"&gt;&amp;lt;&lt;/span&gt;&lt;span class="MetaTagAll"&gt;p&lt;/span&gt;&lt;span class="MetaTagAll"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Here is some &lt;span class="MetaTagInline"&gt;&lt;span class="MetaTagInline"&gt;&amp;lt;&lt;/span&gt;&lt;span class="MetaTagInline"&gt;b&lt;/span&gt;&lt;span class="MetaTagInline"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;HTML&lt;span class="MetaTagInline"&gt;&lt;span class="MetaTagInline"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="MetaTagInline"&gt;b&lt;/span&gt;&lt;span class="MetaTagInline"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="MetaTagAll"&gt;&lt;span class="MetaTagAll"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="MetaTagAll"&gt;p&lt;/span&gt;&lt;span class="MetaTagAll"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="MetaTagAll"&gt;&lt;span class="MetaTagAll"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="MetaTagAll"&gt;div&lt;/span&gt;&lt;span class="MetaTagAll"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;&amp;lt;code language="html" theme="eiffel" numbers="no"&amp;gt;&lt;/b&gt;&lt;/p&gt;

&lt;pre class="eiffel"&gt;&lt;span class="MarkupTag"&gt;&lt;span class="MarkupTag"&gt;&amp;lt;&lt;/span&gt;&lt;span class="MarkupNameOfTag"&gt;div&lt;/span&gt; &lt;span class="MarkupTag"&gt;&lt;span class="MarkupTagAttribute"&gt;id&lt;/span&gt;&lt;span class="MarkupTag"&gt;=&lt;/span&gt;&lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;span class="String"&gt;sample&lt;/span&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="MarkupTag"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="MarkupTag"&gt;&lt;span class="MarkupTag"&gt;&amp;lt;&lt;/span&gt;&lt;span class="MarkupNameOfTag"&gt;p&lt;/span&gt;&lt;span class="MarkupTag"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Here is some &lt;span class="MarkupTag"&gt;&lt;span class="MarkupTag"&gt;&amp;lt;&lt;/span&gt;&lt;span class="MarkupNameOfTag"&gt;b&lt;/span&gt;&lt;span class="MarkupTag"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;HTML&lt;span class="MarkupTag"&gt;&lt;span class="MarkupTag"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="MarkupNameOfTag"&gt;b&lt;/span&gt;&lt;span class="MarkupTag"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="MarkupTag"&gt;&lt;span class="MarkupTag"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="MarkupNameOfTag"&gt;p&lt;/span&gt;&lt;span class="MarkupTag"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="MarkupTag"&gt;&lt;span class="MarkupTag"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="MarkupNameOfTag"&gt;div&lt;/span&gt;&lt;span class="MarkupTag"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;&lt;b&gt;&amp;lt;code language="html" theme="cobalt" numbers="no"&amp;gt;&lt;/b&gt;&lt;/p&gt;

&lt;pre class="cobalt"&gt;&lt;span class="MetaTagA"&gt;&lt;span class="Punctuation"&gt;&amp;lt;&lt;/span&gt;&lt;span class="MetaTagA"&gt;div&lt;/span&gt; &lt;span class="MetaTagA"&gt;&lt;span class="MetaTagA"&gt;id&lt;/span&gt;&lt;span class="Punctuation"&gt;=&lt;/span&gt;&lt;span class="String"&gt;&lt;span class="Punctuation"&gt;&amp;quot;&lt;/span&gt;&lt;span class="String"&gt;sample&lt;/span&gt;&lt;span class="Punctuation"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Punctuation"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="MetaTagA"&gt;&lt;span class="Punctuation"&gt;&amp;lt;&lt;/span&gt;&lt;span class="MetaTagA"&gt;p&lt;/span&gt;&lt;span class="Punctuation"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;Here is some &lt;span class="MetaTagA"&gt;&lt;span class="Punctuation"&gt;&amp;lt;&lt;/span&gt;&lt;span class="MetaTagA"&gt;b&lt;/span&gt;&lt;span class="Punctuation"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;HTML&lt;span class="MetaTagA"&gt;&lt;span class="Punctuation"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="MetaTagA"&gt;b&lt;/span&gt;&lt;span class="Punctuation"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="MetaTagA"&gt;&lt;span class="Punctuation"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="MetaTagA"&gt;p&lt;/span&gt;&lt;span class="Punctuation"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="MetaTagA"&gt;&lt;span class="Punctuation"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="MetaTagA"&gt;div&lt;/span&gt;&lt;span class="Punctuation"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;Cheers.&lt;/p&gt;

&lt;p&gt;--Brent&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/owrdENCt_dU" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/167151176</id>
    <published>2007-08-25T17:00:00-04:00</published>
    <updated>2008-08-25T18:40:25-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/simplenav_plugin_for_simplelog" />
    <title>SimpleNav plugin for SimpleLog</title>
    <content type="html">&lt;h1&gt;SimpleNav&lt;/h1&gt;

&lt;p&gt;SimpleNav is a mixin for the ActionController class and an accompanying Site helper that provide an easy way to add navigation links for each of your pages to your &lt;a href="http://simplelog.net/"&gt;SimpleLog&lt;/a&gt; theme layouts and views.&lt;/p&gt;

&lt;h1&gt;Installation&lt;/h1&gt;

&lt;p&gt;To install SimpleNav you can:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;./script/plugin install http://unwwwired-public.googlecode.com/svn/trunk/plugins/simple_nav/
&lt;/code&gt;&lt;/pre&gt;

&lt;h1&gt;Usage&lt;/h1&gt;

&lt;p&gt;To use SimpleNav you install the plugin and then call the Site helper nav&lt;em&gt;pages&lt;/em&gt;linked() from the layout or view in which you want navigation links to your pages.&lt;/p&gt;

&lt;p&gt;For example, to add page links to the top of the default SimpleLog theme insert a call to the helper inside the "top" div in the file themes/simplelog/layouts/site.rhtml as shown below:&lt;/p&gt;

&lt;pre class="mac_classic"&gt;&lt;span class="Keyword"&gt;&amp;lt;&lt;/span&gt;div id&lt;span class="Keyword"&gt;=&lt;/span&gt;&lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;top&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&amp;gt;&lt;span class="Keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="Keyword"&gt;%=&lt;/span&gt; &lt;span class="LibraryObject"&gt;Site&lt;/span&gt;.&lt;span class="FunctionName"&gt;nav_pages_linked&lt;/span&gt; &lt;span class="Variable"&gt;&lt;span class="Variable"&gt;@&lt;/span&gt;pages&lt;/span&gt;, &lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;top_nav&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class="String"&gt;&lt;span class="String"&gt;%&amp;gt;&lt;/span&gt;&amp;lt;/div&lt;span class="String"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;Providing you have added an "About" page to your blog, this results in HTML similar to the following (linebreaks have been added for readability):&lt;/p&gt;

&lt;pre class="mac_classic"&gt;&lt;span class="Keyword"&gt;&amp;lt;&lt;/span&gt;div id&lt;span class="Keyword"&gt;=&lt;/span&gt;&lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;top_nav&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span class="Keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="Keyword"&gt;&amp;lt;&lt;/span&gt;ul&lt;span class="Keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="Keyword"&gt;&amp;lt;&lt;/span&gt;li id&lt;span class="Keyword"&gt;=&lt;/span&gt;&lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;current&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&amp;gt;&lt;span class="Keyword"&gt;&amp;lt;&lt;/span&gt;a href&lt;span class="Keyword"&gt;=&lt;/span&gt;&lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;http://blog.myhost.com&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span class="Keyword"&gt;&amp;gt;&lt;/span&gt;&lt;span class="Variable"&gt;Home&lt;/span&gt;&lt;span class="Keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="Keyword"&gt;/&lt;/span&gt;a&amp;gt;&lt;span class="Keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="Keyword"&gt;/&lt;/span&gt;li&lt;span class="Keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="Keyword"&gt;&amp;lt;&lt;/span&gt;li&amp;gt;&lt;span class="Keyword"&gt;&amp;lt;&lt;/span&gt;a href&lt;span class="Keyword"&gt;=&lt;/span&gt;&lt;span class="String"&gt;&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;http://blog.myhost.com/pages/about&lt;span class="String"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span class="Keyword"&gt;&amp;gt;&lt;/span&gt;&lt;span class="Variable"&gt;About&lt;/span&gt;&lt;span class="Keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="Keyword"&gt;/&lt;/span&gt;a&amp;gt;&lt;span class="Keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="Keyword"&gt;/&lt;/span&gt;li&lt;span class="Keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="Keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="Keyword"&gt;/&lt;/span&gt;ul&lt;span class="Keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="Keyword"&gt;&amp;lt;&lt;/span&gt;&lt;span class="Keyword"&gt;/&lt;/span&gt;div&lt;span class="Keyword"&gt;&amp;gt;&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;Copyright (c) 2007 [S. Brent Faulkner], released under SimpleLog's license (GPL)&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/PR9TIV1HfKI" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/276308206</id>
    <published>2007-08-22T18:05:00-04:00</published>
    <updated>2008-08-25T18:40:26-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/code_it_and_they_will" />
    <title>Code it and they will run</title>
    <content type="html">&lt;p&gt;My apologies to W. P. Kinsella (if indeed he is responsible for the original phrase)...&lt;/p&gt;

&lt;p&gt;Well, I was digging around through the SimpleLog forums and stumbled upon a promising post entitled &lt;a href="http://www.daikini.com/past/2007/6/14/simplehighlight_syntax_highlighting_for_simplelog/"&gt;SimpleHighlight - Syntax highlighting for SimpleLog&lt;/a&gt;. Given that I expect to be featuring code on here now and then, I thought this would be kind of nice.&lt;/p&gt;

&lt;p&gt;Oh, the joys of a shared hosting environment!&lt;/p&gt;

&lt;p&gt;The following block should be nicely syntax coloured...&lt;/p&gt;

&lt;pre class="mac_classic"&gt;&lt;span class="Keyword"&gt;class&lt;/span&gt; &lt;span class="TypeName"&gt;Post&lt;/span&gt;
  &lt;span class="LibraryFunction"&gt;has_many&lt;/span&gt; &lt;span class="UserDefinedConstant"&gt;&lt;span class="UserDefinedConstant"&gt;:&lt;/span&gt;comments&lt;/span&gt;
&lt;span class="Keyword"&gt;end&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;My intention here is documenting the mess involved in getting SimpleHighlight installed on &lt;a href="http://hostmonster.com"&gt;HostMonster&lt;/a&gt;... and to give another hint (that I didn't find documented anywhere) for how to actually enable the highlighting...&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/kT1vwDnpNHE" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
  <entry>
    <id>tag:www.unwwwired.net,2005:Post/163329697</id>
    <published>2007-08-21T17:21:00-04:00</published>
    <updated>2008-08-25T18:40:25-04:00</updated>
    <link type="text/html" rel="alternate" href="http://www.unwwwired.net/posts/she_canna_go_any_faster" />
    <title>She canna go any faster, Captain</title>
    <content type="html">&lt;p&gt;Well, after all my frustration at past attempts to run &lt;a href="http://rubyonrails.org"&gt;Ruby on Rails&lt;/a&gt; applications on &lt;a href="http://hostmonster.com"&gt;HostMonster&lt;/a&gt;, it finally came time to get my blog up and running...&lt;/p&gt;

&lt;p&gt;It seems that the Rails community is shifting away from &lt;a href="http://typosphere.org"&gt;Typo&lt;/a&gt; to either &lt;a href="http://mephistoblog.com"&gt;Mephisto&lt;/a&gt; or to the new kid on the block, &lt;a href="http://http://simplelog.net"&gt;SimpleLog&lt;/a&gt;. Since I really expect very little from a blogging engine... SimpleLog would appear to fit the bill.&lt;/p&gt;

&lt;p&gt;The requirements were basic enough:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ruby 1.8.4+ (will work with 1.8.2, but not with 1.8.3)&lt;/li&gt;
&lt;li&gt;Rails&lt;/li&gt;
&lt;li&gt;MySQL 4.2+ or PostgreSQL 7+&lt;/li&gt;
&lt;li&gt;Any modern web browser for the admin interface (Firefox, Camino, Safari, Omniweb or such, IE is not supported)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;HostMonster runs Ruby 1.8.5, Rails 1.2.3 and MySQL 4.1.22.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note to self -- MySQL may be a problem -- watch out!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So... assuming that things would work out with MySQL, off I went.&lt;/p&gt;

&lt;p&gt;If you want to replicate my success, just follow these "simple" steps...&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/unwwwritten/atom/~4/lvliWrzSgKk" height="1" width="1"/&gt;</content>
    <author>
      <name>S. Brent Faulkner</name>
    </author>
  </entry>
</feed>
