<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>MetaSkills.net - Home</title>
  <id>tag:metaskills.net,2008:mephisto/</id>
  <generator uri="http://mephistoblog.com" version="0.8.0">Mephisto Drax</generator>
  <link href="http://metaskills.net/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://metaskills.net/" rel="alternate" type="text/html"/>
  <updated>2008-04-25T14:49:58Z</updated>
  <entry xml:base="http://metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:metaskills.net,2008-04-25:132</id>
    <published>2008-04-25T14:34:00Z</published>
    <updated>2008-04-25T14:49:58Z</updated>
    <category term="Apple/OSX"/>
    <category term="Heuristics"/>
    <category term="Ruby/Rails"/>
    <category term="TextMate"/>
    <category term="apple"/>
    <category term="environment"/>
    <category term="path"/>
    <category term="ruby"/>
    <category term="rubyamp"/>
    <category term="textmate"/>
    <link href="http://metaskills.net/2008/4/25/using-rubyamp-textmate-bundle-with-opt-ruby" rel="alternate" type="text/html"/>
    <title>Using RubyAMP TextMate Bundle With /opt Ruby</title>
<summary type="html">&lt;p&gt;I've been a TextMate user for a long time now and I'm still finding new things to do with it. Here recently I wanted to use the &lt;a href=&quot;http://code.leadmediapartners.com/tools/rubyamp&quot; class=&quot;external-link&quot;&gt;RubyAMP TextMate Bundle&lt;/a&gt; and was a little miffed to find that it was pointing to my OS X system ruby. The error message looked something like this when it went looking for my ruby/gems.&lt;/p&gt;

&lt;pre&gt;
No such file to load -- appscript (LoadError) from 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require’
...
&lt;/pre&gt;</summary><content type="html">
            &lt;p&gt;I've been a TextMate user for a long time now and I'm still finding new things to do with it. Here recently I wanted to use the &lt;a href=&quot;http://code.leadmediapartners.com/tools/rubyamp&quot; class=&quot;external-link&quot;&gt;RubyAMP TextMate Bundle&lt;/a&gt; and was a little miffed to find that it was pointing to my OS X system ruby. The error message looked something like this when it went looking for my ruby/gems.&lt;/p&gt;

&lt;pre&gt;
No such file to load -- appscript (LoadError) from 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require’
...
&lt;/pre&gt;
&lt;p&gt;I've been a TextMate user for a long time now and I'm still finding new things to do with it. Here recently I wanted to use the &lt;a href=&quot;http://code.leadmediapartners.com/tools/rubyamp&quot; class=&quot;external-link&quot;&gt;RubyAMP TextMate Bundle&lt;/a&gt; and was a little miffed to find that it was pointing to my OS X system ruby. The error message looked something like this when it went looking for my ruby/gems.&lt;/p&gt;

&lt;pre&gt;
No such file to load -- appscript (LoadError) from 
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require’
...
&lt;/pre&gt;

&lt;p&gt;My problem is that I use ruby installed from MacPorts (yes I have Leopard). I do this because I put a lot of crap and extra dependencies into my opt direcotry and I do not trust Apple to NOT blow away the crazy dependencey hell I would have ended up creating in the standard bin directories if I chose not to use MacPorts. I would have thought that my &lt;code&gt;TM_RUBY&lt;/code&gt; environment variable being set correctly to &lt;code&gt;/opt/local/bin/ruby&lt;/code&gt; in my TextMate preferences would have given RubyAMP enough info to find my correct gem environment. Obviously not... and it took me quite a bit of digging around to learn what else I needed to do. For starters, here is more than you ever wanted to know about &lt;a href=&quot;http://macromates.com/textmate/manual/shell_commands#search_path&quot; class=&quot;external-link&quot;&gt;how TextMate gets the $PATH information&lt;/a&gt;. You can skip reading that and do these simple steps.&lt;/p&gt;

&lt;ul class=&quot;mt10&quot;&gt;
&lt;li&gt;Open /Developer/Applications/Utilities/Property List Editor.app&lt;/li&gt;
&lt;li&gt;Click on &quot;New Root&quot;, now expand that node in the list view below.&lt;/li&gt;
&lt;li&gt;Click on &quot;New Child&quot;, name it PATH&lt;/li&gt;
&lt;li&gt;The child row for PATH should be a String type&lt;/li&gt;
&lt;li&gt;Enter your PATH info here, should mimic your .bash_profile, without $PATH&lt;/li&gt;
&lt;li&gt;Save this file to your Desktop as environment.plist&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now do this in the console, we need to move that file to an invisible &lt;code&gt;.MacOSX&lt;/code&gt; folder in your home directory. In all likelyhood this folder does not exists, nor does the environment.plist file inside of it, if so, please do your own work to make sure that you do not overwrite existing information. Now:&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
mkdir ~/.MacOSX
mv ~/Desktop/environment.plist ~/.MacOSX
&lt;/pre&gt;

&lt;p&gt;With the file in place, you now have to log out and back in. To be on the safe side, just reboot. Now your OSX apps, including TextMate and it's bundles will have the correct PATH information to get to your binaries. See below for an example of what my environment.plist file looks like. Note too that my full PATH info in that file is this string &lt;code&gt;/opt/local/bin:/opt/local/sbin:/opt/local/lib/mysql5/bin:/opt/local/apache2/bin&lt;/code&gt;. Notice that path info after the apache2 path? This is where you should add the default path info for a Mac. Unlike the .bash_profile, you can not specify &lt;code&gt;$PATH&lt;/code&gt; and have it expanded from within a plist file. So to be on the safe side, when I added this, I put the standard mac path info at the end of my own additions. That standard path info is &lt;code&gt;/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin&lt;/code&gt;&lt;/p&gt;



&lt;div class=&quot;iecenter&quot;&gt;
  &lt;img src=&quot;http://www.metaskills.net/assets/2008/4/25/envplist.png&quot; height=&quot;302&quot; width=&quot;496&quot; /&gt;
&lt;/div&gt;
          </content>  </entry>
  <entry xml:base="http://metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:metaskills.net,2008-04-22:131</id>
    <published>2008-04-22T03:12:00Z</published>
    <updated>2008-05-06T13:19:18Z</updated>
    <category term="Heuristics"/>
    <category term="Ruby/Rails"/>
    <category term="edge"/>
    <category term="mod_rails"/>
    <category term="passenger"/>
    <category term="rails"/>
    <link href="http://metaskills.net/2008/4/22/how-to-use-passenger-mod_rails-with-rails-edge-2-1" rel="alternate" type="text/html"/>
    <title>How to use Passenger (mod_rails) with rails edge 2.1</title>
<content type="html">
            &lt;p&gt;If you are like me and have &lt;a href=&quot;/2008/4/13/now-on-passenger-mod_rails&quot;&gt;been using passenger&lt;/a&gt;, then you may have run into an issue when working with rails edge. I mean the REAL rails edge on Git, not that fancy rake task which I think is still pointing to a subversion snapshot. Let me take an aside on how to freeze rails edge to a project that you are managing in Git. This method is akin to using svn:externals. As a cop out, here are 3 links that you should read to learn how.&lt;/p&gt;

&lt;div class=&quot;update bold iecenter mt20 mb20&quot;&gt;UPDATE: This issue has &lt;a href=&quot;http://github.com/FooBarWidget/passenger/commit/53301de464b323d364723854d3a8d293ab8327d6&quot; class=&quot;external-link&quot;&gt;now been resolved&lt;/a&gt; in the official release.&lt;/div&gt; 

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://railsontherun.com/2008/4/16/freezing-rails-with-git&quot; class=&quot;external-link&quot;&gt;http://railsontherun.com/2008/4/16/freezing-rails-with-git&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://woss.name/2008/04/09/using-git-submodules-to-track-vendorrails/&quot; class=&quot;external-link&quot;&gt;http://woss.name/2008/04/09/using-git-submodules-to-track-vendorrails/&lt;/a&gt;
&lt;li&gt;&lt;a href=&quot;http://git.or.cz/gitwiki/GitSubmoduleTutorial&quot; class=&quot;external-link&quot;&gt;http://git.or.cz/gitwiki/GitSubmoduleTutorial&lt;/a&gt;
&lt;/ul&gt;

&lt;p&gt;OK... now that you know how to freeze the real rails edge to your git project, and if you have been using passenger, you may now have seen this error below. The basic problem is that passenger bypasses the work that the rails boot.rb does and in doing so, it only accounts for setting RAILS_ROOT during the ApplicationSpawner process and not the FrameworkSpawner process. In the latest rails, ActionPack is now relying on RAILS_ROOT to be set by calling Rails.root (shortcut method to that constant) when loading. So &lt;a href=&quot;http://github.com/metaskills/passenger/commit/69afcd75425a89c9d17d1fc40c0a7571d6bd547c &quot; class=&quot;external-link&quot;&gt;my fix was to add the RAILS_ROOT to the FrameworkSpawner class&lt;/a&gt;.&lt;/p&gt;

&lt;pre&gt;
Framework that failed to load: Vendor directory: /Users/foo/project/vendor/rails 
Error message: Anonymous modules have no name to be referenced by 
Exception class: ArgumentError 
&lt;/pre&gt;

&lt;h2&gt;Resources&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://code.google.com/p/phusion-passenger/issues/detail?id=29&amp;amp;can=1&amp;amp;q=edge&amp;amp;colspec=ID%20Type%20Status%20Priority%20Milestone%20Stars%20Summary&quot; class=&quot;external-link&quot;&gt;Here is the Passenger Ticket&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://github.com/FooBarWidget/passenger/commit/53301de464b323d364723854d3a8d293ab8327d6&quot; class=&quot;external-link&quot;&gt;The official Passenger change set that fixed this issue.&lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;
          </content>  </entry>
  <entry xml:base="http://metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:metaskills.net,2008-04-13:130</id>
    <published>2008-04-13T18:15:00Z</published>
    <updated>2008-04-14T13:10:52Z</updated>
    <category term="Apple/OSX"/>
    <category term="Heuristics"/>
    <category term="Ruby/Rails"/>
    <link href="http://metaskills.net/2008/4/13/now-on-passenger-mod_rails" rel="alternate" type="text/html"/>
    <title>Now on Passenger (mod_rails)</title>
<content type="html">
            &lt;div class=&quot;iecenter&quot;&gt;&lt;img src=&quot;/assets/2008/4/13/passenger_install.png&quot; height=&quot;308&quot; width=&quot;515&quot; /&gt;&lt;/div&gt;

&lt;p&gt;Well this is working out well so far. I'm really liking the &lt;a href=&quot;http://modrails.com/index.html&quot; class=&quot;external-link&quot;&gt;Passenger (mod_rails for Apache)&lt;/a&gt; extension. Right now I have this Mephisto site running it and it seems to be doing really well. Also, most people do not do this, but I run a full development stack Apache/MongrelCluster to mimic production boxes the best way I can. Now I am running mod_rails on all my development hosts.&lt;/p&gt;

&lt;h2&gt;Some Things I Like&lt;/h2&gt;

&lt;ul class=&quot;mt10&quot;&gt;
  &lt;li&gt;I do not have to fuss with OS X launchd startup scripts for my mongrels, just Apache.&lt;/li&gt;
  &lt;li&gt;Typically in a high volume site that runs mongrel behind an Apache proxy balancer, will get a large timeout and proxy error even if the mongrels are immediately available. Passenger has a &lt;a href=&quot;http://modrails.com/documentation/Users%20guide.html#_redeploying_restarting_the_ruby_on_rails_application&quot; class=&quot;external-link&quot;&gt;nice way to restart&lt;/a&gt; the app, just touch the tmp/restart.txt file.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Some Things I'm Waiting For&lt;/h2&gt;

&lt;ul class=&quot;mt10&quot;&gt;
  &lt;li&gt;The RailsEnv can not be set per virtual host. You have to set RAILS_ENV = 'development' in each app if you want to run mixed virtual hosts with different environments.&lt;/li&gt;
  &lt;li&gt;Normally I would pass environment variables to the console when issuing mongrel cluster starts. I would really love to see Passenger support &lt;a href=&quot;http://httpd.apache.org/docs/2.2/env.html&quot; class=&quot;external-link&quot;&gt;apache environment variables.&lt;/li&gt;
&lt;/ul&gt;
          </content>  </entry>
  <entry xml:base="http://metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:metaskills.net,2008-04-06:127</id>
    <published>2008-04-06T19:11:00Z</published>
    <updated>2008-04-16T22:30:11Z</updated>
    <category term="Heuristics"/>
    <category term="Ruby/Rails"/>
    <link href="http://metaskills.net/2008/4/6/autotest-playlist-for-red-green-feedback" rel="alternate" type="text/html"/>
    <title>Autotest Playlist For Red/Green Feedback</title>
<summary type="html">&lt;p&gt;Here is how to get a playlist of sounds that will be hooked to both your autotest :red and :green callbacks. Basically this gives you a folder of sounds that are played one after another, in a loop, as your tests pass or fail. See this move below for a quick example.&lt;/p&gt;

&lt;div class=&quot;iecenter mt10&quot;&gt;&amp;lt;object height=&quot;350&quot; width=&quot;425&quot;&gt; &amp;lt;param&gt; &amp;lt;/param&gt; &amp;lt;embed src=&quot;http://www.youtube.com/v/HV_drKDclFA&quot; height=&quot;350&quot; width=&quot;425&quot;&gt; &amp;lt;/embed&gt; &amp;lt;/object&gt;&lt;/div&gt;</summary><content type="html">
            &lt;p&gt;Here is how to get a playlist of sounds that will be hooked to both your autotest :red and :green callbacks. Basically this gives you a folder of sounds that are played one after another, in a loop, as your tests pass or fail. See this move below for a quick example.&lt;/p&gt;

&lt;div class=&quot;iecenter mt10&quot;&gt;&amp;lt;object height=&quot;350&quot; width=&quot;425&quot;&gt; &amp;lt;param&gt; &amp;lt;/param&gt; &amp;lt;embed src=&quot;http://www.youtube.com/v/HV_drKDclFA&quot; height=&quot;350&quot; width=&quot;425&quot;&gt; &amp;lt;/embed&gt; &amp;lt;/object&gt;&lt;/div&gt;
&lt;p&gt;Here is how to get a playlist of sounds that will be hooked to both your autotest :red and :green callbacks. Basically this gives you a folder of sounds that are played one after another, in a loop, as your tests pass or fail. See this move below for a quick example.&lt;/p&gt;

&lt;div class=&quot;iecenter mt10&quot;&gt;&amp;lt;object height=&quot;350&quot; width=&quot;425&quot;&gt; &amp;lt;param&gt; &amp;lt;/param&gt; &amp;lt;embed src=&quot;http://www.youtube.com/v/HV_drKDclFA&quot; height=&quot;350&quot; width=&quot;425&quot;&gt; &amp;lt;/embed&gt; &amp;lt;/object&gt;&lt;/div&gt;

&lt;h2&gt;Step 1: Install QTPlay from MacPorts&lt;/h2&gt;

&lt;pre class=&quot;command&quot;&gt;
sudo port install qtplay
&lt;/pre&gt;

&lt;h2&gt;Step 2: Download My Autotest Playlist Files&lt;/h2&gt;

&lt;pre class=&quot;command&quot;&gt;
cd ~
curl -O http://www.metaskills.net/files/autotest_playlist.tar
tar -xf autotest_playlist.tar
mv autotest_playlist .autotest_playlist &amp;&amp; rm autotest_playlist.tar
&lt;/pre&gt;

&lt;h2&gt;Step 3: Modify Your .autotest File&lt;/h2&gt;

&lt;p&gt;User your favorite editor to open your &lt;code&gt;~/.autotest&lt;/code&gt; file. And add this code below to it. Now you should be setup to have your own playlist of sounds that play using the &lt;code&gt;qtplay&lt;/code&gt; binary installed above. If you want to play around with the sounds, then &lt;code&gt;open ~/.autotest_playlist/sounds&lt;/code&gt; and start swapping out sounds. By the way, I made the :initialize and :quit sounds using the new Alex voice in Leopard. I hijacked some text to speech and then ran an audio tool called WavePad to speed change, flange, and chorus the voice a little bit.&lt;/p&gt;

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;require &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;~/.autotest_playlist/playlist&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


&lt;h2&gt;Credits:&lt;/h2&gt;

&lt;p&gt;The idea for this came from &lt;a href=&quot;http://www.fozworks.com/2007/7/28/autotest-sound-effects/&quot; class=&quot;external-link&quot;&gt;FoxWorks&lt;/a&gt;. Shouts out &quot;Thank You&quot;.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:metaskills.net,2008-04-06:126</id>
    <published>2008-04-06T17:52:00Z</published>
    <updated>2008-04-06T20:56:04Z</updated>
    <category term="Heuristics"/>
    <category term="Ruby/Rails"/>
    <category term="autotest"/>
    <category term="rails"/>
    <category term="ruby"/>
    <link href="http://metaskills.net/2008/4/6/autotest-infinite-loop-on-failure-error" rel="alternate" type="text/html"/>
    <title>Autotest Infinite Loop On Failure &amp; Error</title>
<summary type="html">&lt;p&gt;I just had an issue pop up today that seemed to be an issue for a few others. It seemed that all of a sudden that my autotest was stuck in an infinite loop after a failure or error. At first I thought it was related to some additions to my &lt;code&gt;~/.autotest&lt;/code&gt; file but after commenting out the whole lot of additions there, I realized it was something else. Here was my fix. Basically I think these errors are always related to a file that has changed during your test run. Now we just have to find out what that files are. Here are the steps I took to find out.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;I just had an issue pop up today that seemed to be an issue for a few others. It seemed that all of a sudden that my autotest was stuck in an infinite loop after a failure or error. At first I thought it was related to some additions to my &lt;code&gt;~/.autotest&lt;/code&gt; file but after commenting out the whole lot of additions there, I realized it was something else. Here was my fix. Basically I think these errors are always related to a file that has changed during your test run. Now we just have to find out what that files are. Here are the steps I took to find out.&lt;/p&gt;
&lt;p&gt;I just had an issue pop up today that seemed to be an issue for a few others. It seemed that all of a sudden that my autotest was stuck in an infinite loop after a failure or error. At first I thought it was related to some additions to my &lt;code&gt;~/.autotest&lt;/code&gt; file but after commenting out the whole lot of additions there, I realized it was something else. Here was my fix. Basically I think these errors are always related to a file that has changed during your test run. Now we just have to find out what that files are. Here are the steps I took to find out.&lt;/p&gt;

&lt;h2&gt;Step 1: Gather Changed FIle Info&lt;/h2&gt;

&lt;p&gt;To find out what files are changing. To do this add the -v option when you start autotest. This will cause it to run in verbose mode. Now after you have failed a test and YOU KNOW YOU DID NOT SAVE ANYTHING watch what happens below your listing of test, assertions, failures, and errors. There will be an array dumped that will contain the files change that have caused autotest to start another test cycle. In my case here is what I saw.&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
1) Failure:
test_truth(BookmarkTest)
[test/unit/bookmark_test.rb:6
test/unit/bookmark_test.rb:5]:
&amp;lt;false&gt; is not true.

1 tests, 1 assertions, 1 failures, 0 errors
[[&quot;config/uuid.state&quot;, Sun Apr 06 13:58:55 -0400 2008]]
Dunno! config/uuid.state
&lt;/pre&gt;

&lt;p&gt;Ah ha... there it goes. I was using a UUID state file and it appears that file being written into the &lt;code&gt;config&lt;/code&gt; directory is the culprit. By default autotest does not ignore that directory.&lt;/p&gt;

&lt;h2&gt;Step 2: Fix The Problem&lt;/h2&gt;

&lt;p&gt;We have two options here. You can either add an autotest exception in you &lt;code&gt;~/.autotest&lt;/code&gt; file or you can bail out. My option is to bail out because I should not be adding a file at run time to the config directory. It would seem a better place would be the &lt;code&gt;tmp&lt;/code&gt; directory. However if you think that adding an exception to your &lt;code&gt;~/.autotest&lt;/code&gt; file would be more appropriate, here is the syntax&lt;/p&gt;

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;co&quot;&gt;Autotest&lt;/span&gt;.add_hook &lt;span class=&quot;sy&quot;&gt;:initialize&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |autotest|&lt;tt&gt;
&lt;/tt&gt;  [&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;.svn&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;.hg&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;.git&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;].each { |exception| autotest.add_exception(exception) }&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


&lt;h2&gt;Step 3
          </content>  </entry>
  <entry xml:base="http://metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:metaskills.net,2008-04-03:125</id>
    <published>2008-04-03T23:29:00Z</published>
    <updated>2008-04-04T13:06:31Z</updated>
    <category term="Heuristics"/>
    <category term="Ruby/Rails"/>
    <category term="actionmailer"/>
    <category term="delivery"/>
    <category term="rails"/>
    <category term="ruby"/>
    <link href="http://metaskills.net/2008/4/3/how-to-stop-delivery-of-an-email-within-an-actionmailer-method" rel="alternate" type="text/html"/>
    <title>How To Stop Delivery Of An Email Within An ActionMailer Method</title>
<summary type="html">&lt;p&gt;OK, so you want to keep your code placement REALLY organized. You have &lt;a href=&quot;/2008/3/26/don-t-be-a-plinko-programmer&quot;&gt;read about my persnicketyness&lt;/a&gt; and now you want to practice the best in concern placement and keep those controllers of yours really slim. Like me, you may want to try and keep controller feature additions to very specific one liners of code. Organizing your controller code to do just that with ActiveRecord models or even your own custom classes is a pretty easy task, but how do you keep things simple when dealing with controller actions that have to send email AND you want that single email link of code to be responsible for everything in it's own encapsulated way.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;OK, so you want to keep your code placement REALLY organized. You have &lt;a href=&quot;/2008/3/26/don-t-be-a-plinko-programmer&quot;&gt;read about my persnicketyness&lt;/a&gt; and now you want to practice the best in concern placement and keep those controllers of yours really slim. Like me, you may want to try and keep controller feature additions to very specific one liners of code. Organizing your controller code to do just that with ActiveRecord models or even your own custom classes is a pretty easy task, but how do you keep things simple when dealing with controller actions that have to send email AND you want that single email link of code to be responsible for everything in it's own encapsulated way.&lt;/p&gt;


&lt;p&gt;OK, so you want to keep your code placement REALLY organized. You have &lt;a href=&quot;/2008/3/26/don-t-be-a-plinko-programmer&quot;&gt;read about my persnicketyness&lt;/a&gt; and now you want to practice the best in concern placement and keep those controllers of yours really slim. Like me, you may want to try and keep controller feature additions to very specific one liners of code. Organizing your controller code to do just that with ActiveRecord models or even your own custom classes is a pretty easy task, but how do you keep things simple when dealing with controller actions that have to send email AND you want that single email link of code to be responsible for everything in it's own encapsulated way.&lt;/p&gt;

&lt;p&gt;The answer is to push the logic back to the model again. Your controllers should not be concerned with the logic that deals with your own business rules for sending email. The problem with ActionMailer is that most people just use the dynamic &lt;code&gt;MyMailerClass.deliver_&lt;/code&gt; methods that utilize &lt;code&gt;method_missing&lt;/code&gt; to instantiate a mailer classs, and send an email in one fell swoop. I like this usage too, but the challenge is how to tell an instance of a the ActionMailer::Base class that it needs to stop delivery within a method definition that is all set to deliver? The answer is Ruby singleton method magic.&lt;/p&gt; 

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;ActionMailer&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;Base&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;c&quot;&gt;# A simple way to short circuit the delivery of an email from within&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;c&quot;&gt;# deliver_* methods defined in ActionMailer::Base subclases.&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;do_not_deliver!&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;pc&quot;&gt;self&lt;/span&gt;.deliver! ; &lt;span class=&quot;pc&quot;&gt;false&lt;/span&gt; ; &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


&lt;p&gt;I suggest placing this code into your &lt;code&gt;lib/core_ext/action_mailer.rb&lt;/code&gt; file. It will allow you to write mailer methods that can short circuit themselves to stop delivery. For instance:

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;MyMailerClass&lt;/span&gt; &amp;lt; &lt;span class=&quot;co&quot;&gt;ActionMailer&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;user_notification&lt;/span&gt;(user)&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;c&quot;&gt;# ... &lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    do_not_deliver! &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; user.email.blank?&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# In your controller code.&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;co&quot;&gt;MyMailerClass&lt;/span&gt;.deliver_user_notification(&lt;span class=&quot;iv&quot;&gt;@user&lt;/span&gt;)&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


&lt;p&gt;Now you do not have to worry about placing delivery concerns in the controller and even worse duplicate that code when you have to use the same mailer method in multiple places. This works by letting the instance of the ActionMailer::Base class define it's own deliver! method which trumps the delier! method called by that object normally defined in ActionMailer::Base.&lt;/p&gt;

&lt;h2&gt;Resources&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.ruby-doc.org/docs/UsersGuide/rg/singletonmethods.html&quot; class=&quot;external-link&quot;&gt;About Singleton Methods&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://redhanded.hobix.com/inspect/methodsThatSelfDestruct.html&quot; class=&quot;external-link&quot;&gt;Methods That Self-Destruct&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
          </content>  </entry>
  <entry xml:base="http://metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:metaskills.net,2008-04-03:124</id>
    <published>2008-04-03T22:45:00Z</published>
    <updated>2008-04-03T23:01:59Z</updated>
    <category term="Apple/OSX"/>
    <category term="apple"/>
    <category term="ifreemem"/>
    <category term="macbook"/>
    <category term="memory"/>
    <category term="ram"/>
    <link href="http://metaskills.net/2008/4/3/macbook-with-4gb-of-memory" rel="alternate" type="text/html"/>
    <title>MacBook With 4GB Of Memory</title>
<content type="html">
            &lt;p&gt;My MacBook is about a year old now and I've read in &lt;a href=&quot;http://forums.macrumors.com/showthread.php?t=364707&quot; class=&quot;external-link&quot;&gt;quite a few places&lt;/a&gt; that they could be upgraded to around 3.3GB of memory for this specific model. Unlike the latest MacBook which can &quot;as advertised&quot; accommodate 4GB of memory, the theory was that the Santa Rosa chipset can address all 4GB. It could very well be that technically my MacBook is only using ~3.3GB of that memory but the performance has been significant for a very &lt;a href=&quot;http://www.crucial.com/store/partspecs.aspx?imodule=CT25664AC667&quot; class=&quot;external-link&quot;&gt;cheap stick of RAM&lt;/a&gt;. I highly recommend Crucial.&lt;p&gt;

&lt;p&gt;I think this upgrade will have to hold me for some time. In general it has really helped my uptime. Odd as that is I think working with only 2GB of memory caused a lot of IO swap and memory corruption. Especially when stopping and starting so many different mongrels for local Rails development. As of this writing I have not found an issue that I have had to reboot for... uptime 10 days and going strong.&lt;/p&gt;

&lt;p&gt;To keep my uptime going strong, I just purchased an app called &lt;a href=&quot;http://www.activata.co.uk/ifreemem/&quot; class=&quot;external-link&quot;&gt;iFreeMem&lt;/a&gt; today after reading about it on &lt;a href=&quot;http://www.tuaw.com/&quot; class=&quot;external-link&quot;&gt;TUAW&lt;/a&gt;. Because I use PhotoShop ever now and then it really helped having this utility free up some memory that it would not release. So far it is working great!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:metaskills.net,2008-03-26:123</id>
    <published>2008-03-26T22:35:00Z</published>
    <updated>2008-03-27T14:40:36Z</updated>
    <category term="Lifestyle"/>
    <category term="Miscellaneous"/>
    <category term="Ruby/Rails"/>
    <category term="codestyle"/>
    <category term="plinko"/>
    <category term="programming"/>
    <category term="ruby"/>
    <link href="http://metaskills.net/2008/3/26/don-t-be-a-plinko-programmer" rel="alternate" type="text/html"/>
    <title>Don't Be A Plinko Programmer</title>
<summary type="html">&lt;p&gt;
  One of the things that I have really grown persnickety about is the placement of code. For example, I am a huge advocate that controllers in a rails project should read like a mini Domain Specific Language (DSL) and that as much logic as possible be delegated to the models. In my opinion the best way to do that in a Rails project is to learn the proper usage of ActiveRecord Association Extensions. You can check out the Rails API &lt;a href=&quot;http://api.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html&quot; class=&quot;external-link&quot;&gt;on this page&lt;/a&gt; and scroll down to the section called &quot;Association Extensions&quot; if you read the official docs. In short:
&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;
  One of the things that I have really grown persnickety about is the placement of code. For example, I am a huge advocate that controllers in a rails project should read like a mini Domain Specific Language (DSL) and that as much logic as possible be delegated to the models. In my opinion the best way to do that in a Rails project is to learn the proper usage of ActiveRecord Association Extensions. You can check out the Rails API &lt;a href=&quot;http://api.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html&quot; class=&quot;external-link&quot;&gt;on this page&lt;/a&gt; and scroll down to the section called &quot;Association Extensions&quot; if you read the official docs. In short:
&lt;/p&gt;


&lt;p&gt;
  One of the things that I have really grown persnickety about is the placement of code. For example, I am a huge advocate that controllers in a rails project should read like a mini Domain Specific Language (DSL) and that as much logic as possible be delegated to the models. In my opinion the best way to do that in a Rails project is to learn the proper usage of ActiveRecord Association Extensions. You can check out the Rails API &lt;a href=&quot;http://api.rubyonrails.com/classes/ActiveRecord/Associations/ClassMethods.html&quot; class=&quot;external-link&quot;&gt;on this page&lt;/a&gt; and scroll down to the section called &quot;Association Extensions&quot; if you read the official docs. In short:
&lt;/p&gt;&lt;br /&gt;

&lt;blockquote&gt;
  &lt;div&gt;
    The proxy objects that control the access to associations can be extended through anonymous modules. 
    This is especially beneficial for adding new finders, creators, and other factory-type methods that are only used as part of this association.
  &lt;/div&gt;
&lt;/blockquote&gt;

&lt;p&gt;
  Now this brings me to the topic of my article, what is a Plinko Programmer. If you have no class and don't even know what Plinko is, &lt;a href=&quot;http://en.wikipedia.org/wiki/Plinko&quot; class=&quot;external-link&quot;&gt;Wikipedia has a great write up&lt;/a&gt; on it. A Plinko Programmer is someone that writes code which smells in a few ways. For instance they use excessive arguments in their methods and unnecessarily pass objects around as arguments. They like to bake their own &lt;a href=&quot;http://www.ruby-doc.org/core/classes/Enumerable.html&quot; class=&quot;external-link&quot;&gt;Enumerable&lt;/a&gt; methods vs using the ones readily available. They even like to create large class level methods, or even worse controller actions, that really should be factory methods in 2 or more classes. The analogy is akin to much of the Java code I have rewritten in Rails. Plinko code is long and full of if/else conditions, it's just like the game. You drop an object in the top and just watch it &quot;by chance&quot; work it's way thru the method/function. It is a nasty way to write code and if for anything else it is illegible and hard to test.
&lt;/p&gt;


&lt;h2&gt;What Is The Right Way?&lt;/h2&gt;

&lt;p&gt;
  Here is a short example of how to use Association Extensions. This is a simple example, but when you get used to really using association extensions you will begin to see just how much of your code really belongs there. Let's assume you have a simple invoice and items class.
&lt;/p&gt;

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;Invoice&lt;/span&gt; &amp;lt; &lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  has_many &lt;span class=&quot;sy&quot;&gt;:items&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:class_name&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;InvoiceItem&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:foreign_key&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;invoice_id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;InvoiceItem&lt;/span&gt; &amp;lt; &lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  belongs_to &lt;span class=&quot;sy&quot;&gt;:invoice&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;total&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;c&quot;&gt;# Some complex stuff&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


&lt;p&gt;
  Now let's say that you want to have a clean little method for getting the total of the Invoice object. Resist the temptation to simple add an instance method to the Invoice class. Although it is logical to have &lt;code&gt;@invoice.total&lt;/code&gt; it is better to add it too the association extension. Why? Well think about it, what are you doing? The answer is that you are working with a &quot;collection&quot; of InvoiceItems. It turns out that this is the first part of what the association extension is for, an easy way to work with a collection that has the benefits of knowing how to proxy to methods that can reflect back down to the original caller. It's hard to explain but I'll just leave you with my persnickety code example. Your general rule should be if you are working with the collection in part or in total, then the association extension is the place for it. Keep in mind that so far I have only talked about has_may association extensions, you can do these for one-to-on belongs_to and has_one associations as well.
&lt;/p&gt;

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;15&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;Invoice&lt;/span&gt; &amp;lt; &lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  has_many &lt;span class=&quot;sy&quot;&gt;:items&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:class_name&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;InvoiceItem&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:foreign_key&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;invoice_id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;total&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      proxy_target.map(&amp;amp;&lt;span class=&quot;sy&quot;&gt;:total&lt;/span&gt;).sum&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;InvoiceItem&lt;/span&gt; &amp;lt; &lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  belongs_to &lt;span class=&quot;sy&quot;&gt;:invoice&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;total&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;c&quot;&gt;# Some complex stuff&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# Would yeild code like:&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;iv&quot;&gt;@invoice&lt;/span&gt;.items.total&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


&lt;p&gt;P.S. Here lately I've been creating an app/concerns directory where I put modules that encompass mixed in behavior in so many ways for top level models. Typically these modules/concerns shared instance and class methods with two or more primary classes. They have become an excellent home for association extensions since many large applications will define the same association from different models in the object. To keep the code from duplicating in those different models it is better to do something like this&lt;/p&gt;

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;15&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;21&lt;tt&gt;
&lt;/tt&gt;22&lt;tt&gt;
&lt;/tt&gt;23&lt;tt&gt;
&lt;/tt&gt;24&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;25&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;26&lt;tt&gt;
&lt;/tt&gt;27&lt;tt&gt;
&lt;/tt&gt;28&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# This file &amp;quot;invoice_item_concerns.rb&amp;quot; would reside in app/concerns&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;InvoiceItemConcerns&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;AssociationExtensions&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;total&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      proxy_target.map(&amp;amp;&lt;span class=&quot;sy&quot;&gt;:total&lt;/span&gt;).sum&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;Invoice&lt;/span&gt; &amp;lt; &lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  has_many &lt;span class=&quot;sy&quot;&gt;:items&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:class_name&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;InvoiceItem&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:foreign_key&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;invoice_id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:extend&lt;/span&gt; =&amp;gt; &lt;span class=&quot;co&quot;&gt;InvoiceItemConcerns&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;AssociationExtensions&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;PackingSlip&lt;/span&gt; &amp;lt; &lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  has_many &lt;span class=&quot;sy&quot;&gt;:shipments&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:class_name&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;InvoiceItem&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:foreign_key&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;packing_slip_id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:extend&lt;/span&gt; =&amp;gt; &lt;span class=&quot;co&quot;&gt;InvoiceItemConcerns&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;AssociationExtensions&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;InvoiceItem&lt;/span&gt; &amp;lt; &lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  belongs_to &lt;span class=&quot;sy&quot;&gt;:invoice&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;total&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;c&quot;&gt;# Some complex stuff&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# Would yeild code like:&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;iv&quot;&gt;@invoice&lt;/span&gt;.items.total&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;iv&quot;&gt;@packing_slip&lt;/span&gt;.shipments.total&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
          </content>  </entry>
  <entry xml:base="http://metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:metaskills.net,2008-03-22:122</id>
    <published>2008-03-22T01:51:00Z</published>
    <updated>2008-03-22T02:47:29Z</updated>
    <category term="Heuristics"/>
    <category term="mephisto"/>
    <category term="metatheme"/>
    <link href="http://metaskills.net/2008/3/22/metaskills-net-reborn-on-mephisto" rel="alternate" type="text/html"/>
    <title>MetaSkills.net Reborn on Mephisto</title>
<summary type="html">&lt;p&gt;&lt;img src=&quot;/files/metatheme/meta_drax2.png&quot; alt=&quot;Drax&quot; /&gt;Well after a year of neglect, the MetaSkills.net blog has been &lt;a href=&quot;/meta-theme-for-mephisto&quot;&gt;reborn on Mephisto&lt;/a&gt;. Previously I was using Drupal and it finally got to a point where I was so deep into ruby that I did not even have the gumption to open up a PHP session to publish anything. The sad part is that I told myself that this PHP disdain would help me get off my butt and move to Mephisto. You know, eat my own dog food – obviously procrastination won out – but not forever. For the past week I worked hard to get the Meta theme for Drupal converted to Mephisto. You can use this theme yourself if you want, the source is available on &lt;a href=&quot;http://github.com/metaskills/metatheme/tree/master&quot; class=&quot;external-link&quot;&gt;my github&lt;/a&gt; and I am making updates often. Heck... feel free to fork the project and make some changes or let me know if you want me to incorporate them into mine.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;&lt;img src=&quot;/files/metatheme/meta_drax2.png&quot; alt=&quot;Drax&quot; /&gt;Well after a year of neglect, the MetaSkills.net blog has been &lt;a href=&quot;/meta-theme-for-mephisto&quot;&gt;reborn on Mephisto&lt;/a&gt;. Previously I was using Drupal and it finally got to a point where I was so deep into ruby that I did not even have the gumption to open up a PHP session to publish anything. The sad part is that I told myself that this PHP disdain would help me get off my butt and move to Mephisto. You know, eat my own dog food – obviously procrastination won out – but not forever. For the past week I worked hard to get the Meta theme for Drupal converted to Mephisto. You can use this theme yourself if you want, the source is available on &lt;a href=&quot;http://github.com/metaskills/metatheme/tree/master&quot; class=&quot;external-link&quot;&gt;my github&lt;/a&gt; and I am making updates often. Heck... feel free to fork the project and make some changes or let me know if you want me to incorporate them into mine.&lt;/p&gt; 
&lt;p&gt;&lt;img src=&quot;/files/metatheme/meta_drax2.png&quot; alt=&quot;Drax&quot; /&gt;Well after a year of neglect, the MetaSkills.net blog has been &lt;a href=&quot;/meta-theme-for-mephisto&quot;&gt;reborn on Mephisto&lt;/a&gt;. Previously I was using Drupal and it finally got to a point where I was so deep into ruby that I did not even have the gumption to open up a PHP session to publish anything. The sad part is that I told myself that this PHP disdain would help me get off my butt and move to Mephisto. You know, eat my own dog food – obviously procrastination won out – but not forever. For the past week I worked hard to get the Meta theme for Drupal converted to Mephisto. You can use this theme yourself if you want, the source is available on &lt;a href=&quot;http://github.com/metaskills/metatheme/tree/master&quot; class=&quot;external-link&quot;&gt;my github&lt;/a&gt; and I am making updates often. Heck... feel free to fork the project and make some changes or let me know if you want me to incorporate them into mine.&lt;/p&gt; 

&lt;p&gt;Here are a few things that I liked about rewriting the Meta theme for Mephisto. First, unlike Drupal, the administration of your Mephisto blog is not inline, but all tucked away in a private admin section. When you make a theme in Drupal, you are burdened to to the task of coding all the admin CSS for the inline admin features. The Meta theme had over 500 lines of CSS just for the Drupal administration. That is all gone and I love keeping theme code focused on doing nothing but presenting the &quot;user&quot; experience.&lt;/p&gt;

&lt;p&gt;Also, when I first wrote the Meta theme I was just a JavaScript beginner. Nowadays I am pretty good at it and have moved away from the simple script like functions that pass arguments around into a full OO style that spawns from smart classes and a persistent state. The Meta theme is now 100% on Prototype and all the interactive features are tightly knit into the MetaTools, MetaSearch, and MetaContent classes. Take a look at the meta.js source if you want. Lastly, if you are on an old Drupal blog looking to get over to Mephisto, maybe this migration script will help.&lt;/p&gt;


&lt;h2&gt;Migration from Drupal to Mephisto&lt;/h2&gt;

&lt;p&gt;This script is what I used in the rails console to populate data from my old Drupal 4.7 blog to Mephisto. This code is untested on the schema of higher versions of Drupal.&lt;/p&gt;

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;15&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;21&lt;tt&gt;
&lt;/tt&gt;22&lt;tt&gt;
&lt;/tt&gt;23&lt;tt&gt;
&lt;/tt&gt;24&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;25&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;26&lt;tt&gt;
&lt;/tt&gt;27&lt;tt&gt;
&lt;/tt&gt;28&lt;tt&gt;
&lt;/tt&gt;29&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;30&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;31&lt;tt&gt;
&lt;/tt&gt;32&lt;tt&gt;
&lt;/tt&gt;33&lt;tt&gt;
&lt;/tt&gt;34&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;35&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;36&lt;tt&gt;
&lt;/tt&gt;37&lt;tt&gt;
&lt;/tt&gt;38&lt;tt&gt;
&lt;/tt&gt;39&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;40&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;41&lt;tt&gt;
&lt;/tt&gt;42&lt;tt&gt;
&lt;/tt&gt;43&lt;tt&gt;
&lt;/tt&gt;44&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;45&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;46&lt;tt&gt;
&lt;/tt&gt;47&lt;tt&gt;
&lt;/tt&gt;48&lt;tt&gt;
&lt;/tt&gt;49&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;50&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;51&lt;tt&gt;
&lt;/tt&gt;52&lt;tt&gt;
&lt;/tt&gt;53&lt;tt&gt;
&lt;/tt&gt;54&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;55&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;56&lt;tt&gt;
&lt;/tt&gt;57&lt;tt&gt;
&lt;/tt&gt;58&lt;tt&gt;
&lt;/tt&gt;59&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;60&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;61&lt;tt&gt;
&lt;/tt&gt;62&lt;tt&gt;
&lt;/tt&gt;63&lt;tt&gt;
&lt;/tt&gt;64&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;65&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;66&lt;tt&gt;
&lt;/tt&gt;67&lt;tt&gt;
&lt;/tt&gt;68&lt;tt&gt;
&lt;/tt&gt;69&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;70&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;71&lt;tt&gt;
&lt;/tt&gt;72&lt;tt&gt;
&lt;/tt&gt;73&lt;tt&gt;
&lt;/tt&gt;74&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;75&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;76&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# My Drupal 4.7 to Mephisto Script&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# ----------------------------------------------------------------&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# Things I did before&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;#   * Delete all rows from drupal node table where type != 'blog'&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;#   * Remove the type column from the drupal node table&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# &lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# Things I did afterward&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;#   * Found all comments in the Mephisto contents table that were &lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;#     from me and added user_id 1 to them.&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# &lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# Uncomment these if you are debugging the script and want to &lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# start off on a clean mephisto install&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# ----------------------------------------------------------------&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# Article.find(:all).each(&amp;amp;:destroy)&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# CachedPage.delete_all&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# AssignedSection.delete_all&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# Tagging.delete_all&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# Tag.delete_all&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;iv&quot;&gt;@mysite&lt;/span&gt; = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;http://www.metaskills.net/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;iv&quot;&gt;@home&lt;/span&gt; = &lt;span class=&quot;co&quot;&gt;Section&lt;/span&gt;.find_by_name(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Home&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;DrupalArticle&lt;/span&gt; &amp;lt; &lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  establish_connection &lt;span class=&quot;sy&quot;&gt;:drupal&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  set_table_name  &lt;span class=&quot;sy&quot;&gt;:node&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  set_primary_key &lt;span class=&quot;sy&quot;&gt;:nid&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  has_many &lt;span class=&quot;sy&quot;&gt;:comments&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:class_name&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;DrupalComment&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:foreign_key&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;nid&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  has_one &lt;span class=&quot;sy&quot;&gt;:version&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:class_name&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;DrupalArticleVerson&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:foreign_key&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;nid&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;created_at&lt;/span&gt; ; &lt;span class=&quot;co&quot;&gt;Time&lt;/span&gt;.at(&lt;span class=&quot;pc&quot;&gt;self&lt;/span&gt;[&lt;span class=&quot;sy&quot;&gt;:created&lt;/span&gt;]) ; &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;DrupalArticleVerson&lt;/span&gt; &amp;lt; &lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  establish_connection &lt;span class=&quot;sy&quot;&gt;:drupal&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  set_table_name  &lt;span class=&quot;sy&quot;&gt;:node_revisions&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  set_primary_key &lt;span class=&quot;sy&quot;&gt;:vid&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;DrupalComment&lt;/span&gt; &amp;lt; &lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  establish_connection &lt;span class=&quot;sy&quot;&gt;:drupal&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  set_table_name  &lt;span class=&quot;sy&quot;&gt;:comments&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  set_primary_key &lt;span class=&quot;sy&quot;&gt;:cid&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  belongs_to &lt;span class=&quot;sy&quot;&gt;:article&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:class_name&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;DrupalArticle&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:foreign_key&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;nid&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;co&quot;&gt;DrupalArticle&lt;/span&gt;.find(&lt;span class=&quot;sy&quot;&gt;:all&lt;/span&gt;).each &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |da|&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;c&quot;&gt;# Creating the article&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  na = &lt;span class=&quot;co&quot;&gt;Article&lt;/span&gt;.new&lt;tt&gt;
&lt;/tt&gt;  na.site_id      = &lt;span class=&quot;i&quot;&gt;1&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  na.created_at   = da.created_at&lt;tt&gt;
&lt;/tt&gt;  na.published_at = da.created_at&lt;tt&gt;
&lt;/tt&gt;  na.updated_at   = &lt;span class=&quot;co&quot;&gt;Time&lt;/span&gt;.now&lt;tt&gt;
&lt;/tt&gt;  na.title        = da.title&lt;tt&gt;
&lt;/tt&gt;  na.body         = da.version.body&lt;tt&gt;
&lt;/tt&gt;  na.excerpt      = da.version.teaser&lt;tt&gt;
&lt;/tt&gt;  na.updater_id   = &lt;span class=&quot;i&quot;&gt;1&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  na.user_id      = &lt;span class=&quot;i&quot;&gt;1&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  na.save!&lt;tt&gt;
&lt;/tt&gt;  na.sections &amp;lt;&amp;lt; &lt;span class=&quot;iv&quot;&gt;@home&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;c&quot;&gt;# Creating comments for this article&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  da.comments.each &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |dac|&lt;tt&gt;
&lt;/tt&gt;    nac = na.comments.build&lt;tt&gt;
&lt;/tt&gt;    nac.site_id       = &lt;span class=&quot;i&quot;&gt;1&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    nac.created_at    = &lt;span class=&quot;co&quot;&gt;Time&lt;/span&gt;.at(dac.timestamp)&lt;tt&gt;
&lt;/tt&gt;    nac.published_at  = &lt;span class=&quot;co&quot;&gt;Time&lt;/span&gt;.at(dac.timestamp)&lt;tt&gt;
&lt;/tt&gt;    nac.updated_at    = &lt;span class=&quot;co&quot;&gt;Time&lt;/span&gt;.at(dac.timestamp)&lt;tt&gt;
&lt;/tt&gt;    nac.author        = dac.name&lt;tt&gt;
&lt;/tt&gt;    nac.author_url    = dac.homepage&lt;tt&gt;
&lt;/tt&gt;    nac.author_email  = dac.mail&lt;tt&gt;
&lt;/tt&gt;    nac.author_ip     = dac.hostname&lt;tt&gt;
&lt;/tt&gt;    nac.user_agent    = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/523.12.2 (KHTML, like Gecko) Version/3.0.4 Safari/523.12.2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    nac.referrer      = &lt;span class=&quot;iv&quot;&gt;@mysite&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    nac.approved      = &lt;span class=&quot;pc&quot;&gt;true&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    nac.title         = dac.subject&lt;tt&gt;
&lt;/tt&gt;    nac.body          = dac.comment&lt;tt&gt;
&lt;/tt&gt;    nac.save!&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
          </content>  </entry>
  <entry xml:base="http://metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:metaskills.net,2007-01-31:115</id>
    <published>2007-01-31T14:41:00Z</published>
    <updated>2008-03-24T12:59:21Z</updated>
    <category term="Ruby/Rails"/>
    <category term="Workflow"/>
    <category term="activerecord"/>
    <category term="rake"/>
    <category term="schema"/>
    <link href="http://metaskills.net/2007/1/31/rake-task-to-read-and-write-the-activerecord-schema-version-table" rel="alternate" type="text/html"/>
    <title>Rake task to read and write the ActiveRecord schema version table.</title>
<summary type="html">&lt;p&gt;After attending Rails Edge in Reston, Virginia I decided to move some common tasks from my &lt;code&gt;~/.irbrc&lt;/code&gt; file and put them into Rake. I thought I would share a task that reads and writes the ActiveRecord schema table. Sometimes in migrations this is either good to know or manually change. Simply copy this in a foo.task file in your project/lib/tasks directory and use &lt;code&gt;rake -T&lt;/code&gt; to see the description and usage. I have placed these tasks in the db:version namespace.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;After attending Rails Edge in Reston, Virginia I decided to move some common tasks from my &lt;code&gt;~/.irbrc&lt;/code&gt; file and put them into Rake. I thought I would share a task that reads and writes the ActiveRecord schema table. Sometimes in migrations this is either good to know or manually change. Simply copy this in a foo.task file in your project/lib/tasks directory and use &lt;code&gt;rake -T&lt;/code&gt; to see the description and usage. I have placed these tasks in the db:version namespace.&lt;/p&gt;
&lt;p&gt;After attending Rails Edge in Reston, Virginia I decided to move some common tasks from my &lt;code&gt;~/.irbrc&lt;/code&gt; file and put them into Rake. I thought I would share a task that reads and writes the ActiveRecord schema table. Sometimes in migrations this is either good to know or manually change. Simply copy this in a foo.task file in your project/lib/tasks directory and use &lt;code&gt;rake -T&lt;/code&gt; to see the description and usage. I have placed these tasks in the db:version namespace.&lt;/p&gt; 

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;15&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;21&lt;tt&gt;
&lt;/tt&gt;22&lt;tt&gt;
&lt;/tt&gt;23&lt;tt&gt;
&lt;/tt&gt;24&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;namespace &lt;span class=&quot;sy&quot;&gt;:db&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  namespace &lt;span class=&quot;sy&quot;&gt;:version&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; &lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;    desc &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Read the current version of the database.&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    task &lt;span class=&quot;sy&quot;&gt;:read&lt;/span&gt; =&amp;gt; &lt;span class=&quot;sy&quot;&gt;:environment&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      puts &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;The &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;co&quot;&gt;RAILS_ENV&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;' database version is: &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Migrator&lt;/span&gt;.current_version&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;tt&gt;
&lt;/tt&gt;    desc &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Manually set the schema version to a specific target version with VERSION=x&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    task &lt;span class=&quot;sy&quot;&gt;:write&lt;/span&gt; =&amp;gt; &lt;span class=&quot;sy&quot;&gt;:environment&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;co&quot;&gt;ENV&lt;/span&gt;[&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;VERSION&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;]&lt;tt&gt;
&lt;/tt&gt;        &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;.connection.update(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;UPDATE &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Migrator&lt;/span&gt;.schema_info_table_name&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt; SET version = &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;co&quot;&gt;ENV&lt;/span&gt;[&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;VERSION&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;].to_i&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;)&lt;tt&gt;
&lt;/tt&gt;          puts &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;SUCCESS: The '&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;co&quot;&gt;RAILS_ENV&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;' database version is now: &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Migrator&lt;/span&gt;.current_version&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;        &lt;span class=&quot;r&quot;&gt;else&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;          puts &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;FAILED: The '&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;co&quot;&gt;RAILS_ENV&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;' database version is still: &lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Migrator&lt;/span&gt;.current_version&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;        &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;r&quot;&gt;else&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;        puts &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;You must specify a VERSION=n argument to this command. Use rake db:version:read to get the current version.&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;  &lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
          </content>  </entry>
  <entry xml:base="http://metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:metaskills.net,2006-12-29:113</id>
    <published>2006-12-29T19:27:00Z</published>
    <updated>2008-03-24T12:59:23Z</updated>
    <category term="Ruby/Rails"/>
    <category term="ruby"/>
    <category term="soap"/>
    <category term="webservice"/>
    <link href="http://metaskills.net/2006/12/29/web-service-woes" rel="alternate" type="text/html"/>
    <title>Web Service Woes</title>
<summary type="html">&lt;p&gt;Only now do I really get this image from &lt;a href=&quot;http://www.loudthinking.com/arc/000585.html&quot; class=&quot;external-link&quot;&gt;DHH's blog&lt;/a&gt;. I am really beginning to despise SOAP for some reason, but I guess I will &quot;get it&quot; as I learn more about it -- as it seems to be the only way to do business with the big players out there. For a glimpse of some of my hell, check out this &lt;a href=&quot;http://www.brendonwilson.com/blog/2006/04/02/ruby-soap4r-wsdl-hell/&quot; class=&quot;external-link&quot;&gt;Ruby + SOAP4R + WSDL Hell&lt;/a&gt; article.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;Only now do I really get this image from &lt;a href=&quot;http://www.loudthinking.com/arc/000585.html&quot; class=&quot;external-link&quot;&gt;DHH's blog&lt;/a&gt;. I am really beginning to despise SOAP for some reason, but I guess I will &quot;get it&quot; as I learn more about it -- as it seems to be the only way to do business with the big players out there. For a glimpse of some of my hell, check out this &lt;a href=&quot;http://www.brendonwilson.com/blog/2006/04/02/ruby-soap4r-wsdl-hell/&quot; class=&quot;external-link&quot;&gt;Ruby + SOAP4R + WSDL Hell&lt;/a&gt; article.&lt;/p&gt;
&lt;p&gt;Only now do I really get this image from &lt;a href=&quot;http://www.loudthinking.com/arc/000585.html&quot; class=&quot;external-link&quot;&gt;DHH's blog&lt;/a&gt;. I am really beginning to despise SOAP for some reason, but I guess I will &quot;get it&quot; as I learn more about it -- as it seems to be the only way to do business with the big players out there. For a glimpse of some of my hell, check out this &lt;a href=&quot;http://www.brendonwilson.com/blog/2006/04/02/ruby-soap4r-wsdl-hell/&quot; class=&quot;external-link&quot;&gt;Ruby + SOAP4R + WSDL Hell&lt;/a&gt; article.&lt;/p&gt;

&lt;p&gt;The bad news aside, I was really happy to find someuseful tools today from Todd Ditchendorf &lt;a href=&quot;&quot;&gt;Scandalous Software&lt;/a&gt; site. The list is pretty extensive so go check it out. Not on the list that I was happy to see were:&lt;/p&gt;

&lt;p&gt;Check XML and XHTML documents for Well-Formedness and Validity while editing them in TextMate with support for DTD, W3C XML Schema, RELAX NG, Schematron and XInclude.&lt;/p&gt;

&lt;div class=&quot;iecenter&quot;&gt;
&lt;a href=&quot;http://www.ditchnet.org/texmlmate/&quot; class=&quot;external-link&quot;&gt;
&lt;img src=&quot;/files/soaphell/texmlmate.gif&quot; alt=&quot;TextMate XML Editor&quot; /&gt;
&lt;/a&gt;
&lt;/div&gt;

&lt;p&gt;SOAP Client is a free Cocoa-based developer tool for Mac OS X Tiger that allows you access and debug WSDL &amp; SOAP-based Web Services from the comfort of your desktop.&lt;/p&gt;

&lt;div class=&quot;iecenter&quot;&gt;
&lt;a href=&quot;http://www.ditchnet.org/soapclient/&quot; class=&quot;external-link&quot;&gt;
&lt;img src=&quot;/files/soaphell/soap_client.gif&quot; alt=&quot;Free Cocoa SOAP Client&quot; /&gt;
&lt;/a&gt;
&lt;/div&gt;
          </content>  </entry>
  <entry xml:base="http://metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:metaskills.net,2006-12-21:112</id>
    <published>2006-12-21T18:21:00Z</published>
    <updated>2008-03-24T12:59:24Z</updated>
    <category term="Projects"/>
    <category term="ajax"/>
    <category term="homemarks"/>
    <category term="project"/>
    <category term="rails"/>
    <category term="ruby"/>
    <link href="http://metaskills.net/2006/12/21/homemarks-my-first-ruby-on-rails-pet-project" rel="alternate" type="text/html"/>
    <title>HomeMarks, My First Ruby On Rails Pet Project</title>
<summary type="html">&lt;br /&gt;
&lt;div class=&quot;iecenter&quot;&gt;
&lt;img src=&quot;/files/homemarks.png&quot; alt=&quot;HomeMarks, Simple Project-Based Bookmarks&quot; /&gt;
&lt;/div&gt;

&lt;div class=&quot;messages error&quot;&gt;
 UPDATE: HomeMarks is now avialable as a &lt;a href=&quot;http://www.homemarks.com/#about&quot; class=&quot;external-link&quot;&gt;free download.&lt;/a&gt;
&lt;/div&gt;</summary><content type="html">
            &lt;br /&gt;
&lt;div class=&quot;iecenter&quot;&gt;
&lt;img src=&quot;/files/homemarks.png&quot; alt=&quot;HomeMarks, Simple Project-Based Bookmarks&quot; /&gt;
&lt;/div&gt;

&lt;div class=&quot;messages error&quot;&gt;
 UPDATE: HomeMarks is now avialable as a &lt;a href=&quot;http://www.homemarks.com/#about&quot; class=&quot;external-link&quot;&gt;free download.&lt;/a&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;iecenter&quot;&gt;
&lt;img src=&quot;/files/homemarks.png&quot; alt=&quot;HomeMarks, Simple Project-Based Bookmarks&quot; /&gt;
&lt;/div&gt;

&lt;div class=&quot;messages error&quot;&gt;
 UPDATE: HomeMarks is now avialable as a &lt;a href=&quot;http://www.homemarks.com/#about&quot; class=&quot;external-link&quot;&gt;free download.&lt;/a&gt;
&lt;/div&gt;

&lt;p&gt;I've heard that the best web applications are ones that usually start as a simple tool that meets the needs of its creator, in this case, myself. I have always been close to Web Developers that code their own HTML start pages with links to the projects they are working on. So when the time came for me to really get serious with my programing career using &lt;a href=&quot;http://www.rubyonrails.org/&quot; class=&quot;external-link&quot;&gt;RAILS&lt;/a&gt;, this was the first app that I thought about building. From the site's copy...&lt;/p&gt;

&lt;p&gt;HomeMarks is a unique application allowing everyone from novice to elite the ability to create their own bookmark start page using easy drag and drop methods for sorting Columns, Boxes and Bookmarks. Our custom bookmarklet tool allows you to add links to your HomeMarks start page while surfing and/or researching online. If you're a bookmark junkie with literally hundreds of saved links to your favorite Internet haunts, HomeMarks is not for you. However, if you’re looking for a clean, simple homepage to organize your most recent or relevant links in an environment tailored to your needs and interests, &lt;a href=&quot;http://www.homemarks.com/&quot; class=&quot;external-link&quot;&gt;give HomeMarks a try&lt;/a&gt;. After all, HomeMarks is where the heart is.&lt;/p&gt;

&lt;p&gt;So it is not like &lt;a href=&quot;http://www.techcrunch.com/2006/01/25/yes-this-weeks-ajax-homepage/&quot; class=&quot;external-link&quot;&gt;the world needs another AJAX homepage&lt;/a&gt;, there are plenty out there. My problem is that they seem to go to far and build to much into them, Netvibes is a great &quot;poor&quot; example. I do not want XML Feeds, Images, News Headlines, or anything else in my start page. I just want links and only about 100 or so at maximum. For me bookmarks are very transitory objects. They need to be direct links to the things that I am working on, or referencing at that exact time. Once they are not, they get throw away and I can almost certainly find them in the 1st page of a Google result if I really needed to. So this is what &lt;a href=&quot;http://www.homemarks.com/&quot; class=&quot;external-link&quot;&gt;HomeMarks&lt;/a&gt; is for me, simple software, using &lt;a href=&quot;http://gettingreal.37signals.com/ch02_Build_Less.php&quot; class=&quot;external-link&quot;&gt;build less principals&lt;/a&gt;. If you choose to use it, I hope you enjoy using it. Note, only for Firefox or Safari/WebKit.
          </content>  </entry>
  <entry xml:base="http://metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:metaskills.net,2006-10-31:111</id>
    <published>2006-10-31T14:49:00Z</published>
    <updated>2008-03-24T12:59:26Z</updated>
    <category term="TextMate"/>
    <category term="textmate"/>
    <link href="http://metaskills.net/2006/10/31/happy-halloween-from-textmate" rel="alternate" type="text/html"/>
    <title>Happy Halloween from TextMate</title>
<summary type="html">&lt;br /&gt;
&lt;div class=&quot;iecenter&quot;&gt;
&lt;img src=&quot;/files/spooky_textmate.gif&quot; alt=&quot;Happy Halloween from TextMate&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;Upon downloaded the Cutting-Edge version (1.5.4 r1311) of TextMate yesterday, I was happy to find a halloween surprise. How cool can one program be - thanks Allan! Especially to some of your latest work on &lt;a href=&quot;http://macromates.com/blog/archives/2006/10/28/new-dialog-system-for-commands/&quot; class=&quot;external-link&quot;&gt;extending the dialog&lt;/a&gt; features for bundle developers.&lt;/p&gt;</summary><content type="html">
            &lt;br /&gt;
&lt;div class=&quot;iecenter&quot;&gt;
&lt;img src=&quot;/files/spooky_textmate.gif&quot; alt=&quot;Happy Halloween from TextMate&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;Upon downloaded the Cutting-Edge version (1.5.4 r1311) of TextMate yesterday, I was happy to find a halloween surprise. How cool can one program be - thanks Allan! Especially to some of your latest work on &lt;a href=&quot;http://macromates.com/blog/archives/2006/10/28/new-dialog-system-for-commands/&quot; class=&quot;external-link&quot;&gt;extending the dialog&lt;/a&gt; features for bundle developers.&lt;/p&gt;
&lt;br /&gt;
&lt;div class=&quot;iecenter&quot;&gt;
&lt;img src=&quot;/files/spooky_textmate.gif&quot; alt=&quot;Happy Halloween from TextMate&quot; /&gt;
&lt;/div&gt;

&lt;p&gt;Upon downloaded the Cutting-Edge version (1.5.4 r1311) of TextMate yesterday, I was happy to find a halloween surprise. How cool can one program be - thanks Allan! Especially to some of your latest work on &lt;a href=&quot;http://macromates.com/blog/archives/2006/10/28/new-dialog-system-for-commands/&quot; class=&quot;external-link&quot;&gt;extending the dialog&lt;/a&gt; features for bundle developers.&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:metaskills.net,2006-10-02:110</id>
    <published>2006-10-02T18:46:00Z</published>
    <updated>2008-03-24T12:59:27Z</updated>
    <category term="Ruby/Rails"/>
    <category term="Workflow"/>
    <category term="activerecord"/>
    <category term="fixtures"/>
    <category term="rake"/>
    <link href="http://metaskills.net/2006/10/2/custom-rake-task-to-unload-fixtures" rel="alternate" type="text/html"/>
    <title>Custom Rake Task To Unload Fixtures</title>
<summary type="html">&lt;p&gt;I made a revised version of a rake task that I have used quite often, for unloading existing DB tables into fixture data and thought I would share. This rake task is the in correct name space and adds a &quot;rake db:fixtures:unload&quot; command to your rails project when you put this in &quot;lib/tasks/foo.rake&quot;. It can take an optional TABLES variable or if none is present the whole array of DB tables are converted. I find this rake task helpful when dealing with LARGE databases.&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;I made a revised version of a rake task that I have used quite often, for unloading existing DB tables into fixture data and thought I would share. This rake task is the in correct name space and adds a &quot;rake db:fixtures:unload&quot; command to your rails project when you put this in &quot;lib/tasks/foo.rake&quot;. It can take an optional TABLES variable or if none is present the whole array of DB tables are converted. I find this rake task helpful when dealing with LARGE databases.&lt;/p&gt; 
&lt;p&gt;I made a revised version of a rake task that I have used quite often, for unloading existing DB tables into fixture data and thought I would share. This rake task is the in correct name space and adds a &quot;rake db:fixtures:unload&quot; command to your rails project when you put this in &quot;lib/tasks/foo.rake&quot;. It can take an optional TABLES variable or if none is present the whole array of DB tables are converted. I find this rake task helpful when dealing with LARGE databases.&lt;/p&gt; 

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;15&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;21&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;namespace &lt;span class=&quot;sy&quot;&gt;:db&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  namespace &lt;span class=&quot;sy&quot;&gt;:fixtures&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    desc &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Create YAML test fixtures from data in specifed tables. Set table names by TABLES=foos,bars,etc&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    task &lt;span class=&quot;sy&quot;&gt;:unload&lt;/span&gt; =&amp;gt; &lt;span class=&quot;sy&quot;&gt;:environment&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      sql  = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;SELECT * FROM %s&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      tables = [&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;schema_info&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;]&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;.establish_connection&lt;tt&gt;
&lt;/tt&gt;      (&lt;span class=&quot;co&quot;&gt;ENV&lt;/span&gt;[&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;TABLES&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;] ? &lt;span class=&quot;co&quot;&gt;ENV&lt;/span&gt;[&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;TABLES&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;].split(&lt;span class=&quot;rx&quot;&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;/&lt;/span&gt;&lt;/span&gt;) : &lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;.connection.tables).each &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |table_name|&lt;tt&gt;
&lt;/tt&gt;        i = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;000&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;        &lt;span class=&quot;co&quot;&gt;File&lt;/span&gt;.open(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;co&quot;&gt;RAILS_ROOT&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/test/fixtures/&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;table_name&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;.yml&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;w&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;) &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |file|&lt;tt&gt;
&lt;/tt&gt;          data = &lt;span class=&quot;co&quot;&gt;ActiveRecord&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;Base&lt;/span&gt;.connection.select_all(sql % table_name)&lt;tt&gt;
&lt;/tt&gt;          file.write data.inject({}) { |hash, record|&lt;tt&gt;
&lt;/tt&gt;            hash[&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;table_name&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;_&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;i.succ!&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;] = record&lt;tt&gt;
&lt;/tt&gt;            hash&lt;tt&gt;
&lt;/tt&gt;          }.to_yaml&lt;tt&gt;
&lt;/tt&gt;        &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
          </content>  </entry>
  <entry xml:base="http://metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:metaskills.net,2006-06-30:109</id>
    <published>2006-06-30T00:16:00Z</published>
    <updated>2008-03-24T12:59:28Z</updated>
    <category term="Miscellaneous"/>
    <category term="drupal"/>
    <category term="lighttpd"/>
    <category term="webserver"/>
    <link href="http://metaskills.net/2006/6/30/flying-light-configuring-drupal-and-lighttpd" rel="alternate" type="text/html"/>
    <title>Flying Light - Configuring Drupal and LightTPD</title>
<summary type="html">&lt;div class=&quot;iecenter&quot;&gt;&lt;img src=&quot;/files/lighttpd/light_logo.png&quot; height=&quot;239&quot; alt=&quot;LightTPD Logo&quot; width=&quot;249&quot; /&gt;&lt;/div&gt;

&lt;p&gt;So the WebSvr mini here at my &lt;a href=&quot;/colophon/#digitalkitchen&quot;&gt;home-based NOC&lt;/a&gt; (named ActionMoniker.com) is now running LightTPD as the web server. The benefits are that I can now run  my PHP-based Drupal  blog in FastCGI mode while also allowing virtual hosting under the same server/IP for my RAILS projects. The end result has turned out quite well and I am actually loving the speed improvements and the &lt;a href=&quot;http://lighttpd.net/documentation/&quot; class=&quot;external-link&quot;&gt;simple configuration&lt;/a&gt; for LightTPD, which has a more natural feeling for me when it comes to configuring a web server. &lt;/p&gt;</summary><content type="html">
            &lt;div class=&quot;iecenter&quot;&gt;&lt;img src=&quot;/files/lighttpd/light_logo.png&quot; height=&quot;239&quot; alt=&quot;LightTPD Logo&quot; width=&quot;249&quot; /&gt;&lt;/div&gt;

&lt;p&gt;So the WebSvr mini here at my &lt;a href=&quot;/colophon/#digitalkitchen&quot;&gt;home-based NOC&lt;/a&gt; (named ActionMoniker.com) is now running LightTPD as the web server. The benefits are that I can now run  my PHP-based Drupal  blog in FastCGI mode while also allowing virtual hosting under the same server/IP for my RAILS projects. The end result has turned out quite well and I am actually loving the speed improvements and the &lt;a href=&quot;http://lighttpd.net/documentation/&quot; class=&quot;external-link&quot;&gt;simple configuration&lt;/a&gt; for LightTPD, which has a more natural feeling for me when it comes to configuring a web server. &lt;/p&gt;
 &lt;div class=&quot;iecenter&quot;&gt;&lt;img src=&quot;/files/lighttpd/light_logo.png&quot; height=&quot;239&quot; alt=&quot;LightTPD Logo&quot; width=&quot;249&quot; /&gt;&lt;/div&gt;

&lt;p&gt;So the WebSvr mini here at my &lt;a href=&quot;/colophon/#digitalkitchen&quot;&gt;home-based NOC&lt;/a&gt; (named ActionMoniker.com) is now running LightTPD as the web server. The benefits are that I can now run  my PHP-based Drupal  blog in FastCGI mode while also allowing virtual hosting under the same server/IP for my RAILS projects. The end result has turned out quite well and I am actually loving the speed improvements and the &lt;a href=&quot;http://lighttpd.net/documentation/&quot; class=&quot;external-link&quot;&gt;simple configuration&lt;/a&gt; for LightTPD, which has a more natural feeling for me when it comes to configuring a web server. &lt;/p&gt;

&lt;p&gt;Below is a code snippet of my current configuration file for this Drupal host.  Please be aware, that this is not a full LightTPD configuration file which would likely have further restrictions on how your web server operates and secures itself. That said, this snippet incorporates the following configurations which are mostly necessaries for any Drupal blog using the Drupal supplied .htaccess file for Apache.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A vhost default so that both the www and the root domain point to the same directory.&lt;/li&gt;
&lt;li&gt;URL access rules that deny access  to common Drupal install and app files.&lt;/li&gt;
&lt;li&gt;URL rewrite rules for my &lt;a href=&quot;http://haveamint.com/&quot; class=&quot;external-link&quot;&gt;mint statistics,&lt;/a&gt; multi site setup in a &lt;code&gt;/meta-theme-for-drupal&lt;/code&gt; directory which, and the standard drupal rewrites for clean ULRs and a few system functions. It is important that these rewrites be in the correct order with the root drupal install being last.&lt;/li&gt;
&lt;li&gt;URL expires directives that help browser caching for all page assets that are core Drupal and found in the Meta Theme. &lt;/li&gt;
&lt;li&gt;A compress cache directory, server error log, and access log using the web server root variable set at the tops of the vhost config. I like that LightTPD can set variables.      &lt;/li&gt;
&lt;li&gt;Finally a LightTPD declaration for spawning FastCGI process for PHP.&lt;/li&gt;
&lt;/ul&gt;

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;3&lt;tt&gt;
&lt;/tt&gt;4&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;6&lt;tt&gt;
&lt;/tt&gt;7&lt;tt&gt;
&lt;/tt&gt;8&lt;tt&gt;
&lt;/tt&gt;9&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;10&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;11&lt;tt&gt;
&lt;/tt&gt;12&lt;tt&gt;
&lt;/tt&gt;13&lt;tt&gt;
&lt;/tt&gt;14&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;15&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;16&lt;tt&gt;
&lt;/tt&gt;17&lt;tt&gt;
&lt;/tt&gt;18&lt;tt&gt;
&lt;/tt&gt;19&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;20&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;21&lt;tt&gt;
&lt;/tt&gt;22&lt;tt&gt;
&lt;/tt&gt;23&lt;tt&gt;
&lt;/tt&gt;24&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;25&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;26&lt;tt&gt;
&lt;/tt&gt;27&lt;tt&gt;
&lt;/tt&gt;28&lt;tt&gt;
&lt;/tt&gt;29&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;30&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;31&lt;tt&gt;
&lt;/tt&gt;32&lt;tt&gt;
&lt;/tt&gt;33&lt;tt&gt;
&lt;/tt&gt;34&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;35&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;36&lt;tt&gt;
&lt;/tt&gt;37&lt;tt&gt;
&lt;/tt&gt;38&lt;tt&gt;
&lt;/tt&gt;39&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;40&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;41&lt;tt&gt;
&lt;/tt&gt;42&lt;tt&gt;
&lt;/tt&gt;43&lt;tt&gt;
&lt;/tt&gt;44&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;45&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;46&lt;tt&gt;
&lt;/tt&gt;47&lt;tt&gt;
&lt;/tt&gt;48&lt;tt&gt;
&lt;/tt&gt;49&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;50&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;51&lt;tt&gt;
&lt;/tt&gt;52&lt;tt&gt;
&lt;/tt&gt;53&lt;tt&gt;
&lt;/tt&gt;54&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;55&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;56&lt;tt&gt;
&lt;/tt&gt;57&lt;tt&gt;
&lt;/tt&gt;58&lt;tt&gt;
&lt;/tt&gt;59&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;simple-vhost.server-root      = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/Library/WebServer/hosts/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;simple-vhost.&lt;span class=&quot;r&quot;&gt;default&lt;/span&gt;-host     = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;default&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt;HTTP[&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;] =~ &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;^(metaskills.net)|(www.metaskills.net)$&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; {&lt;tt&gt;
&lt;/tt&gt;  simple-vhost.&lt;span class=&quot;r&quot;&gt;default&lt;/span&gt;-host     = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;metaskills.net&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  url.access-deny = ( &lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;.engine&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;.inc&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;.install&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;.module&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;.sh&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;.sql&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;.pgsql&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;.theme&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;.tpl.php&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;.xtmpl&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;.code-style.pl&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;.Repository&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;.Root&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    )&lt;tt&gt;
&lt;/tt&gt; url.rewrite-once = (&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;pp&quot;&gt;# hard&lt;/span&gt;-coded rewrites so the drupal catch-alls &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; not get them.&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;^/mint/$&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/mint/index.php&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;^/mint/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;er&quot;&gt;\&lt;/span&gt;?(.*)&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt; =&amp;gt; &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;/mint/index.php?&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;i&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;er&quot;&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;pp&quot;&gt;# drupal&lt;/span&gt; rules &lt;span class=&quot;r&quot;&gt;for&lt;/span&gt; (meta-theme-&lt;span class=&quot;r&quot;&gt;for&lt;/span&gt;-durpal) multi-site, these MUST BE FIRST.&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;^/meta-theme-for-drupal/system/test/(.*)$&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;  =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/meta-theme-for-drupal/index.php?q=system/test/$1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;^/meta-theme-for-drupal/search/node/(.*)$&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;  =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/meta-theme-for-drupal/index.php?q=search/node/$1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;^/meta-theme-for-drupal/([^.?]*)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;er&quot;&gt;\&lt;/span&gt;?(.*)&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;    =&amp;gt; &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;/meta-theme-&lt;span class=&quot;r&quot;&gt;for&lt;/span&gt;-drupal/index.php?q=&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;i&quot;&gt;1&lt;/span&gt;&amp;amp;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;i&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;er&quot;&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;^/meta-theme-for-drupal/([^.?]*)$&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;          =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/meta-theme-for-drupal/index.php?q=$1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;^/meta-theme-for-drupal$&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;                   =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/meta-theme-for-drupal/index.php&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;pp&quot;&gt;# drupal&lt;/span&gt; rules &lt;span class=&quot;r&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;default&lt;/span&gt; site behavior.&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;^/system/test/(.*)$&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;        =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/index.php?q=system/test/$1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;^/search/node/(.*)$&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;        =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/index.php?q=search/node/$1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;^/([^.?]*)&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;er&quot;&gt;\&lt;/span&gt;?(.*)&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;          =&amp;gt; &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;/index.php?q=&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;i&quot;&gt;1&lt;/span&gt;&amp;amp;&lt;span class=&quot;er&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;i&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;,&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;er&quot;&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;^/([^.?]*)$&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;                =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/index.php?q=$1&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;   )&lt;tt&gt;
&lt;/tt&gt;  expire.url = ( &lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/favicon.ico&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;              =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;access 3 days&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/files/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;                   =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;access 3 days&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/misc/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;                    =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;access 3 days&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/themes/meta/css/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;         =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;access 3 days&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/themes/meta/images/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;      =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;access 3 days&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/themes/meta/js/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;          =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;access 3 days&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/themes/meta/meta-black/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;  =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;access 3 days&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/themes/meta/meta-grey/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;   =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;access 3 days&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/themes/meta/meta-paper/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;  =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;access 3 days&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/themes/meta/meta-pink/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;   =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;access 3 days&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;tt&gt;
&lt;/tt&gt;    )&lt;tt&gt;
&lt;/tt&gt;  compress.cache-dir            = webserver-root + &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;tmp/cache_metaskills/&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  server.errorlog               = webserver-root + &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;logs/metaskills.error.log&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  accesslog.filename            = webserver-root + &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;logs/metaskills.access.log&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  fastcgi.server                = ( &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;.php&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; =&amp;gt;&lt;tt&gt;
&lt;/tt&gt;                                    ( &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;localhost&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; =&amp;gt;&lt;tt&gt;
&lt;/tt&gt;                                      ( &lt;tt&gt;
&lt;/tt&gt;                                        &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;socket&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/tmp/php-fastcgi.socket&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;                                        &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;bin-path&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/opt/local/bin/php-fcgi&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;                                        &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;max-procs&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;i&quot;&gt;4&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;                                        &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;bin-environment&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; =&amp;gt; ( &lt;tt&gt;
&lt;/tt&gt;                                          &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;PHP_FCGI_CHILDREN&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;                                          &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;PHP_FCGI_MAX_REQUESTS&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;10000&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;                                        ),&lt;tt&gt;
&lt;/tt&gt;                                        &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;bin-copy-environment&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; =&amp;gt; (&lt;tt&gt;
&lt;/tt&gt;                                          &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;PATH&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;SHELL&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;USER&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;                                        ),&lt;tt&gt;
&lt;/tt&gt;                                        &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;broken-scriptfilename&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; =&amp;gt; &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;enable&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;                                      )&lt;tt&gt;
&lt;/tt&gt;                                    )&lt;tt&gt;
&lt;/tt&gt;                                  )&lt;tt&gt;
&lt;/tt&gt;}&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


&lt;p&gt;Obviously this configuration is dependant on php-fcgi being installed and If you followed along in my past &lt;a href=&quot;/2006/5/29/my-own-soup-to-nuts-recipe-for-ruby-on-rails-on-os-x&quot;&gt;Soup to Nuts Recipe for Ruby on RAILS on OS X&lt;/a&gt;, here is a few crib notes I kept on how to recompile a few things so that you can have your whole installation of LightTPD, Ruby, PHP, and MySQL  all running from the Darwin Ports /opt directory.&lt;/p&gt;

&lt;h2&gt;Reinstall LightTPD with SSL&lt;/h2&gt;

&lt;p&gt;If you do not plan on using SSL with Lighty, this step is optional.&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
sudo port uninstall lighttpd
sudo port install lighttpd +ssl
&lt;/pre&gt;

&lt;h2&gt;MySQL 5 Installation in Darwin Ports &lt;/h2&gt;

&lt;p&gt;This part is definitely not for the week. If you are total noobie, stick with the &lt;a href=&quot;http://dev.mysql.com/downloads/&quot; class=&quot;external-link&quot;&gt;compiled packages&lt;/a&gt; offered by MySQL AB because doing this installation may break some of the tools you might be familiar with. Most can be fixed, but you will definitely loose your fancy start/stop button in the System Preferences.&lt;/p&gt;

&lt;p&gt;I installed MySQL 5 in this manner so that I could have PHP from Darwin Ports totally hooked into the MySQL installation by DP as well. I do not suggest you do this if you are new to this sort of stuff, again, these are just some quick notes I made. OK...&lt;/p&gt;

&lt;p&gt;First, add &lt;code&gt;/opt/local/lib/mysql5/bin&lt;/code&gt; to the $PATH environment variable in your &lt;code&gt;.bash_profile&lt;/code&gt;. When you do this you are linking to the REAL path for the MySQL binaries and not the Darwin Ports suffix5 sym links that it creates in&lt;code&gt;/opt/local/bin&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now issue these command. This will install mysql5 with Darwin Ports and the server startup scripts. The second command will load that startup script into your &lt;code&gt;launchd&lt;/code&gt; list. and the third will install the default MySQL tables for permissions, etc. &lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
sudo port install mysql5 +server
sudo launchctl load -w /Library/LaunchDaemons/org.darwinports.mysql5.plist
sudo -u mysql /opt/local/lib/mysql5/bin/mysql_install_db
&lt;/pre&gt;

&lt;p&gt;So that you do not have to do the following steps, restart you computer which should let MySQL use the startup script you enabled in the step above. In this way you can bypass these first two commands below. The other two commands are some notes of mine on the usage of the wrapper LaunchDaemon installed by Darwin Ports for MySQL. For easy reading, check out the support pages for &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/unix-post-installation.html&quot; class=&quot;external-link&quot;&gt;UNIX Post-Installation Procedures&lt;/a&gt; offered on the MySQL Reference Manual. Remember, I am pretty sure that you do not have to do these steps if you just restart your computer. &lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
sudo -u mysql /opt/local/lib/mysql5/bin/mysqld_safe &amp;
sudo /opt/local/lib/mysql5/bin/mysqladmin shutdown

sudo -u mysql /opt/local/etc/LaunchDaemons/org.darwinports.mysql5/mysql5.wrapper start
sudo -u mysql /opt/local/etc/LaunchDaemons/org.darwinports.mysql5/mysql5.wrapper stop
&lt;/pre&gt;

&lt;p&gt;Here we are going to create the &lt;code&gt;my.cnf&lt;/code&gt; file in one of the places this installation of MySQL likes to find it from the example files installed by MySQL. In this example I used the medium example file, but if you are expecting more traffic and have more RAM, use the my-huge.cnf file instead. Next we are creating a sym link to the my.cnf in the standard place the normal MySQL AB binaries install them on OS X, in the &lt;code&gt;etc&lt;/code&gt; directory. In this way you can still use &lt;a href=&quot;http://www.mysql.com/products/tools/administrator/&quot; class=&quot;external-link&quot;&gt;MySQL Administrator&lt;/a&gt; buy be aware that I had to use 127.0.0.1 instead of localhost. Not sure why. &lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
sudo -u mysql cp /opt/local/share/mysql5/mysql/my-medium.cnf /opt/local/var/db/mysql5/my.cnf
sudo ln -s /opt/local/var/db/mysql5/my.cnf /etc/my.cnf
&lt;/pre&gt;

&lt;p&gt;Now to fix the MySQL gem that was installed the first time around. This install type uses the &lt;code&gt;mysql-config&lt;/code&gt; as described in &lt;a href=&quot;http://tmtm.org/en/mysql/ruby/&quot; class=&quot;external-link&quot;&gt;the fine manual&lt;/a&gt;. &lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
sudo gem uninstall mysql
sudo gem install mysql -- --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config
&lt;/pre&gt;

&lt;h2&gt;Installing PHP5 using Darwin Ports MySQL &lt;/h2&gt;

&lt;p&gt;Now you are ready to install PHP5 with its FastCGI support and Darwin Ports dependencies on the MySQL previously installed. The second command copies the php.ini installed by DP into the place the Darwin Ports PHP likes to find it. &lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
sudo port install php5 +fastcgi +mysql5
sudo cp /opt/local/etc/php.ini-recommended /opt/local/etc/php.ini
&lt;/pre&gt;

&lt;p&gt;Now add this line of code to the php.ini file somewhere at the end of the section called &quot;Paths and Directories&quot; that is about mid way down. See also this &lt;a href=&quot;http://trac.lighttpd.net/trac/wiki/TutorialLighttpdAndPHP&quot; class=&quot;external-link&quot;&gt;web page&lt;/a&gt; for more info on this.&lt;/p&gt;

&lt;table class=&quot;CodeRay&quot;&gt;&lt;tr&gt;
  &lt;td title=&quot;click to toggle&quot; class=&quot;line_numbers&quot;&gt;&lt;pre&gt;1&lt;tt&gt;
&lt;/tt&gt;2&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
  &lt;td class=&quot;code&quot;&gt;&lt;pre&gt;&lt;tt&gt;
&lt;/tt&gt;cgi.fix_pathinfo = 1&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
          </content>  </entry>
</feed>
