<?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>Beyond Coding &#187; Ruby</title>
	<atom:link href="http://www.beyondcoding.com/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.beyondcoding.com</link>
	<description>Follow us on Twitter: @fredwu and @scotti3g</description>
	<lastBuildDate>Tue, 28 Jun 2011 11:33:57 +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>Using Ruby MySQL Gem with MAMP 1.8.x on Snow Leopard</title>
		<link>http://www.beyondcoding.com/2009/11/10/using-ruby-mysql-gem-with-mamp-1-8-x-on-snow-leopard/</link>
		<comments>http://www.beyondcoding.com/2009/11/10/using-ruby-mysql-gem-with-mamp-1-8-x-on-snow-leopard/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 04:28:58 +0000</pubDate>
		<dc:creator>Fred Wu</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Gem]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.beyondcoding.com/?p=356</guid>
		<description><![CDATA[Being primarily a PHP developer, I always use an AMP package no matter what development platform I am on. So when it comes to developing Ruby/Rails applications on the same platform, I&#8217;d like to use what is already available. Mike Boone has posted a very useful tutorial on how to get MySQL gem and MAMP [...]]]></description>
			<content:encoded><![CDATA[<p>Being primarily a PHP developer, I always use an<a href="http://en.wikipedia.org/wiki/List_of_AMP_packages"> AMP package</a> no matter what development platform I am on. So when it comes to developing Ruby/Rails applications on the same platform, I&#8217;d like to use what is already available.</p>
<p>Mike Boone has posted a very useful tutorial on how to get MySQL gem and MAMP 1.7.2 up and running. So, to recap and make the tutorial compatible with Snow Leopard and MAMP 1.8.x, here is what you need to do:</p>
<ol>
<li>
		<a href="http://www.mamp.info/en/downloads/index.html">Download</a> the latest MAMP dmg file.
	</li>
<li>
		<a href="http://sourceforge.net/projects/mamp/files/mamp/">Download the 1.8.2 (or whichever the latest one you could find) components file from this page.</a>
	</li>
<li>
		Unzip, mount the dmg, then copy the MySQL source file (mysql-5.1.37.tar.gz) to somewhere on your hard drive.
	</li>
<li>
		Untar the MySQL source file, and `cd` to the source file directory.
	</li>
<li>
		Compile the library:</p>
<p>		<code><br />
		$ ./configure --with-unix-socket-path=/Applications/MAMP/tmp/mysql/mysql.sock --without-server --prefix=/Applications/MAMP/Library</p>
<p>		$ make -j2<br />
		</code>
	</li>
<li>
		Copy the compiled libraries into MAMP:</p>
<p>		<code>$ cp libmysql/.libs/*.dylib /Applications/MAMP/Library/lib/mysql</code>
	</li>
<li>
		Copy the MYSQL headers into MAMP:</p>
<p>		<code><br />
		$ mkdir /Applications/MAMP/Library/include</p>
<p>		$ cp -R include /Applications/MAMP/Library/include/mysql<br />
		</code>
	</li>
<li>
		Install the Ruby MySQL Gem, on Snow Leopard:</p>
<p>		<code><br />
		$ sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config<br />
		</code></p>
<p>		On Leopard:</p>
<p>		<code><br />
		$ sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config<br />
		</code>
	</li>
</ol>
<p>Enjoy!</p>
<p><strong>EDIT @ 2009-11-23:</strong> If you&#8217;re still experiencing problems (perhaps with <a href="http://rvm.beginrescueend.com/">RVM</a>), try adding &#8220;/Applications/MAMP/Library/bin/&#8221; to your $PATH in &#8220;~/.bash_profile&#8221;.</p>

	Tags: <a href="http://www.beyondcoding.com/tag/gem/" title="Gem" rel="tag">Gem</a>, <a href="http://www.beyondcoding.com/tag/mysql/" title="MySQL" rel="tag">MySQL</a>, <a href="http://www.beyondcoding.com/tag/rails/" title="Rails" rel="tag">Rails</a>, <a href="http://www.beyondcoding.com/tag/ruby/" title="Ruby" rel="tag">Ruby</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.beyondcoding.com/2010/06/18/what-you-might-have-missed-again/" title="What You Might Have Missed, Again :-) (June 18, 2010)">What You Might Have Missed, Again :-)</a> (0)</li>
	<li><a href="http://www.beyondcoding.com/2010/03/15/what-you-might-have-missed/" title="What You Might Have Missed (March 15, 2010)">What You Might Have Missed</a> (0)</li>
	<li><a href="http://www.beyondcoding.com/2008/05/26/ruby-on-rails-passenger-modrails-vs-codeigniter-and-kohana/" title="Ruby on Rails, Passenger (ModRails) vs CodeIgniter and Kohana (May 26, 2008)">Ruby on Rails, Passenger (ModRails) vs CodeIgniter and Kohana</a> (16)</li>
	<li><a href="http://www.beyondcoding.com/2010/08/09/rails-jquery-dating-etc/" title="Rails, jQuery, Dating, etc (August 9, 2010)">Rails, jQuery, Dating, etc</a> (0)</li>
	<li><a href="http://www.beyondcoding.com/2008/12/18/comparison-ruby-vs-php-the-pros/" title="Comparison: Ruby vs PHP, the Pros (December 18, 2008)">Comparison: Ruby vs PHP, the Pros</a> (5)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.beyondcoding.com/2009/11/10/using-ruby-mysql-gem-with-mamp-1-8-x-on-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Comparison: Ruby vs PHP, the Pros</title>
		<link>http://www.beyondcoding.com/2008/12/18/comparison-ruby-vs-php-the-pros/</link>
		<comments>http://www.beyondcoding.com/2008/12/18/comparison-ruby-vs-php-the-pros/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 11:05:28 +0000</pubDate>
		<dc:creator>Fred Wu</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.beyondcoding.com/?p=153</guid>
		<description><![CDATA[Just to be clear, this is NOT a fanboyism post nor do I encourage the debate between which language is superior. My personal belief is to use the appropriate tool for appropriate projects. PHP Pros Widely available libraries (including PEAR and PECL) An absolutely outstanding online manual Relatively easy to learn (can hack together some [...]]]></description>
			<content:encoded><![CDATA[<p>Just to be clear, this is NOT a fanboyism post nor do I encourage the debate between which language is superior. My personal belief is to use the appropriate tool for appropriate projects.</p>
<p><strong>PHP Pros</strong></p>
<ul>
<li>Widely available libraries (including <a href="http://pear.php.net/">PEAR</a> and <a href="http://pecl.php.net/">PECL</a>)</li>
<li>An absolutely outstanding online manual</li>
<li>Relatively easy to learn (can hack together some code without deep understanding of the language)</li>
<li>Widely used (easy to find clients, etc)</li>
<li>Most if not all control panels have PHP integration</li>
<li>Development packages (XAMPP, WAMP, MAMP, LAMP, etc)</li>
<li>C style syntax (easier transition for people with C/C++/Java background)</li>
<li>Powerful array feature (Ruby&#8217;s equivalent to PHP&#8217;s associative array is Hash, which is not interchangeable with array)</li>
<li>PhpDoc is better than RDoc (this might be because I am too used to PhpDoc)</li>
</ul>
<p><strong>Ruby Pros</strong></p>
<ul>
<li>Fully object oriented</li>
<li><a href="http://rake.rubyforge.org/">Rake</a> (Ruby&#8217;s Make)</li>
<li><a href="http://www.rubygems.org/">RubyGem</a> (Ruby&#8217;s apt/yum)</li>
<li>Code blocks</li>
<li>&#8216;Ghost&#8217; classes</li>
<li>Modules (aka namespace/package, PHP 5.3 will have namespace too, but with much uglier syntax)</li>
<li>lambda functions (PHP 5.3 will have this too, but not as powerful)</li>
<li>Children-aware parent classes (&#8216;inherited&#8217; hook)</li>
<li>Multi-inheritance through Mixins (PHP is single-inheritance)</li>
<li>Ruby 1.9 is unicode friendly (PHP 6 will be)</li>
<li>For what I do, Ruby on Rails > all PHP frameworks combined</li>
<li>Regular Expression built into the language core</li>
</ul>
<p>I am pretty sure there&#8217;s heaps of pros for both PHP and Ruby missing from the list, but at least it gives you a rough idea on what to look for if you are not very familiar with them.</p>
<p>Please share your experience with us too (and I will update this post accordingly). :)</p>

	Tags: <a href="http://www.beyondcoding.com/tag/php/" title="PHP" rel="tag">PHP</a>, <a href="http://www.beyondcoding.com/tag/rails/" title="Rails" rel="tag">Rails</a>, <a href="http://www.beyondcoding.com/tag/ruby/" title="Ruby" rel="tag">Ruby</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.beyondcoding.com/2008/05/26/ruby-on-rails-passenger-modrails-vs-codeigniter-and-kohana/" title="Ruby on Rails, Passenger (ModRails) vs CodeIgniter and Kohana (May 26, 2008)">Ruby on Rails, Passenger (ModRails) vs CodeIgniter and Kohana</a> (16)</li>
	<li><a href="http://www.beyondcoding.com/2010/06/18/what-you-might-have-missed-again/" title="What You Might Have Missed, Again :-) (June 18, 2010)">What You Might Have Missed, Again :-)</a> (0)</li>
	<li><a href="http://www.beyondcoding.com/2010/03/15/what-you-might-have-missed/" title="What You Might Have Missed (March 15, 2010)">What You Might Have Missed</a> (0)</li>
	<li><a href="http://www.beyondcoding.com/2009/11/10/using-ruby-mysql-gem-with-mamp-1-8-x-on-snow-leopard/" title="Using Ruby MySQL Gem with MAMP 1.8.x on Snow Leopard (November 10, 2009)">Using Ruby MySQL Gem with MAMP 1.8.x on Snow Leopard</a> (29)</li>
	<li><a href="http://www.beyondcoding.com/2010/08/09/rails-jquery-dating-etc/" title="Rails, jQuery, Dating, etc (August 9, 2010)">Rails, jQuery, Dating, etc</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.beyondcoding.com/2008/12/18/comparison-ruby-vs-php-the-pros/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Variable methods and accessors in Ruby</title>
		<link>http://www.beyondcoding.com/2008/05/26/variable-methods-and-accessors-in-ruby/</link>
		<comments>http://www.beyondcoding.com/2008/05/26/variable-methods-and-accessors-in-ruby/#comments</comments>
		<pubDate>Sun, 25 May 2008 20:50:19 +0000</pubDate>
		<dc:creator>Fred Wu</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[eval]]></category>
		<category><![CDATA[variable accessor]]></category>
		<category><![CDATA[variable method]]></category>

		<guid isPermaLink="false">http://thislab.com/?p=40</guid>
		<description><![CDATA[Yeah I am a lame PHP guy who hasn&#8217;t gotten too deeply into Ruby yet. ;) In PHP I often use variable methods, for example: $foo = new Foo(); $funcname = 'dynamic_method'; $foo-&#62;$funcname(); // Same as calling $foo-&#62;dynamic_method(); $varname = 'dynamic_accessor'; $foo-&#62;$varname = 'some value'; // Same as calling $foo-&#62;dynamic_accessor = 'some value'; Now, because [...]]]></description>
			<content:encoded><![CDATA[<p>Yeah I am a lame PHP guy who hasn&#8217;t gotten too deeply into Ruby yet. ;)</p>
<p>In PHP I often use <a href="http://php.net/manual/en/functions.variable-functions.php">variable methods</a>, for example:</p>
<pre class="brush: php;">
$foo = new Foo();

$funcname = 'dynamic_method';
$foo-&gt;$funcname();
// Same as calling $foo-&gt;dynamic_method();

$varname = 'dynamic_accessor';
$foo-&gt;$varname = 'some value';
// Same as calling $foo-&gt;dynamic_accessor = 'some value';
</pre>
<p>Now, because Ruby does not prefix $ in front of variables, it is impossible to use variable methods the way we do in PHP.</p>
<p>I am sure for Ruby gurus it&#8217;s pretty obvious but for me, I just spent more than 30 minutes searching for an alternative other than <del>evil</del> <a href="http://www.ruby-doc.org/core/classes/Kernel.html#M005948">eval</a>, and I finally found one.</p>
<p>We use the PHP <a href="http://php.net/manual/en/function.call-user-func.php">call_user_func</a> and <a href="http://php.net/manual/en/function.call-user-func-array.php">call_user_func_array</a> equivalent in Ruby: <a href="http://www.ruby-doc.org/core/classes/Object.html#M000335">send or __send__</a>.</p>
<p>Luckily accessors in Ruby are methods, so we are able to use the <em>send</em> method for both methods and accessors.</p>
<p>For example we can set a variable accessor like this:</p>
<pre class="brush: ruby;">
foo = Foo.new

funcname = 'dynamic_method'
foo.send &quot;#{funcname}&quot;
# same as calling foo.dynamic_method

varname = 'dynamic_accessor'
foo.send &quot;#{varname}=&quot;, 'some value'
# same as calling foo.dynamic_accessor = 'some value'
</pre>
<p>I wish in future versions of Ruby, we can somehow assign accessor values the way we do in PHP. :)</p>

	Tags: <a href="http://www.beyondcoding.com/tag/eval/" title="eval" rel="tag">eval</a>, <a href="http://www.beyondcoding.com/tag/variable-accessor/" title="variable accessor" rel="tag">variable accessor</a>, <a href="http://www.beyondcoding.com/tag/variable-method/" title="variable method" rel="tag">variable method</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li>No related posts.</li>
	</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.beyondcoding.com/2008/05/26/variable-methods-and-accessors-in-ruby/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails, Passenger (ModRails) vs CodeIgniter and Kohana</title>
		<link>http://www.beyondcoding.com/2008/05/26/ruby-on-rails-passenger-modrails-vs-codeigniter-and-kohana/</link>
		<comments>http://www.beyondcoding.com/2008/05/26/ruby-on-rails-passenger-modrails-vs-codeigniter-and-kohana/#comments</comments>
		<pubDate>Sun, 25 May 2008 14:27:45 +0000</pubDate>
		<dc:creator>Fred Wu</dc:creator>
				<category><![CDATA[CodeIgniter]]></category>
		<category><![CDATA[Kohana]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[ModRails]]></category>
		<category><![CDATA[Passenger]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://thislab.com/?p=38</guid>
		<description><![CDATA[Disclaimer: This is a very simple, &#8216;Hello World&#8217; benchmark which has no impact to any real world applications. A more thorough benchmark test (by building two real world applications) is planned. :) Disclaimer 2:I apologise for posting such a useless benchmark (I certainly didn&#8217;t expect it to hit the DZone front page), but I think [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>Disclaimer:</strong> This is a very simple, &#8216;Hello World&#8217; benchmark which has no impact to any real world applications. A more thorough benchmark test (by building two real world applications) is planned. :)</em></p>
<p><em><strong>Disclaimer 2:</strong>I apologise for posting such a useless benchmark (I certainly didn&#8217;t expect it to hit the DZone front page), but I think most of you missed the point. I merely posted this as a result of surprise (to me anyway). At a later stage I will conduct a much more meaningful comparison between some of the frameworks. Until then, please ignore this post. :)</em></p>
<p>Last few days I have been playing with Ruby and Rails, again.</p>
<p>Today, when someone was asking on a forum about the efficiency of web frameworks, I thought I&#8217;d give the few frameworks I work with some more benchmark testing.</p>
<p>So I went ahead and benchmarked CodeIgniter, Kohana and Rails, using a simple &#8216;Hello World!&#8217; page. Now before I post any benchmark results, you should know that I have previously done <a href="http://thislab.com/2008/03/25/kohana-vs-codeigniter-speed-and-memory-usage-performance-benchmark/">a benchmark test on CodeIgniter, Kohana and CakePHP</a>. CodeIgniter and Kohana shared similar results.</p>
<p><span id="more-48"></span></p>
<p>This time though, the benchmark results surprised me. Here they are, in a nutshell:</p>
<p>CodeIgniter: 451.53 [#/sec]<br />
Kohana: 373.05 [#/sec]</p>
<p>Rails: 521.39 [#/sec]<br />
CodeIgniter: 127.23 [#/sec]</p>
<p>Results are presented in requests per seconds, so the higher the better. Now, please let me explain why I have included CodeIgniter twice.</p>
<p>The first two benchmarks were done on MAMP which has Apache 2.0.59 and PHP 5.2.5 with Zend Optimizer and XCache enabled.</p>
<p>The last two benchmarks were done on OS X Leopard&#8217;s default Apache 2.2.8 and PHP 5.2.5 without Zend Optimizer or XCache. Hence the worse result for CodeIgniter.</p>
<p>For the Rails implementation, the benchmark was done on <a href="http://www.modrails.com/">Passenger (aka ModRails)</a>, it is supposedly a more efficient implementation than using Mongrel.</p>
<p>It is very interesting to see that Rails performed faster than two of the most efficient PHP frameworks.</p>
<p>Framework versions used in the benchmark: CodeIgniter 1.6.2, Kohana SVN, Rails 2.0.2.</p>

	Tags: <a href="http://www.beyondcoding.com/tag/apache/" title="Apache" rel="tag">Apache</a>, <a href="http://www.beyondcoding.com/tag/benchmark/" title="benchmark" rel="tag">benchmark</a>, <a href="http://www.beyondcoding.com/tag/codeigniter/" title="CodeIgniter" rel="tag">CodeIgniter</a>, <a href="http://www.beyondcoding.com/tag/framework/" title="framework" rel="tag">framework</a>, <a href="http://www.beyondcoding.com/tag/kohana-php/" title="Kohana" rel="tag">Kohana</a>, <a href="http://www.beyondcoding.com/tag/modrails/" title="ModRails" rel="tag">ModRails</a>, <a href="http://www.beyondcoding.com/tag/passenger/" title="Passenger" rel="tag">Passenger</a>, <a href="http://www.beyondcoding.com/tag/php/" title="PHP" rel="tag">PHP</a>, <a href="http://www.beyondcoding.com/tag/rails/" title="Rails" rel="tag">Rails</a>, <a href="http://www.beyondcoding.com/tag/ruby/" title="Ruby" rel="tag">Ruby</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.beyondcoding.com/2008/02/21/using-zend-framework-with-codeigniter/" title="Using Zend Framework with CodeIgniter (February 21, 2008)">Using Zend Framework with CodeIgniter</a> (48)</li>
	<li><a href="http://www.beyondcoding.com/2008/02/23/notes-on-choosing-a-php-framework-a-quick-comparison-of-codeigniter-and-kohana/" title="Notes on Choosing a PHP Framework: A Quick Comparison of CodeIgniter and Kohana (February 23, 2008)">Notes on Choosing a PHP Framework: A Quick Comparison of CodeIgniter and Kohana</a> (52)</li>
	<li><a href="http://www.beyondcoding.com/2008/03/25/kohana-vs-codeigniter-speed-and-memory-usage-performance-benchmark/" title="Kohana vs CodeIgniter: Speed and Memory Usage Performance Benchmark (March 25, 2008)">Kohana vs CodeIgniter: Speed and Memory Usage Performance Benchmark</a> (16)</li>
	<li><a href="http://www.beyondcoding.com/2008/12/18/comparison-ruby-vs-php-the-pros/" title="Comparison: Ruby vs PHP, the Pros (December 18, 2008)">Comparison: Ruby vs PHP, the Pros</a> (5)</li>
	<li><a href="http://www.beyondcoding.com/2008/02/25/benchmark-litespeed-vs-apache-php-and-plain-html/" title="Benchmark: LiteSpeed vs Apache (PHP and Plain HTML) (February 25, 2008)">Benchmark: LiteSpeed vs Apache (PHP and Plain HTML)</a> (14)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.beyondcoding.com/2008/05/26/ruby-on-rails-passenger-modrails-vs-codeigniter-and-kohana/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>

