<?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>Tech Trivia &#187; ruby</title>
	<atom:link href="http://www.alethe.com/brad/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alethe.com/brad</link>
	<description>For those who know just enough to be dangerous</description>
	<lastBuildDate>Sun, 28 Feb 2010 04:45:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Date format</title>
		<link>http://www.alethe.com/brad/2008/04/date-format/</link>
		<comments>http://www.alethe.com/brad/2008/04/date-format/#comments</comments>
		<pubDate>Wed, 30 Apr 2008 01:57:34 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby and Rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.alethe.com/brad/?p=39</guid>
		<description><![CDATA[Format a date in ruby using the string from time method (strftime). Format options: %a - The abbreviated weekday name (``Sun'') %A - The full weekday name (``Sunday'') %b - The abbreviated month name (``Jan'') %B - The full month name (``January'') %c - The preferred local date and time representation %d - Day of [...]]]></description>
			<content:encoded><![CDATA[<p>Format a date in ruby using the string from time method (strftime).</p>
<pre>
Format options:
  %a - The abbreviated weekday name (``Sun'')
  %A - The  full  weekday  name (``Sunday'')
  %b - The abbreviated month name (``Jan'')
  %B - The  full  month  name (``January'')
  %c - The preferred local date and time representation
  %d - Day of the month (01..31)
  %H - Hour of the day, 24-hour clock (00..23)
  %I - Hour of the day, 12-hour clock (01..12)
  %j - Day of the year (001..366)
  %m - Month of the year (01..12)
  %M - Minute of the hour (00..59)
  %p - Meridian indicator (``AM''  or  ``PM'')
  %S - Second of the minute (00..60)
  %U - Week  number  of the current year,
          starting with the first Sunday as the first
          day of the first week (00..53)
  %W - Week  number  of the current year,
          starting with the first Monday as the first
          day of the first week (00..53)
  %w - Day of the week (Sunday is 0, 0..6)
  %x - Preferred representation for the date alone, no time
  %X - Preferred representation for the time alone, no date
  %y - Year without a century (00..99)
  %Y - Year with century
  %Z - Time zone name
  %% - Literal ``%'' character
</pre>
<pre class="brush: ruby">
   t = Time.now
   t.strftime(&quot;Today is %m/%d/%Y&quot;)   #=&gt; &quot;Today is 04/29/2008&quot;
   t.strftime(&quot;at %I:%M %p&quot;)            #=&gt; &quot;at 10:04 PM&quot;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.alethe.com/brad/2008/04/date-format/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails for RHEL 5</title>
		<link>http://www.alethe.com/brad/2008/04/ruby-on-rails-for-rhel-5/</link>
		<comments>http://www.alethe.com/brad/2008/04/ruby-on-rails-for-rhel-5/#comments</comments>
		<pubDate>Mon, 28 Apr 2008 02:06:49 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ruby and Rails]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[RHEL]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.alethe.com/brad/?p=37</guid>
		<description><![CDATA[Here is the quick and dirty Ruby on Rails setup for Redhat Enterprise Linux v5.0 with MySQL. (2009-12-04 Update: This does not work with RHEL 5.4. The mysql ruby gem requires ruby 1.8.6 and RHEL 5.4 only ships with ruby 1.8.5) Using yum install ruby and mysql. The command below does not list all the [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the quick and dirty Ruby on Rails setup for Redhat Enterprise Linux v5.0 with MySQL.</p>
<p><em>(2009-12-04 Update: This does not work with RHEL 5.4.  The mysql ruby gem requires ruby 1.8.6 and RHEL 5.4 only ships with ruby 1.8.5)</em></p>
<p>Using <code>yum</code> install ruby and mysql.  The command below does not list all the required packages, but due to dependencies, the additional packages will be installed (or should be &#8211; this is all from memory).<br />
<span id="more-37"></span><br />
<code>[bm@app3 ~]$ sudo su -<br />
[root@app3 ~]# yum install ruby ruby-devel ruby-libs ruby-irb \<br />
> ruby-rdoc subversion-ruby mysql-server mysql-devel<br />
[....]</code></p>
<p>Complete the basic configuration of MySQL.<br />
<code>[root@app3 ~]# /sbin/chkconfig mysqld on<br />
[root@app3 ~]# service mysqld start<br />
[root@app3 ~]# mysql_secure_installation<br />
</code></p>
<p><a href="http://rubyforge.org/projects/rubygems/">Download</a> and install RubyGems.  As of the date this post was written, the latest version is 1.1.1.<br />
<code>[root@app3 ~]# wget http://rubyforge.org/frs/download.php/35284/rubygems-1.1.1.zip<br />
[root@app3 ~]# unzip rubygems-1.1.1.zip<br />
[root@app3 ~]# cd rubygems-1.1.1<br />
[root@app3 rubygems-1.1.1]# ruby setup.rb<br />
[root@app3 ~]# cd ..<br />
[root@app3 ~]# rm -rf rubygems-1.1.1<br />
</code></p>
<p>Now install Rails, Mongrel, the Ruby MySQL interface, Capistrano<br />
<code>[root@app3 ~]# gem install rails --include-dependencies --no-rdoc --no-ri<br />
[root@app3 ~]# gem install mongrel --include-dependencies --no-rdoc --no-ri<br />
[root@app3 ~]# gem install mysql -- --with-mysql-config=/usr/bin/mysql_config<br />
[root@app3 ~]# gem install capistrano --include-dependencies --no-rdoc --no-ri<br />
</code></p>
<p>Phusion&#8217;s <a href="http://modrails.com/">passenger</a> gem provides a &#8220;mod_rails&#8221; module for Apache.  The installation is very straight forward.<br />
<code>[root@app3 ~]# gem install passenger<br />
[root@app3 ~]# passenger-install-apache2-module<br />
</code></p>
<p>Just follow the on-screen instructions to finish the installation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alethe.com/brad/2008/04/ruby-on-rails-for-rhel-5/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Reduce database connections using :include</title>
		<link>http://www.alethe.com/brad/2008/04/reduce-database-connections-using-include/</link>
		<comments>http://www.alethe.com/brad/2008/04/reduce-database-connections-using-include/#comments</comments>
		<pubDate>Mon, 28 Apr 2008 01:41:19 +0000</pubDate>
		<dc:creator>Brad</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby and Rails]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.alethe.com/brad/?p=36</guid>
		<description><![CDATA[When displaying a list that requires information from several tables in the database, you can sometimes end up with three or more database queries per list row. Depending on the situation, this may not be a problem. However, it is possible to join the tables in one large SQL query using the :include option. # [...]]]></description>
			<content:encoded><![CDATA[<p>When displaying a list that requires information from several tables in the database, you can sometimes end up with three or more database queries per list row.  Depending on the situation, this may not be a problem.  However, it is possible to join the tables in one large SQL query using the <code>:include</code> option.</p>
<pre class="brush: ruby">
# :include example
#
@requests = Request.find(:all, :include =&gt; [:department, :status])
</pre>
<p>Using the <code>:include</code> option may improve performance.  However, it will likely use more server memory and could potentially return a lot of data through the joins that may not even be used.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alethe.com/brad/2008/04/reduce-database-connections-using-include/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
