<?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>P(failure &#124; big_shot_present) = .9 &#187; ruby</title>
	<atom:link href="http://blog.e-thang.net/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.e-thang.net</link>
	<description>If even 1 person reads this, I will consider that a success</description>
	<lastBuildDate>Wed, 19 Oct 2011 14:52:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>RVM woes on Ubuntu 11.04</title>
		<link>http://blog.e-thang.net/2011/05/19/rvm-woes-on-ubuntu-11-04/</link>
		<comments>http://blog.e-thang.net/2011/05/19/rvm-woes-on-ubuntu-11-04/#comments</comments>
		<pubDate>Thu, 19 May 2011 11:17:12 +0000</pubDate>
		<dc:creator>e-thang</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[installation problems]]></category>
		<category><![CDATA[rvm]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.e-thang.net/?p=135</guid>
		<description><![CDATA[Having had an epiphany the other day, I needed this morning to start work on a new prototype.  This post isn&#8217;t about that prototype. It IS about the new setup I was using to do that prototype.  I figured this was a good chance to try out RVM in a Rails project, as well as [...]]]></description>
			<content:encoded><![CDATA[<p>Having had an epiphany the other day, I needed this morning to start work on a new prototype.  This post isn&#8217;t about that prototype.</p>
<p>It IS about the new setup I was using to do that prototype.  I figured this was a good chance to try out <a href="https://rvm.beginrescueend.com/">RVM</a> in a <a href="http://rubyonrails.org/">Rails</a> project, as well as try out <a href="http://www.ubuntu.com/download/ubuntu/download">Ubuntu 11.04</a>, as well as install the OS in <a href="http://en.wikipedia.org/wiki/France">French</a>.  So, with the new VM up and running, I follow RVM&#8217;s installation instructions, anticipation building with each scrolling character.  And then&#8230; BAM!</p>
<blockquote><p>ethan@ubuntu11:~/rvmsource$ bash &lt; &lt;(curl -s https://rvm.beginrescueend.com/install/rvm)<br />
Cloning into rvm&#8230;<br />
remote: Counting objects: 4765, done.<br />
remote: Compressing objects: 100% (2433/2433), done.<br />
remote: Total 4765 (delta 3086), reused 3183 (delta 1672)<br />
Receiving objects: 100% (4765/4765), 1.57 MiB | 322 KiB/s, done.<br />
Resolving deltas: 100% (3086/3086), done.<br />
WARNING:<br />
Could not source &#8216;/home/ethan/.rvm/scripts/base&#8217; as file does not exist.<br />
RVM will likely not work as expected.<br />
WARNING:<br />
Could not source &#8216;/home/ethan/.rvm/scripts/version&#8217; as file does not exist.<br />
RVM will likely not work as expected.<br />
WARNING:<br />
Could not source &#8216;/home/ethan/.rvm/scripts/selector&#8217; as file does not exist.<br />
RVM will likely not work as expected.<br />
WARNING:<br />
Could not source &#8216;/home/ethan/.rvm/scripts/cd&#8217; as file does not exist.<br />
RVM will likely not work as expected.<br />
WARNING:<br />
Could not source &#8216;/home/ethan/.rvm/scripts/cli&#8217; as file does not exist.<br />
RVM will likely not work as expected.<br />
WARNING:<br />
Could not source &#8216;/home/ethan/.rvm/scripts/override_gem&#8217; as file does not exist.<br />
RVM will likely not work as expected.<br />
cat: /home/ethan/.rvm/VERSION: Aucun fichier ou dossier de ce type</p></blockquote>
<p>A few Google searches turned up a few people having a similar problem but no solutions.  But whould&#8217;ve thunk it that installing the OS in French would actually have some practical value?  Google must&#8217;ve seen that and then dumped me on to <a href="http://forum.ubuntu-fr.org/viewtopic.php?pid=3843024">this forum</a>, wherein one of the posters linked to <a href="http://blog.escarworld.com/post/2010/09/02/Installer-rubyonrails-3.0.0-et-ruby-1.9.2-avec-rvm-sur-ubuntu-10.04">this post</a>, which basically says to just follow the directions that RVM spit out as part of the big error message.  Who&#8217;d've thunk THAT?  I sure didn&#8217;t.  I just focused on the error message itself in my searches.</p>
<blockquote><p>WARNING:  you have a &#8216;return&#8217; statement in your ~/.bashrc<br />
This could cause some features of RVM to not work.</p>
<p>This means that if you see something like:</p>
<p>&#8216;[ -z "$PS1" ] &amp;&amp; return&#8217;</p>
<p>then you change this line to:</p>
<p>if [[ -n "$PS1" ]] ; then</p>
<p># &#8230; original content that was below the &#8216;&amp;&amp; return&#8217; line &#8230;</p>
<p>fi # &lt;= be sure to close the if at the end of the .bashrc.</p>
<p># This is a good place to source rvm v v v<br />
[[ -s "/home/ethan/.rvm/scripts/rvm" ]] &amp;&amp; source &#8220;/home/ethan/.rvm/scripts/rvm&#8221;  # This loads RVM into a shell session.</p></blockquote>
<p>It looks like RVM tries to run outside of a standard shell session, and the way .bashrc is configured by default on Ubuntu 11.04 prevents that sort of thing.  When you&#8217;re done with your edits your .bashrc should look something like this:</p>
<blockquote><p># &#8216;[ -z "$PS1" ] &amp;&amp; return&#8217; &lt;&#8212;&#8211; delete this line.  It isn&#8217;t commented out in the original</p>
<p>if [[ -n "$PS1" ]] ; then</p>
<p># the rest of your old .bashrc contents</p>
<p>fi</p>
<p>[[ -s "/home/ethan/.rvm/scripts/rvm" ]] &amp;&amp; source &#8220;/home/ethan/.rvm/scripts/rvm&#8221;  # This loads RVM into a shell session.</p></blockquote>
<p>After making that change I re-ran <a href="https://rvm.beginrescueend.com/rvm/install/">the installation instructions</a>, and PRESTO!  Or maybe I should say, Voilà!  As always, YMMV.  I really don&#8217;t think it was the double install that fixed the problem.  And be sure to replace &#8220;ethan&#8221; with whatever your actual path is.  That happens to be mine, because, well, that&#8217;s my name.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.e-thang.net/2011/05/19/rvm-woes-on-ubuntu-11-04/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Best comment ever</title>
		<link>http://blog.e-thang.net/2011/03/23/best-comment-ever/</link>
		<comments>http://blog.e-thang.net/2011/03/23/best-comment-ever/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 13:21:54 +0000</pubDate>
		<dc:creator>e-thang</dc:creator>
				<category><![CDATA[software]]></category>
		<category><![CDATA[best comment]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.e-thang.net/?p=113</guid>
		<description><![CDATA[Comments are a wonderful addition to any code base, especially when used well.  As for a definition of used well, that is a Holy War I do not wish to start here. Anyway, I came across the following comment.  Hopefully it isn&#8217;t revealing any proprietary information: # something That isn&#8217;t a typo.  That&#8217;s a verbatim [...]]]></description>
			<content:encoded><![CDATA[<p>Comments are a wonderful addition to any code base, especially when used well.  As for a definition of used well, that is a Holy War I do not wish to start here.</p>
<p>Anyway, I came across the following comment.  Hopefully it isn&#8217;t revealing any proprietary information:</p>
<p><code># something</code></p>
<p>That isn&#8217;t a typo.  That&#8217;s a verbatim reproduction of the comment.</p>
<p>How about you?  What&#8217;s the best comment you&#8217;ve ever seen?</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.e-thang.net/2011/03/23/best-comment-ever/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deprecation warnings in Rails</title>
		<link>http://blog.e-thang.net/2011/03/22/deprecation-warnings-in-rails/</link>
		<comments>http://blog.e-thang.net/2011/03/22/deprecation-warnings-in-rails/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 12:31:28 +0000</pubDate>
		<dc:creator>e-thang</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.e-thang.net/?p=109</guid>
		<description><![CDATA[Are you working on an ever-evolving code base? Did your project start with an initial engineering effort to fix a specific problem / explore the solution space? As requirements are more fully understood, are you increasingly annoyed with the older code to support different data formats and the like? Do you want to get developers [...]]]></description>
			<content:encoded><![CDATA[<p>Are you working on an ever-evolving code base?  Did your project start with an initial engineering effort to fix a specific problem / explore the solution space?  As requirements are more fully understood, are you increasingly annoyed with the older code to support different data formats and the like?  Do you want to get developers and others to stop using those old formats?</p>
<p>Well, you too can have access to what Rails uses to put deprecation warnings in the log file.</p>
<p><code>ActiveSupport::Deprecation.warn("Stop calling me!")</code></p>
<p>It of course takes a good team policy to require all such warnings to be removed, but I was delighted to find that this is readily available and usable for my own deprecation warnings.  It sure beats using Rails.logger, because the intent is clearer, and such warnings will get shut off when all deprecation warnings are turned off anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.e-thang.net/2011/03/22/deprecation-warnings-in-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When having trouble installing the mysql gem on OSX</title>
		<link>http://blog.e-thang.net/2010/04/21/when-having-trouble-installing-the-mysql-gem-on-osx/</link>
		<comments>http://blog.e-thang.net/2010/04/21/when-having-trouble-installing-the-mysql-gem-on-osx/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 18:33:09 +0000</pubDate>
		<dc:creator>e-thang</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[mysql gem]]></category>

		<guid isPermaLink="false">http://blog.e-thang.net/?p=89</guid>
		<description><![CDATA[And you get an error like: *** extconf.rb failed *** Go read: http://blog.bmn.name/2008/02/rails-gem-install-mysql-throws-error-extconfrb-failed]]></description>
			<content:encoded><![CDATA[<p>And you get an error like:</p>
<p>*** extconf.rb failed ***</p>
<p>Go read:</p>
<p><a href="http://blog.bmn.name/2008/02/rails-gem-install-mysql-throws-error-extconfrb-failed">http://blog.bmn.name/2008/02/rails-gem-install-mysql-throws-error-extconfrb-failed</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.e-thang.net/2010/04/21/when-having-trouble-installing-the-mysql-gem-on-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Ruby gems that require building native extensions on Snow Leopard</title>
		<link>http://blog.e-thang.net/2009/12/18/installing-ruby-gems-that-require-building-native-extensions-on-snow-leopard/</link>
		<comments>http://blog.e-thang.net/2009/12/18/installing-ruby-gems-that-require-building-native-extensions-on-snow-leopard/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 19:31:47 +0000</pubDate>
		<dc:creator>e-thang</dc:creator>
				<category><![CDATA[rant]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[XCode]]></category>

		<guid isPermaLink="false">http://blog.e-thang.net/?p=60</guid>
		<description><![CDATA[I haven&#8217;t tested this on all &#8220;machines&#8221; running Snow Leopard, but on the brand new one I had to get today for work, I found that the default Ruby / Gems install doesn&#8217;t support installing gems that require building native extensions. The error message I was treated to contained the following: MacBook-Pro-de-Ethan-Garofolo:~ juanpaco$ sudo gem [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t tested this on all &#8220;machines&#8221; running Snow Leopard, but on the brand new one I had to get today for work, I found that the default Ruby / Gems install doesn&#8217;t support installing gems that require building native extensions.  The error message I was treated to contained the following:</p>
<p><code>MacBook-Pro-de-Ethan-Garofolo:~ juanpaco$ sudo gem install thin<br />
Password:<br />
Building native extensions.  This could take a while...<br />
ERROR:  Error installing thin:<br />
	ERROR: Failed to build gem native extension.<br />
<code><br />
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb install thin<br />
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h</p>
<p><code><br />
Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.10 for inspection.<br />
Results logged to /Library/Ruby/Gems/1.8/gems/eventmachine-0.12.10/ext/gem_make.out</p>
<p>The solution was hyper-intuitive.  Install XCode.  Because of course that's the first thing you think of.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.e-thang.net/2009/12/18/installing-ruby-gems-that-require-building-native-extensions-on-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Renaming a database in Rails</title>
		<link>http://blog.e-thang.net/2009/12/14/renaming-a-database-in-rails/</link>
		<comments>http://blog.e-thang.net/2009/12/14/renaming-a-database-in-rails/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 17:09:15 +0000</pubDate>
		<dc:creator>e-thang</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[myql]]></category>
		<category><![CDATA[rename database]]></category>

		<guid isPermaLink="false">http://blog.e-thang.net/?p=54</guid>
		<description><![CDATA[Hooray for a non-rant post! The heart of this method works outside of Rails, but there&#8217;s one particular convenience method that Rails provides.  Find some way to mimic that behavior, and the rest would apply.  Also, this is a MySQL-specific solution.  I haven&#8217;t tried it with any other DB systems. We &#8220;rename&#8221; a database by [...]]]></description>
			<content:encoded><![CDATA[<p>Hooray for a non-rant post!</p>
<p>The heart of this method works outside of Rails, but there&#8217;s one particular convenience method that Rails provides.  Find some way to mimic that behavior, and the rest would apply.  Also, this is a MySQL-specific solution.  I haven&#8217;t tried it with any other DB systems.</p>
<p>We &#8220;rename&#8221; a database by moving all of its tables into a new database.  We do so via <a title="MySQL RENAME TABLE Syntax" href="http://dev.mysql.com/doc/refman/5.0/en/rename-table.html">MySQL&#8217;s RENAME TABLE command</a>.  Basically, create an empty database with the new name.  We then use our ActiveRecord connection&#8217;s &#8220;tables&#8221; method to loop over all the tables in our database, executing a RENAME TABLE from the old to the new with each iteration.  &#8220;Tables&#8221; is the convenience method I mentioned above. Encapsulating this in a method we get:</p>
<pre>def rename_database(old_db_name, new_db_name)
    ActiveRecord::Base.connection.execute "CREATE DATABASE #{new_db_name}"
    ActiveRecord::Base.connection.tables.each do |table|
        ActiveRecord::Base.connection.execute
            "RENAME TABLE #{old_db_name}.#{table} TO #{new_db_name}.#{table}"
    end
    ActiveRecord::Base.connection.execute "DROP DATABASE #{old_db_name}"
end</pre>
<p>Error checking is left as an (important!) exercise to the reader.  Also, you may prefer to monkey patch this into ActiveRecord itself as opposed to some odd method floating around in global space.</p>
<p>This presupposes that the new database destination will be on the same server.</p>
<p>Another way to rename a database is to mysqldump the old one to a file and then reimport it to the renamed database.  The method presented in this article is advantageous if your database has a large amount of data.  Renaming a table is almost instant.  <strong>Dumping millions of rows and reimporting them is not so instant.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.e-thang.net/2009/12/14/renaming-a-database-in-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to tell where your gems are installed</title>
		<link>http://blog.e-thang.net/2009/09/16/how-to-tell-where-your-gems-are-installed/</link>
		<comments>http://blog.e-thang.net/2009/09/16/how-to-tell-where-your-gems-are-installed/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 17:45:49 +0000</pubDate>
		<dc:creator>e-thang</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[gems]]></category>

		<guid isPermaLink="false">http://blog.e-thang.net/?p=47</guid>
		<description><![CDATA[From http://groups.google.com/group/rubypgh/msg/0489eed858e642a0: gem environment Type the above. That is all.]]></description>
			<content:encoded><![CDATA[<p>From <a href="http://groups.google.com/group/rubypgh/msg/0489eed858e642a0">http://groups.google.com/group/rubypgh/msg/0489eed858e642a0</a>:</p>
<p><code>gem environment</code></p>
<p>Type the above.  That is all.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.e-thang.net/2009/09/16/how-to-tell-where-your-gems-are-installed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>uninitialized constant Thin::Server::Forwardable</title>
		<link>http://blog.e-thang.net/2009/07/02/uninitialized-constant-thinserverforwardable/</link>
		<comments>http://blog.e-thang.net/2009/07/02/uninitialized-constant-thinserverforwardable/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 21:30:41 +0000</pubDate>
		<dc:creator>e-thang</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[forwardable]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[thin]]></category>
		<category><![CDATA[weird]]></category>

		<guid isPermaLink="false">http://blog.e-thang.net/?p=42</guid>
		<description><![CDATA[I may be getting batty in my old age here, but for whatever reason Thin decided to just stop running on my system.  When trying to invoke thin to further development on the code behind my awesome website, I was treated to the following: ethan:ethang juanpaco$ thin start /Library/Ruby/Gems/1.8/gems/thin-1.0.0/lib/thin/server.rb:51: uninitialized constant Thin::Server::Forwardable (NameError) from /Library/Ruby/Gems/1.8/gems/thin-1.0.0/lib/thin/runner.rb:38:in [...]]]></description>
			<content:encoded><![CDATA[<p>I may be getting batty in my old age here, but for whatever reason Thin decided to just stop running on my system.  When trying to invoke thin to further development on <a href="http://github.com/juanpaco/e-thang.net/tree/master">the code</a> behind <a href="http://www.e-thang.net">my awesome website</a>, I was treated to the following:</p>
<p><code><br />
ethan:ethang juanpaco$ thin start<br />
/Library/Ruby/Gems/1.8/gems/thin-1.0.0/lib/thin/server.rb:51: uninitialized constant Thin::Server::Forwardable (NameError)<br />
from /Library/Ruby/Gems/1.8/gems/thin-1.0.0/lib/thin/runner.rb:38:in `initialize'<br />
from /Library/Ruby/Gems/1.8/gems/thin-1.0.0/bin/thin:6:in `new'<br />
from /Library/Ruby/Gems/1.8/gems/thin-1.0.0/bin/thin:6<br />
from /usr/bin/thin:19:in `load'<br />
from /usr/bin/thin:19</code></p>
<p>I didn&#8217;t like that.</p>
<p>I went to the line number where the error occurred (/Library/Ruby/Gems/1.8/gems/thin-1.0.0/lib/thin/server.rb:51), and found:<br />
<code>extend  Forwardable</code></p>
<p>Not knowing what Forwardable was, and for giggles, I went to irb and typed &#8220;Forwardable&#8221; thinking I&#8217;d get the class object.  Not defined.  So I try &#8220;require &#8216;forwardable&#8217;.&#8221;  There was no period in what I typed, but I haven&#8217;t figured out how to get Ruby and English to play well together.  Anyway, that worked, and a subsequent typing of &#8220;Forwardable&#8221; returned the object. So then I tried putting require &#8216;forwardable&#8217; at the top of server.rb in thin&#8217;s gem.</p>
<p>And then it worked.</p>
<p>I&#8217;m not sure why it used to work and then suddenly didn&#8217;t.  This was after several install/uninstall, swear off programming moments.  Weird.  So, if you&#8217;re struggling with this same problem, perhaps the above can be of service.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.e-thang.net/2009/07/02/uninitialized-constant-thinserverforwardable/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

