<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Idle Hacking &#187; Ruby on Rails</title>
	<atom:link href="http://www.idle-hacking.com/tag/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.idle-hacking.com</link>
	<description>Ruby, XUL/Javascript, C/C++, and more...</description>
	<lastBuildDate>Tue, 11 May 2010 02:15:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>SyslogLogger setup and rsyslogd</title>
		<link>http://www.idle-hacking.com/2008/06/sysloglogger-setup-and-rsyslogd/</link>
		<comments>http://www.idle-hacking.com/2008/06/sysloglogger-setup-and-rsyslogd/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 18:33:00 +0000</pubDate>
		<dc:creator>taf2</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[syslog]]></category>

		<guid isPermaLink="false">http://www.idle-hacking.com/2008/06/sysloglogger-setup-and-rsyslogd/</guid>
		<description><![CDATA[Setting up SyslogLogger is a really good idea. sudo gem install SyslogLogger # edit /etc/rsyslog.conf !logtarget *.* /var/log/logtarget/production.log # edit config/environments/production.rb config.logger = RAILS_DEFAULT_LOGGER = SyslogLogger.new('logtarget') References: syslog overview Logging rails to syslog with sysloglogger SyslogLogger]]></description>
			<content:encoded><![CDATA[<p>Setting up SyslogLogger is a really good idea.</p>
<pre lang="bash">sudo gem install SyslogLogger</pre>
<p># edit /etc/rsyslog.conf</p>
<pre lang="bash">
!logtarget
*.* <tab><tab> /var/log/logtarget/production.log</pre>
<p># edit config/environments/production.rb</p>
<pre lang="ruby">config.logger = RAILS_DEFAULT_LOGGER = SyslogLogger.new('logtarget')</pre>
<p><span id="more-129"></span><br />
References:</p>
<ul>
<li><a href="http://www.precision-guesswork.com/sage-guide/syslog-overview.html">syslog overview</a></li>
<li><a href="http://toolmantim.com/article/2007/6/6/logging_rails_to_syslog_with_sysloglogger">Logging rails to syslog with sysloglogger</a></li>
<li><a href="http://seattlerb.rubyforge.org/SyslogLogger/">SyslogLogger</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.idle-hacking.com/2008/06/sysloglogger-setup-and-rsyslogd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>to_xml, almost deep enough</title>
		<link>http://www.idle-hacking.com/2007/11/to_xml-almost-deep-enough/</link>
		<comments>http://www.idle-hacking.com/2007/11/to_xml-almost-deep-enough/#comments</comments>
		<pubDate>Wed, 14 Nov 2007 14:23:00 +0000</pubDate>
		<dc:creator>taf2</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.idle-hacking.com/2007/11/to_xml-almost-deep-enough/</guid>
		<description><![CDATA[Workout has_many :laps Lap has_many :points belongs_to :workout Point belongs_to :lap I&#8217;d like to serialize it all. The first approach render ml => workout.to_xml(:include => :laps) Cool, we get workout data with laps, but no points. Reading through the to_xml implementation it makes sense that you can only get to first level associations. For my [...]]]></description>
			<content:encoded><![CDATA[<pre>
Workout
   has_many :laps

Lap
   has_many :points
   belongs_to :workout

Point
   belongs_to :lap
</pre>
<p>I&#8217;d like to serialize it all.  The first approach</p>
<pre lang="ruby">render <img src='http://www.idle-hacking.com/wp-includes/images/smilies/icon_mad.gif' alt=':x' class='wp-smiley' /> ml => workout.to_xml(:include => :laps)</pre>
<p>Cool, we get workout data with laps, but no points.</p>
<p>Reading through the to_xml implementation it makes sense that you can only get to first level associations.  For my purposes, I just wanted to avoid repeating my data model in my rxml files.</p>
<p>Here&#8217;s what I came up with.</p>
<pre lang="ruby">
module Builder
  class XmlMarkup
    def add_record!(record,options = {})
      options = {:builder => self,:skip_instruct => true}.merge!(options)
      ActiveRecord::XmlSerializer.new(record, options).serialize
    end

    def add_record_attributes!(record)
      record.attribute_names.each do|name|
        attr = ActiveRecord::XmlSerializer::Attribute.new(name,record)
        tag!( attr.name, attr.value.to_s, attr.decorations )
      end
    end
  end
end
</pre>
<p>Now, in my rxml view I can write this.</p>
<pre lang="ruby">
xml.instruct!( <img src='http://www.idle-hacking.com/wp-includes/images/smilies/icon_mad.gif' alt=':x' class='wp-smiley' /> ml, :version=>"1.0", :encoding=>"UTF-8" )
xml.workout do
  xml.add_record_attributes!(@workout)
  xml.laps do
    @workout.laps.each do|lap|
      xml.add_record!(lap, :include => :points)
    end
  end
end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.idle-hacking.com/2007/11/to_xml-almost-deep-enough/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improving test performance by rendering less</title>
		<link>http://www.idle-hacking.com/2007/09/improving-test-performance-by-rendering-less/</link>
		<comments>http://www.idle-hacking.com/2007/09/improving-test-performance-by-rendering-less/#comments</comments>
		<pubDate>Mon, 17 Sep 2007 01:08:00 +0000</pubDate>
		<dc:creator>taf2</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.idle-hacking.com/2007/09/improving-test-performance-by-rendering-less/</guid>
		<description><![CDATA[I have for sometime had a feeling that functional and integration tests could be speed up even more by disabling the rendering of the layout within each test. Here&#8217;s some sample code I used to remove layouts from all my integration and functional tests. class ApplicationController # remove layout to improve test time def render_with_layout_disabled(*args) [...]]]></description>
			<content:encoded><![CDATA[<p>I have for sometime had a feeling that functional and integration tests could be speed up even more by disabling the rendering of the layout within each test.</p>
<p>Here&#8217;s some sample code I used to remove layouts from all my integration and functional tests.</p>
<pre lang="ruby">
class ApplicationController

  # remove layout to improve test time
  def render_with_layout_disabled(*args)
    args << {:layout => false} # force layout to always be false
    render_without_layout_disabled(*args)
  end

  alias_method_chain :render, :layout_disabled
end
</pre>
<p>Tonight I&#8217;ve found that I get about 188% increase in integration test time and about 248% increase in functional test time by removing the layout.</p>
<p>Disabling the layout was pretty easy using <a href="http://errtheblog.com/post/1109">alias_method_chain</a>.   My next question is does doing this break anything or make the test less meaningful?   My thinking is no.  Tests should be small in what they test.  We can have a test to specifically test the layout of our application.  Repeatedly testing the layout is redundant.  So, making this change to my application for my tests seems like a good move.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.idle-hacking.com/2007/09/improving-test-performance-by-rendering-less/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ESI Helpers for Rails</title>
		<link>http://www.idle-hacking.com/2007/08/esi-helpers-for-rails/</link>
		<comments>http://www.idle-hacking.com/2007/08/esi-helpers-for-rails/#comments</comments>
		<pubDate>Tue, 07 Aug 2007 02:24:00 +0000</pubDate>
		<dc:creator>taf2</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[ESI]]></category>
		<category><![CDATA[mongrel]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.idle-hacking.com/2007/08/esi-helpers-for-rails/</guid>
		<description><![CDATA[Aaron put together an awesome post at revolution on rails blog about a nice ESI plugin he wrote for rails. Hoping to spend a little time this week to finish up some work on getting mongrel-esi backed by memcached.]]></description>
			<content:encoded><![CDATA[<p>Aaron put together an awesome <a href="http://revolutiononrails.blogspot.com/2007/08/fragmentfu-fun-with-fragments.html">post at revolution on rails blog</a> about a nice ESI plugin he wrote for rails.  Hoping to spend a little time this week to finish up some work on getting <a href="http://code.google.com/p/mongrel-esi">mongrel-esi</a> backed by <a href="http://www.danga.com/memcached/">memcached</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.idle-hacking.com/2007/08/esi-helpers-for-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails Init Script</title>
		<link>http://www.idle-hacking.com/2006/05/ruby-on-rails-init-script/</link>
		<comments>http://www.idle-hacking.com/2006/05/ruby-on-rails-init-script/#comments</comments>
		<pubDate>Thu, 11 May 2006 16:51:00 +0000</pubDate>
		<dc:creator>taf2</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[init.d]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.idle-hacking.com/2006/05/ruby-on-rails-init-script/</guid>
		<description><![CDATA[I&#8217;m working on a large site built on rails, one thing that has annoyed me is how to manage the config/database.yml file. This little ruby init script allows developers to easily create a new config/database.yml file specific to their local configuration. It also means we can easily recreate the config/database.yml on deployment, so it doesn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a large site built on rails, one thing that has annoyed me is how to manage the config/database.yml file.   <a href="http://xullicious.com/init.rb">This little ruby init script</a> allows developers to easily create a new config/database.yml file specific to their local configuration.  It also means we can easily recreate the config/database.yml on deployment, so it doesn&#8217;t need to be checked into version control.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.idle-hacking.com/2006/05/ruby-on-rails-init-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updated Metrostop.org</title>
		<link>http://www.idle-hacking.com/2006/03/updated-metrostoporg/</link>
		<comments>http://www.idle-hacking.com/2006/03/updated-metrostoporg/#comments</comments>
		<pubDate>Sat, 18 Mar 2006 18:08:00 +0000</pubDate>
		<dc:creator>taf2</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[Google Maps]]></category>
		<category><![CDATA[MetroStop]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.idle-hacking.com/2006/03/updated-metrostoporg/</guid>
		<description><![CDATA[It took much longer then I had expected, between work actually picking up, running into a few unexpected hickups with IE and learning Rails, I finally have a much improved metrostop.org. This was almost a complete rewrite from my previous PHP. The list of improvements include: * Scalable Map &#8211; resizes with the browser width/height [...]]]></description>
			<content:encoded><![CDATA[<p>It took much longer then I had expected, between work actually picking up, running into a few unexpected hickups with IE and learning Rails, I finally have a much improved metrostop.org.<br />
This was almost a complete rewrite from my previous PHP.</p>
<p>The list of improvements include:</p>
<p>* Scalable Map &#8211; resizes with the browser width/height<br />
* Back Button Support &#8211; after searching clicking the back button will return to the previous state<br />
* Caching &#8211; I use a lot more caching now so performance should be much better</p>
<p><span style="font-weight: bold;">Updates:</span> (things I forgot to mention)<br />
* Entrance Level data<br />
* Search Certainty raiting stars<br />
* Nearly Validating markup all but the MS specific namespace validate</p>
]]></content:encoded>
			<wfw:commentRss>http://www.idle-hacking.com/2006/03/updated-metrostoporg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Languages, Frameworks, and a problem to solve</title>
		<link>http://www.idle-hacking.com/2006/01/languages-frameworks-and-a-problem-to-solve/</link>
		<comments>http://www.idle-hacking.com/2006/01/languages-frameworks-and-a-problem-to-solve/#comments</comments>
		<pubDate>Mon, 30 Jan 2006 16:56:00 +0000</pubDate>
		<dc:creator>taf2</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Zop]]></category>

		<guid isPermaLink="false">http://www.idle-hacking.com/2006/01/languages-frameworks-and-a-problem-to-solve/</guid>
		<description><![CDATA[Some note worthy quotes: source And of course, who can ignore Rails? The backlash from heavyweight web frameworks has been significant. We now know that EJB 1 &#38; 2 were based on an entirely flawed set of use cases. Because of the damage this (still slowly dawning) realization has wrought to Sun&#8217;s reputation, it&#8217;s hard [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Some note worthy quotes:</strong><br />
<a href="http://www.artima.com/weblogs/viewpost.jsp?thread=141312">source</a></p>
<blockquote><p>
And of course, who can ignore Rails? The backlash from heavyweight web frameworks has been significant. We now know that EJB 1 &amp; 2 were based on an entirely flawed set of use cases. Because of the damage this (still slowly dawning) realization has wrought to Sun&#8217;s reputation, it&#8217;s hard to know whether EJB3, which probably should have been called something else to disassociate it with the failures of its predecessors, will succeed, despite the fact that EJB3 is like a breath of fresh air. You look at the code and it makes sense; no bizzarre and obscure interfaces and concepts to puzzle over while thinking, &#8220;I wonder why I have to do this? Well, these guys are clearly smarter than I am.&#8221; (I tried to understand EJB1, but when I first heard that entity beans didn&#8217;t actually work, my brain refused to let me invest any more time, which turned out to be the right choice). As a result of all this, someone said &#8220;hey, all I want to do is create a database and use it from the web. Why should I do all that work?&#8221; As it turns out, such activities seem to be about 90% of all we ever do in &#8220;Enterprise&#8221; programming, and EJB 1/2 were solving an entirely different problem, and making the 90% incredibly difficult in the process. Thus, the Rails approach of &#8220;just connect the database to the web.&#8221;
</p></blockquote>
<p><strong>This one reflects my current experiences, in learning <a href="http://www.zope.org">zope</a>, using <a href="http://www.php.net">php</a>, and now <a href="http://www.rubyonrails.org">rails</a></strong></p>
<blockquote><p>My own experience in web frameworks was with Zope. In an interesting parallel with EJB3, Zope is now on version 3 which is a from-the-ground-up redesign, and everything I&#8217;ve seen of it indicates that, like EJB3, it represents a great deal of rethinking of the problem. I&#8217;ve been bumping up against the problem of &#8220;but all I want to do is connect a database to the web&#8221; in Zope2 for several years now. Oh, it&#8217;s definitely something you can do, but unfortunately it&#8217;s past the knee of the &#8220;Z-shaped learning curve,&#8221; and is only trivial if you live and breathe Zope every day. Don&#8217;t get me wrong; Zope is an excellent system and incredibly powerful, and Zope3 may be much easier, but I&#8217;m out of steam. I have realized that on my site, I really just want to do a collection of simple things, and I don&#8217;t want to relearn Zope every time I want to accomplish something. So &#8212; sorry, Jim (Fulton, not Kirk) &#8212; I&#8217;m going to find something drop-dead simple to solve my drop-dead simple problems. Probably PHP5, which actually includes most of Java and C++ syntax, amazingly enough, and I wonder if that isn&#8217;t what made IBM adopt it.
</p></blockquote>
<p><strong>Update:</strong><br />
I wanted to add, I don&#8217;t really see the point in arguing for or against python/ruby.  I think they are pretty comparable languages; So, it really comes down to preference and task.  Right now there is rails, so I&#8217;m using ruby.  What I like about ruby in this respect, is it has block structure just like Javascript, but really something like PHP is even better in this respect because it uses the same kind of block structure (e.g. {} vs begin end).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.idle-hacking.com/2006/01/languages-frameworks-and-a-problem-to-solve/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
