<?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>42</title>
	<atom:link href="http://www.42.mach7x.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.42.mach7x.com</link>
	<description>Thoughts and tips about programming with Ruby on Rails</description>
	<lastBuildDate>Fri, 19 Mar 2010 09:42:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>undefined method &#8216;remap&#8217; for class &#8216;Magick::Image&#8217;</title>
		<link>http://www.42.mach7x.com/2010/03/18/undefined-method-remap-for-class-magickimage/</link>
		<comments>http://www.42.mach7x.com/2010/03/18/undefined-method-remap-for-class-magickimage/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 10:13:10 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[Dreamhost]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[ImageMagick]]></category>
		<category><![CDATA[Magick]]></category>
		<category><![CDATA[Remap]]></category>
		<category><![CDATA[Rmagick]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=180</guid>
		<description><![CDATA[Problem
You have just deployed your rails application to dreamhost but you are getting this error from passenger.
Solution
There was a change in the ImageMagic between versions 6.4.3 and 6.4.4 from the affinity function to remap.
If you don&#8217;t want, or don&#8217;t have time to recompile the ImageMagick and install the rmagick gem, you can comment out the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
You have just deployed your rails application to dreamhost but you are getting this error from passenger.</p>
<p><strong>Solution</strong><br />
There was a change in the ImageMagic between versions 6.4.3 and 6.4.4 from the affinity function to remap.<br />
If you don&#8217;t want, or don&#8217;t have time to recompile the ImageMagick and install the rmagick gem, you can comment out the two declarations for the alias functions, located around lines 782 and 1525 in the file rmagick-2.12.2/lib/RMagick.rb:</p>
<p><span class="code">alias_method :affinity, :remap</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2010/03/18/undefined-method-remap-for-class-magickimage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Freezing rails to an older version using gems</title>
		<link>http://www.42.mach7x.com/2010/03/15/freezing-rails-to-an-older-version-using-gems/</link>
		<comments>http://www.42.mach7x.com/2010/03/15/freezing-rails-to-an-older-version-using-gems/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 10:43:45 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[Dreamhost]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[2.3.2]]></category>
		<category><![CDATA[freezing]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=178</guid>
		<description><![CDATA[Problem
You want to deploy to a shared host (dreamhost) that has a later version of rails from the one you have developed your application.
You also have a later version installed in your development pc,and using rake rails:freeze:gems uses the latest one and not the one you want.
Solution
Use the following to freeze the specific version you [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
You want to deploy to a shared host (dreamhost) that has a later version of rails from the one you have developed your application.<br />
You also have a later version installed in your development pc,and using rake rails:freeze:gems uses the latest one and not the one you want.</p>
<p><strong>Solution</strong><br />
Use the following to freeze the specific version you want, and by using your gems you have installed:<br />
<span class="code">rake rails:freeze:gems VERSION=2.3.2</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2010/03/15/freezing-rails-to-an-older-version-using-gems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting your Github git project to dreamhost</title>
		<link>http://www.42.mach7x.com/2010/03/12/getting-your-github-git-project-to-dreamhost/</link>
		<comments>http://www.42.mach7x.com/2010/03/12/getting-your-github-git-project-to-dreamhost/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 10:17:06 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[Dreamhost]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[github]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=170</guid>
		<description><![CDATA[Problem
You already have a project in github, but you want to move it to a different host (ie dreamhost)
Solution
Following the post here that describes how to setup a new git repository in dreamhost, the only difference after the initial setup :
ssh username@dreamhost_domain.com
mkdir -p ~/git/yourproject.git
cd ~/git/yourproject.git
git &#8211;bare init
is to edit your project&#8217;s .git/config file:
vi local_host/your_project/.git/config
and change [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
You already have a project in github, but you want to move it to a different host (ie dreamhost)</p>
<p><strong>Solution</strong><br />
Following the post <a href="http://railstips.org/blog/archives/2008/11/23/gitn-your-shared-host-on/">here</a> that describes how to setup a new git repository in dreamhost, the only difference after the initial setup :</p>
<p><span class="code">ssh username@dreamhost_domain.com</br><br />
mkdir -p ~/git/yourproject.git</br><br />
cd ~/git/yourproject.git</br><br />
git &#8211;bare init</span></p>
<p>is to edit your project&#8217;s .git/config file:<br />
<span class="code">vi local_host/your_project/.git/config</span></p>
<p>and change the :<br />
<span class="code">url = git@github.com:user_name/project_name.git</span></p>
<p>to the following:<br />
<span class="code">ssh://dreamhost_username@dreamhost_domain/~/git/yourproject.git</span></p>
<p>Lastly you have to push for the first time to the server:<br />
<span class="code">git push origin master</span></p>
<p>Optionally if you would like to check and/or checkout to a different pc you can use:<br />
<span class="code">git clone ssh://dreamhost_username@dreamhost_domain/~/git/yourproject.git</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2010/03/12/getting-your-github-git-project-to-dreamhost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mandriva 2010, Dell Vostro 430, Broadcom Netlink BCM57780 problem</title>
		<link>http://www.42.mach7x.com/2010/03/11/mandriva-2010-dell-vostro-430-broadcom-netlink-bcm57780-problem/</link>
		<comments>http://www.42.mach7x.com/2010/03/11/mandriva-2010-dell-vostro-430-broadcom-netlink-bcm57780-problem/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 16:15:26 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[Mandriva]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[broadcom]]></category>
		<category><![CDATA[Dell Vostro 430]]></category>
		<category><![CDATA[mandriva 2010]]></category>
		<category><![CDATA[network]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=167</guid>
		<description><![CDATA[Problem
Just recently installed Mandriva 2010 in a new Dell Vostro 430 and the network card (Broadcom Netlink BCM57780) was not recognized.
Solution
Add the following to the /etc/modprobe.conf file:
sudo vi /etc/modprobe.conf
install tg3 /sbin/modprobe broadcom; /sbin/modprobe/ &#8211;ignore-install tg3
]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
Just recently installed Mandriva 2010 in a new Dell Vostro 430 and the network card (Broadcom Netlink BCM57780) was not recognized.</p>
<p><strong>Solution</strong><br />
Add the following to the /etc/modprobe.conf file:<br />
<span class="code">sudo vi /etc/modprobe.conf</span><br />
<span class="code">install tg3 /sbin/modprobe broadcom; /sbin/modprobe/ &#8211;ignore-install tg3</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2010/03/11/mandriva-2010-dell-vostro-430-broadcom-netlink-bcm57780-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>replacing comma with and in a list with ruby</title>
		<link>http://www.42.mach7x.com/2010/02/23/replacing-comma-with-and-in-a-list-with-ruby/</link>
		<comments>http://www.42.mach7x.com/2010/02/23/replacing-comma-with-and-in-a-list-with-ruby/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 17:47:51 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[and]]></category>
		<category><![CDATA[commas]]></category>
		<category><![CDATA[replacing]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=162</guid>
		<description><![CDATA[Problem
You have a list, usually after using join(&#8220;,&#8221;) in an array that consists of different values ie &#8220;one, two, three, four&#8221;, but you want to replace the last comma with and so it would be &#8220;one, two, three and four&#8221;.
Solution
Use reverse initially to reverse the string, then use sub to replace the last comma with [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
You have a list, usually after using join(&#8220;,&#8221;) in an array that consists of different values ie &#8220;one, two, three, four&#8221;, but you want to replace the last comma with and so it would be &#8220;one, two, three and four&#8221;.</p>
<p><strong>Solution</strong><br />
Use reverse initially to reverse the string, then use sub to replace the last comma with the word and reversed (dna), and then finally reverse the string again.</p>
<p><span class="code">string_with_and=string_with_commas.reverse.sub(/,/, &#8216; dna &#8216;).reverse</span</p>
<p>or, thanks to Akhil's comment, for Arrays in Rails we can use the to_sentence method as in:</p>
<p><span class="code">string_with_no_commas=array.to_sentence(options = {:last_word_connector => &#8221; and &#8220;})</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2010/02/23/replacing-comma-with-and-in-a-list-with-ruby/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>NoMethodError: Attempt to call private method in using Geokit rake task</title>
		<link>http://www.42.mach7x.com/2010/01/06/nomethoderror-attempt-to-call-private-method-in-using-geokit-rake-task/</link>
		<comments>http://www.42.mach7x.com/2010/01/06/nomethoderror-attempt-to-call-private-method-in-using-geokit-rake-task/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 12:32:56 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[Geokit]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[rake]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=159</guid>
		<description><![CDATA[Problem
Trying to use the rake task for populating latitude and longitude details for addresses as described in the Web mashup projects book, gives the error about attempting to call private method.
Solution
Use the method save instead of update as suggested in the book.
]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
Trying to use the rake task for populating latitude and longitude details for addresses as described in the Web mashup projects book, gives the error about attempting to call private method.</p>
<p><strong>Solution</strong><br />
Use the method save instead of update as suggested in the book.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2010/01/06/nomethoderror-attempt-to-call-private-method-in-using-geokit-rake-task/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NoMethodError: undefined method `timeout=&#8217; for Geokit::Geocoders:Module</title>
		<link>http://www.42.mach7x.com/2010/01/06/nomethoderror-undefined-method-timeout-for-geokitgeocodersmodule/</link>
		<comments>http://www.42.mach7x.com/2010/01/06/nomethoderror-undefined-method-timeout-for-geokitgeocodersmodule/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 11:32:29 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[Geokit]]></category>
		<category><![CDATA[Undefined method]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=157</guid>
		<description><![CDATA[Problem
Using the latest version of Geokit gives the error for undefined method &#8216;timeout&#8217;. This could happen if the gem/plugin didn&#8217;t modify the config/environment.rb file, and you had to copy the configuration values from an older version.
Solution
The configuration variable has changed in the latest version (1.5.0) from timeout to request_timeout, so change it in your config/environment.rb [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
Using the latest version of Geokit gives the error for undefined method &#8216;timeout&#8217;. This could happen if the gem/plugin didn&#8217;t modify the config/environment.rb file, and you had to copy the configuration values from an older version.</p>
<p><strong>Solution</strong><br />
The configuration variable has changed in the latest version (1.5.0) from timeout to request_timeout, so change it in your config/environment.rb  file as :<br />
<span class="code">GeoKit::Geocoders::request_timeout = 3</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2010/01/06/nomethoderror-undefined-method-timeout-for-geokitgeocodersmodule/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Flexigrid with MySQL field carriage returns</title>
		<link>http://www.42.mach7x.com/2010/01/05/using-flexigrid-with-mysql-field-carriage-returns/</link>
		<comments>http://www.42.mach7x.com/2010/01/05/using-flexigrid-with-mysql-field-carriage-returns/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 14:47:57 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[carriage return]]></category>
		<category><![CDATA[FlexiGrid]]></category>
		<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=154</guid>
		<description><![CDATA[Problem
You want to use flexigrid with a MySQL fields that contains carriage returns. As the flexigrid uses json it doesn&#8217;t work with carriage returns, and displays an empty page, instead of an error page.
Solution
In the page_name.json.erb file in the fields that has carriage returns  make sure that you use to_json method as in the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
You want to use flexigrid with a MySQL fields that contains carriage returns. As the flexigrid uses json it doesn&#8217;t work with carriage returns, and displays an empty page, instead of an error page.</p>
<p><strong>Solution</strong><br />
In the page_name.json.erb file in the fields that has carriage returns  make sure that you use to_json method as in the example below:</p>
<p><span class="code">&#8216;<%=fg_escape event.comments.to_json -%>&#8216;,</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2010/01/05/using-flexigrid-with-mysql-field-carriage-returns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>You&#8217;re in the middle of a conflicted merge (git)</title>
		<link>http://www.42.mach7x.com/2009/11/24/youre-in-the-middle-of-a-conflicted-merge-git/</link>
		<comments>http://www.42.mach7x.com/2009/11/24/youre-in-the-middle-of-a-conflicted-merge-git/#comments</comments>
		<pubDate>Tue, 24 Nov 2009 12:56:46 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=150</guid>
		<description><![CDATA[Problem
Trying to update (pull) in git causes the error &#8216;you&#8217;re in the middle of a conflicted merge&#8217;.
Solution
To be able to get out of this error try the followng:

git reset &#8211;hard HEAD
git fetch origin
git reset &#8211;hard origin

to reset the state, and then you should be able to use git pull as normal.
]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
Trying to update (pull) in git causes the error &#8216;you&#8217;re in the middle of a conflicted merge&#8217;.</p>
<p><strong>Solution</strong><br />
To be able to get out of this error try the followng:</p>
<ol>
<li>git reset &#8211;hard HEAD</li>
<li>git fetch origin</li>
<li>git reset &#8211;hard origin</li>
</ol>
<p>to reset the state, and then you should be able to use git pull as normal.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2009/11/24/youre-in-the-middle-of-a-conflicted-merge-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ferret installation error</title>
		<link>http://www.42.mach7x.com/2009/11/03/ferret-installation-error/</link>
		<comments>http://www.42.mach7x.com/2009/11/03/ferret-installation-error/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 17:28:12 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[Mandriva]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=148</guid>
		<description><![CDATA[Problem
Trying to install ferret with sudo gem install ferret fails with the following error:

fs_store.c:300: error: format not a string literal and no format arguments
make: *** [fs_store.o] Error 1
rake aborted!
Command failed with status (2): [make...]
Solution
As the installation was not possible by using the gem install command, the next step was to download the ferret.tar.gz file extract [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
Trying to install ferret with sudo gem install ferret fails with the following error:<br />
<span class="code"><br />
fs_store.c:300: error: format not a string literal and no format arguments<br />
make: *** [fs_store.o] Error 1<br />
rake aborted!<br />
Command failed with status (2): [make...]</span></p>
<p><strong>Solution</strong><br />
As the installation was not possible by using the gem install command, the next step was to download the ferret.tar.gz file extract it and try and install the plugin manually.<br />
It also failed with the same error message.<br />
After some googling for the error message it seems that newer gcc versions fail for non critical errors which in this case is caused by the make options <i>-Wformat -Werror=format-security</i><br />
So if you replace the:<br />
<span class="code">-Werror=format-security</span><br />
with<br />
<span class="code">-Wno-error</span></p>
<p>in the extracted folder/ext/Makefile</p>
<p>and then follow the original instructions as in:<br />
<span class="code"><br />
$ rake ext<br />
$ ruby setup.rb config<br />
$ ruby setup.rb setup<br />
# ruby setup.rb install</span></p>
<p>It should be installed correctly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2009/11/03/ferret-installation-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
