<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>weedygarden.net</title>
	
	<link>http://www.weedygarden.net</link>
	<description>The random ramblings of a web developer.</description>
	<pubDate>Sat, 14 Nov 2009 01:56:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/Weedygarden" type="application/rss+xml" /><feedburner:browserFriendly></feedburner:browserFriendly><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>RVM Ruby 1.9 and the MySQL Gem — Friends at last on x86_64</title>
		<link>http://www.weedygarden.net/2009/11/13/rvm-ruby-19-and-the-mysql-gem-friends-at-last-on-x86_64/</link>
		<comments>http://www.weedygarden.net/2009/11/13/rvm-ruby-19-and-the-mysql-gem-friends-at-last-on-x86_64/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 01:56:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://www.weedygarden.net/?p=81</guid>
		<description><![CDATA[One of our production Rails apps is running on Ruby 1.9. The problem this introduces is that our dev environments must be able to run multiple versions of Ruby side-by-side. There&#8217;s nothing unique about this, it comes with the Ruby/Rails territory. After upgrading to Snow Leopard, I decided to give Ruby Version Manager a try. [...]]]></description>
			<content:encoded><![CDATA[<p>One of our production Rails apps is running on Ruby 1.9. The problem this introduces is that our dev environments must be able to run multiple versions of Ruby side-by-side. There&#8217;s nothing unique about this, it comes with the Ruby/Rails territory. After upgrading to Snow Leopard, I decided to give <a href="http://rvm.beginrescueend.com/">Ruby Version Manager</a> a try. The install of RVM and the subsequent Ruby installs were a breeze. However, when it came time to install the MySQL gem, I ran into a brick wall. No matter what I tried, I kept getting install errors.</p>
<p>I&#8217;m running the standard MacOSX package install from <a href="http://dev.mysql.com/downloads/">mysql.com</a> (Mac OS X 10.5 x86_64). I tried setting my ARCHFLAGS to the correct architecture,  pointing to the correct config, and nothing helped. After Google turned up nothing, I decided to bother the nice folks in the #rvm channel. There I was given a handy little tip that goes as follows:</p>
<ol>
<li>Uninstall the version of Ruby you&#8217;re trying to install the MySQL gem on</li>
<li>place the following in your ~/.rvmrc file:
<pre>rvm_archflags="-arch x86_64"</pre>
</li>
<li>Reinstall Ruby using RVM</li>
<li>Install the ruby gem:
<pre>export ARCHFLAGS="-arch x86_64" ; gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config</pre>
<p> (use the correct path to your MySQL config file. If you installed mysql with MacPorts, it will be in /opt somewhere).</li>
</ol>
<p>The problem turned out to be that RVM was not installing the x86_64 version of Ruby 1.9. And if Ruby&#8217;s architecture doesn&#8217;t match MySQL&#8217;s, then you have problems. Once they match, then it&#8217;s back to Ruby bliss.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weedygarden.net/2009/11/13/rvm-ruby-19-and-the-mysql-gem-friends-at-last-on-x86_64/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A Note on ActiveRecord Serialization and Objects</title>
		<link>http://www.weedygarden.net/2009/04/19/a-note-on-activerecord-serialization-and-objects/</link>
		<comments>http://www.weedygarden.net/2009/04/19/a-note-on-activerecord-serialization-and-objects/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 11:56:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.weedygarden.net/?p=53</guid>
		<description><![CDATA[Let&#8217;s say you&#8217;re serializing a ruby object for later use in a field of another model.
class Foo &#60; ActiveRecord::Base
  serialize :bar
end
In this instance, assume an object of type &#8220;Bar&#8221; is what&#8217;s being serialized. After save, the data appears fine, but when you retrieve the data, instead of your Object you end up with yaml [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say you&#8217;re serializing a ruby object for later use in a field of another model.</p>
<pre><code>class Foo &lt; ActiveRecord::Base
  serialize :bar
end</code></pre>
<p>In this instance, assume an object of type &#8220;Bar&#8221; is what&#8217;s being serialized. After save, the data appears fine, but when you retrieve the data, instead of your Object you end up with yaml that looks like this:</p>
<pre>[#&lt;YAML::Object:0x3fcade8 @ivars={"attributes_cache"=&gt;{}, "attributes"=&gt;{"updated_at"=&gt;"2008-11-04 19:33:05", "id"=&gt;"1", "message"=&gt;"Hello World!", "created_at"=&gt;"2008-11-04 19:33:05"}}, @class="Bar"&gt;</pre>
<p>This most likely means that the model of the object being serialized is not loaded yet. This can be resolved by simply doing:</p>
<pre><code>class Foo &lt; ActiveRecord::Base
  Bar

  serialize :bar
end</code></pre>
<p>This will load the model before serialization occurs and you&#8217;ll be all set.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weedygarden.net/2009/04/19/a-note-on-activerecord-serialization-and-objects/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A Tale of Woe: starring Rails 2.2, Mac OS X and a MySQL Upgrade</title>
		<link>http://www.weedygarden.net/2009/01/13/a-tale-of-woe-starring-rails-22-mac-os-x-and-a-mysql-upgrade/</link>
		<comments>http://www.weedygarden.net/2009/01/13/a-tale-of-woe-starring-rails-22-mac-os-x-and-a-mysql-upgrade/#comments</comments>
		<pubDate>Wed, 14 Jan 2009 02:14:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.weedygarden.net/?p=39</guid>
		<description><![CDATA[If you&#8217;ve used Rails 2.1 at all, you will no doubt be aware due to the incessant notifications, that Rails 2.2 will be dropping its MySQL driver. Therefore, in order to use Rails 2.2, you will need to install an updated version of MySQL. I found one good resource that got me most of the [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve used Rails 2.1 at all, you will no doubt be aware due to the incessant notifications, that Rails 2.2 will be dropping its MySQL driver. Therefore, in order to use Rails 2.2, you will need to install an updated version of MySQL. I found <a href="http://craiccomputing.blogspot.com/2008/11/installing-rails-22-on-mac-os-x-mysql.html">one good resource</a> that got me most of the way there, however, after the upgrade, most of my tests, in all of my apps were failing.</p>
<p>While trying to figure out what was going on, a couple of things became apparent. If I moved tests around or deleted specific tests (mainly update and destroy tests), it caused previously failing tests to pass. Also, setting &#8220;self.use_transactional_fixtures&#8221; to false in &#8220;test_helper.rb&#8221; caused most tests to pass. As I was checking on that further in one of my apps (one that I didn&#8217;t delete all the comments from), I noticed this:</p>
<blockquote><p>&#8220;Every Active Record database supports transactions except MyISAM tables in MySQL.  Turn off transactional fixtures in this case; however, if you don&#8217;t care one way or the other, switching from MyISAM to InnoDB tables is recommended.&#8221;</p></blockquote>
<p>Cue the lightbulb.</p>
<p>Jumping into mysql and running &#8220;show engines;&#8221; confirmed the bulb. InnoDB was disabled. So now we ned to remedy this little problem.</p>
<p>If you already have a &#8216;my.cnf&#8217; file, you&#8217;re ahead of the class, so please hold on while the rest of us catch up.</p>
<p>The MySQL package installer drops mysql in:</p>
<pre>/usr/local/mysql</pre>
<p>If you look in the support-files directory, they have several my.cnf sample files. So now we need to get one of these into play.</p>
<p>Copy</p>
<pre>/usr/local/mysql/support-files/my-medium.cnf</pre>
<p>to</p>
<pre>/etc/my.cnf</pre>
<p>At this time I&#8217;d like to welcome back those of you who already had a my.cnf file.</p>
<p>Now open your my.cnf file and uncomment the lines that start with &#8220;innodb_&#8221; (starting at line 123 in my config file). Save the file and restart MySQL. If you go back into mysql and rerun &#8220;show engines;&#8221;, you should now see InnoDB support has been enabled.</p>
<p>Now when you run your tests, all should be well in the world again.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weedygarden.net/2009/01/13/a-tale-of-woe-starring-rails-22-mac-os-x-and-a-mysql-upgrade/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What I Learned Today About ActionView</title>
		<link>http://www.weedygarden.net/2009/01/06/what-i-learned-today-about-actionview/</link>
		<comments>http://www.weedygarden.net/2009/01/06/what-i-learned-today-about-actionview/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 03:14:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Rails]]></category>

		<category><![CDATA[Ruby]]></category>

		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.weedygarden.net/?p=35</guid>
		<description><![CDATA[I ran across a couple of ActionView tidbits that were new to me, so I thought I'd share.]]></description>
			<content:encoded><![CDATA[<p>I ran across a couple of ActionView tidbits that were new to me, so I thought I&#8217;d share.</p>
<p>You can comment out ERb delimiters in your view by adding a pound sign before the equal sign.</p>
<pre><code class="erb">
&lt;%#= str %&gt;
</code></pre>
<p>When rendering a collection, you have access to a zero-based &#8220;partial_<em>counter</em>&#8221; variable that increments on each iteration.</p>
<pre><code class="erb">
&lt;%= div_for(entry) do %&gt;
	&lt;%= entry_counter %&gt;
&lt;% end  %&gt;
</code></pre>
<p>Todays lesson brought you by chapter 10 of &#8220;The Rails Way&#8221; by Obie Fernandez.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weedygarden.net/2009/01/06/what-i-learned-today-about-actionview/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What’s your css style?</title>
		<link>http://www.weedygarden.net/2008/11/16/whats-your-css-style/</link>
		<comments>http://www.weedygarden.net/2008/11/16/whats-your-css-style/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 02:16:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.weedygarden.net/?p=24</guid>
		<description><![CDATA[Let&#8217;s talk for a moment about style. More specifically, CSS style. Every web developer I&#8217;ve met has had a personal way they write their style declarations. And typically if you have five developers in the room, you&#8217;ll have five distinct styles. It&#8217;s probably safe to say these styles are developed early on in a developers [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s talk for a moment about style. More specifically, CSS style. Every web developer I&#8217;ve met has had a personal way they write their style declarations. And typically if you have five developers in the room, you&#8217;ll have five distinct styles. It&#8217;s probably safe to say these styles are developed early on in a developers career and tend to change ever so slightly as time goes on to suit individual preference. I know that I had basically the same style for the first seven years of my CSS using web career (I&#8217;m talking post table/font= days).</p>
<p>About a year and a half ago, however, <a href="/2007/07/17/enter-the-monkey-wrench/">I switched jobs</a> and found myself dealing with the CSS of others that was quite different from my own. They went on about how nice their style was and how in time I would come around. After all, they all eventually adapted to the same style. I was fairly adamant at the time that, no, I was pretty set in my style ways and didn&#8217;t see myself switching any time soon. It only took a couple of months.</p>
<p>My style at the time was a declaration with each property on its own line.</p>
<pre><code class="css">
body {
  margin:0;
  padding:0;
}
</code></pre>
<p>The style of the new shop was to use single line styles as follows:</p>
<pre><code class="css">
body {margin:0; padding:0;}
</code></pre>
<p>Since the time I switched over, I&#8217;ve grown to love this format. My initial argument against it was I felt it was harder to read and find the individual declaration I was looking for. But if you follow a simple set of rules, it&#8217;s actually very easy to scan a large css file and find what you&#8217;re looking for.</p>
<p>Out of curiosity, I checked out the CSS of some bloggers I read to see what styles they use.</p>
<p>The closest I could find to my old style was <a href="http://boagworld.com">Paul Boag</a>. Here&#8217;s a sample:</p>
<pre><code class="css">
body {
  background:#d6e59b url(../images/background.jpg);
  padding:2em 0;
}

#content {
  width:600px;
  padding:0 20px 0 30px;
}
</code></pre>
<p>Very similar to that style is Dan Cederholm of <a href="http://simplebits.com">simplebits.com</a></p>
<pre><code class="css">
body {
  margin: 0;
  padding: 0;
  font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Helvetica, Arial, sans-serif;
  font-size: 62.5%;
  color: #474a51;
  background: #f4f4ed;
  }
a:link, a:visited {
  color: #317b9e;
  text-decoration: none;
  }
</code></pre>
<p>You can see two differences here. The closing brace is tabbed in with the declarations, and he puts a space between the declaration and the values, as Boag does not.</p>
<p>Now we&#8217;ll get into some developers using single line declarations. First off is <a href="http://meyerweb.com/">Eric Meyer</a>. You&#8217;ll notice he does &#8216;mostly&#8217; single line. The body declaration is broken over a couple of lines. If you scan through the css at meyerweb, you&#8217;ll see several instances of that treatment. Eric also does the space between the declaration and the value.</p>
<pre><code class="css">
* {font-size: 100%; padding: 0; margin: 0;}
body {font: 0.84em/1.333 Arial, sans-serif; margin: 0; padding: 0;
  color: #202020; background: #FFF;
  min-width: 40em; margin: 0 auto;}
h1 {font-size: 2em; margin: 2em 0 0.5em; padding: 0.25em 0;}
h2 {font-size: 1.5em; margin: 2em 0 0.33em; padding: 0.25em 0;}
</code></pre>
<p>Next up is <a href="http://www.alistapart.com/">A List Apart</a> and Dan Rubin from <a href="http://superflousbanter.org">superflousbanter.org</a>. Both use primarily single line styles. The differences you&#8217;ll notice are A List Apart puts spaces between pretty much everything.</p>
<pre><code class="css">
* {margin: 0; padding: 0;}
body {font: 0.8125em Verdana, sans-serif; line-height: 1; color: #333; background: #FFF;}
html body a:hover {color: #000; background-color: #F4F2E4;
  border-bottom: 1px solid #9A8E51;}
h2 {font: 1.5em Georgia, "Times New Roman", serif; letter-spacing: 1px;}
h3 {font: bold 1em Verdana, Arial, sans-serif; letter-spacing: 2px;
  text-transform: uppercase;}
</code></pre>
<p>Dan Rubin on the other hand uses no spaces except for the right before and after the braces.</p>
<pre><code class="css">
body { background-color:#210D00;font-family:helvetica,arial,sans-serif;font-size:small;text-align:center;min-width:1000px;margin:0; }
#content { float:left;background:url(../i/bg_content_top.gif) no-repeat;width:618px;margin:58px 0 0 37px;padding:16px 0 0; }
#content2 { background:url(../i/bg_content_bottom.gif) no-repeat bottom;padding:0 0 16px; }
#content3 { background:#fff url(../i/bg_content_middle.gif) repeat-y;padding:3px 60px 1px; }
</code></pre>
<p>Finally, we come to <a href="http://orderedlist.com/">Ordered List</a>. This style is almost exactly like the what I use. This is because the two members of OL are both former lead developers of my department.</p>
<pre><code class="css">
.wrapper            {float:left; display:inline; width:940px;}
.primary            {float:left; display:inline; width:630px; border-left:320px solid transparent; margin:0 0 0 10px;}
div#post_info h4    {color:#C0BA8D; font-size:116%; margin:0 0 15px;}
</code></pre>
<p>I realize that some people style a certain way due to the editor used when cutting the site. For instance, I use <a href="http://www.panic.com/coda/">Coda</a> to code HTML/CSS. When it auto-completes a style, it will put a space between the colon and the value. I find this very annoying. Especially since editors such as <a href="http://macrabbit.com/cssedit/">CSSEdit</a> (also in my Dock) has had a preference for default spacing for years. Hopefully their upcoming all-in-one editor, <a href="http://macrabbit.com/espresso/">Espresso</a>, will have that as well (the current beta does not).</p>
<p>One final note. This site was styled prior to my metamorphasis with a lot of WordPress styles rolling over, so yes, it&#8217;s in the old style, and probably will be for quite some time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weedygarden.net/2008/11/16/whats-your-css-style/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
