<?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 &#187; kosmas</title>
	<atom:link href="http://www.42.mach7x.com/author/kosmas/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>Wed, 01 Feb 2012 14:38:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Pausing between steps in cucumber</title>
		<link>http://www.42.mach7x.com/2012/02/01/pausing-between-steps-in-cucumber/</link>
		<comments>http://www.42.mach7x.com/2012/02/01/pausing-between-steps-in-cucumber/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 14:38:36 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[Cucumber]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[hooks]]></category>
		<category><![CDATA[pause tag]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=467</guid>
		<description><![CDATA[Problem You want to be able to go through a scenario step by step when you are testing with a browser as sometimes can be very fast. &#160; Solution By following the suggestion here you would only need to add the following to your features/support/hooks.rb file AfterStep('@pause') do print "Press Return to continue ..." STDIN.getc [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong></p>
<p>You want to be able to go through a scenario step by step when you are testing with a browser as sometimes can be very fast.</p>
<p>&nbsp;</p>
<p><strong>Solution</strong></p>
<p>By following the suggestion <a href="http://itshouldbeuseful.wordpress.com/tag/cucumber/">here</a> you would only need to add the following to your features/support/hooks.rb file</p>
<pre class="brush:ruby">AfterStep('@pause') do
  print "Press Return to continue ..."
  STDIN.getc
end</pre>
<p>and then you should be able to use it in your scenario by adding the @pause tag.<br />
Then you would have to press continue in your terminal to go step by step</p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2012/02/01/pausing-between-steps-in-cucumber/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using named gemsets with rvm</title>
		<link>http://www.42.mach7x.com/2012/01/31/using-named-gemsets-with-rvm/</link>
		<comments>http://www.42.mach7x.com/2012/01/31/using-named-gemsets-with-rvm/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 13:48:27 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[named gemsets]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rvm]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=464</guid>
		<description><![CDATA[Problem You want to be able to use different gems/rails version for your application after installing the latest rails version, without having to use bundle exec. &#160; Solution You can use the named gemsets with rvm. More instructions are here: http://beginrescueend.com/gemsets/basics/ so you can install two gemsets for example ruby-1.9.3-p0@rails3_0_11 and another with ruby-1.9.3-p0@rails3_2_1 you [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong></p>
<p>You want to be able to use different gems/rails version for your application after installing the latest rails version, without having to use bundle exec.</p>
<p>&nbsp;</p>
<p><strong>Solution</strong></p>
<p>You can use the named gemsets with rvm.</p>
<p>More instructions are here: http://beginrescueend.com/gemsets/basics/</p>
<p>so you can install two gemsets for example ruby-1.9.3-p0@rails3_0_11 and another with ruby-1.9.3-p0@rails3_2_1</p>
<p>you could then do :</p>
<pre class="brush:shell">rvm gemset create rails3_0_11 rails3_2_1

rvm 1.9.3-p0@rails3_0_11
gem install rails -v 3.0.11

rvm 1.9.3-p0@rails3_2_1
gem install rails -v 3.2.1

rvm gemset use rails3_0_11
bundle install</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2012/01/31/using-named-gemsets-with-rvm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Could not open library &#8216;libgtkmm-2.4.so&#8217;: libgtkmm-2.4.so: cannot open shared object file: No such file or directory.</title>
		<link>http://www.42.mach7x.com/2012/01/09/could-not-open-library-libgtkmm-2-4-so-libgtkmm-2-4-so-cannot-open-shared-object-file-no-such-file-or-directory/</link>
		<comments>http://www.42.mach7x.com/2012/01/09/could-not-open-library-libgtkmm-2-4-so-libgtkmm-2-4-so-cannot-open-shared-object-file-no-such-file-or-directory/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 10:28:23 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[Guard]]></category>
		<category><![CDATA[Kubuntu]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=461</guid>
		<description><![CDATA[Problem If you have setup guard with your Rails project and you are trying to run it in an (K)Ubuntu installation you get the following message: Could not open library 'libgtkmm-2.4.so': libgtkmm-2.4.so: cannot open shared object file: No such file or directory. Solution Install the missing library with the following: sudo apt-get install libgtkmm-2.4]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong></p>
<p>If you have setup guard with your Rails project and you are trying to run it in an (K)Ubuntu installation you get the following message:</p>
<pre class="brush:shell">Could not open library 'libgtkmm-2.4.so': libgtkmm-2.4.so: cannot open shared object file: No such file or directory.</pre>
<p><strong>Solution</strong></p>
<p>Install the missing library with the following:</p>
<pre class="brush:shell">sudo apt-get install libgtkmm-2.4</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2012/01/09/could-not-open-library-libgtkmm-2-4-so-libgtkmm-2-4-so-cannot-open-shared-object-file-no-such-file-or-directory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ImageMagick, RMagick, Kubuntu</title>
		<link>http://www.42.mach7x.com/2011/12/22/imagemagick-rmagick-kubuntu/</link>
		<comments>http://www.42.mach7x.com/2011/12/22/imagemagick-rmagick-kubuntu/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 14:35:58 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[ImageMagick]]></category>
		<category><![CDATA[Kubuntu]]></category>
		<category><![CDATA[Rmagick]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=458</guid>
		<description><![CDATA[Problem You want to use the rmagick gem in your rails application after a new (K)ubuntu system installation, but the bundler command gives you errors. &#160; Solution Install the following before running budler again: sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong></p>
<p>You want to use the rmagick gem in your rails application after a new (K)ubuntu system installation, but the bundler command gives you errors.</p>
<p>&nbsp;</p>
<p><strong>Solution</strong></p>
<p>Install the following before running budler again:</p>
<pre class="brush:shell">sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2011/12/22/imagemagick-rmagick-kubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cucumber &#8211; Carrierwave &#8211; ImageUploader &#8211; Variable class</title>
		<link>http://www.42.mach7x.com/2011/12/13/cucumber-carrierwave-imageuploader-variable-class/</link>
		<comments>http://www.42.mach7x.com/2011/12/13/cucumber-carrierwave-imageuploader-variable-class/#comments</comments>
		<pubDate>Tue, 13 Dec 2011 13:14:36 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[Cucumber]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Carriewave]]></category>
		<category><![CDATA[ImageUploader]]></category>
		<category><![CDATA[Variable Class and field name]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=453</guid>
		<description><![CDATA[Problem You would like to test the carrierwave imageuploader with a cucumber test, but you would also like to use a generic step that can be used with different classes and different image file column names. Solution Use the following and perhaps put it a file named features/common_steps.rb Then /^the url for the column "([^"]*)" [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
You would like to test the carrierwave imageuploader with a cucumber test, but you would also like to use a generic step that can be used with different classes and different image file column names.</p>
<p><strong>Solution</strong><br />
Use the following and perhaps put it a file named features/common_steps.rb</p>
<pre class="brush:ruby">Then /^the url for the column "([^"]*)" of model "([^"]*)" should be "([^"]*)"$/ do |col,mdl,url|
  # First get tne class name from the mdl argument by using the Kernel.const_get method
  m = Kernel.const_get(mdl).first
  # And then use the send with the column name (col) to call the model's field,
  # the url method of ImageUploader to get the full path
  # and basename to get only the file name
  File.basename(m.send(col).url).should == url
end</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2011/12/13/cucumber-carrierwave-imageuploader-variable-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing local timezone in Debian server</title>
		<link>http://www.42.mach7x.com/2011/12/05/changing-local-timezone-in-debian-server/</link>
		<comments>http://www.42.mach7x.com/2011/12/05/changing-local-timezone-in-debian-server/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 12:18:37 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=450</guid>
		<description><![CDATA[Problem You have developed your application in your local environment or you use it in an environment that has your local timezone, but your live deployment server is in a hosted server that has a different timezone. So a lot of the SQL queries, are not working correctly. &#160; Solution Login as root in your [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong></p>
<p>You have developed your application in your local environment or you use it in an environment that has your local timezone, but your live deployment server is in a hosted server that has a different timezone. So a lot of the SQL queries, are not working correctly.</p>
<p>&nbsp;</p>
<p><strong>Solution</strong></p>
<p>Login as root in your server and run:</p>
<pre class="brush:shell">dpkg-reconfigure tzdata
</pre>
<p>and then reload your database server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2011/12/05/changing-local-timezone-in-debian-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>setting dynamic event_source in jquery fullcalendar in rails application</title>
		<link>http://www.42.mach7x.com/2011/11/15/setting-dynamic-event_source-in-jquery-fullcalendar-in-rails-application/</link>
		<comments>http://www.42.mach7x.com/2011/11/15/setting-dynamic-event_source-in-jquery-fullcalendar-in-rails-application/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 16:46:28 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[JQuery]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[fullCalendar]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=446</guid>
		<description><![CDATA[Problem You would like to use the fullcalendar jquery plugin to be able to display events in your rails application, but you also want to be able to set the eventSources dynamically depending on the path to your view, especially if your view contains a relationship as in the following example: model_a/1/model_b (user/14/comments) Solution Change [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong></p>
<p>You would like to use the fullcalendar jquery plugin to be able to display events in your rails application, but you also want to be able to set the eventSources dynamically depending on the path to your view, especially if your view contains a relationship as in the following example:</p>
<p>model_a/1/model_b (user/14/comments)</p>
<p><strong>Solution</strong></p>
<p>Change your eventSources to be something like the following and using the jQuery.ajaxSettings.url :</p>
<pre class="brush:js"> // a future calendar might have many sources.
    eventSources: [{
      url: jQuery.ajaxSettings.url,
      color: 'orange',
      textColor: 'black',
      ignoreTimezone: false
    }],</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2011/11/15/setting-dynamic-event_source-in-jquery-fullcalendar-in-rails-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ActiveSupport::TimeWithZone comparisons</title>
		<link>http://www.42.mach7x.com/2011/11/03/activesupporttimewithzone-comparisons/</link>
		<comments>http://www.42.mach7x.com/2011/11/03/activesupporttimewithzone-comparisons/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 14:07:23 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[ActiveSupport::TimeWithZone]]></category>
		<category><![CDATA[Date Comparison]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=441</guid>
		<description><![CDATA[Problem You have two dates that you want to compare in your Rails application, which are both ActiveSupport::TimeWithZone. Although they both look identical, when you are trying to compare them for equality (using ==), you get back false as a result. &#160; Solution These dates can have a difference in milliseconds that doesn&#8217;t normally get [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
You have two dates that you want to compare in your Rails application, which are both ActiveSupport::TimeWithZone.</p>
<p>Although they both look identical, when you are trying to compare them for equality (using ==), you get back false as a result.</p>
<p>&nbsp;</p>
<p><strong>Solution</strong></p>
<p>These dates can have a difference in milliseconds that doesn&#8217;t normally get displayed. So first of all try to use to_f to see if they really have a difference.</p>
<p>If they do, then you would need to compare them by converting them to integers first as in :</p>
<p>date_a.to_i == date_b.to_i</p>
<p>and you should be getting back true</p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2011/11/03/activesupporttimewithzone-comparisons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The user limit on the total number of inotify watches was reached or the kernel failed to allocate a needed resource. (Errno::ENOSPC)</title>
		<link>http://www.42.mach7x.com/2011/10/24/the-user-limit-on-the-total-number-of-inotify-watches-was-reached-or-the-kernel-failed-to-allocate-a-needed-resource-errnoenospc/</link>
		<comments>http://www.42.mach7x.com/2011/10/24/the-user-limit-on-the-total-number-of-inotify-watches-was-reached-or-the-kernel-failed-to-allocate-a-needed-resource-errnoenospc/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 10:32:31 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[Cucumber]]></category>
		<category><![CDATA[RSpec]]></category>
		<category><![CDATA[BDD]]></category>
		<category><![CDATA[Carriewave]]></category>
		<category><![CDATA[Guard]]></category>
		<category><![CDATA[Spork]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=439</guid>
		<description><![CDATA[Problem When using the guard gem together with spork and cucumber and rspec to automate testing in your rails app, you get the following error: The user limit on the total number of inotify watches was reached or the kernel failed to allocate a needed resource. (Errno::ENOSPC) which also causes the guard to stop running. [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong></p>
<p>When using the guard gem together with spork and cucumber and rspec to automate testing in your rails app, you get the following error:</p>
<pre class="brush:shell">The user limit on the total number of inotify watches was reached or the kernel failed to allocate a needed resource. (Errno::ENOSPC)</pre>
<p>which also causes the guard to stop running.</p>
<p><strong>Solution</strong></p>
<p>Looking at the directory where the error takes place it appears there are a lot of temp files in the public/uploads/tmp directory that are not cleared up (using carrierwave for image uploading).<br />
Maybe adding an initializer as suggested <a href="https://github.com/jnicklas/carrierwave" title="carrierwave">here</a> would solve the clearing up of the files.<br />
Otherwise by manually deleting the files and running guard again, it should work as expected.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2011/10/24/the-user-limit-on-the-total-number-of-inotify-watches-was-reached-or-the-kernel-failed-to-allocate-a-needed-resource-errnoenospc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use devise to login user for RSpec tests</title>
		<link>http://www.42.mach7x.com/2011/10/20/use-devise-to-login-user-for-rspec-tests/</link>
		<comments>http://www.42.mach7x.com/2011/10/20/use-devise-to-login-user-for-rspec-tests/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 13:30:24 +0000</pubDate>
		<dc:creator>kosmas</dc:creator>
				<category><![CDATA[RSpec]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[devise]]></category>
		<category><![CDATA[log in]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.42.mach7x.com/?p=435</guid>
		<description><![CDATA[Problem You want to test with RSpec for links that are visible only after the user signs into the application. Solution Use the following before method in your RSpec test: before(:each) do @user = Factory(:user) sign_in @user end &#160;]]></description>
			<content:encoded><![CDATA[<p><strong>Problem</strong><br />
You want to test with RSpec for links that are visible only after the user signs into the application.</p>
<p><strong>Solution</strong><br />
Use the following before method in your RSpec test:</p>
<pre class="brush:ruby">before(:each) do
      @user = Factory(:user)
      sign_in @user
end</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.42.mach7x.com/2011/10/20/use-devise-to-login-user-for-rspec-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

