<?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>pastbedti.me &#187; Ruby</title>
	<atom:link href="http://www.pastbedti.me/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pastbedti.me</link>
	<description>About ruby, rails, postgresql and stuff....</description>
	<lastBuildDate>Wed, 01 Jun 2011 20:09:49 +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>Change PATH environment with Rails and Capistrano</title>
		<link>http://www.pastbedti.me/2011/06/change-path-environment-with-rails-and-capistrano/</link>
		<comments>http://www.pastbedti.me/2011/06/change-path-environment-with-rails-and-capistrano/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 20:09:49 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[deploy]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=699</guid>
		<description><![CDATA[Note to self. When deploying my RubyOnRails applications with Capistrano and I get errors like this one 12345servers: &#91;&#34;app.myserver.com&#34;&#93; &#91;app.myserver.com&#93; executing command ** &#91;out :: app.myserver.com&#93; sh: bundle: command not found command finished in 31ms servers: &#91;&#34;app.myserver.com&#34;&#93; &#160; &#160;&#91;app.myserver.com&#93; executing command ** &#91;out :: app.myserver.com&#93; sh: bundle: command not found &#160; &#160;command finished in 31ms [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Note to self.</strong></p>
<div>When deploying my <strong>RubyOnRails</strong> applications with <strong>Capistrano</strong> and I get errors like this one</div>
<p></p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">servers: <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">&quot;app.myserver.com&quot;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>app.myserver.com<span style="color: #7a0874; font-weight: bold;">&#93;</span> executing <span style="color: #7a0874; font-weight: bold;">command</span><br />
<span style="color: #000000; font-weight: bold;">**</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>out :: app.myserver.com<span style="color: #7a0874; font-weight: bold;">&#93;</span> sh: bundle: <span style="color: #7a0874; font-weight: bold;">command</span> not found<br />
<span style="color: #7a0874; font-weight: bold;">command</span> finished <span style="color: #000000; font-weight: bold;">in</span> 31ms<br />
servers: <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">&quot;app.myserver.com&quot;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> &nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">&#91;</span>app.myserver.com<span style="color: #7a0874; font-weight: bold;">&#93;</span> executing <span style="color: #7a0874; font-weight: bold;">command</span> <span style="color: #000000; font-weight: bold;">**</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>out :: app.myserver.com<span style="color: #7a0874; font-weight: bold;">&#93;</span> sh: bundle: <span style="color: #7a0874; font-weight: bold;">command</span> not found &nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">command</span> finished <span style="color: #000000; font-weight: bold;">in</span> 31ms</div></td></tr></tbody></table></div>
<p>Capistrano executes the commands in a very basic shell so the $PATH environment are not the same as when you login through SSH.</p>
<p>One way to solve this is by setting PermitUserEnvironment  to yes in /etc/sshd_config and then add the correct PATH to ~/.ssh/environment</p>
<p>I just found another way that was much easier <img src='http://www.pastbedti.me/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>In you <strong>config/deploy.rb</strong> add the following snippet</p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">set <span style="color:#ff3333; font-weight:bold;">:default_environment</span>, <span style="color:#006600; font-weight:bold;">&#123;</span><br />
&nbsp; <span style="color:#996600;">'PATH'</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;/opt/ruby-enterprise/bin/:$PATH&quot;</span><br />
<span style="color:#006600; font-weight:bold;">&#125;</span></div></td></tr></tbody></table></div>
<p>Thats it! </p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2011/06/change-path-environment-with-rails-and-capistrano/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nokogiri quote</title>
		<link>http://www.pastbedti.me/2010/04/nokogiri-quote/</link>
		<comments>http://www.pastbedti.me/2010/04/nokogiri-quote/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 20:12:14 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[funny]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[quote]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=665</guid>
		<description><![CDATA[I just have to share this funny quote from the nokogiri website (for those of you that does not know 鋸 it&#8217;s a reeeeeeeeaaally good and fast HTML, XML, SAX, and Reader parser). XML is like violence &#8211; if it doesn’t solve your problems, you are not using enough of it. &#8211; http://nokogiri.org/ Cheers!]]></description>
			<content:encoded><![CDATA[<p>I just have to share this funny quote from the nokogiri website (for those of you that does not know 鋸 it&#8217;s a reeeeeeeeaaally good and fast HTML, XML, SAX, and Reader parser).</p>
<blockquote><p>
XML is like violence &#8211; if it doesn’t solve your problems, you are not using enough of it. &#8211; <a href="http://nokogiri.org/">http://nokogiri.org/</a>
</p></blockquote>
<p>Cheers! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2010/04/nokogiri-quote/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploying a Sinatra app with Apache and Phusion Passenger a.k.a. mod_rack</title>
		<link>http://www.pastbedti.me/2009/11/deploying-a-sinatra-app-with-apache-and-phusion-passenger-a-k-a-mod_rack/</link>
		<comments>http://www.pastbedti.me/2009/11/deploying-a-sinatra-app-with-apache-and-phusion-passenger-a-k-a-mod_rack/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 22:01:30 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Sinatra]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[passenger]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[webroot]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=610</guid>
		<description><![CDATA[My Sinatra + Apache + Passenger setup did not just run Deploying a simple Sinatra rack application under Apache and Phusion Passenger turned out not work out of the box for me. I already had a virtual host so I decided to deploy with passengers sub URI (sub URI documentation). To make this work you&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<h3>My Sinatra + Apache + Passenger setup did not just run <img src='http://www.pastbedti.me/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </h3>
<p>Deploying a simple Sinatra rack application under Apache and Phusion Passenger turned out not work out of the box for me. </p>
<p>I already had a virtual host so I decided to deploy with passengers sub URI (<a href="http://www.modrails.com/documentation/Users%20guide.html#deploying_rack_to_sub_uri" target="_blank">sub URI documentation</a>).</p>
<p>To make this work you&#8217;ll need Apache installed with Phusion Passenger setup (<a href="http://www.modrails.com/install.html" target="_blank">Passenger installation</a>)</p>
<p>
<h3>This is what I started with</h3>
<p>This is my folders for the already existing website.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># Existing homedir</span><br />
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>my_web<span style="color: #000000; font-weight: bold;">/</span><br />
<span style="color: #666666; font-style: italic;"># Current webroot</span><br />
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>my_web<span style="color: #000000; font-weight: bold;">/</span>htdocs</div></td></tr></tbody></table></div>
<p>
<h3>Creating folders and files for Sinatra</h3>
<p>The first thing you want to do is to create folders and files for Sinatra.</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mkdir /home/my_web/sinatra</div></td></tr></tbody></table></div>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cd /home/my_web/sinatra<br />
mkdir tmp<br />
mkdir logs<br />
mkdir public<br />
touch app.rb<br />
touch config.ru</div></td></tr></tbody></table></div>
<p>
<h3>Create symlink</h3>
<p>Create a symbolic link from our current webroot to the new Sinatra app so that apache/passenger can find it.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>my_web<span style="color: #000000; font-weight: bold;">/</span>sinatra<span style="color: #000000; font-weight: bold;">/</span>public <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>my_web<span style="color: #000000; font-weight: bold;">/</span>htdocs<span style="color: #000000; font-weight: bold;">/</span>app</div></td></tr></tbody></table></div>
<p>
<h3>Creating the application</h3>
<p>We also need a Sinatra application for this to work so lets fill those files.</p>
<p>
<h4>File: config.ru</h4>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'app'</span><br />
<br />
set <span style="color:#ff3333; font-weight:bold;">:environment</span>, ENV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'RACK_ENV'</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_sym</span><br />
set <span style="color:#ff3333; font-weight:bold;">:app_file</span>, &nbsp; &nbsp; <span style="color:#996600;">'app.rb'</span><br />
disable <span style="color:#ff3333; font-weight:bold;">:run</span><br />
<br />
log = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;logs/sinatra.log&quot;</span>, <span style="color:#996600;">&quot;a&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
STDOUT.<span style="color:#9900CC;">reopen</span><span style="color:#006600; font-weight:bold;">&#40;</span>log<span style="color:#006600; font-weight:bold;">&#41;</span><br />
STDERR.<span style="color:#9900CC;">reopen</span><span style="color:#006600; font-weight:bold;">&#40;</span>log<span style="color:#006600; font-weight:bold;">&#41;</span><br />
<br />
run <span style="color:#6666ff; font-weight:bold;">Sinatra::Application</span></div></td></tr></tbody></table></div>
<p>
<h4>File: app.rb</h4>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span><br />
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'sinatra'</span><br />
<br />
before <span style="color:#9966CC; font-weight:bold;">do</span> <br />
&nbsp; <span style="color:#008000; font-style:italic;"># Strip the last / from the path</span><br />
&nbsp; request.<span style="color:#9900CC;">env</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'PATH_INFO'</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#CC0066; font-weight:bold;">gsub!</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span>\<span style="color:#006600; font-weight:bold;">/</span>$<span style="color:#006600; font-weight:bold;">/</span>, <span style="color:#996600;">''</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span><br />
<br />
get <span style="color:#996600;">''</span> <span style="color:#9966CC; font-weight:bold;">do</span><br />
&nbsp; &nbsp;<span style="color:#996600;">&quot;Hello world&quot;</span><br />
<span style="color:#9966CC; font-weight:bold;">end</span></div></td></tr></tbody></table></div>
<p>
<h3>Apache configuration</h3>
<p>Now we need to setup apache so that it can find our Sinatra app and load it.</p>
<p>The only thing you need to do is add the following line to your existing VirtualHost block:</p>
<div class="codecolorer-container apache twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">RackBaseURI /app</div></td></tr></tbody></table></div>
<p>This line will tell passenger to look into our existing webroot for a symlink thats named app and which points to our rack app.  (<a href="http://www.modrails.com/documentation/Users%20guide.html#RackBaseURI" target="_blank">RackBaseURI  documentation</a>)</p>
<p>
<h3>Virtual host entry</h3>
<div class="codecolorer-container apache twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br /></div></td><td><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;<span style="color: #000000; font-weight:bold;">VirtualHost</span> *:<span style="color: #ff0000;">80</span>&gt;<br />
&nbsp; <span style="color: #00007f;">ServerName</span> www.example.com<br />
&nbsp; <span style="color: #00007f;">ServerAlias</span> example.com<br />
&nbsp; <span style="color: #00007f;">DocumentRoot</span> /home/my_web/htdocs/<br />
&nbsp; RackBaseURI /app<br />
<br />
&nbsp; &lt;<span style="color: #000000; font-weight:bold;">Directory</span> <span style="color: #7f007f;">&quot;/home/my_web/htdocs/&quot;</span>&gt;<br />
&nbsp; &nbsp; <span style="color: #00007f;">Order</span> <span style="color: #00007f;">allow</span>,<span style="color: #00007f;">deny</span><br />
&nbsp; &nbsp; <span style="color: #00007f;">Allow</span> from <span style="color: #0000ff;">all</span><br />
&nbsp; &nbsp; <span style="color: #00007f;">AllowOverride</span> <span style="color: #0000ff;">All</span><br />
&nbsp; &lt;/<span style="color: #000000; font-weight:bold;">Directory</span>&gt;<br />
&lt;/<span style="color: #000000; font-weight:bold;">VirtualHost</span>&gt;</div></td></tr></tbody></table></div>
<p>The best part is that you are allowed to specify this option multiple times. So you can easily setup multiple apps under the same virtual host.</p>
<p>Cheers! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2009/11/deploying-a-sinatra-app-with-apache-and-phusion-passenger-a-k-a-mod_rack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grouping a timestamp field by date in Ruby On Rails / PostgreSQL</title>
		<link>http://www.pastbedti.me/2009/11/grouping-a-timestamp-field-by-date-in-ruby-on-rails-postgresql/</link>
		<comments>http://www.pastbedti.me/2009/11/grouping-a-timestamp-field-by-date-in-ruby-on-rails-postgresql/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 00:55:09 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[timestamp]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=563</guid>
		<description><![CDATA[Recently I&#8217;ve been working a lot with dates and tonight I had a hard time finding information about how to group a model by date when the model only have a timestamp column. Lets pretend we have a user model with a created_at attribute which is stored as a timestamp. If we want to plot [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been working a lot with dates and tonight I had a hard time finding information about how to group a model by date when the model only have a timestamp column. </p>
<p>Lets pretend we have a user model with a created_at attribute which is stored as a timestamp.</p>
<p>If we want to plot a simple graph showing signups per date this is the way to extract them:</p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">User.<span style="color:#9900CC;">count</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:group</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;DATE(created_at)&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div></td></tr></tbody></table></div>
<p>Thats all there is to it. From this you will get an OrderedHash containing the date and count of users for each date. </p>
<p>One small thing to remember if you are using PostgreSQL. You will need the DATE() function in any ORDER/SELECT statements because PostgreSQL will only select/order by fields thats in the GROUP BY statement and this is a  pretty healthy behavior that many databases (no names here) don&#8217;t care about. Think about it. If you are grouping all users by date and use * as selector how would the database know which username or email address to display?</p>
<p>This is what happens if you try to group by created_at without DATE() -></p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#006600; font-weight:bold;">&gt;&gt;</span> User.<span style="color:#9900CC;">count</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:order</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'created_at DESC'</span>, <span style="color:#ff3333; font-weight:bold;">:group</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;DATE(created_at)&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<span style="color:#6666ff; font-weight:bold;">ActiveRecord::StatementInvalid</span>: PGError: ERROR: &nbsp;column <span style="color:#996600;">&quot;users.created_at&quot;</span> must appear <span style="color:#9966CC; font-weight:bold;">in</span> the GROUP BY clause <span style="color:#9966CC; font-weight:bold;">or</span> be used <span style="color:#9966CC; font-weight:bold;">in</span> an aggregate function<br />
: <span style="color:#CC0066; font-weight:bold;">SELECT</span> count<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">*</span><span style="color:#006600; font-weight:bold;">&#41;</span> AS count_all, DATE<span style="color:#006600; font-weight:bold;">&#40;</span>created_at<span style="color:#006600; font-weight:bold;">&#41;</span> AS date_created_at FROM <span style="color:#996600;">&quot;users&quot;</span> &nbsp;GROUP BY DATE<span style="color:#006600; font-weight:bold;">&#40;</span>created_at<span style="color:#006600; font-weight:bold;">&#41;</span> &nbsp;ORDER BY created_at DESC <br />
&nbsp; &nbsp; &nbsp; &nbsp; from <span style="color:#006600; font-weight:bold;">/</span>tmp<span style="color:#006600; font-weight:bold;">/</span>app<span style="color:#006600; font-weight:bold;">/</span>vendor<span style="color:#006600; font-weight:bold;">/</span>rails<span style="color:#006600; font-weight:bold;">/</span>activerecord<span style="color:#006600; font-weight:bold;">/</span>lib<span style="color:#006600; font-weight:bold;">/</span>active_record<span style="color:#006600; font-weight:bold;">/</span>connection_adapters<span style="color:#006600; font-weight:bold;">/</span>abstract_adapter.<span style="color:#9900CC;">rb</span>:<span style="color:#006666;">212</span>:<span style="color:#9966CC; font-weight:bold;">in</span> <span style="color:#996600;">`log'<br />
&nbsp; &nbsp; &nbsp; &nbsp; from /tmp/app/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:507:in `</span>execute<span style="color:#996600;">'<br />
&nbsp; &nbsp; &nbsp; &nbsp; from /tmp/app/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:985:in `select_raw'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; from <span style="color:#006600; font-weight:bold;">/</span>tmp<span style="color:#006600; font-weight:bold;">/</span>app<span style="color:#006600; font-weight:bold;">/</span>vendor<span style="color:#006600; font-weight:bold;">/</span>rails<span style="color:#006600; font-weight:bold;">/</span>activerecord<span style="color:#006600; font-weight:bold;">/</span>lib<span style="color:#006600; font-weight:bold;">/</span>active_record<span style="color:#006600; font-weight:bold;">/</span>connection_adapters<span style="color:#006600; font-weight:bold;">/</span>postgresql_adapter.<span style="color:#9900CC;">rb</span>:<span style="color:#006666;">972</span>:<span style="color:#9966CC; font-weight:bold;">in</span> <span style="color:#996600;">`select'<br />
&nbsp; &nbsp; &nbsp; &nbsp; from /tmp/app/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:7:in `</span>select_all_without_query_cache<span style="color:#996600;">'<br />
&nbsp; &nbsp; &nbsp; &nbsp; from /tmp/app/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:62:in `select_all'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; from <span style="color:#006600; font-weight:bold;">/</span>tmp<span style="color:#006600; font-weight:bold;">/</span>app<span style="color:#006600; font-weight:bold;">/</span>vendor<span style="color:#006600; font-weight:bold;">/</span>rails<span style="color:#006600; font-weight:bold;">/</span>activerecord<span style="color:#006600; font-weight:bold;">/</span>lib<span style="color:#006600; font-weight:bold;">/</span>active_record<span style="color:#006600; font-weight:bold;">/</span>calculations.<span style="color:#9900CC;">rb</span>:<span style="color:#006666;">255</span>:<span style="color:#9966CC; font-weight:bold;">in</span> <span style="color:#996600;">`execute_grouped_calculation'<br />
&nbsp; &nbsp; &nbsp; &nbsp; from /tmp/app/vendor/rails/activerecord/lib/active_record/calculations.rb:132:in `</span>calculate<span style="color:#996600;">'<br />
&nbsp; &nbsp; &nbsp; &nbsp; from /tmp/app/vendor/rails/activerecord/lib/active_record/calculations.rb:130:in `catch'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; from <span style="color:#006600; font-weight:bold;">/</span>tmp<span style="color:#006600; font-weight:bold;">/</span>app<span style="color:#006600; font-weight:bold;">/</span>vendor<span style="color:#006600; font-weight:bold;">/</span>rails<span style="color:#006600; font-weight:bold;">/</span>activerecord<span style="color:#006600; font-weight:bold;">/</span>lib<span style="color:#006600; font-weight:bold;">/</span>active_record<span style="color:#006600; font-weight:bold;">/</span>calculations.<span style="color:#9900CC;">rb</span>:<span style="color:#006666;">130</span>:<span style="color:#9966CC; font-weight:bold;">in</span> <span style="color:#996600;">`calculate'<br />
&nbsp; &nbsp; &nbsp; &nbsp; from /tmp/app/vendor/rails/activerecord/lib/active_record/calculations.rb:48:in `</span>count<span style="color:#996600;">'<br />
&nbsp; &nbsp; &nbsp; &nbsp; from (irb):18</span></div></td></tr></tbody></table></div>
<p>And this is the right way to do it:</p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#006600; font-weight:bold;">&gt;&gt;</span> User.<span style="color:#9900CC;">count</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:order</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'DATE(created_at) DESC'</span>, <span style="color:#ff3333; font-weight:bold;">:group</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;DATE(created_at)&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
<span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#008000; font-style:italic;">#&lt;OrderedHash {&quot;2009-10-14&quot;=&gt;22, &quot;2009-10-25&quot;=&gt;4, &quot;2009-11-04&quot;=&gt;8, &quot;2009-10-15&quot;=&gt;9, &quot;2009-10-26&quot;=&gt;16, &quot;2009-11-05&quot;=&gt;9, &quot;2009-10-16&quot;=&gt;193, &quot;2009-10-27&quot;=&gt;14, &quot;2009-11-06&quot;=&gt;9, &quot;2009-10-17&quot;=&gt;49, &quot;2009-10-28&quot;=&gt;15, &quot;2009-11-07&quot;=&gt;6, &quot;2009-10-18&quot;=&gt;36, &quot;2009-10-29&quot;=&gt;8, &quot;2009-10-19&quot;=&gt;116, &quot;2009-10-30&quot;=&gt;15&gt;</span></div></td></tr></tbody></table></div>
<p>As you may notice the Hash does not look ordered. But if you loop over it you will get them in order:</p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color:#006600; font-weight:bold;">&gt;&gt;</span> User.<span style="color:#9900CC;">count</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:order</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'DATE(created_at) DESC'</span>, <span style="color:#ff3333; font-weight:bold;">:group</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;DATE(created_at)&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">|</span>u<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;#{u[0]} -&gt; #{u[1]}&quot;</span> <span style="color:#006600; font-weight:bold;">&#125;</span><br />
<span style="color:#006666;">2009</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">11</span><span style="color:#006600; font-weight:bold;">-</span>07 <span style="color:#006600; font-weight:bold;">-&gt;</span> <span style="color:#006666;">6</span><br />
<span style="color:#006666;">2009</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">11</span><span style="color:#006600; font-weight:bold;">-</span>06 <span style="color:#006600; font-weight:bold;">-&gt;</span> <span style="color:#006666;">9</span><br />
<span style="color:#006666;">2009</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">11</span><span style="color:#006600; font-weight:bold;">-</span>05 <span style="color:#006600; font-weight:bold;">-&gt;</span> <span style="color:#006666;">9</span><br />
<span style="color:#006666;">2009</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">11</span><span style="color:#006600; font-weight:bold;">-</span>04 <span style="color:#006600; font-weight:bold;">-&gt;</span> <span style="color:#006666;">8</span><br />
<span style="color:#006666;">2009</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">11</span><span style="color:#006600; font-weight:bold;">-</span>03 <span style="color:#006600; font-weight:bold;">-&gt;</span> <span style="color:#006666;">14</span><br />
<span style="color:#006666;">2009</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">11</span><span style="color:#006600; font-weight:bold;">-</span>02 <span style="color:#006600; font-weight:bold;">-&gt;</span> <span style="color:#006666;">20</span><br />
<span style="color:#006666;">2009</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">11</span><span style="color:#006600; font-weight:bold;">-</span>01 <span style="color:#006600; font-weight:bold;">-&gt;</span> <span style="color:#006666;">10</span><br />
<span style="color:#006666;">2009</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">10</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">31</span> <span style="color:#006600; font-weight:bold;">-&gt;</span> <span style="color:#006666;">6</span><br />
<span style="color:#006666;">2009</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">10</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">30</span> <span style="color:#006600; font-weight:bold;">-&gt;</span> <span style="color:#006666;">15</span><br />
<span style="color:#006666;">2009</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">10</span><span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">29</span> <span style="color:#006600; font-weight:bold;">-&gt;</span> <span style="color:#006666;">8</span><br />
..</div></td></tr></tbody></table></div>
<p>And thats how you group a timestamp field with just its date part.</p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2009/11/grouping-a-timestamp-field-by-date-in-ruby-on-rails-postgresql/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to compile VIM under OS X</title>
		<link>http://www.pastbedti.me/2009/01/how-to-compile-vim-under-os-x/</link>
		<comments>http://www.pastbedti.me/2009/01/how-to-compile-vim-under-os-x/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 09:53:31 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[compiling]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=367</guid>
		<description><![CDATA[Configure and compiling VIM under OS X did not work out-of-the box for me. I did not want to use MacPorts VIM as it&#8217;s dependent on ruby (if you like me want that) and I did not find a way of compiling MacPorts VIM against my local ruby. This post is about how to get [...]]]></description>
			<content:encoded><![CDATA[<p>Configure and compiling <a href="http://www.vim.org/">VIM</a> under OS X did not work out-of-the box for me. I did not want to use <a href="http://www.macports.org/">MacPorts</a> VIM as it&#8217;s dependent on ruby (if you like me want that) and I did not find a way of compiling MacPorts VIM against my local ruby.</p>
<p>This post is about how to get VIM compiling on OS X/intel without the use of  MacPorts.</p>
<p><span id="more-367"></span></p>
<h3>1. Configure without specifying architecture</h3>
<p>When running configure without specifying architecture everything looks fine but when you run make you get this nice little error.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--enable-rubyinterp</span> <span style="color: #660033;">--enable-multibyte</span> <span style="color: #660033;">--with-features</span>=huge<br />
... stripped output ...<br />
<span style="color: #c20cb9; font-weight: bold;">make</span><br />
<br />
Undefined symbols <span style="color: #000000; font-weight: bold;">for</span> architecture ppc:<br />
&nbsp; <span style="color: #ff0000;">&quot;_main&quot;</span>, referenced from:<br />
&nbsp; &nbsp; &nbsp; start <span style="color: #000000; font-weight: bold;">in</span> crt1.10.5.o<br />
ld: symbol<span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span> not found <span style="color: #000000; font-weight: bold;">for</span> architecture ppc<br />
collect2: <span style="color: #c20cb9; font-weight: bold;">ld</span> returned <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">exit</span> status<br />
lipo: can<span style="color: #ff0000;">'t open input file: /var/folders/os/osNwawQ0Hreve7NDQEugQ++++TI/-Tmp-//ccD17Dx3.out (No such file or directory)<br />
make[1]: *** [Vim] Error 1<br />
make: *** [first] Error 2</span></div></td></tr></tbody></table></div>
<p>I did not do any <a href="http://en.wikipedia.org/wiki/Sherlock_Holmes">Sherlock holmes</a> work to understand this message as I do not need PPC support. I learned that there is a flag called &#8216;<strong>&#8211;with-mac-arch</strong>&#8216;.</p>
<h3>2. configure with specifying architecture</h3>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&gt;</span> .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--with-mac-arch</span>=intel <span style="color: #660033;">--enable-rubyinterp</span> <span style="color: #660033;">--enable-multibyte</span> <span style="color: #660033;">--with-features</span>=huge<br />
<br />
checking <span style="color: #660033;">--with-tlib</span> argument... empty: automatic terminal library selection<br />
checking <span style="color: #000000; font-weight: bold;">for</span> tgetent <span style="color: #000000; font-weight: bold;">in</span> -lncurses... <span style="color: #7a0874; font-weight: bold;">&#40;</span>cached<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #c20cb9; font-weight: bold;">yes</span><br />
ncurses library is not usable<br />
checking <span style="color: #000000; font-weight: bold;">for</span> tgetent <span style="color: #000000; font-weight: bold;">in</span> -ltermlib... no<br />
checking <span style="color: #000000; font-weight: bold;">for</span> tgetent <span style="color: #000000; font-weight: bold;">in</span> -ltermcap... no<br />
checking <span style="color: #000000; font-weight: bold;">for</span> tgetent <span style="color: #000000; font-weight: bold;">in</span> -lcurses... no<br />
no terminal library found<br />
checking <span style="color: #000000; font-weight: bold;">for</span> tgetent<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>... configure: error: NOT FOUND<span style="color: #000000; font-weight: bold;">!</span><br />
&nbsp; &nbsp; &nbsp; You need to <span style="color: #c20cb9; font-weight: bold;">install</span> a terminal library; <span style="color: #000000; font-weight: bold;">for</span> example ncurses.<br />
&nbsp; &nbsp; &nbsp; Or specify the name of the library with --with-tlib.</div></td></tr></tbody></table></div>
<p>But as you can see specifying architecture did not even make is trough configure. I tried to specifying &#8211;with-tlib and adding LIBS path did not help. I did spend quite some time on this step to solve this one, but no luck here.</p>
<h3>3. The working solution.</h3>
<p>This became the working solution for me. Not that pretty but it did work <img src='http://www.pastbedti.me/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Run ./configure without arch flags.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--enable-rubyinterp</span> <span style="color: #660033;">--enable-multibyte</span> <span style="color: #660033;">--with-features</span>=huge</div></td></tr></tbody></table></div>
<p>When done, edit src/auto/config.mk and remove PPC arch.<br />
And yes! I know editing src/auto/config.mk  is not that good and that the file is getting overwritten every time you run configure</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #c20cb9; font-weight: bold;">vim</span> src<span style="color: #000000; font-weight: bold;">/</span>auto<span style="color: #000000; font-weight: bold;">/</span>config.mk</div></td></tr></tbody></table></div>
<p>on Line 26</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; LDFLAGS &nbsp; = -L. <span style="color: #660033;">-arch</span> ppc <span style="color: #660033;">-arch</span> i386 &nbsp;-L<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib</div></td></tr></tbody></table></div>
<p>Remove the PPC part &#8220;<strong>-arch ppc</strong>&#8221;<br />
After removing PPC you can run:</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">make</span><br />
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></div></td></tr></tbody></table></div>
<p>I hope this can save someone else some time and i hope this is one of many to come blog posts that involves VIM!</p>
<p>Cheers! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2009/01/how-to-compile-vim-under-os-x/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>New version of capistrano_colors released.</title>
		<link>http://www.pastbedti.me/2009/01/new-version-of-capistrano_colors-released/</link>
		<comments>http://www.pastbedti.me/2009/01/new-version-of-capistrano_colors-released/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 15:36:40 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[gems]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[colorize]]></category>
		<category><![CDATA[colors]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=328</guid>
		<description><![CDATA[Just released a new version of capistrano_colors. This is a total rewrite from the last version. This post show some of the bigger changes. The biggest/coolest changes: You can write your own custom machers and colorize rows that&#8217;s special for you. I found a pretty neat way of making capistrano_colors system wide. You can hide [...]]]></description>
			<content:encoded><![CDATA[<p>Just released a new version of capistrano_colors. This is a total rewrite from the last version. This post show some of the bigger changes.<br />
<span id="more-328"></span></p>
<p>The biggest/coolest changes:</p>
<ul>
<li>You can write your own custom machers and colorize rows that&#8217;s special for you.</li>
<li>I found a pretty neat way of making capistrano_colors system wide.</li>
<li>You can hide rows that you do not care for</li>
</ul>
<p>I do not want to bore you more so I&#8217;ll just skip to an example <img src='http://www.pastbedti.me/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>If you have not already, install capistrano_colors (v.0.5.0)</p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp;sudo gem install capistrano_colors</div></td></tr></tbody></table></div>
<p>The following commands can go into deploy.rb or ~/.caprc depending if you want cc for a single project or system wide.</p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp;<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'capistrano_colors'</span><br />
<br />
&nbsp; &nbsp;capistrano_color_matchers = <span style="color:#006600; font-weight:bold;">&#91;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:match</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">/</span>command finished<span style="color:#006600; font-weight:bold;">/</span>, &nbsp; &nbsp; &nbsp; <span style="color:#ff3333; font-weight:bold;">:color</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:hide</span>, &nbsp; &nbsp; &nbsp;<span style="color:#ff3333; font-weight:bold;">:prio</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">10</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,<br />
&nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:match</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">/</span>executing command<span style="color:#006600; font-weight:bold;">/</span>, &nbsp; &nbsp; &nbsp;<span style="color:#ff3333; font-weight:bold;">:color</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:blue</span>, &nbsp; &nbsp; &nbsp;<span style="color:#ff3333; font-weight:bold;">:prio</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">10</span>, <span style="color:#ff3333; font-weight:bold;">:attribute</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:underscore</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,<br />
&nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:match</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">/</span>^transaction: commit$<span style="color:#006600; font-weight:bold;">/</span>, &nbsp;<span style="color:#ff3333; font-weight:bold;">:color</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:magenta</span>, &nbsp; <span style="color:#ff3333; font-weight:bold;">:prio</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">10</span>, <span style="color:#ff3333; font-weight:bold;">:attribute</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:blink</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,<br />
&nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#ff3333; font-weight:bold;">:match</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">/</span>git<span style="color:#006600; font-weight:bold;">/</span>, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#ff3333; font-weight:bold;">:color</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:white</span>, &nbsp; &nbsp; <span style="color:#ff3333; font-weight:bold;">:prio</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">20</span>, <span style="color:#ff3333; font-weight:bold;">:attribute</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#ff3333; font-weight:bold;">:reverse</span> <span style="color:#006600; font-weight:bold;">&#125;</span>,<br />
&nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#93;</span><br />
<br />
&nbsp; &nbsp;colorize<span style="color:#006600; font-weight:bold;">&#40;</span> capistrano_color_matchers <span style="color:#006600; font-weight:bold;">&#41;</span></div></td></tr></tbody></table></div>
<p>The only mandatory options are :match, :colors and :prio.</p>
<p>A fast description of the options:</p>
<li>:match     &#8211; A regular expression of the row to match.</li>
<li>:color     &#8211; The color we want on the matching rows.</li>
<li>:prio      &#8211; What prio should this rule have (higher = more prio)</li>
<li>:attribute &#8211; Special effect (:underline, :reverse, :blink)</li>
<li>:level     &#8211; Specify if this matcher should be bound to some of capistranos log levels (info,debug,&#8230;)</li>
<p>A more detailed description can be found at <a href="http://github.com/stjernstrom/capistrano_colors/tree/master">http://github.com/stjernstrom/capistrano_colors/tree/master</a></p>
<p>As this is a rewrite I would love some feedback.</p>
<p>Thanks! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2009/01/new-version-of-capistrano_colors-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby enterprise edition (REE) on Gentoo failed and some performance experience.</title>
		<link>http://www.pastbedti.me/2008/12/ruby-enterprise-edition-ree-on-gentoo-failed-and-some-performance-experience/</link>
		<comments>http://www.pastbedti.me/2008/12/ruby-enterprise-edition-ree-on-gentoo-failed-and-some-performance-experience/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 20:44:36 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby_enterprise]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=280</guid>
		<description><![CDATA[Today I got the chance to give Ruby Enterprise Edition a try. We are currently working with a really fun new environment and you do not get better opportunities to try new stuff as when you have a complete new environment thats not in production. So we gave REE a shoot. When compiling REE with got in trouble really fast and this [...]]]></description>
			<content:encoded><![CDATA[<p>Today I got the chance to give <a href="http://www.rubyenterpriseedition.com/">Ruby Enterprise Edition</a> a try. We are currently working with a really fun new environment and you do not get better opportunities to try new stuff as when you have a complete new environment thats not in production. So we gave REE a shoot. When compiling REE with got in trouble really fast and this post is about the quick fix to solve it and some of our early performance results.</p>
<p><span id="more-280"></span></p>
<p>The installation of REE is nothing more that unpacking ruby-enterprise-1.8.6-20081205.tar.gz and the run the installer.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">tar</span> xzvf ruby-enterprise-1.8.6-<span style="color: #000000;">20081205</span>.tar.gz</div></td></tr></tbody></table></div>
<p>And after that we run</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">.<span style="color: #000000; font-weight: bold;">/</span>ruby-enterprise-1.8.6-<span style="color: #000000;">20081205</span><span style="color: #000000; font-weight: bold;">/</span>installer</div></td></tr></tbody></table></div>
<p>This is when our problems started.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #660033;">-R</span> g+r,o+r,o-w <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>ruby-enterprise-1.8.6-<span style="color: #000000;">20081205</span><span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby<br />
<span style="color: #660033;">--------------------------------------------</span><br />
Installing RubyGems...<br />
<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>ruby-enterprise-1.8.6-<span style="color: #000000;">20081205</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby setup.rb <span style="color: #660033;">--no-ri</span> <span style="color: #660033;">--no-rdoc</span><br />
<span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>ruby-enterprise-1.8.6-<span style="color: #000000;">20081205</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby: no such <span style="color: #c20cb9; font-weight: bold;">file</span> to load <span style="color: #660033;">--</span> auto_gem <span style="color: #7a0874; font-weight: bold;">&#40;</span>LoadError<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">***</span> Cannot <span style="color: #c20cb9; font-weight: bold;">install</span> RubyGems</div></td></tr></tbody></table></div>
<p>This one took some time to find but first I could not understand why auto_gem was not found and also why it tried to load auto_gem when the installation of rubygems is not done.</p>
<p>After a few minutes of thinking and digging i found my environment variable RUBYOPT which was set to -rauto_gem.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">RUBYOPT</span>=-rauto_gem</div></td></tr></tbody></table></div>
<p>This one makes rubygems to autoload when you run something in ruby. I already had this line because i had ruby/rubygems installed before we installed REE. I still want this enviroment but not during the installation so i disabled it by starting the installer like this:</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">RUBYOPT</span>=<span style="color: #ff0000;">&quot;&quot;</span> .<span style="color: #000000; font-weight: bold;">/</span>ruby-enterprise-1.8.6-<span style="color: #000000;">20081205</span><span style="color: #000000; font-weight: bold;">/</span>installer</div></td></tr></tbody></table></div>
<p>Passing the environment variable before the command just sets it for this command.</p>
<p>If you do want this change permanent some digging in /etc found there is no less that 3 files where this variable is set <em>(depending of shells)</em>.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-R</span> <span style="color: #ff0000;">&quot;RUBYOPT&quot;</span> <span style="color: #000000; font-weight: bold;">*</span><br />
csh.env:setenv RUBYOPT <span style="color: #ff0000;">'-rauto_gem'</span><br />
env.d<span style="color: #000000; font-weight: bold;">/</span>10rubygems:<span style="color: #007800;">RUBYOPT</span>=<span style="color: #ff0000;">&quot;-rauto_gem&quot;</span><br />
profile.env:export <span style="color: #007800;">RUBYOPT</span>=<span style="color: #ff0000;">'-rauto_gem'</span></div></td></tr></tbody></table></div>
<p>After changing this variable everything worked as expected! </p>
<p>So far our experience with REE is great. With plain old ruby we where running about 15 <a href="http://www.modrails.com/">passenger (mod_rails)</a> instances and we where using around 1.6GB memory. After The ruby enterprise upgrade we are now using 26 instances with only 1.7GB memory. CPU loads when stressing seems to be 50% less with REE and pages load times are much more stable.</p>
<p>You have to take these measurements with a bit of salt because we only had around an hour of testing but they seem pretty impressive so far.</p>
<p>I will get back with more performance data as we play.</p>
<p>Cheers! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2008/12/ruby-enterprise-edition-ree-on-gentoo-failed-and-some-performance-experience/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>The developers behind Newsdesk have a weblog!</title>
		<link>http://www.pastbedti.me/2008/11/the-developers-behind-newsdesk-have-a-weblog/</link>
		<comments>http://www.pastbedti.me/2008/11/the-developers-behind-newsdesk-have-a-weblog/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 19:21:21 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[charts]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=236</guid>
		<description><![CDATA[Finally my friends at newsdesk have a blog. They have started off real good with a comparison of three ruby wrappers for Google charts. I have great expectations from the newsdesk developers blog. If you are a Ruby and Rails developer you should definitely keep and eye on them!]]></description>
			<content:encoded><![CDATA[<p>Finally my friends at <a href="http://www.newsdesk.se/">newsdesk</a> have a blog. They have started off real good with <a href="http://developer.newsdesk.se/2008/11/25/using-google-charts-from-rails/">a comparison of three ruby wrappers for Google charts</a>.</p>
<p>I have great expectations from the <a href="http://developer.newsdesk.se/">newsdesk developers blog</a>. If you are a Ruby and Rails developer you should definitely keep and eye on them! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2008/11/the-developers-behind-newsdesk-have-a-weblog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Merb 1.0 and Empty reply from server</title>
		<link>http://www.pastbedti.me/2008/11/merb-10-and-empty-reply-from-server/</link>
		<comments>http://www.pastbedti.me/2008/11/merb-10-and-empty-reply-from-server/#comments</comments>
		<pubDate>Sun, 16 Nov 2008 13:51:03 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Merb]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[gems]]></category>

		<guid isPermaLink="false">http://www.pastbedti.me/?p=161</guid>
		<description><![CDATA[Yesterday I upgraded merb to 1.0 and I got in some trouble that I solved pretty fast. Last night I started an empty application an got trouble again, but this time for real. I did a fresh install (removed all merb gems and datamapper gems). I generated a fresh merb app with merb-gen but i [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday <a href="http://www.pastbedti.me/2008/11/updating-rubygems-to-131-on-mac-os-x-1055/">I upgraded merb to 1.0</a> and I got in some trouble that I solved pretty fast. Last night I started an empty application an got trouble again, but this time for real. I did a fresh install (removed all merb gems and datamapper gems). I generated a fresh merb app with merb-gen but i could not get it to work and all i got from merb was empty replies. </p>
<p>In this post I will try to describe the steps I took to track the problem down and how I solved it.<br />
<span id="more-161"></span></p>
<p>(<a href="#summary">I don&#8217;t care about this long post so just take me to the solution</a>)</p>
<h3>How i generated the app (on a fresh merb install)</h3>
<p>Instruction from <a href="http://wiki.merbivore.com/howto/gettingstarted/firstapp">http://wiki.merbivore.com/howto/gettingstarted/firstapp</a></p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&gt;</span> merb-gen app testapp<br />
<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #7a0874; font-weight: bold;">cd</span> testapp<br />
<span style="color: #000000; font-weight: bold;">&gt;</span> merb-gen resource article title:string,content:text<br />
<span style="color: #000000; font-weight: bold;">&gt;</span> rake db:automigrate<br />
<span style="color: #000000; font-weight: bold;">&gt;</span> merb<br />
Loading init <span style="color: #c20cb9; font-weight: bold;">file</span> from <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>mathias<span style="color: #000000; font-weight: bold;">/</span>Documents<span style="color: #000000; font-weight: bold;">/</span>Dev<span style="color: #000000; font-weight: bold;">/</span>merb<span style="color: #000000; font-weight: bold;">/</span>testapp<span style="color: #000000; font-weight: bold;">/</span>config<span style="color: #000000; font-weight: bold;">/</span>init.rb<br />
Loading <span style="color: #000000; font-weight: bold;">/</span>Users<span style="color: #000000; font-weight: bold;">/</span>mathias<span style="color: #000000; font-weight: bold;">/</span>Documents<span style="color: #000000; font-weight: bold;">/</span>Dev<span style="color: #000000; font-weight: bold;">/</span>merb<span style="color: #000000; font-weight: bold;">/</span>testapp<span style="color: #000000; font-weight: bold;">/</span>config<span style="color: #000000; font-weight: bold;">/</span>environments<span style="color: #000000; font-weight: bold;">/</span>development.rb<br />
&nbsp;~ Connecting to database...<br />
&nbsp;~ Loaded slice <span style="color: #ff0000;">'MerbAuthSlicePassword'</span> ...<br />
&nbsp;~ Parent pid: <span style="color: #000000;">1239</span><br />
&nbsp;~ Compiling routes...<br />
&nbsp;~ Activating slice <span style="color: #ff0000;">'MerbAuthSlicePassword'</span> ...<br />
merb : worker <span style="color: #7a0874; font-weight: bold;">&#40;</span>port <span style="color: #000000;">4000</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ~ Starting Mongrel at port <span style="color: #000000;">4000</span><br />
merb : worker <span style="color: #7a0874; font-weight: bold;">&#40;</span>port <span style="color: #000000;">4000</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ~ Successfully bound to port <span style="color: #000000;">4000</span></div></td></tr></tbody></table></div>
<h3>Respons from merb</h3>
<p>When i point the browser to http://localhost:4000/articles I get the following in the browser</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Safari can’t open the page “http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">4000</span><span style="color: #000000; font-weight: bold;">/</span>articles<span style="color: #000000; font-weight: bold;">/</span>”.<br />
The error was: “Operation could not be completed. <span style="color: #7a0874; font-weight: bold;">&#40;</span>kCFErrorDomainCFNetwork error <span style="color: #000000;">302</span>.<span style="color: #7a0874; font-weight: bold;">&#41;</span>” <span style="color: #7a0874; font-weight: bold;">&#40;</span>kCFErrorDomainCFNetwork:<span style="color: #000000;">302</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
Please choose Report Bugs to Apple from the Safari menu, note the error number, and describe what you did before you saw this message.</div></td></tr></tbody></table></div>
<p>Testing the same url with curl i get</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&gt;</span> curl http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">4000</span><span style="color: #000000; font-weight: bold;">/</span>articles<br />
curl: <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">52</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> Empty reply from server</div></td></tr></tbody></table></div>
<p>And the only thing i see in the console is the following. No error, no nothing.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">merb : worker <span style="color: #7a0874; font-weight: bold;">&#40;</span>port <span style="color: #000000;">4000</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ~ Started request handling: Sat Nov <span style="color: #000000;">15</span> <span style="color: #000000;">20</span>:<span style="color: #000000;">39</span>:<span style="color: #000000;">57</span> +0100 <span style="color: #000000;">2008</span><br />
merb : worker <span style="color: #7a0874; font-weight: bold;">&#40;</span>port <span style="color: #000000;">4000</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ~ Routed to: <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #ff0000;">&quot;format&quot;</span>=<span style="color: #000000; font-weight: bold;">&gt;</span>nil, <span style="color: #ff0000;">&quot;action&quot;</span>=<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #ff0000;">&quot;index&quot;</span>, <span style="color: #ff0000;">&quot;controller&quot;</span>=<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #ff0000;">&quot;articles&quot;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
merb : worker <span style="color: #7a0874; font-weight: bold;">&#40;</span>port <span style="color: #000000;">4000</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ~ Params: <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #ff0000;">&quot;format&quot;</span>=<span style="color: #000000; font-weight: bold;">&gt;</span>nil, <span style="color: #ff0000;">&quot;action&quot;</span>=<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #ff0000;">&quot;index&quot;</span>, <span style="color: #ff0000;">&quot;controller&quot;</span>=<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #ff0000;">&quot;articles&quot;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span></div></td></tr></tbody></table></div>
<p>It seems that merb just drop the connection as soon as it get my request. The following part will be about my debugging. </p>
<h3>My effort to solve/debug the problem.</h3>
<p>First i followed the steps on <a href="http://wiki.merbivore.com/howto/installation/gems#troubleshooting">http://wiki.merbivore.com/howto/installation/gems#troubleshooting</a> and erased all my merb, datamapper and data_objects gems. Just to get a real clean start.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem update <span style="color: #660033;">--system</span><br />
<span style="color: #000000; font-weight: bold;">&gt;</span> gem search <span style="color: #660033;">--no-version</span> merb <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> merb <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem uninstall <span style="color: #660033;">-a</span><br />
<span style="color: #000000; font-weight: bold;">&gt;</span> gem search <span style="color: #660033;">--no-version</span> dm <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> dm <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem uninstall <span style="color: #660033;">-a</span><br />
<span style="color: #000000; font-weight: bold;">&gt;</span> gem search <span style="color: #660033;">--no-version</span> data_objects <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> data_objects <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">xargs</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem uninstall <span style="color: #660033;">-a</span><br />
<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem sources <span style="color: #660033;">-c</span><br />
<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Ruby<span style="color: #000000; font-weight: bold;">/</span>Gems<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span><span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/</span>merb<span style="color: #000000; font-weight: bold;">*</span><br />
<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Ruby<span style="color: #000000; font-weight: bold;">/</span>Gems<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span><span style="color: #000000; font-weight: bold;">/</span>cache<span style="color: #000000; font-weight: bold;">/</span>dm<span style="color: #000000; font-weight: bold;">*</span><br />
<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #660033;">-r</span> merb</div></td></tr></tbody></table></div>
<p>After this i created a new application but still with the same result. Now my only option was to dig deep in merb to se why i get those empty replies. <em>(I did stop by in #merb and got some suggestions but nothing helped)</em>. </p>
<p>I started in merb-core in the Dispatcher. The problem seems to be that merb cannot find any actions in my controllers. It does not raise an &#8220;action not found&#8221; but the problem points to actions/action args.</p>
<p>Digging deeper I finally find myself in merb-action-args. In the module GetArgs there is a function called get_args and it uses ParseTree to get all action and their arguments. After some simple debugging I found that this is the function that fail.</p>
<p>(Debugging took nearly 2 hours)</p>
<div class="codecolorer-container ruby twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="ruby codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color:#9966CC; font-weight:bold;">def</span> get_args<br />
&nbsp; &nbsp; &nbsp; klass, meth = <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">to_s</span>.<span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">/</span> <span style="color:#006600; font-weight:bold;">/</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">to_a</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span>..<span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#CC0066; font-weight:bold;">split</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;#&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color:#008000; font-style:italic;"># Remove stupidity for #&lt;Method: Class(Object)#foo&gt;</span><br />
&nbsp; &nbsp; &nbsp; klass = $<span style="color:#996600;">` if klass =~ /<span style="color:#000099;">\(</span>/<br />
&nbsp; &nbsp; &nbsp; ParseTreeArray.translate(Object.full_const_get(klass), meth).get_args<br />
&nbsp; &nbsp; end</span></div></td></tr></tbody></table></div>
<p>The row 5 silently fails.</p>
<p>This make me wonder whats up with my ParseTree installation. Listing my ParseTree gems get me notified of how many versions i have.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Select gem to uninstall:<br />
&nbsp;<span style="color: #000000;">1</span>. ParseTree-1.7.1<br />
&nbsp;<span style="color: #000000;">2</span>. ParseTree-2.1.1<br />
&nbsp;<span style="color: #000000;">3</span>. ParseTree-2.2.0<br />
&nbsp;<span style="color: #000000;">4</span>. ParseTree-3.0.1<br />
&nbsp;<span style="color: #000000;">5</span>. ParseTree-3.0.2<br />
&nbsp;<span style="color: #000000;">6</span>. All versions</div></td></tr></tbody></table></div>
<p>I first try to reinstall ParseTree with <em>sudo gem install ParseTree</em> to reinstall 3.0.2.<br />
The problem still exists so my next step is to uninstall all version and just install the last one.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem uninstall ParseTree<br />
<br />
Select gem to uninstall:<br />
&nbsp;<span style="color: #000000;">1</span>. ParseTree-1.7.1<br />
&nbsp;<span style="color: #000000;">2</span>. ParseTree-2.1.1<br />
&nbsp;<span style="color: #000000;">3</span>. ParseTree-2.2.0<br />
&nbsp;<span style="color: #000000;">4</span>. ParseTree-3.0.1<br />
&nbsp;<span style="color: #000000;">5</span>. All versions<br />
<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000;">5</span><br />
<br />
<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> ParseTree<br />
Successfully installed ParseTree-3.0.2<br />
<span style="color: #000000;">1</span> gem installed</div></td></tr></tbody></table></div>
<p>&nbsp;</p>
<h3>EVREKA!</h3>
<p>This makes merb happy again. Seems like my collection of ParseTree installations made merb unhappy. To get some more understanding of what version made this error i reinstalls all my old versions again, one after one. But after every last one is installed merb still works so there must have been something very wrong with my gems. It shows that i am not alone if you read the comments from a <a href="http://brainspl.at/articles/2008/11/08/merb-1-0#comment-5020">merb 1.0 blog post</a></p>
<h3 id="summary">Summary</h3>
<p>merb relies on other gems than the ones named merb-* in this case ParseTree. So when merb starts delivering empty results. There may be ParseTree thats broken. Just erase all ParseTree version and reinstall the ones you need and maybe you will be as happy as i am <img src='http://www.pastbedti.me/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Cheers! </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2008/11/merb-10-and-empty-reply-from-server/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Stuck with a gem that just wont uninstall</title>
		<link>http://www.pastbedti.me/2008/05/stuck-with-a-gem-that-just-wont-uninstall/</link>
		<comments>http://www.pastbedti.me/2008/05/stuck-with-a-gem-that-just-wont-uninstall/#comments</comments>
		<pubDate>Tue, 13 May 2008 18:56:05 +0000</pubDate>
		<dc:creator>Mathias Stjernström</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[gems]]></category>

		<guid isPermaLink="false">http://stjernstromblog.cust.globalinn.com/?p=9</guid>
		<description><![CDATA[Yesterday i was updating all my ruby gems. During the update a got disturbed by something so i did not pay attention what gems got updated. This morning i found my current app not starting up. This is how i solved it 123456789101112131415161718192021222324#script/server =&#62; Booting Mongrel (use 'script/server webrick' to force WEBrick) =&#62; Rails application [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday i was updating all my ruby gems. During the update a got disturbed by something so i did not pay attention what gems got updated.</p>
<p>This morning i found my current app not starting up.</p>
<p>This is how i solved it</p>
<p><span id="more-9"></span></p>
<div class="codecolorer-container html4strict twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">#script/server<br />
=&gt; Booting Mongrel (use 'script/server webrick' to force WEBrick)<br />
=&gt; Rails application starting on http://0.0.0.0:3000<br />
=&gt; Call with -d to detach<br />
=&gt; Ctrl-C to shutdown server<br />
** Starting Mongrel listening at 0.0.0.0:3000<br />
** Starting Rails with development environment...<br />
** Rails loaded.<br />
** Loading any Rails specific GemPlugins<br />
Exiting<br />
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1-java/lib/mongrel/init.rb (MissingSourceFile)<br />
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'<br />
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in `require'<br />
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in `new_constants_in'<br />
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:495:in `require'<br />
from /opt/local/lib/ruby/gems/1.8/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:134:in `load'<br />
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:184:in `each'<br />
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:184:in `each'<br />
from /opt/local/lib/ruby/gems/1.8/gems/gem_plugin-0.2.3/lib/gem_plugin.rb:112:in `load'<br />
... 21 levels...<br />
from /opt/local/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/server.rb:39<br />
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'<br />
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'<br />
from script/server:3`</div></td></tr></tbody></table></div>
<p>Ok, so now what? I know i do not run java. Not just yet.</p>
<p>My update last night must have installed a mongrel-1.1-java, no biggy i just uninstall.</p>
<div class="codecolorer-container html4strict twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">gem uninstall mongrel<br />
<br />
Select gem to uninstall:<br />
1. mongrel-1.0.1<br />
2. mongrel-1.0.2<br />
3. mongrel-1.1<br />
4. mongrel-1.1-java<br />
5. mongrel-1.1.1<br />
6. mongrel-1.1.4<br />
7. All versions<br />
&gt; 4<br />
INFO: &nbsp;In order to remove mongrel, please execute:<br />
gem uninstall mongrel --install-dir=/opt/local/lib/ruby/gems/1.8</div></td></tr></tbody></table></div>
<p>If i add the install dir i get the same result. Just for fun i try to delete the ruby-java-gem folder -&gt; /opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1-jruby/</p>
<p>But still the same error and gem still think the gem is installed.</p>
<p>This became my solution</p>
<p>For each installed gem there is a gemspec file that holds information about the gem. After deleting the gemspec for ruby-1.1-java everything went back to normal.</p>
<div class="codecolorer-container html4strict twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo rm /opt/local/lib/ruby/gems/1.8/specifications/mongrel-1.1.1.gemspec</div></td></tr></tbody></table></div>
<p>Hope this can help someone <img src='http://www.pastbedti.me/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pastbedti.me/2008/05/stuck-with-a-gem-that-just-wont-uninstall/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

