<?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:www.metaskills.net,2010:mephisto/</id>
  <generator uri="http://mephistoblog.com" version="0.8.0">Mephisto Drax</generator>
  <link href="http://www.metaskills.net/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://www.metaskills.net/" rel="alternate" type="text/html"/>
  <updated>2010-03-19T16:01:38Z</updated>
  <entry xml:base="http://www.metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:www.metaskills.net,2010-03-19:797</id>
    <published>2010-03-19T15:58:00Z</published>
    <updated>2010-03-19T16:01:38Z</updated>
    <link href="http://www.metaskills.net/2010/3/19/textmate-theme-key-bindings-for-xcode" rel="alternate" type="text/html"/>
    <title>TextMate Theme &amp; Key Bindings For Xcode</title>
<summary type="html">&lt;div class=&quot;mt20 photobounding&quot;&gt;
  &lt;div class=&quot;tl&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;tr&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;bl&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;br&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;photoborder&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;phototime&quot;&gt;
    &lt;img src=&quot;/assets/2010/3/19/textmate_xcode_theme2.gif&quot; height=&quot;287&quot; alt=&quot;Xcode TextMate Theme&quot; width=&quot;420&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;
  I've been using Xcode for about 8 hard core months now and for all this time I have been using a theme I made that mimics the All Hallow's Eve TextMate theme with a bunch of custom key bindings that make Xcode more TextMate compatible. Here are links to download both below and a few notes I have put together. As I remember more of what I have actually done, this post will get updated. I do remember the first thing I did with Xcode for almost 3 days was just to customize the heck out of it and these files are the results.
&lt;/p&gt;</summary><content type="html">
            &lt;div class=&quot;mt20 photobounding&quot;&gt;
  &lt;div class=&quot;tl&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;tr&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;bl&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;br&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;photoborder&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;phototime&quot;&gt;
    &lt;img src=&quot;/assets/2010/3/19/textmate_xcode_theme2.gif&quot; height=&quot;287&quot; alt=&quot;Xcode TextMate Theme&quot; width=&quot;420&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;
  I've been using Xcode for about 8 hard core months now and for all this time I have been using a theme I made that mimics the All Hallow's Eve TextMate theme with a bunch of custom key bindings that make Xcode more TextMate compatible. Here are links to download both below and a few notes I have put together. As I remember more of what I have actually done, this post will get updated. I do remember the first thing I did with Xcode for almost 3 days was just to customize the heck out of it and these files are the results.
&lt;/p&gt;

&lt;div class=&quot;mt20 photobounding&quot;&gt;
  &lt;div class=&quot;tl&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;tr&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;bl&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;br&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;photoborder&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;phototime&quot;&gt;
    &lt;img src=&quot;/assets/2010/3/19/textmate_xcode_theme2.gif&quot; height=&quot;287&quot; alt=&quot;Xcode TextMate Theme&quot; width=&quot;420&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;
  I've been using Xcode for about 8 hard core months now and for all this time I have been using a theme I made that mimics the All Hallow's Eve TextMate theme with a bunch of custom key bindings that make Xcode more TextMate compatible. Here are links to download both below and a few notes I have put together. As I remember more of what I have actually done, this post will get updated. I do remember the first thing I did with Xcode for almost 3 days was just to customize the heck out of it and these files are the results.
&lt;/p&gt;

&lt;table&gt;
  &lt;tr&gt;
    &lt;td class=&quot;center&quot;&gt;
     &lt;a href=&quot;/assets/2010/3/19/TextMate-All-Hallows-Eve.xccolortheme.zip&quot; class=&quot;noa&quot;&gt;
      &lt;img src=&quot;/assets/2010/3/19/fonts_and_colors2.gif&quot; height=&quot;50&quot; alt=&quot;Xcode Fonts &amp;amp; Colors&quot; width=&quot;86&quot; /&gt;&lt;br /&gt;
      TextMate All Hallows Eve Theme
    &lt;/a&gt;
    &lt;/td&gt;
    &lt;td class=&quot;center&quot;&gt;
    &lt;a href=&quot;/assets/2010/3/19/TextMate-Compatible.pbxkeys.zip&quot; class=&quot;noa&quot;&gt;
      &lt;img src=&quot;/assets/2010/3/19/key_binding2.gif&quot; height=&quot;50&quot; alt=&quot;Xcode Key Bindings&quot; width=&quot;78&quot; /&gt;&lt;br /&gt;
      TextMate Key Bindings
    &lt;/a&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;

&lt;p&gt;
  To use these download and unzip them. Please the theme in &lt;code&gt;~/Library/Application Support/Xcode/Color Themes&lt;/code&gt; and place the bindings in &lt;code&gt;~/Library/Application Support/Xcode/Key Bindings&lt;/code&gt;. That should be it. Hare are my notes for now on what the key bindings do.
&lt;/p&gt;


&lt;h3 class=&quot;mb10&quot;&gt;Misc Key Bindings&lt;/h3&gt;

&lt;ul class=&quot;mb10&quot;&gt;
  &lt;li&gt;Command-W - Works on a file! Not the whole project window!&lt;/li&gt;
  &lt;li&gt;Command-1 - Open File List&lt;/li&gt;
  &lt;li&gt;Command-2 - Method List&lt;/li&gt;
&lt;/ul&gt;


&lt;h3 class=&quot;mb10&quot;&gt;TextMate Style Key Bindings&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Command-T - for Open Quickly&lt;/li&gt;
  &lt;li&gt;I'll update this as I find more, it has honestly been so long I forget all the work I've done and just use this now as if it were TextMate.&lt;/li&gt;
&lt;/ul&gt;
          </content>  </entry>
  <entry xml:base="http://www.metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:www.metaskills.net,2010-02-23:786</id>
    <published>2010-02-23T16:28:00Z</published>
    <updated>2010-02-23T16:31:47Z</updated>
    <category term="Apple/OSX"/>
    <category term="Heuristics"/>
    <category term="Workflow"/>
    <category term="git"/>
    <category term="xcode"/>
    <link href="http://www.metaskills.net/2010/2/23/git-init-xcode-projects" rel="alternate" type="text/html"/>
    <title>Git Init XCode Projects</title>
<content type="html">
            &lt;p&gt;
  Here is a little ZSH function I have been using for quickly setting up new XCode apps I call tire kickers, little play and learn apps. Being able to track your learning as you go with git.
&lt;/p&gt;

&lt;pre&gt;
if [[ -x `which git` ]]; then
  
	function ginit_xcode () {
	  git init
	  echo &quot;\n\n# XCode\nbuild\n*.mode1v3\n*.mode2v3\n*.nib\n*.swp\n\
*.pbxuser\n*.perspective\n*.perspectivev3\n\n# OSX\n.DS_Store\n\n\
# TextMate\n*.tm_build_errors\n\n\n&quot; &gt;&gt; .gitignore
	  git add .gitignore
	  git commit -m &quot;Ignore Xcode stuff.&quot;
	  git add .
	  git commit -m &quot;Initial Xcode project.&quot;
	}
  
fi
&lt;/pre&gt;

&lt;p&gt;The echo lines puts out a .gitignore file that will look something like this.&lt;/p&gt;

&lt;pre&gt;
# XCode
build
*.mode1v3
*.mode2v3
*.nib
*.swp
*.pbxuser
*.perspective
*.perspectivev3

# OSX
.DS_Store

# TextMate
*.tm_build_errors
&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:www.metaskills.net,2010-02-12:777</id>
    <published>2010-02-12T03:00:00Z</published>
    <updated>2010-02-24T23:54:54Z</updated>
    <category term="ajax"/>
    <category term="core data"/>
    <category term="objective-c"/>
    <category term="rails"/>
    <category term="rest"/>
    <category term="ruby"/>
    <link href="http://www.metaskills.net/2010/2/12/synchronizing-core-data-with-rails-3-0-0-pre" rel="alternate" type="text/html"/>
    <title>Synchronizing Core Data With Rails (3.0.0.pre)</title>
<content type="html">
            &lt;p&gt;
  &lt;a href=&quot;http://homemarks.com/&quot; class=&quot;nobor&quot;&gt;&lt;img class=&quot;floatl pr20 pb10&quot; src=&quot;/assets/2010/2/17/57x57_w_shadow.png&quot; /&gt;&lt;/a&gt;
  This is my presentation to our local @757rb/@757objc users group this past Tuesday. Hope some find it useful. Lessons learned from building HomeMarks native iPhone application to synchronize Core Data with a RESTful backend built using rails 3.0.0.pre. This covers a previous design methodology called the AJAX head pattern which decouples rails applications from the views they present which allowed an easy API foundation for the iPhone application and data sync methods.
&lt;/p&gt;
  
&lt;div class=&quot;photobounding&quot;&gt;
  &lt;div class=&quot;tl&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;tr&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;bl&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;br&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;photoborder&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;phototime&quot;&gt;
    &lt;div&gt;    
      &amp;lt;object height=&quot;355&quot; width=&quot;425&quot;&gt;&amp;lt;param /&gt;&amp;lt;param /&gt;&amp;lt;param /&gt;&amp;lt;embed src=&quot;http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=synchronizingcoredatawithrailswebapplications-100211204432-phpapp01&amp;amp;stripped_title=synchronizing-core-data-with-rails&quot; height=&quot;355&quot; width=&quot;425&quot;&gt;&amp;lt;/embed&gt;&amp;lt;/object&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;Resources&lt;/h2&gt;

&lt;ul class=&quot;mt20&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;http://homemarks.com/&quot; class=&quot;external-link&quot;&gt;HomeMarks (buy it, try it, review it)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.slideshare.net/metaskills/synchronizing-core-data-with-rails&quot; class=&quot;external-link&quot; title=&quot;Synchronizing Core Data With Rails&quot;&gt;Synchronizing Core Data With Rails (slideshare)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://metaskills.net/2008/5/24/the-ajax-head-br-design-pattern&quot;&gt;AJAX Head Design Pattern&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://metaskills.net/2008/6/18/restful-ajax-with-forgery-protection&quot;&gt;RESTful AJAX With Forgery Protection&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://metaskills.net/2008/8/18/in-hell-oo-for-homemarks&quot;&gt;In HELL-OO For HomeMarks&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://code.google.com/p/json-framework/&quot; class=&quot;external-link&quot;&gt;The json-framework Project&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://allseeing-i.com/ASIHTTPRequest/&quot; class=&quot;external-link&quot;&gt;The ASIHTTPRequest Project&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
          </content>  </entry>
  <entry xml:base="http://www.metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:www.metaskills.net,2010-02-06:769</id>
    <published>2010-02-06T14:34:00Z</published>
    <updated>2010-02-06T17:41:22Z</updated>
    <category term="Heuristics"/>
    <category term="Ruby/Rails"/>
    <link href="http://www.metaskills.net/2010/2/6/simple-script-console-function" rel="alternate" type="text/html"/>
    <title>Simple Script/Console Function</title>
<content type="html">
            &lt;p&gt;
  This is something simple I worked up today for my ZSH profile that let's me keep my simple &lt;code&gt;sc&lt;/code&gt; alias and have it work with all versions of rails. If you did not know, all the script files in rails 3 are gone and the new all-in-one &lt;code&gt;rails&lt;/code&gt; executable does all the heavy lifting. This little function even passes down all the arguments too.
&lt;/p&gt;

&lt;pre&gt;
sc () {
  if [ -f ./script/rails ]; then 
    rails console $argv
  else
    ./script/console $argv
  fi
}
&lt;/pre&gt;

&lt;p&gt;
  One other thing, the way rails uses IRB is different now. I had to change my &lt;code&gt;~/.irbrc&lt;/code&gt; file to look like this below to get my simple prompt and history back. IMPORTANT NOTE: In order for this to work, you &lt;a href=&quot;http://redmine.ruby-lang.org/issues/show/1556&quot; class=&quot;external-link&quot;&gt;have to apply this 2 line patch to your save-history.rb file&lt;/a&gt;. Worked like a champ for me.
&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;c&quot;&gt;# IRB history patch &amp;lt;http://redmine.ruby-lang.org/issues/show/1556&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&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;irb/completion&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&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;irb/ext/save-history&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;co&quot;&gt;IRB&lt;/span&gt;.conf[&lt;span class=&quot;sy&quot;&gt;:USE_READLINE&lt;/span&gt;] = &lt;span class=&quot;pc&quot;&gt;true&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;co&quot;&gt;IRB&lt;/span&gt;.conf[&lt;span class=&quot;sy&quot;&gt;:SAVE_HISTORY&lt;/span&gt;] = &lt;span class=&quot;i&quot;&gt;500&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;co&quot;&gt;IRB&lt;/span&gt;.conf[&lt;span class=&quot;sy&quot;&gt;:HISTORY_FILE&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;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;HOME&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;]&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/.irb.hist&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;IRB&lt;/span&gt;.conf[&lt;span class=&quot;sy&quot;&gt;:PROMPT_MODE&lt;/span&gt;] = &lt;span class=&quot;sy&quot;&gt;:SIMPLE&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://www.metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:www.metaskills.net,2010-01-29:761</id>
    <published>2010-01-29T19:24:00Z</published>
    <updated>2010-01-29T20:56:15Z</updated>
    <category term="Heuristics"/>
    <category term="Ruby/Rails"/>
    <link href="http://www.metaskills.net/2010/1/29/unobtrusive-js-in-rails-3-with-prototype" rel="alternate" type="text/html"/>
    <title>Unobtrusive JS In Rails 3 With Prototype </title>
<summary type="html">&lt;p&gt;
  Are you bleeding on the edge of rails 3 and need to shim up some unobtrusive JavaScript to work with your &lt;code&gt;link_to&lt;/code&gt; code that uses a destructive :method option? I did today and here is what I did to solve it. If you are unfamiliar with the problem, and what has been happening in rails 3 with UJS, check out &lt;a href=&quot;http://blog.solnic.eu/2009/09/08/unobtrusive-javascript-helpers-in-rails-3&quot; class=&quot;external-link&quot;&gt;Piotr Solnica's&lt;/a&gt; blog for a good run down. Or you can check out the simple code block below.
&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;
  Are you bleeding on the edge of rails 3 and need to shim up some unobtrusive JavaScript to work with your &lt;code&gt;link_to&lt;/code&gt; code that uses a destructive :method option? I did today and here is what I did to solve it. If you are unfamiliar with the problem, and what has been happening in rails 3 with UJS, check out &lt;a href=&quot;http://blog.solnic.eu/2009/09/08/unobtrusive-javascript-helpers-in-rails-3&quot; class=&quot;external-link&quot;&gt;Piotr Solnica's&lt;/a&gt; blog for a good run down. Or you can check out the simple code block below.
&lt;/p&gt;

&lt;p&gt;
  Are you bleeding on the edge of rails 3 and need to shim up some unobtrusive JavaScript to work with your &lt;code&gt;link_to&lt;/code&gt; code that uses a destructive :method option? I did today and here is what I did to solve it. If you are unfamiliar with the problem, and what has been happening in rails 3 with UJS, check out &lt;a href=&quot;http://blog.solnic.eu/2009/09/08/unobtrusive-javascript-helpers-in-rails-3&quot; class=&quot;external-link&quot;&gt;Piotr Solnica's&lt;/a&gt; blog for a good run down. Or you can check out the simple code block below.
&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;&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 Ruby&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;link_to &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Logout&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, session_path, &lt;span class=&quot;sy&quot;&gt;:method&lt;/span&gt; =&amp;gt; &lt;span class=&quot;sy&quot;&gt;:delete&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# Will out put this HTML in Rails 3&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;c&quot;&gt;# &amp;lt;a href=&amp;quot;/session&amp;quot; data-method=&amp;quot;delete&amp;quot; data-url &amp;quot;/session&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;Logoout&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;


&lt;p&gt;
  So no more tag soup. Yea! There was much rejoicing, but I could not find any illustrated examples of what type of JavaScript to use to back this up. There are two problems at play here. First, simple link &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; tags are not forms and hence methods like post/put/delete are not going to be solved with simple query params. Second, because link tags are not forms, there is no authenticity_token hidden in the generated form, like a &lt;code&gt;button_to&lt;/code&gt; would generate. Let's ignore the second problem for a bit and see what I came up with for using with Prototype.
&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;&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;var&lt;/span&gt; MyJsObject = {&lt;tt&gt;
&lt;/tt&gt;  &lt;tt&gt;
&lt;/tt&gt;  linkToDelete: &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt;(&lt;span class=&quot;pt&quot;&gt;event&lt;/span&gt;) {&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;pt&quot;&gt;event&lt;/span&gt;.&lt;span class=&quot;fu&quot;&gt;stop&lt;/span&gt;();&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; e = &lt;span class=&quot;pt&quot;&gt;event&lt;/span&gt;.element();&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; a = e.readAttribute(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;) ? e : e.up(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;a&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;var&lt;/span&gt; form = FORM({action:a.href, method:&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;},[&lt;tt&gt;
&lt;/tt&gt;      INPUT({&lt;span class=&quot;r&quot;&gt;type&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;hidden&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,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;_method&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,value:&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;delete&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;}),&lt;tt&gt;
&lt;/tt&gt;      INPUT({&lt;span class=&quot;r&quot;&gt;type&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;hidden&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,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;authenticity_token&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;,value:authParams.get(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;authenticity_token&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;    form.submit();&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;pc&quot;&gt;false&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;span class=&quot;pt&quot;&gt;document&lt;/span&gt;.observe(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;dom:loaded&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt;(){&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;a[data-method=delete]&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;).each(&lt;span class=&quot;r&quot;&gt;function&lt;/span&gt;(a){ a.observe(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, MyJsObject.linkToDelete); });&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;
  In this example I am only covering the DELETE action. This code could be abstracted to take a &quot;method&quot; argument and use it. As you can see, it's just a simple iteration over the links with custom &quot;data-method&quot; attributes and attaching a function to it. For brevity, I am using the Builder.js methods for building DOM objects. See anything odd up there? The authentication token? You got it, destructive actions like POST/DELETE/PUT will need that token. I wrote up a great article a year or so ago that still works today titled &lt;a href=&quot;/2008/6/18/restful-ajax-with-forgery-protection&quot;&gt;RESTful AJAX with Forgery Protection&lt;/a&gt; that gives me that nice global var. Check it out for the last piece to this puzzle and have fun working on the edge!
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:www.metaskills.net,2010-01-25:760</id>
    <published>2010-01-25T02:19:00Z</published>
    <updated>2010-01-26T02:27:12Z</updated>
    <category term="Apple/OSX"/>
    <category term="Heuristics"/>
    <category term="apple"/>
    <category term="javascript"/>
    <category term="prototype"/>
    <category term="quicktime"/>
    <link href="http://www.metaskills.net/2010/1/25/quickie-js-prototype-wrapper-for-quicktime" rel="alternate" type="text/html"/>
    <title>Quickie.js - Prototype wrapper for QuickTime</title>
<summary type="html">&lt;p&gt;
  As some of you know, I am in the last steps of announcing my first iPhone application. We all know that every good iPhone application has a great marketing website with a screen cast. I myself was heavily inspired by the &lt;a href=&quot;http://tapbots.com/convertbot&quot; class=&quot;external-link&quot;&gt;Tapbots Convertbot&lt;/a&gt; website while building my own and wanted a good way of embedding the screen cast. I think the last time I did an object/embed tag was god... around 2003 or something, seriously.
&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;
  As some of you know, I am in the last steps of announcing my first iPhone application. We all know that every good iPhone application has a great marketing website with a screen cast. I myself was heavily inspired by the &lt;a href=&quot;http://tapbots.com/convertbot&quot; class=&quot;external-link&quot;&gt;Tapbots Convertbot&lt;/a&gt; website while building my own and wanted a good way of embedding the screen cast. I think the last time I did an object/embed tag was god... around 2003 or something, seriously.
&lt;/p&gt;

&lt;p&gt;
  As some of you know, I am in the last steps of announcing my first iPhone application. We all know that every good iPhone application has a great marketing website with a screen cast. I myself was heavily inspired by the &lt;a href=&quot;http://tapbots.com/convertbot&quot; class=&quot;external-link&quot;&gt;Tapbots Convertbot&lt;/a&gt; website while building my own and wanted a good way of embedding the screen cast. I think the last time I did an object/embed tag was god... around 2003 or something, seriously.
&lt;/p&gt;

&lt;p&gt;
  So after looking at the source of the Convertbot website, I was happy to find a nice little JavaScript wrapper for QuickTime called Quickie.js. This is a MooTools class created by Jose Prado that helps generate an object or embed tag appropriate for the requesting browser in an abstract way. Here is the link to the &lt;a href=&quot;http://pradador.com/code/quickiejs/&quot; class=&quot;external-link&quot;&gt;original Quickie.js&lt;/a&gt;. If you use MooTools, fine, it is real close to Prototype and has my respect, but if you use Prototype, here is my rewrite of the 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;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;77&lt;tt&gt;
&lt;/tt&gt;78&lt;tt&gt;
&lt;/tt&gt;79&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;80&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;81&lt;tt&gt;
&lt;/tt&gt;82&lt;tt&gt;
&lt;/tt&gt;83&lt;tt&gt;
&lt;/tt&gt;84&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;85&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;86&lt;tt&gt;
&lt;/tt&gt;87&lt;tt&gt;
&lt;/tt&gt;88&lt;tt&gt;
&lt;/tt&gt;89&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;90&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;91&lt;tt&gt;
&lt;/tt&gt;92&lt;tt&gt;
&lt;/tt&gt;93&lt;tt&gt;
&lt;/tt&gt;94&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;95&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;96&lt;tt&gt;
&lt;/tt&gt;97&lt;tt&gt;
&lt;/tt&gt;98&lt;tt&gt;
&lt;/tt&gt;99&lt;tt&gt;
&lt;/tt&gt;&lt;strong&gt;100&lt;/strong&gt;&lt;tt&gt;
&lt;/tt&gt;101&lt;tt&gt;
&lt;/tt&gt;102&lt;tt&gt;
&lt;/tt&gt;103&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;/*&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;Author:&lt;tt&gt;
&lt;/tt&gt;  Ken Collins &amp;lt;metaskills.net&amp;gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;Options:&lt;tt&gt;
&lt;/tt&gt;  id - (string: defaults to 'Quickie_' + unique id) The id of the Quickie object.&lt;tt&gt;
&lt;/tt&gt;  width - (number: defaults to 1) The width of the Quickie object.&lt;tt&gt;
&lt;/tt&gt;  height - (number: defaults to 1) The height of the Quickie object.&lt;tt&gt;
&lt;/tt&gt;  container - (element) The container into which the Quickie object will be injected.&lt;tt&gt;
&lt;/tt&gt;  attributes - (object) QuickTime attributes for the element. See http://www.apple.com/quicktime/tutorials/embed.html for possible attributes.&lt;tt&gt;
&lt;/tt&gt;  &lt;tt&gt;
&lt;/tt&gt;Returns:&lt;tt&gt;
&lt;/tt&gt;  - (element) A new HTML object Element with browser appropriate QuickTime embed code.&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;Example:&lt;tt&gt;
&lt;/tt&gt;  var myQuickie = new Quickie('myMovie.mov', {&lt;tt&gt;
&lt;/tt&gt;    id: 'myQuicktimeMovie',&lt;tt&gt;
&lt;/tt&gt;    width: 640,&lt;tt&gt;
&lt;/tt&gt;    height: 480,&lt;tt&gt;
&lt;/tt&gt;    container: 'qtmovie',&lt;tt&gt;
&lt;/tt&gt;    attributes: {&lt;tt&gt;
&lt;/tt&gt;      controller: 'true',&lt;tt&gt;
&lt;/tt&gt;      autoplay: 'false'&lt;tt&gt;
&lt;/tt&gt;    }&lt;tt&gt;
&lt;/tt&gt;  });&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;Credits:&lt;tt&gt;
&lt;/tt&gt;  Mootools Implementaiton: http://pradador.com/code/quickiejs/&lt;tt&gt;
&lt;/tt&gt;  &lt;tt&gt;
&lt;/tt&gt;License:&lt;tt&gt;
&lt;/tt&gt;  MIT-Style License&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;*/&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; Quickie = Class.create({&lt;tt&gt;
&lt;/tt&gt;  &lt;tt&gt;
&lt;/tt&gt;  initialize: &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt;(path, options){&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; time = Try.these(&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt;() { &lt;span class=&quot;r&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;pt&quot;&gt;Date&lt;/span&gt;.now() },&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt;() { &lt;span class=&quot;r&quot;&gt;return&lt;/span&gt; +new &lt;span class=&quot;pt&quot;&gt;Date&lt;/span&gt; }&lt;tt&gt;
&lt;/tt&gt;    );&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; defaultOptions = {&lt;tt&gt;
&lt;/tt&gt;      id: &lt;span class=&quot;pc&quot;&gt;null&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;      height: 1,&lt;tt&gt;
&lt;/tt&gt;      width: 1,&lt;tt&gt;
&lt;/tt&gt;      container: &lt;span class=&quot;pc&quot;&gt;null&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;      attributes: {}&lt;tt&gt;
&lt;/tt&gt;    }&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.path = path;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.instance = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;Quickie_&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; + time;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.options = &lt;span class=&quot;pt&quot;&gt;Object&lt;/span&gt;.extend(defaultOptions, arguments[1] || {});&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.id = &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.options.id || &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.instance;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.container = $(&lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.options.container);&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.attributes = &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.options.attributes;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.attributes.src = &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.path;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.height = (&lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.attributes.controller == &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;) ? &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.options.height + 16 : &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.options.height; &lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.width = &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.options.width;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;._assignElement();&lt;tt&gt;
&lt;/tt&gt;  },&lt;tt&gt;
&lt;/tt&gt;  &lt;tt&gt;
&lt;/tt&gt;  toElement: &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt;() {&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.element;&lt;tt&gt;
&lt;/tt&gt;  },&lt;tt&gt;
&lt;/tt&gt;  &lt;tt&gt;
&lt;/tt&gt;  _assignElement: &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt;() {&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; build = (Prototype.Browser.IE) ? &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;._buildObjectTag() : &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;._buildEmbedTag();&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.element = ((&lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.container) ? &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.container.update(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;) : new Element(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;)).update(build).down();&lt;tt&gt;
&lt;/tt&gt;  },&lt;tt&gt;
&lt;/tt&gt;  &lt;tt&gt;
&lt;/tt&gt;  _buildObjectTag: &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt;() {&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; build = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;;&lt;tt&gt;
&lt;/tt&gt;    build = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&amp;lt;object classid=&amp;quot;clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B&amp;quot; codebase=&amp;quot;http://www.apple.com/qtactivex/qtplugin.cab&amp;quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;;&lt;tt&gt;
&lt;/tt&gt;    build += &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt; id=&amp;quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; + &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.id + &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;;&lt;tt&gt;
&lt;/tt&gt;    build += &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt; width=&amp;quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; + &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.width + &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;;&lt;tt&gt;
&lt;/tt&gt;    build += &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt; height=&amp;quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; + &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.height + &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;;&lt;tt&gt;
&lt;/tt&gt;    build += &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&amp;gt;&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;for&lt;/span&gt; (&lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; attribute in &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.attributes) {&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (&lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.attributes[attribute]) {&lt;tt&gt;
&lt;/tt&gt;        build += &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&amp;lt;param name=&amp;quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; + attribute + &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&amp;quot; value=&amp;quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; + &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.attributes[attribute] + &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&amp;quot; /&amp;gt;&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;tt&gt;
&lt;/tt&gt;    build += &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&amp;lt;/object&amp;gt;&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;return&lt;/span&gt; build;&lt;tt&gt;
&lt;/tt&gt;  },&lt;tt&gt;
&lt;/tt&gt;  &lt;tt&gt;
&lt;/tt&gt;  _buildEmbedTag: &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt;() {&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; build = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;;&lt;tt&gt;
&lt;/tt&gt;    build = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&amp;lt;embed &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;;&lt;tt&gt;
&lt;/tt&gt;    build += &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt; id=&amp;quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; + &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.id + &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;;&lt;tt&gt;
&lt;/tt&gt;    build += &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt; width=&amp;quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; + &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.width + &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;;&lt;tt&gt;
&lt;/tt&gt;    build += &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt; height=&amp;quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; + &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.height + &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&amp;quot;&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;for&lt;/span&gt; (attribute in &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.attributes) {&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; (&lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.attributes[attribute]) {&lt;tt&gt;
&lt;/tt&gt;        build += &lt;span class=&quot;s&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; + attribute + &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;=&amp;quot;&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt; + &lt;span class=&quot;pc&quot;&gt;this&lt;/span&gt;.attributes[attribute] + &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;&amp;quot;&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;tt&gt;
&lt;/tt&gt;    build += &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt; pluginspage=&amp;quot;http://www.apple.com/quicktime/download/&amp;quot;&amp;gt;&amp;lt;/embed&amp;gt;&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;return&lt;/span&gt; build;&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;
  If you ask me this is far cleaner than the original. It encapsulates factory methods and all the initialize does is just setup vars, not do ALL the work in one big procedural way. So what does this class do? It's simple, it allows you to create JavaScript objects that will represent DOM objects for QuickTime movies. This object can be passed to any method that takes expects and element to Prototype since it has a toElement method. Here is the way I am using it in my upcoming project. Just like the Tapbots website, I am creating &lt;code&gt;&lt;div&gt;&lt;/code&gt; tags that have all the attributes I need and are the container elements. On page load, I update all those containers with generate QuickTime source code. See the example below.
&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;&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;/* &lt;tt&gt;
&lt;/tt&gt;Example Container&lt;tt&gt;
&lt;/tt&gt;&amp;lt;div id=&amp;quot;mymovie_container&amp;quot; class=&amp;quot;quicktime_video&amp;quot; rel=&amp;quot;src=/video/mymovie.mov|width=280|height=393|loop=true|autoplay=true|video_id=mymovie&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;tt&gt;
&lt;/tt&gt;*/&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;pt&quot;&gt;document&lt;/span&gt;.observe(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;dom:loaded&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;, &lt;span class=&quot;r&quot;&gt;function&lt;/span&gt;(){&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;.quicktime_video&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;).each(&lt;span class=&quot;r&quot;&gt;function&lt;/span&gt;(container){&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; attributes = {};&lt;tt&gt;
&lt;/tt&gt;    attributes.controller = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;;&lt;tt&gt;
&lt;/tt&gt;    attributes.autoplay = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;;&lt;tt&gt;
&lt;/tt&gt;    attributes.loop = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;;&lt;tt&gt;
&lt;/tt&gt;    attributes.enablejavascript = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;;&lt;tt&gt;
&lt;/tt&gt;    container.readAttribute(&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;rel&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;).&lt;span class=&quot;fu&quot;&gt;split&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;|&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;).each(&lt;span class=&quot;r&quot;&gt;function&lt;/span&gt;(keyvalue) {&lt;tt&gt;
&lt;/tt&gt;      pair = keyvalue.&lt;span class=&quot;fu&quot;&gt;split&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;=&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;);&lt;tt&gt;
&lt;/tt&gt;      attributes[pair[0]] = pair[1];&lt;tt&gt;
&lt;/tt&gt;    });&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;r&quot;&gt;var&lt;/span&gt; qt = new Quickie(attributes[&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;src&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;], {  &lt;tt&gt;
&lt;/tt&gt;      id: attributes[&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;video_id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;], &lt;tt&gt;
&lt;/tt&gt;      width: &lt;span class=&quot;fu&quot;&gt;parseInt&lt;/span&gt;(attributes[&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;width&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;]), &lt;tt&gt;
&lt;/tt&gt;      height: &lt;span class=&quot;fu&quot;&gt;parseInt&lt;/span&gt;(attributes[&lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;height&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;]), &lt;tt&gt;
&lt;/tt&gt;      container: container, &lt;tt&gt;
&lt;/tt&gt;      attributes: attributes&lt;tt&gt;
&lt;/tt&gt;    });&lt;tt&gt;
&lt;/tt&gt;    container.update(qt);&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;h2&gt;Resources&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://github.com/metaskills/quickie.js&quot; class=&quot;external-link&quot;&gt;Quickie.js on Github&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
          </content>  </entry>
  <entry xml:base="http://www.metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:www.metaskills.net,2010-01-05:754</id>
    <published>2010-01-05T23:55:00Z</published>
    <updated>2010-03-05T18:00:09Z</updated>
    <category term="Heuristics"/>
    <category term="Ruby/Rails"/>
    <category term="form"/>
    <category term="rails"/>
    <category term="ruby"/>
    <link href="http://www.metaskills.net/2010/1/5/rails-button-links-in-embedded-forms" rel="alternate" type="text/html"/>
    <title>Rails Button Links In Embedded Forms</title>
<content type="html">
            &lt;p&gt;
  This is one I have had sitting around for almost 3 years now in my toolbox and thought I would share. Have you ever had complicated rails forms and needed simple form buttons that just took you to a simple link? Were you bitten by the &lt;code&gt;button_to&lt;/code&gt; helper code because it generates another form inside of a form? If so, here is a simple rails view helper I made that creates simple button links for embedded forms by making an input with a javascript function. Tag soup you ask, hell yeah, but worth if if you need it.
&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;&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;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;button_to_link&lt;/span&gt;(name, link, options={})&lt;tt&gt;
&lt;/tt&gt;  confirm_option = options.delete(&lt;span class=&quot;sy&quot;&gt;:confirm&lt;/span&gt;)&lt;tt&gt;
&lt;/tt&gt;  popup_option = options.delete(&lt;span class=&quot;sy&quot;&gt;:popup&lt;/span&gt;)&lt;tt&gt;
&lt;/tt&gt;  link_function = popup_option ? redirect_function(link,&lt;span class=&quot;sy&quot;&gt;:new_window&lt;/span&gt; =&amp;gt; &lt;span class=&quot;pc&quot;&gt;true&lt;/span&gt;) : redirect_function(link)&lt;tt&gt;
&lt;/tt&gt;  link_function = &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;if (confirm('&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;escape_javascript(confirm_option)&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;link_function&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;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; confirm_option&lt;tt&gt;
&lt;/tt&gt;  button_to_function name, link_function, options&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;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;redirect_function&lt;/span&gt;(location, options={})&lt;tt&gt;
&lt;/tt&gt;  location = location.is_a?(&lt;span class=&quot;co&quot;&gt;String&lt;/span&gt;) ? location : url_for(location)&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;r&quot;&gt;if&lt;/span&gt; options[&lt;span class=&quot;sy&quot;&gt;:new_window&lt;/span&gt;]&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;window.open('&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;location&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;dl&quot;&gt;|&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;    &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;%|&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;{window.location.href='&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;location&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;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;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
          </content>  </entry>
  <entry xml:base="http://www.metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:www.metaskills.net,2009-11-23:452</id>
    <published>2009-11-23T18:10:00Z</published>
    <updated>2009-12-02T13:56:03Z</updated>
    <category term="Heuristics"/>
    <category term="Ruby/Rails"/>
    <category term="paperclip"/>
    <category term="rails"/>
    <category term="ruby"/>
    <category term="s3"/>
    <link href="http://www.metaskills.net/2009/11/23/authenticated-s3-gets-for-private-objects-using-paperclip" rel="alternate" type="text/html"/>
    <title>Authenticated S3 GETs For Private Objects Using Paperclip</title>
<summary type="html">&lt;p&gt;
  Yea I know, I am probably the last person on earth that is just getting around to using &lt;a href=&quot;http://github.com/thoughtbot/paperclip&quot; class=&quot;external-link&quot;&gt;Paperclip&lt;/a&gt;. To be honest, most of my file upload code was written way before Paperclip or even AttachementFu was ever conceived. And frankly, I do not do much social app coding on the side - so the need never came up. But that changed recently and I wanted a really really good way of leveraging AWS::S3 storage with the best local app security while maintaining tight control over the files.
&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;
  Yea I know, I am probably the last person on earth that is just getting around to using &lt;a href=&quot;http://github.com/thoughtbot/paperclip&quot; class=&quot;external-link&quot;&gt;Paperclip&lt;/a&gt;. To be honest, most of my file upload code was written way before Paperclip or even AttachementFu was ever conceived. And frankly, I do not do much social app coding on the side - so the need never came up. But that changed recently and I wanted a really really good way of leveraging AWS::S3 storage with the best local app security while maintaining tight control over the files.
&lt;/p&gt;

&lt;p&gt;
  Yea I know, I am probably the last person on earth that is just getting around to using &lt;a href=&quot;http://github.com/thoughtbot/paperclip&quot; class=&quot;external-link&quot;&gt;Paperclip&lt;/a&gt;. To be honest, most of my file upload code was written way before Paperclip or even AttachementFu was ever conceived. And frankly, I do not do much social app coding on the side - so the need never came up. But that changed recently and I wanted a really really good way of leveraging AWS::S3 storage with the best local app security while maintaining tight control over the files.
&lt;/p&gt;

&lt;p&gt;
  So the Paperclip wiki has a few links that already dealt with some ways of protecting your app's attachments. One mentions a method I totally love called security through obscurity. It uses a secure random token as part of the filename which combined with the original filename and the id partition makes for great random URLs. The other is a great walk thru on how to use the :url option of paperclip to point access control back to your own application for your normal biz logic.
&lt;/p&gt;

&lt;p&gt; 
  The problem I see with both of these methods is that they do not allow you to maintain app control past the final URL handoff/redirect. It also requires that your S3 bucket is public. For instance, if you were to use the &lt;code&gt;s3_permissions =&gt; :private&lt;/code&gt; option of Paperclip, then that URL given to you by Paperclip is pretty much worthless. I knew AWS::S3 had authenticated GETs that generated an automatically expiring URL, but saw no way of accessing its features using the abstract &lt;code&gt;Paperclip::Attachment&lt;/code&gt; object. So this is what I did.
&lt;/p&gt;


&lt;div class=&quot;mt20 mb10&quot;&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;/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;MyDownload&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;tt&gt;
&lt;/tt&gt;  has_attached_file &lt;span class=&quot;sy&quot;&gt;:attachment&lt;/span&gt;, &lt;tt&gt;
&lt;/tt&gt;                    &lt;span class=&quot;sy&quot;&gt;:storage&lt;/span&gt; =&amp;gt; &lt;span class=&quot;sy&quot;&gt;:s3&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:bucket&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;mybucket&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;sy&quot;&gt;:s3_credentials&lt;/span&gt; =&amp;gt; {...}, &lt;span class=&quot;sy&quot;&gt;:s3_protocol&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;https&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;sy&quot;&gt;:s3_permissions&lt;/span&gt; =&amp;gt; &lt;span class=&quot;sy&quot;&gt;:private&lt;/span&gt;,&lt;tt&gt;
&lt;/tt&gt;                    &lt;span class=&quot;sy&quot;&gt;:path&lt;/span&gt; =&amp;gt; lambda { |attachment| &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;:id_partition/&lt;/span&gt;&lt;span class=&quot;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;attachment.instance.random_secret&lt;span class=&quot;dl&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;/:filename&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;sy&quot;&gt;:processors&lt;/span&gt; =&amp;gt; [&lt;span class=&quot;sy&quot;&gt;:noop&lt;/span&gt;]&lt;tt&gt;
&lt;/tt&gt;  &lt;tt&gt;
&lt;/tt&gt;  before_validation_on_create &lt;span class=&quot;sy&quot;&gt;:set_random_secret&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;tt&gt;
&lt;/tt&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;attachment_url&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;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;&lt;span class=&quot;pc&quot;&gt;self&lt;/span&gt;.class.tableize&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;id&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;attachment_file_name&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;  &lt;span class=&quot;r&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;authenticated_s3_get_url&lt;/span&gt;(options={})&lt;tt&gt;
&lt;/tt&gt;    options.reverse_merge! &lt;span class=&quot;sy&quot;&gt;:expires_in&lt;/span&gt; =&amp;gt; &lt;span class=&quot;i&quot;&gt;10&lt;/span&gt;.minutes, &lt;span class=&quot;sy&quot;&gt;:use_ssl&lt;/span&gt; =&amp;gt; &lt;span class=&quot;pc&quot;&gt;true&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;co&quot;&gt;AWS&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;S3&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;S3Object&lt;/span&gt;.url_for attachment.path, attachment.options[&lt;span class=&quot;sy&quot;&gt;:bucket&lt;/span&gt;], options&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;  private&lt;tt&gt;
&lt;/tt&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;set_random_secret&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;pc&quot;&gt;self&lt;/span&gt;.random_secret = &lt;span class=&quot;co&quot;&gt;ActiveSupport&lt;/span&gt;::&lt;span class=&quot;co&quot;&gt;SecureRandom&lt;/span&gt;.hex(&lt;span class=&quot;i&quot;&gt;8&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;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;/div&gt;

&lt;p&gt;
  Let me walk you thru some of the highlights of that class, the general concept following is that we are going to use the best of both examples in security mentioned above. First, the secure token, that is what #set_random_secret will generate for each instance. The &lt;code&gt;:path&lt;/code&gt; option for Paperclip uses a proc to make sure each instance uses that attribute in the string that will be later interpolated further down. You can also see how I use the id partition too. Next, I have added two public instance methods. The first is #attachment_url and it will need a bit of explaining.
&lt;/p&gt;

&lt;p&gt;
  Currently in Paperclip, if you use the :url option and your :storage is set to :s3, then it is ignored. This could totally be intentional. So in a typical setup where you want the file download running through your own access control, you wold have a :url option like this &lt;code&gt;:url =&gt; '/:class/:id/:filename'&lt;/code&gt;. So this is what #attachment_url mimics, it simply gets around that shortcoming and points the download action back to your own controller. How that controller would work is beyond the scope of this article, see the resources section below for those links.
&lt;/p&gt;

&lt;p&gt;
  The last example method is #authenticated_s3_get_url which dips right on down to the AWS::S3 library to get the URL for the object in the bucket. AWS::S3's doc mention that it will automatically generate a secure GET url that expires in 5 minutes. However in my example, you can see where I am changing that to 10 minutes and forcing the HTTPS protocol. This would be the URL that your own controller would do the final redirect to. This URL is for your private objects in your S3 bucket and will only work for the amount of time you want it too! Meaning your app stays in complete control. Putting it all together one more time...
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
# A MyDownload instance.
&gt;&gt; dl = MyDownload.find(4)

# This is totally useless for private buckets/objects.
&gt;&gt; dl.attachment.url
=&gt; &quot;https://s3.amazonaws.com/mybucket/000/000/004/147681c16fddc1e5/private.pdf?1258989107&quot;

# This is what you use in your own views.
&gt;&gt; dl.attachment_url
=&gt; &quot;my_downloads/4/private.pdf&quot;

# Your controller would redirect to this secure GET.
&gt;&gt; dl.authenticated_s3_get_url
=&gt; &quot;https://s3.amazonaws.com/mybucket/000/000/004/147681c16fddc1e5/private.pdf?AWSAccessKeyId=0HJD3NS9CVWN2JV89K02&amp;Expires=1258990967&amp;Signature=8aWsq4o5gXfpIrRZyeETddnOeFw%3D&quot;
&lt;/pre&gt;


&lt;h3&gt;What Is That Noop Processor&lt;/h3&gt;

&lt;p&gt;
  Good eye! Did you see that I have a processor called Noop in the has_attached_file declaration? The default processor in Paperclip is the Thumbnail processor, which no matter what calls the ImageMagick identify command to see if it can do something to the file. I did not want that or any processing, just simple attachments. So I created this simple processor that just straight returns the file object. I made a &lt;a href=&quot;http://github.com/thoughtbot/paperclip/issues/#issue/118&quot; class=&quot;external-link&quot;&gt;ticket on the Paperclip's issue page&lt;/a&gt; that hopefully would allow a &lt;code&gt;:processors =&gt; false&lt;/code&gt; option one day that would do this as well. So maybe one day it'll be a feature.
&lt;/p&gt;

&lt;div class=&quot;mt20 mb10&quot;&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;module&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;Paperclip&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;Noop&lt;/span&gt; &amp;lt; &lt;span class=&quot;co&quot;&gt;Processor&lt;/span&gt;&lt;tt&gt;
&lt;/tt&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;make&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      file&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;/div&gt;


&lt;h2&gt;Resources&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://almosteffortless.com/2009/03/22/randomize-filename-in-paperclip/&quot; class=&quot;external-link&quot;&gt;Security Through Obscurity: Randomize Filename in Paperclip&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://thewebfellas.com/blog/2009/8/29/protecting-your-paperclip-downloads&quot; class=&quot;external-link&quot;&gt;Your Access Control: Protecting Your Paperclip Downloads&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://github.com/thoughtbot/paperclip/issues/#issue/118&quot; class=&quot;external-link&quot;&gt;Allow False Option For Processors&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
          </content>  </entry>
  <entry xml:base="http://www.metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:www.metaskills.net,2009-11-11:440</id>
    <published>2009-11-11T17:47:00Z</published>
    <updated>2009-11-11T18:36:53Z</updated>
    <link href="http://www.metaskills.net/2009/11/11/meta-programming-in" rel="alternate" type="text/html"/>
    <title>Meta Programming In...</title>
<summary type="html">&lt;p&gt;
  Last nights &lt;a href=&quot;http://757rb.org/&quot; class=&quot;external-link&quot;&gt;757.rb&lt;/a&gt; meeting was a great success. We did a talk titled &lt;em&gt;Introduction To Ruby &amp; Rails&lt;/em&gt; for all the new comers that might have been interested in learning more about both – from the ground up. Since Ruby was my first language and my toolbelt only extends to JavaScript and Objective-C, I'm always interested in how other languages do the things that I love so much in Ruby. One of the biggest pluses for Ruby, to me, is the support for meta programming. In a typical rails model, you might see something like this.
&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;
  Last nights &lt;a href=&quot;http://757rb.org/&quot; class=&quot;external-link&quot;&gt;757.rb&lt;/a&gt; meeting was a great success. We did a talk titled &lt;em&gt;Introduction To Ruby &amp; Rails&lt;/em&gt; for all the new comers that might have been interested in learning more about both – from the ground up. Since Ruby was my first language and my toolbelt only extends to JavaScript and Objective-C, I'm always interested in how other languages do the things that I love so much in Ruby. One of the biggest pluses for Ruby, to me, is the support for meta programming. In a typical rails model, you might see something like this.
&lt;/p&gt;
&lt;p&gt;
  Last nights &lt;a href=&quot;http://757rb.org/&quot; class=&quot;external-link&quot;&gt;757.rb&lt;/a&gt; meeting was a great success. We did a talk titled &lt;em&gt;Introduction To Ruby &amp; Rails&lt;/em&gt; for all the new comers that might have been interested in learning more about both – from the ground up. Since Ruby was my first language and my toolbelt only extends to JavaScript and Objective-C, I'm always interested in how other languages do the things that I love so much in Ruby. One of the biggest pluses for Ruby, to me, is the support for meta programming. In a typical rails model, you might see something like this.
&lt;/p&gt;

&lt;div class=&quot;mt20 mb10&quot;&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;&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;User&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;:articles&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  named_scope             &lt;span class=&quot;sy&quot;&gt;:active&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:conditions&lt;/span&gt; =&amp;gt; {&lt;span class=&quot;sy&quot;&gt;:active&lt;/span&gt; =&amp;gt; &lt;span class=&quot;pc&quot;&gt;true&lt;/span&gt;}&lt;tt&gt;
&lt;/tt&gt;  validates_uniqueness_of &lt;span class=&quot;sy&quot;&gt;:email&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  validates_presence_of   &lt;span class=&quot;sy&quot;&gt;:email&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:username&lt;/span&gt;, &lt;span class=&quot;sy&quot;&gt;:twitter_handle&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;/div&gt;

&lt;p&gt;
  For the untrained, those are class level methods writing code for an model that persists objects to a database. It looks like you are typing a spec or some declaration. In fact this is code writing other code. For newcomers to the language this is voodoo magic, but if you write programs and interfaces for others, meta programming is what it is all about. In fact, I use this technique all the time instead of writing the same code over and over again.
&lt;/p&gt;

&lt;p&gt;
  This concept is built into the core of Ruby. In fact here is an example from my talk on the class method built into Ruby called &lt;code&gt;attr_accessor&lt;/code&gt; which wraps a common paradigm of generating getter/setter methods for an instance variable. No magic here, the two class definitions below are equal and the interface of the object is the same. One is you do not have to write code over an over again in an vanilla class you care to have getter/setter methods for.
&lt;/p&gt;

&lt;div class=&quot;mt20 mb10&quot;&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;&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;MyClass&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  attr_accessor &lt;span class=&quot;sy&quot;&gt;:foo&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;# Same as writing&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;MyClass&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;foo&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;iv&quot;&gt;@foo&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;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;foo=&lt;/span&gt;(value)&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;iv&quot;&gt;@foo&lt;/span&gt; = value&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;# Same results&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;tt&gt;
&lt;/tt&gt;o = &lt;span class=&quot;co&quot;&gt;MyClass&lt;/span&gt;.new&lt;tt&gt;
&lt;/tt&gt;o.foo           &lt;span class=&quot;c&quot;&gt;# =&amp;gt; nil&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;o.foo = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;   &lt;span class=&quot;c&quot;&gt;# =&amp;gt; &amp;quot;bar&amp;quot;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;o               &lt;span class=&quot;c&quot;&gt;# =&amp;gt; #&amp;lt;MyClass:0x100172b80 @foo=&amp;quot;bar&amp;quot;&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&amp;lt;/dib&gt;

&lt;p&gt;
  So here is where I want to learn. I know how to write Ruby well enough that I can show one way below of how to write &lt;code&gt;attr_accessor&lt;/code&gt; if it did not exist in core Ruby. In my example below I made the method named &lt;code&gt;attribute_accessor&lt;/code&gt; to avoid the name conflict. Can anyone show me how this would be done in PHP, Java, Anything? What is meta programming like in those languages? How about posting a code example on &lt;a href=&quot;http://pastie.org/&quot; class=&quot;external-link&quot;&gt;pastie.org&lt;/a&gt; and school me. I really am interested in knowing. BTW, my example only shows how the &lt;code&gt;attribute_accessor&lt;/code&gt; takes on argument. In actuality in Ruby, the built in &lt;code&gt;attr_accessor&lt;/code&gt; method takes multiple args and generates methods for each. For simplicity I narrowed down my examples and code to only take one argument so we can all stay focused.
&lt;/p&gt;

&lt;div class=&quot;mt20 mb10&quot;&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;&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;MetaSkills&lt;/span&gt;&lt;tt&gt;
&lt;/tt&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;.included(klass)&lt;tt&gt;
&lt;/tt&gt;    klass.class_eval &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      include &lt;span class=&quot;co&quot;&gt;ClassMethods&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;module&lt;/span&gt; &lt;span class=&quot;cl&quot;&gt;ClassMethods&lt;/span&gt;&lt;tt&gt;
&lt;/tt&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;attribute_accessor&lt;/span&gt;(name)&lt;tt&gt;
&lt;/tt&gt;      attribute_reader(name)&lt;tt&gt;
&lt;/tt&gt;      attribute_writer(name)&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;def&lt;/span&gt; &lt;span class=&quot;fu&quot;&gt;attribute_reader&lt;/span&gt;(name)&lt;tt&gt;
&lt;/tt&gt;      define_method(name) &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;        instance_variable_get &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;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;name&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;end&lt;/span&gt;&lt;tt&gt;
&lt;/tt&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;attribute_writer&lt;/span&gt;(name)&lt;tt&gt;
&lt;/tt&gt;      define_method &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;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;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;r&quot;&gt;do&lt;/span&gt; |value|&lt;tt&gt;
&lt;/tt&gt;        instance_variable_set &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;il&quot;&gt;&lt;span class=&quot;dl&quot;&gt;#{&lt;/span&gt;name&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;, value&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;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;Class&lt;/span&gt;.send &lt;span class=&quot;sy&quot;&gt;:include&lt;/span&gt;, &lt;span class=&quot;co&quot;&gt;MetaSkills&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;MyClass&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  attribute_accessor &lt;span class=&quot;sy&quot;&gt;:foo&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;o = &lt;span class=&quot;co&quot;&gt;MyClass&lt;/span&gt;.new&lt;tt&gt;
&lt;/tt&gt;o.foo           &lt;span class=&quot;c&quot;&gt;# =&amp;gt; nil&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;o.foo = &lt;span class=&quot;s&quot;&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;bar&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;'&lt;/span&gt;&lt;/span&gt;   &lt;span class=&quot;c&quot;&gt;# =&amp;gt; &amp;quot;bar&amp;quot;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;o               &lt;span class=&quot;c&quot;&gt;# =&amp;gt; #&amp;lt;MyClass:0x100171c80 @foo=&amp;quot;bar&amp;quot;&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;/div&gt;

&lt;p&gt;
  Update: A friend was asking me about the namespaces you see in the module. It is technically possible to just open up the Class object and add my example additions. Typically in Ruby you are encouraged to create your own namespaced module and inject class/instance modules into the included class via the module's hook method &lt;code&gt;self.included&lt;/code&gt;. The pattern is like so &lt;a href=&quot;http://pastie.org/694019&quot; class=&quot;external-link&quot;&gt;http://pastie.org/694019&lt;/a&gt;. So for instance, I could have done this &lt;a href=&quot;http://pastie.org/694038&quot; class=&quot;external-link&quot;&gt;http://pastie.org/694038&lt;/a&gt; without taking advantages of the modules hook method. 
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:www.metaskills.net,2009-10-27:424</id>
    <published>2009-10-27T20:06:00Z</published>
    <updated>2009-11-02T00:39:49Z</updated>
    <category term="Database"/>
    <category term="Heuristics"/>
    <category term="Projects"/>
    <category term="Ruby/Rails"/>
    <category term="ree"/>
    <category term="ruby"/>
    <category term="sqlserver"/>
    <link href="http://www.metaskills.net/2009/10/27/installing-ree-with-the-snow-leopard-sql-server-stack" rel="alternate" type="text/html"/>
    <title>Installing REE With The Snow Leopard SQL Server Stack</title>
<summary type="html">&lt;p&gt;
  Today I noticed that Ruby Enterprise Edition 2009.10 was released and I have really been wanting to see if I could get the &lt;a href=&quot;http://github.com/rails-sqlserver&quot; class=&quot;external-link&quot;&gt;SQL Server adapter&lt;/a&gt; tested and running under it. I am really curious how the speed improvements might look and will share my results below. This article assumes that you read my previous guide titled &lt;a href=&quot;/2009/9/5/the-ultimate-os-x-snow-leopard-stack-for-rails-development-x86_64-macports-ruby-1-8-1-9-sql-server-more&quot;&gt;The Ultimate OS X Snow Leopard Stack For Rails Development - x86_64, MacPorts, Ruby 1.8/1.9, SQL Server, SQLite3, MySQL &amp; More&lt;/a&gt; as I will be building on top of it and referencing certain steps. So let's get down to business.
&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;
  Today I noticed that Ruby Enterprise Edition 2009.10 was released and I have really been wanting to see if I could get the &lt;a href=&quot;http://github.com/rails-sqlserver&quot; class=&quot;external-link&quot;&gt;SQL Server adapter&lt;/a&gt; tested and running under it. I am really curious how the speed improvements might look and will share my results below. This article assumes that you read my previous guide titled &lt;a href=&quot;/2009/9/5/the-ultimate-os-x-snow-leopard-stack-for-rails-development-x86_64-macports-ruby-1-8-1-9-sql-server-more&quot;&gt;The Ultimate OS X Snow Leopard Stack For Rails Development - x86_64, MacPorts, Ruby 1.8/1.9, SQL Server, SQLite3, MySQL &amp; More&lt;/a&gt; as I will be building on top of it and referencing certain steps. So let's get down to business.
&lt;/p&gt;

&lt;p&gt;
  Today I noticed that Ruby Enterprise Edition 2009.10 was released and I have really been wanting to see if I could get the &lt;a href=&quot;http://github.com/rails-sqlserver&quot; class=&quot;external-link&quot;&gt;SQL Server adapter&lt;/a&gt; tested and running under it. I am really curious how the speed improvements might look and will share my results below. This article assumes that you read my previous guide titled &lt;a href=&quot;/2009/9/5/the-ultimate-os-x-snow-leopard-stack-for-rails-development-x86_64-macports-ruby-1-8-1-9-sql-server-more&quot;&gt;The Ultimate OS X Snow Leopard Stack For Rails Development - x86_64, MacPorts, Ruby 1.8/1.9, SQL Server, SQLite3, MySQL &amp; More&lt;/a&gt; as I will be building on top of it and referencing certain steps. So let's get down to business.
&lt;/p&gt;



&lt;h2&gt;Installing REE&lt;/h2&gt;

&lt;p&gt;
  The guys at Phusion have done a rock solid job. My previous attempts to install REE were a bomb, but it worked perfectly this time around. Simply &lt;a href=&quot;http://www.rubyenterpriseedition.com/download.html&quot; class=&quot;external-link&quot;&gt;follow their directions&lt;/a&gt; and all will be OK. A snippet of my output is below. I liked how they picked a new default install directory of &lt;code&gt;/opt/ruby-enterprise-1.8.7-2009.10&lt;/code&gt;. Wicked cool! By the way, the only issue I had during install was when they were trying to install the pg gem for me. I ignored that error for now.
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
sudo ./ruby-enterprise-1.8.7-2009.10/installer

Where would you like to install Ruby Enterprise Edition to?
(All Ruby Enterprise Edition files will be put inside that directory.)
[/opt/ruby-enterprise-1.8.7-2009.10] :
&lt;/pre&gt;



&lt;h2&gt;Configuring For REE&lt;/h2&gt;

&lt;p&gt;
  This is actually really easy. In my previous article, I talked about installing MacPorts and configure your profile. All I did this time around was add the REE path extensions after my MacPort extensions in my ZSH kit. So my path file now looks this below. If I ever want to just go back to my normal 1.8/1.9 toggle in &lt;code&gt;/opt/local/bin&lt;/code&gt;, I just comment out the REE path extensions, source my profile and I'm back to my MacPort basics.
&lt;/p&gt;

&lt;pre&gt;
# MacPorts
path=(/opt/local/bin /opt/local/sbin /opt/local/apache2/bin ~/.zshkit/bin $path)
manpath=(/opt/local/share/man $manpath)
infopath=(/opt/local/share/info $infopath)

# REE
path=(/opt/ruby-enterprise-1.8.7-2009.10/bin $path)
manpath=(/opt/ruby-enterprise-1.8.7-2009.10/share/man $manpath)
infopath=(/opt/ruby-enterprise-1.8.7-2009.10/share/info $infopath)
&lt;/pre&gt;

&lt;p&gt;
  In the last guide, I mentioned how to switch between ruby 1.8/1.9 installed by MacPorts using a simple ZSH function. You can find this in my article title &lt;a href=&quot;/2009/1/20/multiruby-the-macports-way-testing-your-rails-apps-with-ruby-1-9&quot;&gt;MultiRuby The MacPorts Way. Testing Your Rails Apps With Ruby 1.9&lt;/a&gt;. I have updated this to include a condition that will noop the function if you are running REE. So to recap. I use my &lt;code&gt;chruby&lt;/code&gt; function to switch between 1.8/1.9 installed by MacPorts and I use my profile extension to use REE. So what that profile change done... reload and/or open a new terminal window and test it out.
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
$ which ruby
/opt/ruby-enterprise-1.8.7-2009.10/bin/ruby
$ which gem
/opt/ruby-enterprise-1.8.7-2009.10/bin/gem
&lt;/pre&gt;



&lt;h2&gt;Using REE With SQL Server&lt;/h2&gt;

&lt;p&gt;
  Let's get the easy stuff out of the way and install the needed gems for the adapter to work. Again, always &lt;a href=&quot;http://github.com/rails-sqlserver&quot; class=&quot;external-link&quot;&gt;follow the TODO on the adapter page&lt;/a&gt; for the latest blessed versions of DBI and low level connectivity stuff. But just to recap the current needs.
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
$ sudo gem install dbi -v 0.4.1
$ sudo gem install dbd-odbc -v 0.2.4
$ sudo gem install activerecord-sqlserver-adapter
&lt;/pre&gt;

&lt;p&gt;
  Now the hard part, but I have an easy solution. You can do this the hard way and recompile the UTF8 version of ruby odbc by hand or you can type one command. I tried compiling it by hand and found that I had a few bugs, even after following &lt;a href=&quot;http://digitaljacob.riff.dk/2009/10/26/using-ruby-odbc-with-unixodbc-on-snow-leopard/&quot; class=&quot;external-link&quot;&gt;Jacob Riff's notes&lt;/a&gt; when he had a similar issue when trying to hook ruby ODBC to use unixODBC in his &lt;code&gt;/usr/local&lt;/code&gt; . My solution was much simpler. I just coped my ruby 1.8.7 ruby odbc to the REE's vendor ruby directory. Hence:
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
$ sudo cp /opt/local/lib/ruby/vendor_ruby/1.8/i686-darwin10/odbc.bundle /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/vendor_ruby/1.8/i686-darwin10.0.0
&lt;/pre&gt;

&lt;p&gt;
  Here are my notes below on where I failed on installing ruby odbc by hand under REE. Feedback welcome, but good to know that the above simple copy worked just fine.
&lt;/p&gt;

&lt;pre&gt;
# Installing Ruby ODBC By Hand Notes

$ ruby -Cutf8 extconf.rb
$ make -C utf8
$ sudo make -C utf8 install
  /usr/bin/install -c -m 0755 odbc_utf8.bundle /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/site_ruby/1.8/i686-darwin10.0.0
$ sudo mv /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/site_ruby/1.8/i686-darwin10.0.0/odbc_utf8.bundle /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/site_ruby/1.8/i686-darwin10.0.0/odbc.bundle 

Loading development environment (Rails 2.3.4)
dlsym(0x102c6e330, Init_odbc): symbol not found - /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/site_ruby/1.8/i686-darwin10.0.0/odbc.bundle
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/site_ruby/1.8/i686-darwin10.0.0/odbc.bundle
/opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
&lt;/pre&gt;




&lt;h2&gt;Benchmarking REE vs MacPorts&lt;/h2&gt;

&lt;p&gt;
  Here is the good news, the above hacks and REE work! I have even tested the adapter and all is looking good from my end!!! Now how about those benchmarks? Here are the speed differences for running the full adapter test suite under 1.8.7 installed in MacPorts and the latest REE. Note, this is really non-scientific benchmarks, but I think they fun facts.
&lt;/p&gt;

&lt;pre&gt;
Ruby 1.8.7 MacPorts (patchlevel 174)
Finished in 158.574243 seconds.
2190 tests, 7395 assertions, 0 failures, 0 errors

REE 1.8.7 (2009.10)
Finished in 146.834762 seconds.
2190 tests, 7636 assertions, 0 failures, 0 errors
&lt;/pre&gt;



&lt;h2&gt;Installing Passenger&lt;/h2&gt;

&lt;p&gt;
  Since passenger was installed as part of the REE installation, all I had to do was run the apache2 installer again and paste in the new code into my httpd.conf file.
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
$ which passenger-install-apache2-module
/opt/ruby-enterprise-1.8.7-2009.10/bin/passenger-install-apache2-module
$ sudo passenger-install-apache2-module
&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:www.metaskills.net,2009-10-11:375</id>
    <published>2009-10-11T03:14:00Z</published>
    <updated>2009-10-12T00:19:23Z</updated>
    <category term="Heuristics"/>
    <category term="Ruby/Rails"/>
    <category term="middleware"/>
    <category term="rack"/>
    <category term="ruby"/>
    <link href="http://www.metaskills.net/2009/10/11/the-zombie-shotgun-revisited" rel="alternate" type="text/html"/>
    <title>The Zombie Shotgun Revisited </title>
<content type="html">
            &lt;div class=&quot;photobounding floatl mr20&quot;&gt;
  &lt;div class=&quot;tl&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;tr&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;bl&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;br&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;photoborder&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;phototime&quot;&gt;
    &lt;img src=&quot;/assets/2008/7/6/zombie_shotgun.jpg&quot; height=&quot;213&quot; alt=&quot;Resident Evil Zombie Shotgun&quot; width=&quot;320&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;
  My how time flies. Over a year ago &lt;a href=&quot;/2008/7/6/stop-exception-notifications-with-the-zombieshotgun&quot;&gt;I created a simple bit of code&lt;/a&gt; that was useful for stopping ActionController routing errors from common Microsoft attacks from sending exception notification emails. Well now most people do not use exception notifications emails in favor of apps like Hoptoad. And hey, most code like this has moved to Rack middlewares.
&lt;/p&gt;

&lt;p&gt;
  Yesterday I noticed a &lt;a href=&quot;http://coderack.org&quot; class=&quot;external-link&quot;&gt;rack code competition&lt;/a&gt; that encouraged &quot;most useful and top quality Rack middlewares&quot;. Well the Zombie Shotgun is pretty useful to me, but I'm sure it's not top quality. That said, I did take the time to finally pick up on the rack internals and learn how to use &lt;a href=&quot;http://github.com/brynary/rack-test&quot; class=&quot;external-link&quot;&gt;rack-test&lt;/a&gt;. If you want to check out the new tested Zombie Shotgun middleware and how I tested it using Shoulda, &lt;a href=&quot;http://github.com/metaskills/rack-zombieshotgun&quot; class=&quot;external-link&quot;&gt;go see the project on my github page&lt;/a&gt;. Also, here is my &lt;a href=&quot;http://coderack.org/users/MetaSkills/entries/15-zombie-shotgun&quot; class=&quot;external-link&quot;&gt;CodeRack entry&lt;/a&gt;.
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:www.metaskills.net,2009-10-04:366</id>
    <published>2009-10-04T13:02:00Z</published>
    <updated>2009-10-04T13:39:24Z</updated>
    <category term="757"/>
    <category term="cocoa"/>
    <category term="objc"/>
    <category term="rails"/>
    <category term="ruby"/>
    <category term="studio"/>
    <link href="http://www.metaskills.net/2009/10/4/757-studio" rel="alternate" type="text/html"/>
    <title>757 Studio</title>
<summary type="html">&lt;div class=&quot;center&quot;&gt;
  &lt;img src=&quot;/assets/2009/10/4/757_studio_conference.png&quot; alt=&quot;757 Studio Website&quot;&gt;
&lt;/div&gt;

&lt;p&gt;
  Well it took up quite a bit of my free time and a good 2 weeks of no iPhone development, but I am very very happy that
  the organization of my first event has been a success so far. Check out &lt;a href=&quot;http://757studio.org/&quot; class=&quot;external-link&quot;&gt;
  757studio.org&lt;/a&gt; for full details. Andy Hunt is headlining the event with a talk on Pragmatic Thinking and Learning. Clinton 
  Nixon and Jamie Pinkham will be following with talks on Ruby/Rails and iPhone/Cocoa. So even though I can not make it to the 
  West Coast for RubyConf this year, it is not so bad with a local event like this.
&lt;/p&gt;</summary><content type="html">
            &lt;div class=&quot;center&quot;&gt;
  &lt;img src=&quot;/assets/2009/10/4/757_studio_conference.png&quot; alt=&quot;757 Studio Website&quot;&gt;
&lt;/div&gt;

&lt;p&gt;
  Well it took up quite a bit of my free time and a good 2 weeks of no iPhone development, but I am very very happy that
  the organization of my first event has been a success so far. Check out &lt;a href=&quot;http://757studio.org/&quot; class=&quot;external-link&quot;&gt;
  757studio.org&lt;/a&gt; for full details. Andy Hunt is headlining the event with a talk on Pragmatic Thinking and Learning. Clinton 
  Nixon and Jamie Pinkham will be following with talks on Ruby/Rails and iPhone/Cocoa. So even though I can not make it to the 
  West Coast for RubyConf this year, it is not so bad with a local event like this.
&lt;/p&gt;

&lt;div class=&quot;center&quot;&gt;
  &lt;img src=&quot;/assets/2009/10/4/757_studio_conference.png&quot; alt=&quot;757 Studio Website&quot;&gt;
&lt;/div&gt;

&lt;p&gt;
  Well it took up quite a bit of my free time and a good 2 weeks of no iPhone development, but I am very very happy that
  the organization of my first event has been a success so far. Check out &lt;a href=&quot;http://757studio.org/&quot; class=&quot;external-link&quot;&gt;
  757studio.org&lt;/a&gt; for full details. Andy Hunt is headlining the event with a talk on Pragmatic Thinking and Learning. Clinton 
  Nixon and Jamie Pinkham will be following with talks on Ruby/Rails and iPhone/Cocoa. So even though I can not make it to the 
  West Coast for RubyConf this year, it is not so bad with a local event like this.
&lt;/p&gt;

&lt;p&gt;
  Thanks so much to the &lt;a href=&quot;http://pragmaticstudio.com/&quot; class=&quot;external-link&quot;&gt;Pragmatic Studio&lt;/a&gt; and the 
  &lt;a href=&quot;http://www.pragprog.com/&quot; class=&quot;external-link&quot;&gt;Pragmatic Bookshelf&lt;/a&gt; for sponsoring the event and most 
  important to the speakers who are giving the talks. It is my sincere hopes that the Hampton Roads area can support more 
  talks like this and hopefully the advocacy of Ruby/Objective-C to local software developers and business will pay off, for 
  everyone!
&lt;/p&gt;

&lt;h2&gt;Some Background&lt;/h2&gt;

&lt;p&gt;
  I myself designed and developed the 757 Studio site. Yes, I used to be a designer back in the day, not a good one, but enough 
  to get by. It took me a few days to get to something in PhotoShop that looked right to me. I'm digging the brick and wood 
  masthead. I think it gives the site both a modern &quot;.com&quot; office look, even though some say it feels dated. On the technical 
  side, this was my first experience using &lt;a href=&quot;http://haml-lang.com/&quot; class=&quot;external-link&quot;&gt;HAML&lt;/a&gt; and 
  &lt;a href=&quot;http://sass-lang.com/&quot; class=&quot;external-link&quot;&gt;SASS&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
  I loved HAML so much, I doubt I'll ever go back to ERB templates in Rails again. The forced indentation and not having to 
  manage closing tags was wonderful, it kept my views clean and forces you to use helpers like they should vs inlining a 
  bunch of control structures. SASS, the companion to HAML is for generating your CSS. It too forces you to write a strict 
  indentation for you CSS which works wonders. Not only will it generate deep selectors that maintain good scope, but the 
  the layout helps you really understand where in the DOM tree you are.
&lt;/p&gt;

&lt;p&gt;
  If you want to see how all this came together and how I quickly hashed up a battle tested rails app for the studio's 
  RSVP/Reservation system, &lt;a href=&quot;http://github.com/metaskills/757studio&quot; class=&quot;external-link&quot;&gt;the project is on my 
  Github page&lt;/a&gt;. Check out the &lt;code&gt;app/stylesheets/site.sass&lt;/code&gt; for the SASS CSS template and all the other views
  use HAML. Oh yea... I should also say that this was my first time playing with some webkit animations and effects. You may
  be able to spot them if you are on Safari/WebKit/Chrome.
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:www.metaskills.net,2009-09-21:343</id>
    <published>2009-09-21T16:42:00Z</published>
    <updated>2009-12-07T20:28:32Z</updated>
    <category term="bookshelf"/>
    <category term="objc"/>
    <category term="pragmatic"/>
    <category term="ruby"/>
    <link href="http://www.metaskills.net/2009/9/21/perform-occupational-maintenance" rel="alternate" type="text/html"/>
    <title>Perform Occupational Maintenance!</title>
<content type="html">
            &lt;p&gt;
One of the things that bugs me about some people in the technology field is that they do not perform enough occupational maintenance. Today I just purchased &lt;a href=&quot;http://www.pragprog.com/titles/sdcoach/agile-coaching&quot; class=&quot;external-link&quot;&gt;&lt;em&gt;Agile Coaching&lt;/em&gt;&lt;/a&gt; and &lt;a href=&quot;http://www.pragprog.com/titles/tibmac/beginning-mac-programming&quot; class=&quot;external-link&quot;&gt;&lt;em&gt;Beginning Mac Programming: Develop with Objective-C and Cocoa&lt;/em&gt;&lt;/a&gt;. Both from the &lt;a href=&quot;http://www.pragprog.com/&quot; class=&quot;external-link&quot;&gt;Pragmatic Bookshelf&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
If you have not done so already, do yourself a favor and go to the Pragmatic Bookstore, check yo self, and get better at what you do! Here is my bookshelf to date.
&lt;/p&gt;

&lt;div class=&quot;center&quot;&gt;
&lt;img class=&quot;mr20&quot; src=&quot;/assets/2009/9/21/occupational_maintenance.png&quot; height=&quot;361&quot; alt=&quot;757.rb Memcached Presentation&quot; width=&quot;502&quot; /&gt;
&lt;/div&gt;
          </content>  </entry>
  <entry xml:base="http://www.metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:www.metaskills.net,2009-09-05:321</id>
    <published>2009-09-05T23:20:00Z</published>
    <updated>2010-01-26T02:15:03Z</updated>
    <category term="Apple/OSX"/>
    <category term="Database"/>
    <category term="Heuristics"/>
    <category term="Ruby/Rails"/>
    <category term="adapter"/>
    <category term="apple"/>
    <category term="macports"/>
    <category term="rails"/>
    <category term="sql server"/>
    <category term="x86_64"/>
    <link href="http://www.metaskills.net/2009/9/5/the-ultimate-os-x-snow-leopard-stack-for-rails-development-x86_64-macports-ruby-1-8-1-9-sql-server-more" rel="alternate" type="text/html"/>
    <title>The Ultimate OS X Snow Leopard Stack For Rails Development - x86_64, MacPorts, Ruby 1.8/1.9, SQL Server, SQLite3, MySQL &amp; More</title>
<summary type="html">&lt;p&gt;
  This guide is all encompassing but primarily focuses on the benefits of MacPorts, second the development stack for SQL Server and lastly on anything else a rails developer might need on OS X. If you are on a Mac, possibly running Snow Leopard and x86_64 is near and dear to your heart, this article is for you. &lt;strong&gt;If you do not &quot;have&quot; to use SQL Server, you can safely skip those sections and get to the Ruby1.9/Apache2/SQLite3/MySQL stuff.&lt;/strong&gt;
&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;
  This guide is all encompassing but primarily focuses on the benefits of MacPorts, second the development stack for SQL Server and lastly on anything else a rails developer might need on OS X. If you are on a Mac, possibly running Snow Leopard and x86_64 is near and dear to your heart, this article is for you. &lt;strong&gt;If you do not &quot;have&quot; to use SQL Server, you can safely skip those sections and get to the Ruby1.9/Apache2/SQLite3/MySQL stuff.&lt;/strong&gt;
&lt;/p&gt;

&lt;p&gt;
  This guide is all encompassing but primarily focuses on the benefits of MacPorts, second the development stack for SQL Server and lastly on anything else a rails developer might need on OS X. If you are on a Mac, possibly running Snow Leopard and x86_64 is near and dear to your heart, this article is for you. &lt;strong&gt;If you do not &quot;have&quot; to use SQL Server, you can safely skip those sections and get to the Ruby1.9/Apache2/SQLite3/MySQL stuff.&lt;/strong&gt;
&lt;/p&gt;

&lt;p&gt;
  A small forward. If you are developing rails applications on a modern OS such as Snow Leopard and your needs never make it out of the shallow end of the default Ruby and SQLite3, then this how-to might not be for you. However if you find yourself needing more and you want it to be easy and optimized for your architecture, then I highly suggest MacPorts.
&lt;/p&gt;

&lt;p&gt;
  Even though this tutorial is based on MacPorts, there are alternatives if you have the guts. One is called &lt;a href=&quot;http://github.com/mxcl/homebrew/tree/masterbrew&quot; class=&quot;external-link&quot;&gt;Homebrew&lt;/a&gt; by Max Howell, which offers a very easy package management system that is closely knit to OS X's own libraries. If your smart enough to manage the sheer amount of dependencies and different ways OS X wants to pull you when using their libraries, then have at it. I failed horribly and I consider myself somewhat smart. This article also focuses on running multiple versions of ruby, specifically 1.8.7 and a flavor of 1.9.x. Again to this end there are other solutions. One recent one is called &lt;a href=&quot;http://rvm.beginrescueend.com/&quot; class=&quot;external-link&quot;&gt;Ruby Version Manager (rvm)&lt;/a&gt; by Wayne Seguin. An incredible library, but something I could not use with my level of compiling source due to the fact that all the dependencies needed for SQL Server to ODBC are hard enough to get in place for one ruby installation. RVM has it's use, but if you just need two versions of ruby with a full 64-bit stack to SQL Server, read on.
&lt;/p&gt;





&lt;h2&gt;Install MacPorts&lt;/h2&gt;

&lt;p&gt;
  If you have not done so already, go &lt;a href=&quot;http://www.macports.org/install.php&quot; class=&quot;external-link&quot;&gt;download MacPorts&lt;/a&gt; and run the installer and follow &lt;a href=&quot;http://guide.macports.org/&quot; class=&quot;external-link&quot;&gt;their installation instructions&lt;/a&gt;. At the time of this writing, the current version is 1.8 and has tons of new stuff for Snow Leopard. If you use bash, the default shell on OS X, then add this to your ~/.profile.
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
export PATH=&quot;/usr/local/bin:$PATH&quot;
export MANPATH=&quot;/usr/local/share/man:$MANPATH&quot;
export INFOPATH=&quot;/usr/local/share/info:$INFOPATH&quot;
&lt;/pre&gt;

&lt;p&gt;
  However, if you have &lt;a href=&quot;http://books.google.com/books?id=jKY-rDoJx3wC&amp;amp;pg=PA115&amp;amp;lpg=PA115&amp;amp;dq=system+preferences+account+right+click+os+x+switch+to+zsh+default+shell&amp;amp;source=bl&amp;amp;ots=J0eyfcuH37&amp;amp;sig=F4MrA0-NmqeprnqEneAhAdqJBPg&amp;amp;hl=en&amp;amp;ei=FFigSs73GMqc8QaAzoDeDw&amp;amp;sa=X&amp;amp;oi=book_result&amp;amp;ct=result&amp;amp;resnum=2#v=onepage&amp;amp;q=system%20preferences%20account%20right%20click%20os%20x%20switch%20to%20zsh%20default%20shell&amp;amp;f=false&quot; class=&quot;external-link&quot;&gt;changed your default shell to ZSH&lt;/a&gt;, then put this in your ~/.zshenv file. I highly recommend switching your default shell to ZSH.
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
path=(/opt/local/bin /opt/local/sbin /opt/local/apache2/bin $path)
manpath=(/opt/local/share/man $manpath)
infopath=(/opt/local/share/info $infopath)
&lt;/pre&gt;

&lt;h3&gt;Important x86_64 Arch Notice&lt;/h3&gt;

&lt;p&gt;
  If you are running Snow Leopard and if your processor supports 64-bit, say a Core 2 Duo (consult your manual), then I highly suggest you set the MacPorts build_arch to force it to x86_64 for all installed ports. Remember, even if you have a unibody MacBook that can not boot the 64-bit kernel yet, that does not mean you are not running 64-bit apps. If your chip supports it and your on Snow Leopard, turn it on. Here is how.
&lt;/p&gt;

&lt;p&gt;
  Open up your MacPorts config file located at &lt;code&gt;/opt/local/etc/macports/macports.conf&lt;/code&gt;. Around line 59, find the section that has the build_arch and set it to x86_64. I have done this on both my unibody MacBook 13&quot; and Nehalem MacPro and everything has installed and works perfectly. This includes, ruby, git, and everything in between. See screenshots below for proof. Lastly, as a good habit, always run &lt;code&gt;sudo port selfupdate&lt;/code&gt; before installing ports. This makes sure you have the latest port files.
&lt;/p&gt;





&lt;h2&gt;Installing Ruby 1.8.7&lt;/h2&gt;

&lt;p&gt;
  By now Ruby 1.8.7 is the new 1.8.6. It will be the de-facto low level version that supports the enterprise. Frankly, 1.9.2 is really where it is at, but we all have our day jobs right. Either way it is good to have this version installed. You may ask why, 1.8.7 comes on OS X by default now in Snow Leopard? Correct, but the goal here is to get a base ruby installed whose libs are known and compiled the way we want them for our low level SQL Server libraries and their dependencies. The goal here is to avoid dependency hell.
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
$ sudo port install ruby  

$ which ruby
/opt/local/bin/ruby

$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10]
&lt;/pre&gt;

&lt;p&gt;
  Running that port install may have taken awhile, but let me show you something. Do you see that below? That's right, it's 64-bit ruby just like the default OS X installed 1.8.7. In fact, it's even a bit faster for some reason. So remember, using MacPorts this way means that everything you install that supports it, will be built for 64-bit.
&lt;/p&gt;

&lt;div class=&quot;photobounding&quot;&gt;
  &lt;div class=&quot;tl&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;tr&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;bl&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;br&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;photoborder&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;phototime&quot;&gt;
    &lt;img src=&quot;http://www.metaskills.net/assets/2009/9/4/ruby18_darwin_x86_64.jpg&quot; height=&quot;260&quot; alt=&quot;Ruby 1.8.7 64-bit Activity Monitor&quot; width=&quot;497&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;
  Lets get RubyGems package management up and running. Thanks again to MacPorts this is really easy. Some advice. Never use MacPorts to update RubyGems! We just used it to get it installed easily and quickly and in the right scope. If you need to update RubyGems, just use it's own self update feature. 
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
$ sudo port install rb-rubygems
&lt;/pre&gt;

&lt;p&gt;
  Feeling good? Maybe like me, you wouldn't mind getting side tracked. If so, go ahead and install Subversion and/or Git. I personally like to install both of these since I use Git to manage my Subversion repos too.
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
$ sudo port install subversion
$ sudo port install git-core +svn
&lt;/pre&gt;


&lt;h2&gt;The SQL Server Connection Stack&lt;/h2&gt;

&lt;p&gt;
  So back on track. The low level connection stack for SQL Server is pretty easy. We need unixODBC and not OS X's installed iODBC. After that FreeTDS needs to be installed with the +odbc variant so that it prefers the installed unixODBC. If you did not get side tracked above, these two installs could pull in a lot of dependency installs too and take some time. When we are done the final stack for connecting Rails to SQL Server will look something like this. Ruby/Rails =&gt; ActiveRecord SQL Server Adapter =&gt; DBI Gem w/DBD-ODBC =&gt; Ruby ODBC =&gt; unixODBC =&gt; FreeTDS =&gt; SQL Server.
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
$ sudo port install unixODBC
$ sudo port install freetds +odbc
&lt;/pre&gt;

&lt;p&gt;
  If all went well, you should see a configuration file notice after FreeTDS installs. This is just the port reminding us that we will ultimately have to configure FreeTDS to point to our SQL Server box. We'll get back to that later, for now, let's check that the install is looking good.
&lt;p&gt;

&lt;pre class=&quot;command&quot;&gt;
$ which tsql
/opt/local/bin/tsql

$ tsql -C
Compile-time settings (established with the &quot;configure&quot; script)
                            Version: freetds v0.82
             freetds.conf directory: /opt/local/etc/freetds
     MS db-lib source compatibility: no
        Sybase binary compatibility: no
                      Thread safety: yes
                      iconv library: yes
                        TDS version: 5.0
                              iODBC: no
                           unixodbc: yes

$ tsql I
locale is &quot;en_US.utf-8&quot;
locale charset is &quot;utf-8&quot;
&lt;/pre&gt;

&lt;p&gt;
  See that last line after &lt;code&gt;tsql -C&lt;/code&gt;? It says unixodbc is a go! That's important. If for some reason you do not see this, then I suggest reinstalling unixODBC and FreeTDS in that order again. Also note the output of &lt;code&gt;tsql I&lt;/code&gt; and check out the locale settings. On Mac OS X, this seems to default to the utf-8 stuff we would expect. Possibly due to the default LANG env var is set to en_US.utf-8. However, on other systems this may note be right. See the configure FreeTDS section below for what to do if this is the case.
&lt;/p&gt;

&lt;p&gt;
  Right. That completes the UNIX'y low level parts to get us talking to SQL Server, now to put the focus back on Ruby again by installing a few gems that will be needed. Here are the ones critical to this setup. Please consult the adapter's &lt;a href=&quot;http://github.com/rails-sqlserver/2000-2005-adapter/tree/master&quot; class=&quot;external-link&quot;&gt;README&lt;/a&gt; for update to date version information on the approved/latest gems for DBI.
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
$ sudo gem install dbi -v 0.4.1
$ sudo gem install dbd-odbc -v 0.2.4
$ sudo gem install activerecord-sqlserver-adapter
&lt;/pre&gt;

&lt;p&gt;
  Almost there, we need one more piece, the Ruby ODBC bindings, so we can talk to the low level unixODBC. At the time of this writing, the MacPort portfile for rb-odbc was stuck at 0.9995 while the &lt;a href=&quot;http://www.ch-werner.de/rubyodbc/&quot; class=&quot;external-link&quot;&gt;ruby odbc project page&lt;/a&gt; reports that the latest version is 0.9997. So here is a little lesson on how to edit a portfile to get our desired results. 
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
$ port file rb-odbc
/opt/local/var/macports/sources/rsync.macports.org/release/ports/ruby/rb-odbc/Portfile

$ port file rb-odbc | xargs mate
&lt;/pre&gt;

&lt;p&gt;
  The first command simply shows you how you can get MacPorts to revel where the port file is located. The second shows how you can pipe that result to xargs to get TextMate to open the portfile. Now that we have the port file in front of us, let's edit it so that it pulls the latest. First change all occurrences of the version to latest, in this case from 0.9995 to 0.9997. Lastly, download your target version from the ruby odbc project page and do a MD5 checksum on it. In my case, when I downloaded 0.9997, the md5 checksum is 36d21519795c3edc8bc63b1ec6682b99. Now change the odd md5 in the portfile to this new one, hit save, and close. Let's try it out.
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
$ sudo port install rb-odbc +utf8
&lt;/pre&gt;

&lt;p&gt;
  So without little fuss, that should have worked. Did you notice how we have the +utf8 variant there? If your like me and have national/unicode columns in your database, this is a good thing. The adapter has tests and support for unicode as well.
&lt;/p&gt;


  

&lt;h2&gt;Configure The SQL Server Stack&lt;/h2&gt;

&lt;p&gt;
  First, let's configure FreeTDS to point to our server. Assuming you have TextMate a simple &lt;code&gt;mate /opt/local/etc/freetds/freetds.conf&lt;/code&gt; should get it open for us. FreeTDS even put in a few examples at the bottom of the file, I typically comment these out and add my own. In this example I am naming my server &quot;my_dev_server&quot;. Note that tds version section, I personally use tds version 8.0 and have tested this against my stack on all SQL Server types with the ActiveRecord tests. Some have reported that they have errors unless the use 7.0. Your mileage may vary. Save and close the file. &lt;strong&gt;UPDATE:&lt;/strong&gt; As noted above when running &lt;code&gt;tsql I&lt;/code&gt;, if you do not see a utf-8 locale setting, you may have to add this line &lt;code&gt;client charset = UTF-8&lt;/code&gt; to your configuration file. Here is a thread on &lt;a href=&quot;http://lists.ibiblio.org/pipermail/freetds/2006q3/020396.html&quot; class=&quot;external-link&quot;&gt;how to set tsql's client character set&lt;/a&gt;.
&lt;/p&gt;

&lt;pre class=&quot;&quot;&gt;
# A typical Sybase server
# [egServer50]
#   host = symachine.domain.com
#   port = 5000
#   tds version = 5.0

# A typical Microsoft server
# [egServer70]
#   host = ntmachine.domain.com
#   port = 1433
#   tds version = 7.0

[my_dev_server]
  host = 192.168.1.58
  port = 1433
  tds version = 8.0
&lt;/pre&gt;

&lt;p&gt;
  It has been noted that Windows user may want to include client encodings and character sets that set UTF-8 values. If you are running on Windows, try out this style freetds conf.
&lt;/p&gt;

&lt;pre class=&quot;&quot;&gt;
[YOURSERVER]
 host             = yourserver.com
 port             = 1433
 tds version      = 7.0
 text size = 64512
 client encoding  = UTF-8
 client charset   = UTF-8
&lt;/pre&gt;

&lt;p&gt;
  So after you have added your own server here, it is now time to configure unixODBC to use FreeTDS. Let's copy the default distribution files to the correctly named ones that unixODBC will look for.
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
$ sudo cp /opt/local/etc/odbc.ini.dist /opt/local/etc/odbc.ini
$ sudo cp /opt/local/etc/odbcinst.ini.dist /opt/local/etc/odbcinst.ini
&lt;/pre&gt;

&lt;p&gt;
  Open up the newly copied &lt;code&gt;/opt/local/etc/odbcinst.ini&lt;/code&gt; file. More than likely, this will be the only time you ever edit this file. Add a FreeTDS configuration to it like so. No personal configuration options here, this just links up the MacPort installed unixODBC and FreeTDS.
&lt;/p&gt;

&lt;pre class=&quot;&quot;&gt;
[FreeTDS]
Decscription = FreeTDS driver for SQLServer
Driver = /opt/local/lib/libtdsodbc.so
Setup = /opt/local/lib/libtdsodbc.so
FileUsage = 1
&lt;/pre&gt;

&lt;p&gt;
  So the last thing is to create some DSNs in your &lt;code&gt;/opt/local/etc/odbc.ini&lt;/code&gt; file. It is very likely that you could edit this file often. Perhaps you do a lot of development and DB server changes. My personal file has over 20 some DSNs here. Here is one example. The name and description of the DSN is up to you. Take note how I made the server name &quot;my_dev_server&quot; line up to that used in the FreeTDS conf file. That is important. Flavor this to your tastes.
&lt;/p&gt;

&lt;pre class=&quot;&quot;&gt;
[my_dev_server_dsn]
Driver=FreeTDS
Description=My Server Connection
Servername=my_dev_server
Server=my_dev_server
Port=1433
Database=killer_app
&lt;/pre&gt;

&lt;p&gt;
  Here is an example of what your database.yml will look like. So by now you should be able to connect and work with your database. I have this working on quite a few Macs. If you found any issues, let me know, but a good place to start is running the adapter tests. That is of course if you have the stack setup right.
&lt;/p&gt;

&lt;pre class=&quot;&quot;&gt;
development:
  adapter: sqlserver
  mode: ODBC
  username: rails
  password: secret
  database: killer_app
  dsn: my_dev_server_dsn
&lt;/pre&gt;





&lt;h2&gt;Going The Extra Mile With Ruby 1.9.x&lt;/h2&gt;

&lt;p&gt;
  Here is a little trick that I put in an article called &lt;a href=&quot;http://www.metaskills.net/2009/1/20/multiruby-the-macports-way-testing-your-rails-apps-with-ruby-1-9&quot;&gt;MultiRuby The MacPorts Way. Testing Your Rails Apps With Ruby 1.9&lt;/a&gt;. Follow the steps in this post to get 1.9.x installed and switchable between your default 1.8.7 install.
&lt;/p&gt;

&lt;p&gt;
  Remember, RubyGems already comes in 1.9 and that tutorial leaves your installed gems under 1.9 empty. Do the right thing and install gems on an as needed basis under 1.9. As for the ruby-odbc which is installed in the 1.8's vendor ruby directory, we will need to trick MacPorts to recompile and reinstall that for us. Here is how I did it. First make sure you in the right ruby version.
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
$ ruby -v                                 
ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-darwin10]
&lt;/pre&gt;

&lt;p&gt;
  Now we need to trick MacPorts to forget about the previous install so it will build and use the extconf.rb of the ruby 1.9 installation. Here are the commands to softly remove rb-odbc from MacPorts memory. If you want, you can change &lt;code&gt;rm -rf&lt;/code&gt; to just &lt;code&gt;mv&lt;/code&gt; and move these files to some other place.
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
sudo rm -rf /opt/local/var/macports/receipts/rb-odbc
sudo rm -rf /opt/local/var/macports/software/rb-odbc
sudo rm -rf /opt/local/share/doc/rb-odbc
&lt;/pre&gt;

&lt;p&gt;
  Now you can tell MacPorts to reinstall ruby-odbc and it should create a new odbc.bundle in your &lt;code&gt;/opt/local/lib/ruby1.9/site_ruby/1.9.1/i386-darwin10/odbc.bundle&lt;/code&gt;.
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
$ sudo port install rb-odbc +utf8
&lt;/pre&gt;

&lt;p&gt;
  Here is the proof that I have 1.9 installed, working with SQL Server adapter and 64-bit. Thanks to the &lt;code&gt;chruby&lt;/code&gt; ZSH function described in my other post, I can easily switch between my ruby installs.
&lt;/p&gt;

&lt;div class=&quot;photobounding&quot;&gt;
  &lt;div class=&quot;tl&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;tr&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;bl&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;br&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;photoborder&quot;&gt;&lt;/div&gt;
  &lt;div class=&quot;phototime&quot;&gt;
    &lt;img src=&quot;http://www.metaskills.net/assets/2009/9/4/ruby19_darwin_x86_64.jpg&quot; height=&quot;260&quot; alt=&quot;Ruby 1.8.7 64-bit Activity Monitor&quot; width=&quot;497&quot; /&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;h2&gt;Complete The Marathon!&lt;/h2&gt;

&lt;p&gt;
  Installing apache2 and passenger, yes all 64-bit happy.
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
$ sudo port install apache2
$ sudo gem install passenger
$ sudo passenger-install-apache2-module
&lt;/pre&gt;


&lt;p&gt;
  How about a more common setup for SQLite3? If you took the side track and installed subversion from above, then you already have SQLite3 installed via MacPorts. If not, that's easy to fix. Here is how to install it and the ruby sqlite3 gem. I have done this for both my 1.8.7 and 1.9.x install above and again I am all 64-bit happy and passing all my tets.
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
$ sudo port install sqlite3
$ sudo gem install sqlite3-ruby
&lt;/pre&gt;


&lt;p&gt;
  Installing MySQL and the ruby drivers are a bit more involved. This will get it installed and your launch control setup to act as if your box is a server, ie. load MySQL when it starts up.
&lt;/p&gt;

&lt;pre class=&quot;command&quot;&gt;
$ sudo port install mysql5-server
$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
$ sudo -u _mysql mysql_install_db5
$ sudo /opt/local/share/mysql5/mysql/mysql.server start
 Starting MySQL
 SUCCESS!
$ sudo gem install mysql -- --with-mysql-config=/opt/local/bin/mysql_config5
&lt;/pre&gt;

&lt;p&gt;
  Nice, fully 64-bit and passing all the ActiveRecord tests for me. Note, sometimes you will have to reset your shell for new path binaries to become usable. It's always a good idea to open a new shell post a port install If you get an unfound &lt;code&gt;mysql_install_db5&lt;/code&gt;, try opening a new shell. Pay attention to some of the output from that command too. For instance, if you want to set a root user password. I choose not to do this for a dev DB, but I do like to limit the connections so that only local connections can be used by editing the conf file. To create yourself a my.cnf file, copy one of the templates in &lt;code&gt;/opt/local/share/mysql5/mysql&lt;/code&gt;, I choose to copy the large conf like so &lt;code&gt;sudo cp /opt/local/share/mysql5/mysql/my-large.cnf /opt/local/etc/mysql5/my.cnf&lt;/code&gt;. Then I edit the conf file and uncomment the link that says &quot;skip-networking&quot;. That way no one on the local network can hit my DBs. Lastly, here are some helpful aliases that I use.
&lt;/p&gt;

&lt;pre&gt;
alias my_stop=&quot;sudo launchctl stop org.macports.mysql5&quot;
alias my_start=&quot;sudo launchctl start org.macports.mysql5&quot;
alias my_rs=&quot;my_stop ; my_start&quot;
alias myconf=&quot;mate /opt/local/etc/mysql5/my.cnf&quot;
&lt;/pre&gt;
          </content>  </entry>
  <entry xml:base="http://www.metaskills.net/">
    <author>
      <name>kencollins</name>
    </author>
    <id>tag:www.metaskills.net,2009-08-18:288</id>
    <published>2009-08-18T15:56:00Z</published>
    <updated>2010-01-26T16:40:33Z</updated>
    <category term="Apple/OSX"/>
    <category term="leopard"/>
    <category term="snow"/>
    <category term="terminal"/>
    <category term="visor"/>
    <link href="http://www.metaskills.net/2009/8/18/visor-terminal-on-snow-leopard" rel="alternate" type="text/html"/>
    <title>Visor Terminal on Snow Leopard</title>
<summary type="html">&lt;p&gt;
 &lt;strong&gt;UPDATE: Hacks no longer needed, latest Visor/SIMBL is 64-bit Snow Leopard happy!&lt;/strong&gt;
  This is a similar process that I had to go through back in the day when I had to hack visor terminal in Leopard. Basically the steps are pretty easy. First you just install &lt;a href=&quot;http://www.culater.net/software/SIMBL/SIMBL.php&quot; class=&quot;external-link&quot;&gt;SIMBL&lt;/a&gt; and the &lt;a href=&quot;http://visor.binaryage.com/&quot; class=&quot;external-link&quot;&gt;Visor.bundle&lt;/a&gt; as a SIMBL plugin in &lt;code&gt;~/Library/Application Support/SIMBL/Plugins/Visor.bundle&lt;/code&gt;. Once that is done here is the process to get this working in Snow Leopard.
&lt;/p&gt;</summary><content type="html">
            &lt;p&gt;
 &lt;strong&gt;UPDATE: Hacks no longer needed, latest Visor/SIMBL is 64-bit Snow Leopard happy!&lt;/strong&gt;
  This is a similar process that I had to go through back in the day when I had to hack visor terminal in Leopard. Basically the steps are pretty easy. First you just install &lt;a href=&quot;http://www.culater.net/software/SIMBL/SIMBL.php&quot; class=&quot;external-link&quot;&gt;SIMBL&lt;/a&gt; and the &lt;a href=&quot;http://visor.binaryage.com/&quot; class=&quot;external-link&quot;&gt;Visor.bundle&lt;/a&gt; as a SIMBL plugin in &lt;code&gt;~/Library/Application Support/SIMBL/Plugins/Visor.bundle&lt;/code&gt;. Once that is done here is the process to get this working in Snow Leopard.
&lt;/p&gt;
&lt;p&gt;
  &lt;strong&gt;UPDATE: Hacks no longer needed, latest Visor/SIMBL is 64-bit Snow Leopard happy!&lt;/strong&gt;
  This is a similar process that I had to go through back in the day when I had to hack visor terminal in Leopard. Basically the steps are pretty easy. First you just install &lt;a href=&quot;http://www.culater.net/software/SIMBL/SIMBL.php&quot; class=&quot;external-link&quot;&gt;SIMBL&lt;/a&gt; and the &lt;a href=&quot;http://visor.binaryage.com/&quot; class=&quot;external-link&quot;&gt;Visor.bundle&lt;/a&gt; as a SIMBL plugin in &lt;code&gt;~/Library/Application Support/SIMBL/Plugins/Visor.bundle&lt;/code&gt;. Once that is done here is the process to get this working in Snow Leopard.
&lt;/p&gt;

&lt;p class=&quot;mb20&quot;&gt;
  First, you are going to need a copy of the Terminal.app from Leopard. I have &lt;a href=&quot;https://cdn.mmetaskills.net/VisorTerminal.zip&quot; class=&quot;external-link&quot;&gt;provided a copy&lt;/a&gt; in the resources section below. This copy has a few key things changed in the app's Info.plist file. First I have changed the bundle identifiers and display names to VisorTerminal. This is how we are going to scope visor to use this particular app. It also allows us to set things like the LSUIElement to 1 so that this app does not show in the dock. A summary of the changes I made are below, all these are done already in the download file I provide. If you want to do these on your own copy of Leopard's Terminal.app then just right click on the app, show package contents, and edit the Info.plist file. Remember to rename the app to VisorTerminal.app.
&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;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;CFBundleDisplayName&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;ta&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;VisorTerminal&lt;span class=&quot;ta&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;...&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;CFBundleIdentifier&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;ta&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;com.apple.VisorTerminal&lt;span class=&quot;ta&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;...&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;CFBundleName&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;ta&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;VisorTerminal&lt;span class=&quot;ta&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;...&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;LSUIElement&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;ta&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;1&lt;span class=&quot;ta&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;br /&gt;

&lt;p class=&quot;mb20&quot;&gt;
  Now we need to edit the installed &lt;code&gt;~/Library/Application Support/SIMBL/Plugins/Visor.bundle&lt;/code&gt; so that it focuses on the old Leopard's terminal app (now VisorTerminal.app). Again right click on it and show the package contents, here is the complete plist below. You can see where I changed 3 places to VisorTerminal.
&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;&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;pp&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;pp&quot;&gt;&amp;lt;!DOCTYPE plist PUBLIC &amp;quot;-//Apple//DTD PLIST 1.0//EN&amp;quot; &amp;quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&amp;quot;&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;ta&quot;&gt;&amp;lt;plist&lt;/span&gt; &lt;span class=&quot;an&quot;&gt;version&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;1.0&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;ta&quot;&gt;&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;ta&quot;&gt;&amp;lt;dict&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;CFBundleDevelopmentRegion&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;English&lt;span class=&quot;ta&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;CFBundleExecutable&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;Visor&lt;span class=&quot;ta&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;CFBundleIdentifier&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;com.blacktree.visor&lt;span class=&quot;ta&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;CFBundleInfoDictionaryVersion&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;6.0&lt;span class=&quot;ta&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;CFBundleName&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;Visor&lt;span class=&quot;ta&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;CFBundlePackageType&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;BNDL&lt;span class=&quot;ta&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;CFBundleSignature&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;????&lt;span class=&quot;ta&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;CFBundleVersion&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;Custom&lt;span class=&quot;ta&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;GoogleML&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;dict&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;TargetApplications&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;ta&quot;&gt;&amp;lt;array&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;ta&quot;&gt;&amp;lt;dict&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;        &lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;BundleIdentifier&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;        &lt;span class=&quot;ta&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;com.apple.VisorTerminal&lt;span class=&quot;ta&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;        &lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;BundleVersionsRE&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;        &lt;span class=&quot;ta&quot;&gt;&amp;lt;array&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;          &lt;span class=&quot;ta&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;.*&lt;span class=&quot;ta&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;        &lt;span class=&quot;ta&quot;&gt;&amp;lt;/array&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;        &lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;ExecPattern&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;        &lt;span class=&quot;ta&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;*/VisorTerminal.app/Contents/MacOS/Terminal&lt;span class=&quot;ta&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;ta&quot;&gt;&amp;lt;/dict&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;ta&quot;&gt;&amp;lt;/array&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;/dict&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;NSPrincipalClass&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;Visor&lt;span class=&quot;ta&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;SIMBLTargetApplications&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;array&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;ta&quot;&gt;&amp;lt;dict&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;ta&quot;&gt;&amp;lt;key&amp;gt;&lt;/span&gt;BundleIdentifier&lt;span class=&quot;ta&quot;&gt;&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;      &lt;span class=&quot;ta&quot;&gt;&amp;lt;string&amp;gt;&lt;/span&gt;com.apple.VisorTerminal&lt;span class=&quot;ta&quot;&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;    &lt;span class=&quot;ta&quot;&gt;&amp;lt;/dict&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;  &lt;span class=&quot;ta&quot;&gt;&amp;lt;/array&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;ta&quot;&gt;&amp;lt;/dict&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;span class=&quot;ta&quot;&gt;&amp;lt;/plist&amp;gt;&lt;/span&gt;&lt;tt&gt;
&lt;/tt&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;

&lt;br /&gt;

&lt;p&gt;
  Now when you launch VisorTerminal, it will be hidden from the dock and be the app that Visor.bundle focuses on. I really like how this app is removed from the doc too. More so I am just stoked it is working in Snow Leopard. As a last step, yoyou can add this to your login items so that it opens up automatically. I have found that it is a bit sticky when it first launches, but a few clicks in and out on first launch fixes that. One last note, I found it is easier to edit the custom properties for this terminal window like it's default color, font size, etc, if I turn off the LSUIElement.
&lt;/p&gt;

&lt;p&gt;
 &lt;strong&gt;UPDATE:&lt;/strong&gt; Thanks to Raptor007 for reminding us that if you want to get a head start on your terminal preferences looking the same for your VisorTerminal, you should copy &lt;code&gt; ~/Library/Preferences/com.apple.Terminal.plist&lt;/code&gt; to &lt;code&gt; ~/Library/Preferences/com.apple.VisorTerminal.plist&lt;/code&gt;. Thanks!
&lt;/p&gt;

&lt;h2 class=&quot;mb10&quot;&gt;Resources&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;http://visor.binaryage.com/&quot; class=&quot;external-link&quot;&gt;Visor Project Page&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://www.culater.net/software/SIMBL/SIMBL.php&quot; class=&quot;external-link&quot;&gt;SIMBL Project Page&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://metaskills.s3.amazonaws.com/VisorTerminal.zip&quot; class=&quot;external-link&quot;&gt;VisorTerminal.app (Leopard)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
          </content>  </entry>
</feed>
