<?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, 12 Mar 2010 10:30:31 +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>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>
]]></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>
		<item>
		<title>Pdf with .doc templates using prawn in Ruby on Rails</title>
		<link>http://www.42.mach7x.com/2009/09/09/pdf-with-doc-templates-using-prawn-in-ruby-on-rails/</link>
		<comments>http://www.42.mach7x.com/2009/09/09/pdf-with-doc-templates-using-prawn-in-ruby-on-rails/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 13:21:48 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[2.3.4]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[doc]]></category>
		<category><![CDATA[ImageMagick]]></category>
		<category><![CDATA[odt]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[prawn]]></category>
		<category><![CDATA[prawnto]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=138</guid>
		<description><![CDATA[Problem
You want to generate pdf documents in your Ruby on Rails app using .doc templates.
Solution
Open the .doc document in OpenOffice and save it as an Open Document Format (.odt).
Open the saved .odt document and export to pdf, making sure you use &#8216;Losless compression&#8217; in the General Options section.
Use imagemagick&#8217;s convert to make the pdf file [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
You want to generate pdf documents in your Ruby on Rails app using .doc templates.</p>
<p><strong>Solution</strong><br />
Open the .doc document in OpenOffice and save it as an Open Document Format (.odt).</p>
<p>Open the saved .odt document and export to pdf, making sure you use &#8216;Losless compression&#8217; in the General Options section.</p>
<p>Use imagemagick&#8217;s convert to make the pdf file to an image (setting the density to your requirements &#8211; default is 72dpi):</p>
<p><span class="code">convert -density 150 one.pdf one.png</span></p>
<p>Copy the image one.png to your rails image directory (public/images).</p>
<p>Use the image as a background to the pdf created by prawnto (install plugin if you don&#8217;t have it) with:</p>
<p><span class="code">templ=&#8221;#{RAILS_ROOT}/public/images/one.png&#8221;<br />
pdf.image(templ, {:position => :center, :vposition => :top, :scale => 0.215})</span></p>
<p>Put the database field(s) text on position (you&#8217;ll have to play around with the coordinates to get it right), like:</p>
<p><span class="code">pdf.font &#8220;#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf&#8221;, :size => 9<br />
pdf.text &#8220;#{@model_name.fielda_name}&#8221;, :at => [100,530]<br />
pdf.text &#8220;#{@model_name.fieldb_name}&#8221;, :at => [100,510] &#8230;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2009/09/09/pdf-with-doc-templates-using-prawn-in-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Freezing gems (other than rails) on 2.3.4</title>
		<link>http://www.42.mach7x.com/2009/09/08/freezing-gems-other-than-rails-on-2-3-4/</link>
		<comments>http://www.42.mach7x.com/2009/09/08/freezing-gems-other-than-rails-on-2-3-4/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 20:17:04 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[Dreamhost]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[2.3.4]]></category>
		<category><![CDATA[freezing]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=132</guid>
		<description><![CDATA[Problem
Your host (ie dreamhost) for deploying applications doesn&#8217;t have the gems you are using in your development.
Solution
After freezing your rails gems with rake rails:freeze:gems, freeze the rest of your gems, not with rake gems:freeze gem=GEM_NAME, as used in previous versions of rails, but with:
rake gems:unpack
]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
Your host (ie dreamhost) for deploying applications doesn&#8217;t have the gems you are using in your development.</p>
<p><strong>Solution</strong><br />
After freezing your rails gems with rake rails:freeze:gems, freeze the rest of your gems, not with rake gems:freeze gem=GEM_NAME, as used in previous versions of rails, but with:</p>
<p><span class="code">rake gems:unpack</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2009/09/08/freezing-gems-other-than-rails-on-2-3-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
