<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>jeremyweiland.com</title>
	<atom:link href="http://jeremyweiland.com/feed" rel="self" type="application/rss+xml" />
	<link>http://jeremyweiland.com</link>
	<description>The home page of Jeremy Weiland</description>
	<pubDate>Tue, 01 Jul 2008 13:31:37 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>The RSpec post (including an important tip on shared example groups)</title>
		<link>http://jeremyweiland.com/archives/59</link>
		<comments>http://jeremyweiland.com/archives/59#comments</comments>
		<pubDate>Fri, 28 Mar 2008 01:40:01 +0000</pubDate>
		<dc:creator>jeremy</dc:creator>
		
		<category><![CDATA[Blogroll]]></category>

		<guid isPermaLink="false">http://blog.6thdensity.net/?p=940</guid>
		<description><![CDATA[So in my Rails apps lately I&#8217;ve been using the hell out of some RSpec.  I have to say that it&#8217;s making me a better, more methodical coder.  It&#8217;s not just allowing me to define my app in terms of expected behaviors and providing the well understood regression testing capabilities of any testing [...]]]></description>
			<content:encoded><![CDATA[<p>So in my Rails apps lately I&#8217;ve been using the hell out of some <a href="http://rspec.info">RSpec</a>.  I have to say that it&#8217;s making me a better, more methodical coder.  It&#8217;s not just allowing me to define my app <a href="http://behaviour-driven.org/">in terms of expected behaviors</a> and providing the well understood regression testing capabilities of <a href="http://www.ruby-doc.org/stdlib/libdoc/test/unit/rdoc/index.html">any testing framework</a>. It&#8217;s a whole new way of organizing my approach to programming.</p>
<p><span id="more-59"></span>First of all, starting a large application can seem daunting.  To paraphrase Rumsfeld, we don&#8217;t know what we don&#8217;t know half the time - so many different features, so much complexity in the way domain objects interract, and the coder inevitably drops a ball juggling all this in his head.  Add to this uncertainty the inevitable course corrections by the client, and it&#8217;s no wonder we lose a lot of sleep during the big pushes to get the foundations of our applications written.</p>
<p>By starting out writing specifications - and not as &#8220;business analysts&#8221; per se, but rather as programmers who are taking a moment to analyze what real world problems we&#8217;re trying to solve - we give ourselves a sort of technical permission to begin with a 10,000 foot view and build a structured path down to the ground level, step by behavior driven step. The way the application gets used really should only be considered at whatever level of detail makes sense at a particular stage in the development cycle (the insight of the <a href="http://agilemanifesto.org/">agile school</a>).</p>
<p><span></span>Throughout my &#8220;spec&#8217;ed&#8221; apps I have lots of &#8220;pending&#8221; specification cases.  These are just placeholders to allow me to talk about future functionality I don&#8217;t yet want to implement.  It&#8217;s remarkably freeing to be able to simply record what you want the code to do in plain English, worrying about the implementation later. You&#8217;re basically giving yourself a &#8220;plan of attack&#8221; without being slowed down by how the attack will actually take place - remember, we&#8217;re worried at this point about simply defining what behavior we should expect, not how that behavior will come about (also see <a href="http://blog.6thdensity.net/?p=940#comment-96149">the comments</a> - you can simply omit the block altogether).<br />
<blockquote>

<div class="wp_syntax"><div class="code"><pre>describe Bulletin, <span>&quot;when being composed&quot;</span> <span>do</span>
&nbsp;
  it <span>&quot;should be valid with all fields filled in&quot;</span> <span>do</span>
    pending
  <span>end</span>
&nbsp;
  it <span>&quot;should require a title&quot;</span> <span>do</span>
    pending
  <span>end</span>
&nbsp;
  it <span>&quot;should require a body&quot;</span> <span>do</span>
    pending
  <span>end</span>
&nbsp;
  it <span>&quot;should require an author&quot;</span> <span>do</span>
    pending
  <span>end</span>
&nbsp;
  it <span>&quot;should require a valid author&quot;</span> <span>do</span>
    pending
  <span>end</span>
<span>end</span></pre></div></div>

</blockquote>
<p>Once I&#8217;ve worked out a plan about how this code will behave, I can write a test inside each individual specification block.  By writing the test first, seeing the test fail, then implementing the code that makes the test pass, I break a big problem into bite size chunks.  I&#8217;m also being forced to &#8220;think ahead&#8221; about what I want to accomplish - thereby discovering edge cases that might complicate my original plan of attack.  I cannot overstate the utility of thinking about what your code does in terms of tests.<br />
<blockquote>

<div class="wp_syntax"><div class="code"><pre>describe Bulletin, <span>&quot;when being composed&quot;</span> <span>do</span>
&nbsp;
  fixtures <span>:volunteers</span>
&nbsp;
  before<span>&#40;</span><span>:each</span><span>&#41;</span> <span>do</span>
    <span>@bulletin</span> = Bulletin.<span>new</span><span>&#40;</span> <span>:body</span> =&gt; <span>&quot;Random body text&quot;</span>,
                              <span>:title</span> =&gt; <span>&quot;the title of the post&quot;</span>,
                              <span>:author_id</span> =&gt; volunteers<span>&#40;</span><span>:quentin</span><span>&#41;</span>.<span>id</span><span>&#41;</span>
  <span>end</span>
&nbsp;
  it <span>&quot;should be valid with all fields filled in&quot;</span> <span>do</span>
    <span>@bulletin</span>.<span>should</span> be_valid
  <span>end</span>
&nbsp;
  it <span>&quot;should require a title&quot;</span> <span>do</span>
    <span>@bulletin</span>.<span>title</span> = <span>nil</span>
    <span>@bulletin</span>.<span>should_not</span> be_valid
  <span>end</span></pre></div></div>

</blockquote>
<p>The nested describe blocks redefined my whole approach to rspec.  As you&#8217;ve seen, before blocks allow you do shared setup for a group of tests.  Well, you can share these before blocks among several different types of describe blocks, and the description texts just build on one another.  This allows you to organize the spec in a readable and DRY form, factoring out mere setup steps to expose the more readable business logic.<br />
<blockquote>

<div class="wp_syntax"><div class="code"><pre>  describe <span>&quot;when attempting to edit a comment&quot;</span> <span>do</span>
&nbsp;
    before<span>&#40;</span><span>:each</span><span>&#41;</span> <span>do</span>
      <span>@bulletin</span> = bulletins<span>&#40;</span><span>:the_first_one</span><span>&#41;</span>
      <span>@try_to_get_an_edit_form</span> = <span>lambda</span> <span>&#123;</span> get <span>:edit</span>, 
                                              <span>:member_id</span> =&gt; <span>@author_of_the_note</span>.<span>member_url</span>, 
                                              <span>:trade_note_id</span> =&gt; <span>@the_note</span>.<span>id</span>, 
                                              <span>:id</span> =&gt; <span>@comment</span>.<span>id</span> <span>&#125;</span>
    <span>end</span>
&nbsp;
    describe <span>&quot;by somebody other than the comment's author or an administrator&quot;</span> <span>do</span>          
      before<span>&#40;</span><span>:each</span><span>&#41;</span> <span>do</span>
        login_as<span>&#40;</span><span>:some_other_guy</span><span>&#41;</span>
        <span>@try_to_get_an_edit_form</span>
      <span>end</span>
&nbsp;
      it <span>&quot;should not successfully load the edit page&quot;</span> <span>do</span> 
        response.<span>should_not</span> be_success
      <span>end</span>
&nbsp;
      it <span>&quot;should display an error message&quot;</span> <span>do</span>
        <span>puts</span> flash.<span>inspect</span>
        flash<span>&#91;</span><span>:warning</span><span>&#93;</span>.<span>should</span> == <span>&quot;Unauthorized action.&quot;</span>
      <span>end</span>
    <span>end</span>
&nbsp;
    describe <span>&quot;by an administrator&quot;</span> <span>do</span>
      before<span>&#40;</span><span>:each</span><span>&#41;</span> <span>do</span>
        login_as<span>&#40;</span><span>:admin</span><span>&#41;</span>
        <span>@try_to_get_an_edit_form</span>
      <span>end</span>
...</pre></div></div>

</blockquote>
<p>The next step from that was getting to shared example groups.  This feature allows you to define an example group containing specified behavior that can be shared by multiple subsequent specifications.  Take the example of a feature that allows certain user roles to edit a post, but not others.  Instead of repeating the expectation for each role&#8217;s specification, you can define a set of expectations that apply to a certain class of behavior:<br />
<blockquote>

<div class="wp_syntax"><div class="code"><pre>describe <span>&quot;an allowable edit&quot;</span>, <span>:shared</span> =&gt; <span>true</span> <span>do</span>
&nbsp;
  it <span>&quot;should render the edit template&quot;</span> <span>do</span>
    response.<span>should</span> render_template<span>&#40;</span><span>'edit'</span><span>&#41;</span>
  <span>end</span>
<span>end</span></pre></div></div>

</blockquote>
<p>Then just reference that each role should behave like that example group:<br />
<blockquote>

<div class="wp_syntax"><div class="code"><pre>describe <span>&quot;by an administrator&quot;</span> <span>do</span>
  before<span>&#40;</span><span>:each</span><span>&#41;</span> <span>do</span>
    login_as<span>&#40;</span><span>:admin</span><span>&#41;</span>
      <span>@try_to_get_an_edit_form</span>
    <span>end</span>
&nbsp;
  it_should_behave_like <span>&quot;an allowable edit&quot;</span>
<span>end</span></pre></div></div>

</blockquote>
<p>Now, it took me a long time to get RSpec to play nice with shared example groups, because I had gotten so used to heavily nested describe blocks that I wanted to include the shared example groups in these blocks.  <em>That will not work.</em>  You need to put all your shared example groups outside of <em>any</em> describe blocks.  They also need to be run before they can be used, so I put them at the top</p>
<p>I know there&#8217;s a way to load shared examples from separate file, allowing you to bounce behaviors throughout your specs, but I haven&#8217;t gotten there yet (I hope to discover <a href="http://rspec.info/documentation/stories.html">RSpec Stories</a> soon as well, which promise an even more natural language way to specify behavior).  Suffice to say, this is power enough for me now.  As somebody who gets easily overwhelmed and distracted, the focus that behavior driven development gives me is priceless.  I also appreciate being able to have an intermediate layer between the technical implementation frame of mind and the human-useable functionality frame-of-mind.  It&#8217;s about a process that manages the monster you&#8217;re creating, and I know few programmers who wouldn&#8217;t benefit from the type of programming RSpec encourages.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeremyweiland.com/archives/59/feed</wfw:commentRss>
		</item>
		<item>
		<title>Using attachment_fu with :storage =&gt; :db_file</title>
		<link>http://jeremyweiland.com/archives/49</link>
		<comments>http://jeremyweiland.com/archives/49#comments</comments>
		<pubDate>Sun, 23 Mar 2008 16:59:05 +0000</pubDate>
		<dc:creator>jeremy</dc:creator>
		
		<category><![CDATA[Blogroll]]></category>

		<guid isPermaLink="false">http://blog.6thdensity.net/?p=937</guid>
		<description><![CDATA[So I recently got to use Rick Olson&#8217;s attachment_fu in a Rails application I&#8217;m working on, and it is pretty awesome.  It takes a lot of the hassle out of managing files that you might need to upload such as images, and even has the capability of doing thumbnails on the fly.  Attachment_fu [...]]]></description>
			<content:encoded><![CDATA[<p>So I recently got to use Rick Olson's <a href="http://svn.techno-weenie.net/projects/plugins/attachment_fu/">attachment_fu</a> in a Rails application I'm working on, and it is pretty awesome.  It takes a lot of the hassle out of managing files that you might need to upload such as images, and even has the capability of doing thumbnails on the fly.  Attachment_fu has three methods for storing uploads: the file system, Amazon S3 storage, and the database.  You can find ample articles on the 'net for using the first two methods, but the last one is poorly documented - both in the attachment_fu docs and on the web (that's not to say it isn't documented at all - I owe everything to <a href="http://deadprogrammersociety.blogspot.com/2007/04/getting-your-attachmentfu-back-out-of.html">Ron Evans' crucially helpful post</a>).  But I'd like to provide a streamlined - or at least personalized - tutorial for getting this to work.</p>
<p><span id="more-49"></span>The first step is figuring out which image manipulation library to use.  I used <a href="http://rmagick.rubyforge.org/">RMagick</a> just because I had <a href="http://www.railsenvy.com/2007/4/26/rmagick-on-os-x-10-4-9-intel">the directions</a> for compiling it handy, but <a href="http://seattlerb.rubyforge.org/ImageScience.html">ImageScience</a> and <a href="http://rubyforge.org/projects/mini-magick/">minimagick</a> are also supported.  Installation instructions abound, so google around to find something that works for you (it may or may not be painful, and I take no responsibility for it either way).</p>
<p>Next, download and install attachment_fu.  From your application root:<blockquote><pre><code>script/plugin install http://svn.techno-weenie.net/projects/plugins/attachment_fu/
</pre></code></p></blockquote>
<p>But there's more to do in vendor/plugins.  Since attachment_fu doesn&#8217;t have any ready-made helpers for pulling images out of the database, I rolled my own.  This a hack, and I follow <a href="http://errtheblog.com/posts/67-evil-twin-plugin">err's discipline of hacking plugins</a>.  Read his post for details, but essentially you create a directory called "attachment_fu_hacks" in vendor/plugins with a single file called "init.rb" In that file, paste the following:</p>
<blockquote><pre><code>Technoweenie::AttachmentFu::Backends::DbFileBackend.module_eval do
  def image_data(thumb_flag = false)
    if thumb_flag and the_thumb = thumbnails.first
      the_thumb.current_data
    else
      current_data
    end
  end
end</pre></code>
</blockquote>
<p>This is a tweaked version of Ron's method.  Essentially, it gives you a way to pull the binary data directly, which we'll need (since we don't have a "file" to serve).</p>
<p>Now scaffold your asset resource:<blockquote><code>script/generate scaffold_resource asset filename:string content_type:string size:integer width:integer height:integer parent_id:integer thumbnail:string created_at:datetime db_file_id:integer</code></blockquote>Roll into the migration it created; you'll need to add the actual table that will hold the databased file.  Keep in mind that we're using a <a href="http://dev.mysql.com/doc/refman/5.0/en/blob.html">blob</a> data, type, so here's the full monty:
<blockquote>
<pre><code>class CreateAssets &lt; ActiveRecord::Migration
  def self.up
    create_table :assets do |t|
      t.column :filename, :string
      t.column :type, :string
      t.column :content_type, :string
      t.column :size, :integer
      t.column :width, :integer
      t.column :height, :integer
      t.column :parent_id, :integer
      t.column :thumbnail, :string
      t.column :created_at, :datetime
      t.column :db_file_id, :integer
    end
    create_table :db_files
    execute 'ALTER TABLE db_files ADD COLUMN data LONGBLOB'
  end
  def self.down
    drop_table :assets
    drop_table :db_files
  end
end</pre></code></p></blockquote>
<p>Now, your model file will look something like this (see <a href="http://clarkware.com/cgi/blosxom/2007/02/24">Mike Clark&#8217;s post</a> or the <a href="n.techno-weenie.net/projects/plugins/attachment_fu/README">attachment_fu readme</a> for more details):
<blockquote><pre><code>class Asset &lt; ActiveRecord::Base
  has_attachment  :storage => :db_file,
                  :content_type => :image,
                  :max_size => 1.megabytes,
                  :thumbnails => { :thumb => "100&#215;100>" }
  validates_as_attachment
end</pre></code></p></blockquote>
<p>Note the thumbnail line, which instructs attachment_fu to create a thumbnail of the image.</p>
<p>Your controller will look normal (except you may not want to support the edit / update functions, since that has little meaning to the asset).  However, in "show" we need to be able to not only serve an HTML page with the image, but also serve <em>the image itself</em>.  This requires us to include the mime type in environment.rb:
<blockquote><pre><code>Mime::Type.register "image/jpeg", :jpg
Mime::Type.register "image/gif",  :gif
Mime::Type.register "image/png",  :png</pre></code></p></blockquote>
<p>and do something strange in the controller:
<blockquote><pre><code>  def show
    @asset = Asset.find(params[:id])
    show_thumbnail = (params[:thumb] == "true")
    respond_to do |format|
      format.html { render :action => 'show', :layout => false }
      format.jpg  { send_data(@asset.image_data(show_thumbnail),
                              :type  => 'image/jpeg',
                              :filename => @asset.create_temp_file,
                              :disposition => 'inline') }
      format.gif  { send_data(@asset.image_data(show_thumbnail),
                              :type  => 'image/gif',
                              :filename => @asset.create_temp_file,
                              :disposition => 'inline') }
      format.png  { send_data(@asset.image_data(show_thumbnail),
                              :type  => 'image/png',
                              :filename => @asset.create_temp_file,
                              :disposition => 'inline') }
    end
  rescue
    flash[:warning] = 'Could not find image.'
    redirect_to home_url
  end</pre></code></p></blockquote>
<p>I'm sure there's a way to DRY up the handling of each image type, but I couldn't figure it out.</p>
<p>Notice how I'm handling the possibility of a thumbnail image.  In attachment_fu, any thumbnails automatically created are stuck in the "db_files" table along with the normal image.  No real distinction is made at that level.  However, an original image model will have a &#8220;thumbnails&#8221; collection including all the thumbnails associated with it.  That&#8217;s what the method we hacked into attachment_fu does.  So in the controller, I just keep an eye out for the &#8220;thumb&#8221; parameter.</p>
<p>I'm also serving the binary image data <em>directly</em> if the request is for a jpg, gif, or png instead of an html file with the image rendered in it.  This allows you to use the image elsewhere in the application like so:
<blockquote><pre><code><%= image_tag "/assets/1.jpg" %></pre></code></p></blockquote>
<p>To get the thumbnail, it's easy:
<blockquote><pre><code><%= image_tag "/assets/1.jpg?thumb=true" %></pre></code></p></blockquote>
<p>I'm sure you can roll some helpers that will be suited to how you use images (you might want to even have one that would look up the image based on the filename instead of the id).</p>
<p>One thing to keep in mind is that the asset model definition is not the only limit on the size of file you can upload.  If you upload something too large, you may get a MySQL error about the max_packet_size.  This is a MySQL setting that you may need to tweak for your purposes.</p>
<p>Well, that's it.  Let me know if I forgot anything important.</p>]]></content:encoded>
			<wfw:commentRss>http://jeremyweiland.com/archives/49/feed</wfw:commentRss>
		</item>
		<item>
		<title>GitHub: Anarchy for Programmers</title>
		<link>http://jeremyweiland.com/archives/48</link>
		<comments>http://jeremyweiland.com/archives/48#comments</comments>
		<pubDate>Tue, 11 Mar 2008 23:43:04 +0000</pubDate>
		<dc:creator>jeremy</dc:creator>
		
		<category><![CDATA[Blogroll]]></category>

		<guid isPermaLink="false">http://blog.6thdensity.net/?p=923</guid>
		<description><![CDATA[I&#8217;m at the CVREG meeting watching Jon give his presentation on GitHub, the new awesomeness that everybody (nerdy) is talking about.  I&#8217;m still learning about it and figuring out how / why it&#8217;s different than Subversion, but look for a personal project on there soon.
git is a source code management system designed to make [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m at the <a href="http://cvreg.org">CVREG</a> meeting watching <a href="http://simplisticcomplexity.com">Jon</a> give his presentation on <a href="http://github.com">GitHub</a>, the new awesomeness that everybody (nerdy) is talking about.  I&#8217;m still learning about it and figuring out how / why it&#8217;s different than Subversion, but look for a personal project on there soon.</p>
<p><a href="http://git.or.cz/">git</a> is a source code management system designed to make branching easy.  It doesn&#8217;t enforce a &#8220;HEAD&#8221; like CVS and Subversion, so you can organize your project (or not) any way you want and fork to your heart&#8217;s content. It was written by <a href="http://en.wikipedia.org/wiki/Linus_Torvalds">Linus Torvalds</a> and company to help them develop the linux kernel, so it&#8217;s all about lots of people hacking on code and figuring out a way to diff between versions without making full copies of the source.  GitHub tracks, hosts, and manages all the distributed goodness: think MySpace for programmers.  It also has profiles, update feeds, requests, and more.  It&#8217;s perfect for starting your own, decentralized, self-organizing coding community. </p>
<p>Let me know if you want a beta invite. I&#8217;m <a href="http://github.com/jeremy6d">jeremy6d</a> if you want to find me.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeremyweiland.com/archives/48/feed</wfw:commentRss>
		</item>
		<item>
		<title>It’s 11:00 pm; do you know where your model methods are?</title>
		<link>http://jeremyweiland.com/archives/47</link>
		<comments>http://jeremyweiland.com/archives/47#comments</comments>
		<pubDate>Sat, 23 Feb 2008 22:21:10 +0000</pubDate>
		<dc:creator>jeremy</dc:creator>
		
		<category><![CDATA[Blogroll]]></category>

		<guid isPermaLink="false">http://blog.6thdensity.net/?p=903</guid>
		<description><![CDATA[So the other day I was implementing what I considered a simple Rails association helper to make my life easier:
has_many :unapproved_posts,
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;:class_name => "Post",
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;:finder_sql => "SELECT posts.* from  posts " +
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;"INNER JOIN users ON  posts.user_id = users.id " +
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;"INNER JOIN groups ON users.group_id = groups.id " +
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;'WHERE (groups.id = #{id}) and ' +
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;'(posts.approved is [...]]]></description>
			<content:encoded><![CDATA[<p>So the other day I was implementing what I considered a simple Rails association helper to make my life easier:<br />
<blockquote><code>has_many :unapproved_posts,<br />
<t />:class_name => "Post",<br />
:finder_sql => 'SELECT posts.* from  posts INNER JOIN users ON  posts.user_id = users.id INNER JOIN groups ON users.group_id = groups.id WHERE (groups.id = #{id}) and (posts.approved is NULL)'</code></p></blockquote>
<p>Yeah, it&#8217;s a little clunky, but I needed a quick fix.</p>
<p>Perhaps I should have spent the time on a refactor, because this code put me in Rails hell.  When displaying unapproved posts in my controller, my code iterated over a collection of <code>Post</code> objects.  When I&#8217;d first start the server, the action would grab the association with no problems.  However, every subsequent time the action runs, the <code>Post</code> objects I got back were missing the methods I defined in the <code>Post</code> model.  All the attributes were there and accessible, but any methods had disappeared.  Note that this only happened when accessing the posts via the association helper through the controller; doing the exact same stuff in script/console gave me no problem.</p>
<p>After a few hours of troubleshooting and abject frustration, I came across <a href="http://dev.rubyonrails.org/ticket/3558">this ticket</a> which seems to describe the behavior I was seeing.  Note that this is a 1.2.6 application I&#8217;m working on, so the lack of resolution makes some sense.  However, I needed a fix, and <a href="http://www.simplisticcomplexity.com/">my friend Jon</a> suggested I just write a method that returns the collection rather than using the helper.  So running the same query with <code>Post.find_by_sql</code> worked fine, and since I merely needed a read-only collection, this serves my purposes.</p>
<p>Just wanted to drop a line in case anybody in the future runs into this.  Watch out using finder_sql; it does not appear reliable.  Also, if you experience this behavior in a Rails 2.0 app, let me know (less important) and reopen the ticket (very important).</p>
]]></content:encoded>
			<wfw:commentRss>http://jeremyweiland.com/archives/47/feed</wfw:commentRss>
		</item>
		<item>
		<title>New Frontiers in Ruby Web Applications</title>
		<link>http://jeremyweiland.com/archives/46</link>
		<comments>http://jeremyweiland.com/archives/46#comments</comments>
		<pubDate>Thu, 07 Feb 2008 06:51:01 +0000</pubDate>
		<dc:creator>jeremy</dc:creator>
		
		<category><![CDATA[Blogroll]]></category>

		<guid isPermaLink="false">http://blog.6thdensity.net/?p=894</guid>
		<description><![CDATA[So as somebody who has experienced their share of headaches deploying Rails apps (and ended up learning how to provision a VPS from scratch as a result) I&#8217;m interested in the questions Peter Cooper of Ruby Inside asks:


Is there / why isn’t there a version of mod_ruby that doesn’t have the “class sharing” issue? What [...]]]></description>
			<content:encoded><![CDATA[<p>So as somebody who has experienced their share of headaches deploying Rails apps (and ended up learning how to provision a VPS from scratch as a result) I&#8217;m interested in the questions Peter Cooper of Ruby Inside <a href="http://www.rubyinside.com/no-true-mod_ruby-is-damaging-rubys-viability-on-the-web-693.html">asks</a>:<br />
<blockquote>
<ol>
<li>Is there / why isn’t there a version of mod_ruby that doesn’t have the “class sharing” issue? What is the technical impediment?</li>
<li>Is there any immutable reason that Ruby apps couldn’t, in the future, be deployed in a PHP-esque fashion?</li>
</ol>
</blockquote>
<p>The ensuing discussion in the comments is very instructive, and I&#8217;ve even been giving Cooper&#8217;s <a href="http://switchpipe.org/">Switchpipe</a> project a bit of attention lately.  But <a href="http://brainspl.at/">Ezra Zygmuntowicz</a> chimed in with quite welcome news:<br />
<blockquote>
<p>I’m just going to say that <a href="http://rubini.us/">Rubinius</a> has support (as of today!) for running multiple instances of it’s VM within one process, each VM on it’s own *native* thread, each VM running many ruby green threads. Each VM has it’s own heap and so each VM could load different apps that wouldn’t interfere with each other. <em>We have plans for a mod_rubinius for apache that takes full advantage of this feature.</em> Stay tuned <img src='http://blog.6thdensity.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' /> </p>
</blockquote>
<p>I certainly will!</p>
]]></content:encoded>
			<wfw:commentRss>http://jeremyweiland.com/archives/46/feed</wfw:commentRss>
		</item>
		<item>
		<title>Two tired girls</title>
		<link>http://jeremyweiland.com/archives/45</link>
		<comments>http://jeremyweiland.com/archives/45#comments</comments>
		<pubDate>Mon, 21 Jan 2008 04:24:22 +0000</pubDate>
		<dc:creator>jeremy</dc:creator>
		
		<category><![CDATA[Blogroll]]></category>

		<guid isPermaLink="false">http://blog.6thdensity.net/?p=879</guid>
		<description><![CDATA[Just had to post this because it was too perfect a shot not to.

The busyness won&#8217;t last; stay tuned for real blogging.
]]></description>
			<content:encoded><![CDATA[<p>Just had to post this because it was too perfect a shot not to.</p>
<p align="center"><img src='http://blog.6thdensity.net/wp-content/uploads/2008/01/t-girls.jpg' alt='t-girls.jpg' /></p>
<p>The busyness won&#8217;t last; stay tuned for real blogging.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeremyweiland.com/archives/45/feed</wfw:commentRss>
		</item>
		<item>
		<title>A single press for all my words</title>
		<link>http://jeremyweiland.com/archives/44</link>
		<comments>http://jeremyweiland.com/archives/44#comments</comments>
		<pubDate>Thu, 27 Dec 2007 23:00:05 +0000</pubDate>
		<dc:creator>jeremy</dc:creator>
		
		<category><![CDATA[Blogroll]]></category>

		<guid isPermaLink="false">http://blog.6thdensity.net/?p=868</guid>
		<description><![CDATA[So one of the big changes I made on my new slice is to centralize my WordPress blogs.  I run three WordPress sites, and having to upload a whole new codebase three times while being careful not to overwrite my customizations, plugins, themes, etc. was beginning to grate.  It would be better to [...]]]></description>
			<content:encoded><![CDATA[<p>So one of the big changes I made on <a href="http://jeremyweiland.com/2007/12/27/welcome-to-my-new-slice/">my new slice</a> is to centralize my <a href="http://wordpress.org">WordPress </a>blogs.  I run three WordPress sites, and having to upload a whole new codebase three times while being careful not to overwrite my customizations, plugins, themes, etc. was beginning to grate.  It would be better to have one unit of code that I could maintain and tweak.  But was that possible without going down <a href="http://mu.wordpress.org/">the MU route</a>?</p><p>The answer is that not only is it possible, but <a href="http://me.mywebsight.ws/2006/08/11/host-multiple-wp-sites-on-one-installation/">it’s also rather easy</a>.  I made a modification to my wp-config.php file that appends a host name prefix to every WP table in the database.  So I run everything in one database, and the wordpress PHP code just chooses the tables to run off of based on the requested host.  Pretty slick, because it also means I can keep all my themes, plugins, etc. in one place and just turn them on and off in the different tables.  And I’<a href="http://codex.wordpress.org/Installing/Updating_WordPress_with_Subversion">m using Subversion to run updates</a>, which means it doesn’t overwrite files I’ve modified, while still letting me do updates with one command.</p><p>So I guess now that I’ve found such a convenient solution to my problem, I’m wondering <s>if it’s vulnerable at all</s> how vulnerable it is.  I suppose I’m advertising any security holes, but I’m a pretty transparent internet user, and all the data’s backed up anyway - plus, I keep a pretty good eye on the server, and it’s locked up rather tight for anything that would be terribly damaging.  But all you WordPress gurus: <strong>what do I need to know about this approach?</strong> Is it insecure?  Are there performance issues with which I need to concern myself?  This is running everything from my personal blog to a moderate traffic aggregator.  I’d appreciate any insight or warnings or sharp tongue lashings you could provide.</p><p>And of course, this is only the first step.  I still want to do a full reengineering of my stylesheet and clean up loose ends in the design.  And I’m gonna implement some long-overdue social networking upgrades… you’ll see.  So stay tuned for more wordpress-y goodness.</p>]]></content:encoded>
			<wfw:commentRss>http://jeremyweiland.com/archives/44/feed</wfw:commentRss>
		</item>
		<item>
		<title>Ruby 1.9 released!</title>
		<link>http://jeremyweiland.com/archives/43</link>
		<comments>http://jeremyweiland.com/archives/43#comments</comments>
		<pubDate>Thu, 27 Dec 2007 21:26:44 +0000</pubDate>
		<dc:creator>jeremy</dc:creator>
		
		<category><![CDATA[Blogroll]]></category>

		<guid isPermaLink="false">http://blog.6thdensity.net/?p=865</guid>
		<description><![CDATA[Praise be to jeebus - a development release of Ruby 1.9.0 was announced on ruby-lang.org Christmas Day (nice timing for the western world).  I guess it&#8217;s too early to install on my new slice, and probably better to wait for the package anyway.  Nevertheless, at RubyConf this year we got a sneak peak [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://blog.6thdensity.net/wp-content/uploads/2007/12/ruby1.png" alt="ruby.png" style="margin: 1em; float: right" />Praise be to jeebus - a development release of Ruby 1.9.0 was announced on <a href="http://www.ruby-lang.org/en/news/2007/12/25/ruby-1-9-0-released/">ruby-lang.org</a> Christmas Day (nice timing for the western world).  I guess it’s too early to install on my new slice, and probably better to wait for the package anyway.  Nevertheless, <a href="http://jeremyweiland.com/2007/11/04/rubyconf-%e2%80%9807/">at RubyConf this year</a> we got a sneak peak at the priorities and decisions that have been guiding the implementation of 1.9, which above all should be <a href="http://antoniocangiano.com/2007/12/03/the-great-ruby-shootout/">much faster than 1.8</a> (and <a href="http://antoniocangiano.com/2007/11/28/holy-shmoly-ruby-19-smokes-python-away/">more competitive with other languages</a>).  More detailed changes <a href="http://eigenclass.org/hiki/mechanically-verified-ruby19-changelog">here</a>.</p><p>Also, in case you didn’t hear, <a href="http://weblog.rubyonrails.org/2007/12/7/rails-2-0-it-s-done">Rails 2.0 was released last month</a>.  ‘Tis hot.  And I finally figured out that scaffolding has NOT been gutted; I had lamented the fact that the scaffolded views no longer generated HTML input fields based on the database table fields.  But now it’s much more consistent: you name the fields at generation time and it creates the views and the migration for you.  Kids, it pays to read the docs.</p>]]></content:encoded>
			<wfw:commentRss>http://jeremyweiland.com/archives/43/feed</wfw:commentRss>
		</item>
		<item>
		<title>Welcome to my new slice</title>
		<link>http://jeremyweiland.com/archives/41</link>
		<comments>http://jeremyweiland.com/archives/41#comments</comments>
		<pubDate>Thu, 27 Dec 2007 17:23:56 +0000</pubDate>
		<dc:creator>jeremy</dc:creator>
		
		<category><![CDATA[Blogroll]]></category>

		<guid isPermaLink="false">http://blog.6thdensity.net/?p=864</guid>
		<description><![CDATA[Since I&#8217;ve been on SliceHost I&#8217;ve learned a lot about server management.  I&#8217;ve also made a lot of mistakes and generally made a mess out of that slice.  So I got a new one and am moving everything over.  This is the first post from the new slice.  If you have [...]]]></description>
			<content:encoded><![CDATA[<p>Since I&#8217;ve been on <a href="http://slicehost.com">SliceHost</a> I&#8217;ve learned a lot about server management.  I&#8217;ve also made a lot of mistakes and generally made a mess out of that slice.  So I got a new one and am moving everything over.  This is the first post from the new slice.  If you have performance issues, let me know - I probably could stand to tweak some of the Apache and PHP settings.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeremyweiland.com/archives/41/feed</wfw:commentRss>
		</item>
		<item>
		<title>2nd Annual McWeiland Chili Cookoff Photo Montage</title>
		<link>http://jeremyweiland.com/archives/39</link>
		<comments>http://jeremyweiland.com/archives/39#comments</comments>
		<pubDate>Mon, 05 Nov 2007 20:46:50 +0000</pubDate>
		<dc:creator>jeremy</dc:creator>
		
		<category><![CDATA[Blogroll]]></category>

		<guid isPermaLink="false">http://jeremyweiland.com/archives/39</guid>
		<description><![CDATA[And first YouTube upload ever.  Tasha did the video on her new MacBook - like that &#8220;Ken Burns&#8221; effect?  Enjoy!

    
]]></description>
			<content:encoded><![CDATA[And first YouTube upload ever.  Tasha did the video on her new MacBook - like that “Ken Burns” effect?  Enjoy!
<div style="text-align: center; overflow: hidden;"><object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/qzkVLUBlPNw&rel=1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/qzkVLUBlPNw&rel=1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object></div>]]></content:encoded>
			<wfw:commentRss>http://jeremyweiland.com/archives/39/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
