<?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>Gudasoft &#187; Rails</title>
	<atom:link href="http://www.gudasoft.com/category/english/development/rails-development/feed" rel="self" type="application/rss+xml" />
	<link>http://www.gudasoft.com</link>
	<description>Impossible is nothing</description>
	<lastBuildDate>Thu, 06 Oct 2011 07:17:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<item>
		<title></title>
		<link>http://www.gudasoft.com/english/development/rails-development/08/23/1374/1374/2011</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/08/23/1374/1374/2011#comments</comments>
		<pubDate>Tue, 23 Aug 2011 13:08:50 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=1374</guid>
		<description><![CDATA[If you have a lot of readings then Struct is the winner. If you have equal read/write then Hash And forget for OpenStruct Here is why and how I benchmark all those methods ﻿﻿﻿ guda: ~/vanilla_ui/vanilla_properties  (v2 *$ u=) ∴ irb ruby-1.8.7-p330 :001 &#62; require &#8216;benchmark&#8217; =&#62; true ruby-1.8.7-p330 :002 &#62; require &#8216;ostruct&#8217; =&#62; false [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a lot of readings then Struct is the winner.</p>
<p>If you have equal read/write then Hash</p>
<p>And forget for OpenStruct</p>
<p>Here is why and how I benchmark all those methods</p>
<p>﻿﻿﻿</p>
<div id="_mcePaste">guda: ~/vanilla_ui/vanilla_properties  (v2 *$ u=) ∴ irb</div>
<div id="_mcePaste">ruby-1.8.7-p330 :001 &gt; require &#8216;benchmark&#8217;</div>
<div id="_mcePaste">=&gt; true</div>
<div id="_mcePaste">ruby-1.8.7-p330 :002 &gt; require &#8216;ostruct&#8217;</div>
<div id="_mcePaste">=&gt; false</div>
<div id="_mcePaste">ruby-1.8.7-p330 :003 &gt; n = 5000000</div>
<div id="_mcePaste">=&gt; 5000000</div>
<div id="_mcePaste">ruby-1.8.7-p330 :004 &gt;</div>
<div id="_mcePaste">ruby-1.8.7-p330 :005 &gt;   puts &#8220;convertions&#8221;</div>
<div id="_mcePaste">convertions</div>
<div id="_mcePaste">=&gt; nil</div>
<div id="_mcePaste">ruby-1.8.7-p330 :006 &gt;</div>
<div id="_mcePaste">ruby-1.8.7-p330 :007 &gt;   Benchmark.bm do |x|</div>
<div id="_mcePaste"><span style="color: #339966;">ruby-1.8.7-p330 :008 &gt;      x.report(&#8220;Struct init at start&#8221;) { CustomerOne = Struct.new(:name, :age);  s = CustomerOne.new(&#8216;a&#8217;);   n.times do s.name; end }</span></div>
<div id="_mcePaste"><span style="color: #339966;">ruby-1.8.7-p330 :009?&gt;    x.report(&#8220;Struct with write op&#8221;) { CustomerTwo = Struct.new(:name, :age);  s = CustomerTwo.new;  s.name = &#8216;a&#8217;; n.times do s.name; end }</span></div>
<div id="_mcePaste"><span style="color: #339966;">ruby-1.8.7-p330 :010?&gt;    x.report(&#8220;Hash&#8221;) {  s = Hash.new;  s[:name] = &#8216;a&#8217;; n.times do   ; s[:name]; end }</span></div>
<div id="_mcePaste"><span style="color: #339966;">ruby-1.8.7-p330 :011?&gt;    x.report(&#8220;OpenStruct&#8221;) { s = OpenStruct.new;  s.name = &#8216;a&#8217;; n.times do   ;  s.name; end }</span></div>
<div id="_mcePaste">ruby-1.8.7-p330 :012?&gt;   end</div>
<div id="_mcePaste">user     system      total        real</div>
<div id="_mcePaste">Struct init at start</div>
<div id="_mcePaste"><span style="color: #ff0000;">1.160000   0.000000   1.160000 (  1.155457)</span></div>
<div id="_mcePaste"><span style="color: #ff0000;">Struct with write op  1.200000   0.000000   1.200000 (  1.208754)</span></div>
<div id="_mcePaste"><span style="color: #ff0000;">Hash  1.510000   0.000000   1.510000 (  1.507588)</span></div>
<div id="_mcePaste"><span style="color: #ff0000;">OpenStruct  5.990000   0.000000   5.990000 (  5.999714)</span></div>
<div id="_mcePaste">=&gt; true</div>
<div id="_mcePaste"></div>
<div>Lets do some = operations</div>
<div id="_mcePaste"><span style="color: #339966;">ruby-1.8.7-p330 :015 &gt;   Benchmark.bm do |x|</span></div>
<div id="_mcePaste"><span style="color: #339966;">ruby-1.8.7-p330 :016 &gt;      x.report(&#8220;Struct init at start&#8221;) { CustomerMale = Struct.new(:name, :age);  n.times do s = CustomerMale.new(&#8216;a&#8217;);  s.name; end }</span></div>
<div id="_mcePaste"><span style="color: #339966;">ruby-1.8.7-p330 :017?&gt;    x.report(&#8220;Hash&#8221;) { n.times do   ; s = Hash.new;  s[:name] = &#8216;a&#8217;; s[:name]; end }</span></div>
<div id="_mcePaste"><span style="color: #339966;">ruby-1.8.7-p330 :018?&gt;    x.report(&#8220;Struct with write op&#8221;) { CustomerFemale = Struct.new(:name, :age);  n.times do s = CustomerFemale.new;  s.name = &#8216;a&#8217;; s.name; end }</span></div>
<div id="_mcePaste"><span style="color: #339966;">ruby-1.8.7-p330 :019?&gt;    x.report(&#8220;OpenStruct&#8221;) { n.times do   ; s = OpenStruct.new;  s.name = &#8216;a&#8217;; s.name; end }</span></div>
<div id="_mcePaste"><span style="color: #339966;">ruby-1.8.7-p330 :020?&gt;   end</span></div>
<div id="_mcePaste"><span style="color: #ff0000;">user     system      total        real</span></div>
<div id="_mcePaste"><span style="color: #ff0000;">Struct init at start  9.930000   0.000000   9.930000 (  9.943670)</span></div>
<div id="_mcePaste"><span style="color: #ff0000;">Hash 11.090000   0.000000  11.090000 ( 11.127766)</span></div>
<div id="_mcePaste"><span style="color: #ff0000;">Struct with write op 12.230000   0.000000  12.230000 ( 12.243452)</span></div>
<div id="_mcePaste"><span style="color: #ff0000;">OpenStruct still working &#8230;.</span></div>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/08/23/1374/1374/2011/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>to_i or to_s is faster?</title>
		<link>http://www.gudasoft.com/english/development/rails-development/08/04/1371/to_i-or-to_s-is-faster/2011</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/08/04/1371/to_i-or-to_s-is-faster/2011#comments</comments>
		<pubDate>Thu, 04 Aug 2011 14:46:16 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=1371</guid>
		<description><![CDATA[require 'benchmark' n = 500000 puts "convertions" Benchmark.bm do &#124;x&#124; x.report("to_i") { n.times do   ; "123456789".to_i; end } x.report("to_s") { n.times do   ; 1234567890.to_s; end } x.report("to_sym") { n.times do   ; 1234567890.to_sym; end } end user     system      total        real to_i  0.310000   0.000000   0.310000 (  0.315844) to_s  0.490000   0.000000   0.490000 (  0.490607) to_sym  0.170000   0.000000   0.170000 [...]]]></description>
			<content:encoded><![CDATA[<pre>require 'benchmark'
n = 500000

puts "convertions"
Benchmark.bm do |x|
 x.report("to_i") { n.times do   ; "123456789".to_i; end }
 x.report("to_s") { n.times do   ; 1234567890.to_s; end }
 x.report("to_sym") { n.times do   ; 1234567890.to_sym; end }
end

user     system      total        real
to_i  0.310000   0.000000   0.310000 (  0.315844)
to_s  0.490000   0.000000   0.490000 (  0.490607)
to_sym  0.170000   0.000000   0.170000 (  0.171511)

Benchmark.bm(30) do |x|
 x.report("string.to_i == number") { n.times do   ; "123456789".to_i == 1234567890; end }
 x.report("number.to_s == string") { n.times do   ; 1234567890.to_s == '1234567890'; end }
 x.report("string.to_sym == string.to_sym") { n.times do   ; '1234567890'.to_sym == '1234567890'.to_sym; end }
 x.report("num.to_sym == string.to_sym") { n.times do   ; 1234567890.to_sym == '1234567890'.to_sym; end }
 x.report("number.sym == number.sym") { n.times do   ; 1234567890.to_sym == 1234567890.to_sym; end }
end

user     system      total        real
string.to_i == number           0.400000   0.000000   0.400000 (  0.401863)
number.to_s == string           0.740000   0.000000   0.740000 (  0.744603)
string.to_sym == string.to_sym  0.560000   0.000000   0.560000 (  0.574106)
num.to_sym == string.to_sym     0.460000   0.000000   0.460000 (  0.459292)
number.sym == number.sym        0.400000   0.000000   0.400000 (  0.399014)</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/08/04/1371/to_i-or-to_s-is-faster/2011/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails tip of the day</title>
		<link>http://www.gudasoft.com/english/development/rails-development/04/12/1346/rails-tip-of-the-day/2011</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/04/12/1346/rails-tip-of-the-day/2011#comments</comments>
		<pubDate>Tue, 12 Apr 2011 17:06:30 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=1346</guid>
		<description><![CDATA[Generating random string ActiveSupport::SecureRandom.hex(16)]]></description>
			<content:encoded><![CDATA[<p>Generating random string</p>
<pre>ActiveSupport::SecureRandom.hex(16)</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/04/12/1346/rails-tip-of-the-day/2011/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is Rails going down?</title>
		<link>http://www.gudasoft.com/english/development/rails-development/08/23/1312/is-rails-going-down/2010</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/08/23/1312/is-rails-going-down/2010#comments</comments>
		<pubDate>Mon, 23 Aug 2010 17:21:14 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=1312</guid>
		<description><![CDATA[The first Rails framework was fast. then it become slow, big and the idea of convetion over configuration becomes more poisoned. Currently to start with Rails you have to learn a lot of stuff which are added just now and is not sure how long they will stay. Also Rails is not targeting the developers [...]]]></description>
			<content:encoded><![CDATA[<p>The first Rails framework was fast. then it become slow, big and the idea of convetion over configuration becomes more poisoned.</p>
<p>Currently to start with Rails you have to learn a lot of stuff which are added just now and is not sure how long they will stay.</p>
<p>Also Rails is not targeting the developers to be fast but is targeting to be the perfect framework.</p>
<p>The price for that is that almost a year and a half there is no new version while the they refactor it.</p>
<p>No goodies like scafolding, only enterprise stuff around.</p>
<p>That is my personal opinion on this framework.</p>
<p>As I like to say &#8211; you cant leave your followers without food for such long time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/08/23/1312/is-rails-going-down/2010/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Piece of wizdom</title>
		<link>http://www.gudasoft.com/english/development/rails-development/08/22/1310/piece-of-wizdom/2010</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/08/22/1310/piece-of-wizdom/2010#comments</comments>
		<pubDate>Sun, 22 Aug 2010 06:54:49 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=1310</guid>
		<description><![CDATA[The original code &#60;%= select(&#8220;city&#8221;,&#8221;kind&#8221;, t(:place_types).map.map!.each{&#124;key, value&#124; [value, key]}, {:include_blank =&#62; t(:chose), :selected =&#62; @city.kind}) %&#62; The bad code t(:place_types).map.map!.each{&#124;key, value&#124; [value, key]}, {:include_blank =&#62; t(:chose), :selected =&#62; @city.kind}) the replacement key_values = t(:place_types).collect{&#124;key, value&#124; [value.to_s, key.to_s, ]} Rails.ouch.ouch.omg!]]></description>
			<content:encoded><![CDATA[<p>The original code</p>
<p>&lt;%= select(&#8220;city&#8221;,&#8221;kind&#8221;, t(:place_types).map.map!.each{|key, value| [value, key]}, {:include_blank =&gt; t(:chose), :selected =&gt; @city.kind}) %&gt;</p>
<p>The bad code</p>
<p>t(:place_types).map.map!.each{|key, value| [value, key]}, {:include_blank =&gt; t(:chose), :selected =&gt; @city.kind})</p>
<p>the replacement</p>
<p>key_values = t(:place_types).collect{|key, value| [value.to_s, key.to_s, ]}</p>
<p>Rails.ouch.ouch.omg!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/08/22/1310/piece-of-wizdom/2010/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Search Logic and whats wrong with it</title>
		<link>http://www.gudasoft.com/english/development/rails-development/07/31/1300/search-logic-and-whats-wrong-with-it/2010</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/07/31/1300/search-logic-and-whats-wrong-with-it/2010#comments</comments>
		<pubDate>Sat, 31 Jul 2010 19:16:29 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=1300</guid>
		<description><![CDATA[The idea of the Searchlogic is to save you time and give flexibility. The first time I saw this gem  I was very excited about it. With only a few lines of code an you have the whole search done. I have start using it. Once I want to apply it to a complicated search. [...]]]></description>
			<content:encoded><![CDATA[<p>The idea of the <a href="http://github.com/binarylogic/searchlogic">Searchlogic</a> is to save you time and give flexibility.</p>
<p>The first time I saw this gem  I was very excited about it.</p>
<p>With only a few lines of code an you have the whole search done. I have start using it.</p>
<p>Once I want to apply it to a complicated search. The problem was that I have to write more code and &#8220;patches&#8221; in order to keep the Searchlogic working&#8230;.</p>
<p>So my advice is &#8211; don&#8217;t use such boosters if you can apply your own solution. There will be aways a time when you want to extend your search and you will loose a lot of time search how to do it with the 3rd party solution.</p>
<p>Do it yourself.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/07/31/1300/search-logic-and-whats-wrong-with-it/2010/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Argh&#8230;this rmagick gem &#8211; aways difficult to install/maintain.</title>
		<link>http://www.gudasoft.com/english/development/05/11/1241/god-bless-google/2010</link>
		<comments>http://www.gudasoft.com/english/development/05/11/1241/god-bless-google/2010#comments</comments>
		<pubDate>Tue, 11 May 2010 14:12:28 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=1241</guid>
		<description><![CDATA[I have recently upgraded to Ubuntu 10.04 and I got this nasty rmagick gem error: RMagick2.so: This installation of RMagick was configured with ImageMagick 6.5.5 but ImageMagick 6.5.7-8 is in use. (RuntimeError) google for This installation of RMagick was configured with ImageMagick 6.5.5 but ImageMagick 6.5.7-8 is in use. (RuntimeError) then found this page in [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently upgraded to Ubuntu 10.04 and I got this nasty rmagick gem error:</p>
<p>RMagick2.so: This installation of RMagick was configured with ImageMagick 6.5.5 but ImageMagick 6.5.7-8 is in use. (RuntimeError)</p>
<p>google for <a href="http://www.google.com/search?hl=en&amp;q=t++This+installation+of+RMagick+was+configured+with+ImageMagick+6.5.5+but+ImageMagick+6.5.7-8+is+in+use.+%28RuntimeError%29&amp;aq=f&amp;aqi=&amp;aql=&amp;oq=&amp;gs_rfai=">This installation of RMagick was configured with ImageMagick 6.5.5 but ImageMagick 6.5.7-8 is in use. (RuntimeError)</a></p>
<p>then found <a href="http://uperro.blogspot.com/2010/05/after-upgrading-ubuntu-904-to-1004-lts.html">this page</a> in mixed English/Chinees</p>
<p>and finally got a <a href="http://adelio.org/redmine-lauft-nach-upgrade-auf-ubuntu-10-04-lucid-lynx-nicht-mehr/comment-page-1/">page</a> in German :)</p>
<p>Then I decide to write this post in English and slightly modify the solution</p>
<p>instead of putting</p>
<p>RMAGICK_BYPASS_VERSION_TEST = true in the deploy.rb</p>
<p>I have put this in the development.rb</p>
<p>and all it works &#8211; this way on the production I will be forced to use real compatible library or at least check again for another solution or gem.</p>
<p>AUCH! This solution doesn&#8217;t work even in development I got weird core dumps :( &#8230;so here it is another try</p>
<h1>Here is the real working  solution:</h1>
<pre>su -
git clone http://github.com/rmagick/rmagick.git
cd rmagick/
ruby setup.rb
ruby setup.rb  install</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/05/11/1241/god-bless-google/2010/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Nice code</title>
		<link>http://www.gudasoft.com/english/development/rails-development/04/20/1237/nice-code/2010</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/04/20/1237/nice-code/2010#comments</comments>
		<pubDate>Tue, 20 Apr 2010 15:51:35 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=1237</guid>
		<description><![CDATA[I have just finished one method and I was not happy with the code. Then I put a comment on top of the method &#8220;Far from perfect&#8230;.&#8221;. Then I read the class &#8211; it was ugly. here is the before def validate return if is_email == false found = InternetComunicatorType.find(:first, :conditions =&#62; { :is_email =&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>I have just finished one method and I was not happy with the code. Then I put a comment on top of the method &#8220;Far from perfect&#8230;.&#8221;.</p>
<p>Then I read the class &#8211; it was ugly.</p>
<p>here is the before</p>
<pre>def validate
 return if is_email == false
 found = InternetComunicatorType.find(:first, :conditions =&gt; {
 :is_email =&gt; true,
 })

 return unless found

 if found.id != id
 errors.add(:is_email, "We have already email type")
 return
 end
end
</pre>
<p>here is the after</p>
<pre>def validate
  if is_email
    found = InternetComunicatorType.find(:first, :conditions =&gt; {
      :is_email =&gt; true,
    })

    if found and found.id != id
      errors.add(:is_email, "We have already email type")
    end
  end
end</pre>
<p>The result is much far readable</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/04/20/1237/nice-code/2010/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mongoid presentations</title>
		<link>http://www.gudasoft.com/english/development/04/15/1235/mongoid-presentations/2010</link>
		<comments>http://www.gudasoft.com/english/development/04/15/1235/mongoid-presentations/2010#comments</comments>
		<pubDate>Thu, 15 Apr 2010 19:54:10 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[mongoid]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=1235</guid>
		<description><![CDATA[When starting with mongoid I have missed a lot some demo source code. How it works with controllers, does it plays nice with nested attributes, such things. Here is presentation of mongo  and here are some slides]]></description>
			<content:encoded><![CDATA[<p>When starting with mongoid I have missed a lot some demo source code.</p>
<p>How it works with controllers, does it plays nice with nested attributes, such things.</p>
<p>Here is <a href="http://vimeo.com/9864311">presentation</a> of mongo  and here are <a href="http://www.slideshare.net/jsmestad/mongodb-mongoid-with-rails">some slides</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/04/15/1235/mongoid-presentations/2010/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mongoid</title>
		<link>http://www.gudasoft.com/english/development/rails-development/04/01/1233/mongoid/2010</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/04/01/1233/mongoid/2010#comments</comments>
		<pubDate>Thu, 01 Apr 2010 19:09:12 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=1233</guid>
		<description><![CDATA[I writing this post for those who start using Mongo in their rails applications. I want to share my experience. First I discovered mongoid but then i saw mongo_mapper  &#8211; so I decide to go with the crowd. But! I was wrong. I there is no documentation for mongo_mapper but some blog posts arround, the [...]]]></description>
			<content:encoded><![CDATA[<p>I writing this post for those who start using Mongo in their rails applications. I want to share my experience. First I discovered mongoid but then i saw mongo_mapper  &#8211; so I decide to go with the crowd. But! I was wrong. I there is no documentation for mongo_mapper but some blog posts arround, the examples are not aways working and you have to fight with all the code &#8211; I don&#8217;t maybe I have found some old documentation. When you dive in the code &#8211; again no documentation and not clear behaviour. Maybe it is a good solution but for me it doesn&#8217;t work. I lost 1.5 days experimenting and hoping that the things will go.</p>
<p>Then I give a try with mongoid. It has wonderfull <a href="http://mongoid.org/docs/associations">documentation</a> for starters also it seems at first glance that the code in mongoid is more readably and human friendly. It took me 2hours to port all my models to mongoid.</p>
<p>The guy developing mongoid seems pretty active.</p>
<p>last words &#8211; it is pleasure to work with mongoid &#8211; I recommend it to all.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/04/01/1233/mongoid/2010/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting fast with rspec</title>
		<link>http://www.gudasoft.com/english/development/11/29/1179/getting-fast-with-rspec/2009</link>
		<comments>http://www.gudasoft.com/english/development/11/29/1179/getting-fast-with-rspec/2009#comments</comments>
		<pubDate>Sun, 29 Nov 2009 18:03:00 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=1179</guid>
		<description><![CDATA[get the gem from here http://github.com/timcharper/spork &#160; How to fix the Missing error http://chrisblunt.com/blog/2009/08/28/rails-configuring-rspec-for-spork/ &#160;]]></description>
			<content:encoded><![CDATA[<p>get the gem from here</p>
<p>http://github.com/timcharper/spork</p>
<p>&nbsp;</p>
<p>How to fix the Missing error</p>
<p>http://chrisblunt.com/blog/2009/08/28/rails-configuring-rspec-for-spork/</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/11/29/1179/getting-fast-with-rspec/2009/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 2.3.2+, memcached and logger</title>
		<link>http://www.gudasoft.com/english/development/rails-development/08/17/1058/rails-2-3-2-memcached-and-logger/2009</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/08/17/1058/rails-2-3-2-memcached-and-logger/2009#comments</comments>
		<pubDate>Mon, 17 Aug 2009 11:43:42 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=1058</guid>
		<description><![CDATA[Finally our twitterized version of psspy.se is ready. But! When in production &#8211; read with many connection &#8211; the memcached get overloaded by not closed connections and on 1024 it says &#8220;accept(): Too many open file&#8221; and memcached dies. After 1 day investigating the problem  we have found that the following line in the initializers [...]]]></description>
			<content:encoded><![CDATA[<p>Finally our twitterized version of psspy.se is ready. But! When in production &#8211; read with many connection &#8211; the memcached get overloaded by not closed connections and on 1024 it says</p>
<p>&#8220;accept(): Too many open file&#8221; and memcached dies.</p>
<p>After 1 day investigating the problem  we have found that the following line in the initializers is causing the problem</p>
<p>RAILS_DEFAULT_LOGGER.level = Logger::DEBUG</p>
<p>We havent investigating deeper but when commenting this line everything works fine.</p>
<p>We have tested with Rails 2.3.2 and 2.3.3 with memcache-client-1.7.4</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/08/17/1058/rails-2-3-2-memcached-and-logger/2009/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Ubuntu workstation configuration</title>
		<link>http://www.gudasoft.com/english/linux/06/24/989/my-ubutno-workstation-configuration/2009</link>
		<comments>http://www.gudasoft.com/english/linux/06/24/989/my-ubutno-workstation-configuration/2009#comments</comments>
		<pubDate>Wed, 24 Jun 2009 18:42:39 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[admini]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=989</guid>
		<description><![CDATA[XOrg configuration https://wiki.ubuntu.com/X/Config/Resolution cvt 1680 1050 75 xrandr &#8211;newmode &#8230;the output from cvt xrandr &#8211;newmode &#8220;1680x1050_75.00&#8243; 187.00 1680 1800 1976 2272 1050 1053 1059 1099 -hsync +vsync xrandr &#8211;addmode DVI-0 1680x1050_75.00 Lenovo Y510 You have to install the latest alsa. Then replace the existing kernel modules with the just build one. Then run depmod -a [...]]]></description>
			<content:encoded><![CDATA[<h1>XOrg configuration</h1>
<ul>
<li>https://wiki.ubuntu.com/X/Config/Resolution</li>
<li>cvt 1680 1050 75</li>
<li> xrandr &#8211;newmode &#8230;the output from cvt<br />
xrandr &#8211;newmode  &#8220;1680x1050_75.00&#8243;  187.00  1680 1800 1976 2272  1050 1053 1059 1099 -hsync +vsync</li>
<li> xrandr &#8211;addmode  DVI-0 1680x1050_75.00</li>
</ul>
<h1>Lenovo Y510</h1>
<p>You have to install the latest alsa.</p>
<p>Then replace the existing kernel modules with the just build one. Then run depmod -a as point kilbasar here</p>
<p>http://ubuntuforums.org/showthread.php?t=687663&amp;page=2</p>
<pre dir="ltr">sudo su
cd /lib/modules/2.6.22-14-generic/ubuntu/media/snd-hda-intel/
mv snd-hda-intel.ko snd-hda-intel.ko.bak
ln -s /lib/modules/2.6.22-14-generic/kernel/sound/pci/hda/snd-hda-intel.ko /lib/modules/2.6.22-14-generic/ubuntu/media/snd-hda-intel/snd-hda-intel.ko
cd /usr/src/alsa/alsa-driver-1.0.16rc2/modules
cp * /lib/modules/2.6.22-14-generic/kernel/sound/
depmod -a</pre>
<h1>Logitech Revolution MX</h1>
<p>http://x4.6times7.org/dokuwiki/doku.php/devlog/blog/howto_logitech_mx_revolution_on_ubuntu</p>
<ul>
<li>The mouse wheel control
<ul>
<li>Download from here http://goron.de/~froese/revoco/ or <a href="http://www.gudasoft.com/wp-content/uploads/2009/06/revoco-0.5.tar.gz">revoco-0.5.tar</a></li>
</ul>
<ul>
<li>make</li>
<li>sudo ./revoco manual=6</li>
<li><tt>lets try to add it in ~/.xprofile next time<br />
</tt></li>
</ul>
</li>
</ul>
<ul>
<li>Here is my xorg.conf</li>
</ul>
<pre>Section "Monitor"
 Identifier "External DVI"
 # 1680x1050 74.89 Hz (CVT 1.76MA) hsync: 82.31 kHz; pclk: 187.00 MHz
 Modeline "1680x1050_75.00"  187.00  1680 1800 1976 2272  1050 1053 1059 1099 -hsync +vsync
 # 1680x1050 59.95 Hz (CVT 1.76MA) hsync: 65.29 kHz; pclk: 146.25 MHz
 Modeline "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync
 # 1680x1050 69.88 Hz (CVT) hsync: 76.58 kHz; pclk: 174.00 MHz
 Modeline "1680x1050_70.00"  174.00  1680 1800 1976 2272  1050 1053 1059 1096 -hsync +vsync
 Option "PreferedMode"    "1280x1024_75.00"
EndSection

Section "Screen"
 Identifier    "Configured Screen Device"
 Device    "Configured Video Device"
 SubSection "Display"
 Depth    24
 Modes "1680x1050" "1024x768" "640x480"
 Virtual    2960 1050
 EndSubSection
EndSection

Section "Device"
 Identifier    "Configured Video Device"
 Option    "Monitor-DVI-0" "External DVI"
EndSection</pre>
<h1>My Development setup commands</h1>
<p>I noticed simillar post <a href="http://yobine.tistory.com/?page=3">here</a></p>
<pre>sudo aptitude install mc vim subversion screen pidgin meld curl links2 vim-ruby vim-gnome vim-doc vim-scripts vim-ruby vim-perl \
subversion git-core bluefish kompozer\
libmysqlclient15off libmysqlclient15-dev mysql-common mysql-client \
libmysql-ruby1.8 irb ruby1.8 rdoc ri rake \
apt-utils build-essential ruby1.8-dev mysql-server memcached libxslt1-dev libpcre3-dev zlib1g-dev unzip gzip mytop openssl \
libopenssl-ruby libmagick9-dev imagemagick librmagick-ruby1.8 imagemagick librmagick-ruby-doc  libmagick9-dev ruby1.8-dev \
libdbd-sqlite3-ruby libsqlite3-ruby sqlite3 libsqlite3-dev

ln -s /usr/bin/ruby1.8 /usr/bin/ruby

mkdir ruby_install
cd ruby_install
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
tar xzvf ruby*
cd rubygems-1.3.5
ruby setup.rb
cd ..
cd ..

ln -s /usr/bin/gem1.8 /usr/bin/gem

gem install rails mysql mongrel mongrel_cluster rails paperclip will_paginate andand \
json feed-normalizer hpricot mechanize ruby-debug uuid ruport ruport-util acts_as_reportable \
rufus-scheduler annotate openwferu-scheduler production_log_analyzer capistrano-ext libxml-ruby twitter capistrano wirble RedCloth
rspec-rails sqlite3-ruby \
--no-ri --no-rdoc

gem install rmagick -v 1.15.12
ruby -rrubygems -e "require 'RMagick'; puts Magick::Long_version;"

cat &gt; /home/guda/.irbrc
require 'rubygems'
require 'wirble'
Wirble.init
Wirble.colorize
require 'logger'
if ENV.include?('RAILS_ENV') &amp;&amp; !Object.const_defined?('RAILS_DEFAULT_LOGGER')
Object.const_set('RAILS_DEFAULT_LOGGER', Logger.new(STDOUT))
end

Gmail notification

http://www.workswithu.com/2009/10/06/gmail-notifier-applets-for-ubuntu/</pre>
<pre></pre>
<pre>What about <a href="http://ubuntu-tweak.com/">http://ubuntu-tweak.com/</a></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/linux/06/24/989/my-ubutno-workstation-configuration/2009/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rake mysql tasks</title>
		<link>http://www.gudasoft.com/english/development/rails-development/05/06/880/rake-mysql-tasks/2009</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/05/06/880/rake-mysql-tasks/2009#comments</comments>
		<pubDate>Wed, 06 May 2009 19:06:13 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rake]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=880</guid>
		<description><![CDATA[I have found that I should be quicker if I put the following task in all my small projects. require &#8216;find&#8217; namespace :mysql do desc &#8220;Perform mysql dump on the RAILS_ENV environment&#8221; task :dump =&#62; :environment do db_config = ActiveRecord::Base.configurations[RAILS_ENV] backup_file = &#8220;#{db_config['database']}.sql&#8221; cmd = &#8220;mysqldump -u #{db_config['username']} -p#{db_config['password']} -Q &#8211;add-drop-table -O add-locks=FALSE -O lock-tables=FALSE [...]]]></description>
			<content:encoded><![CDATA[<p>I have found that I should be quicker if I put the following task in all my small projects.<br />
<span id="more-880"></span></p>
<p>require &#8216;find&#8217;<br />
namespace :mysql do<br />
desc &#8220;Perform mysql dump on the RAILS_ENV environment&#8221;<br />
task :dump =&gt; :environment do<br />
db_config = ActiveRecord::Base.configurations[RAILS_ENV]<br />
backup_file = &#8220;#{db_config['database']}.sql&#8221;<br />
cmd = &#8220;mysqldump -u #{db_config['username']} -p#{db_config['password']} -Q &#8211;add-drop-table -O add-locks=FALSE -O lock-tables=FALSE #{db_config['database']} -r #{backup_file}&#8221;<br />
puts cmd<br />
sh cmd<br />
end</p>
<p>desc &#8220;imports the dumped database in the mysql FILE&#8221;<br />
task :import =&gt; :environment do |t, args|<br />
version = ENV["FILE"] ? ENV["FILE"].to_i : nil<br />
raise &#8220;FILE is required&#8221; unless version</p>
<p>db_config = ActiveRecord::Base.configurations[RAILS_ENV]<br />
backup_file = ENV["FILE"]<br />
sh &#8220;mysql -u #{db_config['username']} -p#{db_config['password']} -e \&#8221;CREATE DATABASE IF NOT EXISTS #{db_config['database']}\&#8221; &#8221;<br />
sh &#8220;mysql -u #{db_config['username']} -p#{db_config['password']} #{db_config['database']} &lt; #{backup_file}&#8221;<br />
end</p>
<p>desc &#8220;runs the mysql console for the selected RAILS_ENV&#8221;<br />
task :console =&gt; :environment do<br />
db_config = ActiveRecord::Base.configurations[RAILS_ENV]<br />
backup_file = &#8220;#{db_config['database']}.sql&#8221;<br />
cmd = &#8220;mysql -u #{db_config['username']} -p#{db_config['password']} #{db_config['database']}&#8221;<br />
sh cmd<br />
end</p>
<p>end</p>
<p>The task dumps just make a mysql dump from the current environment. Hmm. The next step is to transfer it with scp to my host.</p>
<p>Grab from <a href="http://errtheblog.com/posts/31-rake-around-the-rosie">here</a> the mysql console task</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/05/06/880/rake-mysql-tasks/2009/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysql gem and the mkfm error</title>
		<link>http://www.gudasoft.com/english/development/rails-development/04/14/789/mysql-gem-and-the-mkfm-error/2009</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/04/14/789/mysql-gem-and-the-mkfm-error/2009#comments</comments>
		<pubDate>Tue, 14 Apr 2009 15:44:32 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=789</guid>
		<description><![CDATA[The mysql gem was removed from the rails 2.3.2. and you need to install it via the gem install mysql command But! There is a problem compiling it. seems that the mysql cant find the libmysql so..here are the options: yum install openssl openssl-devel Configure with path to mysql_config and install the mysql api via [...]]]></description>
			<content:encoded><![CDATA[<pre>The mysql gem was removed from the rails 2.3.2. and you need to install it via the gem install mysql command
But! There is a problem compiling it. seems that the mysql cant find the libmysql so..here are the options:
yum install openssl openssl-devel

Configure with path to mysql_config and install the mysql api via gem:

# cd /usr/lib/ruby/gems/1.8/gems/mysql-2.7
# ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config
# make
# ruby ./test.rb [hostname [user [passwd [dbname [port [socket [flag]]]]]]]
# make install
# gem install mysql

Source: http://www.linuxweblog.com/ruby-on-rails-install

And after that you can read the README.html located in the mysql gem directory :)</pre>
<h1>Debian/Ubuntu</h1>
<pre> sudo aptitude install libmysqlclient-dev libmysql-ruby  libmysql++-dev ruby-dev</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/04/14/789/mysql-gem-and-the-mkfm-error/2009/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ruby classes and instances override</title>
		<link>http://www.gudasoft.com/uncategorized/02/16/526/ruby-classes-and-instances-override/2009</link>
		<comments>http://www.gudasoft.com/uncategorized/02/16/526/ruby-classes-and-instances-override/2009#comments</comments>
		<pubDate>Mon, 16 Feb 2009 13:43:25 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=526</guid>
		<description><![CDATA[module InstanceMethods def an_instance_method &#8220;You called an_instance_method on #{self.class}&#8221; end end module ClassMethods def a_class_method &#8220;You called a_class_method_from_module on #{self}&#8221; end def b_class_method puts &#8220;b_class_metbod&#8221; end end class MyClass include InstanceMethods extend ClassMethods def MyClass.a_class_method puts &#8220;Mine class Method&#8221; end def an_instance_method puts &#8220;Mine instance&#8221; end end my_class = MyClass.new puts my_class.an_instance_method puts MyClass.a_class_method puts [...]]]></description>
			<content:encoded><![CDATA[<p>module InstanceMethods<br />
def an_instance_method<br />
&#8220;You called an_instance_method on #{self.class}&#8221;<br />
end</p>
<p>end</p>
<p>module ClassMethods<br />
def a_class_method<br />
&#8220;You called a_class_method_from_module on #{self}&#8221;<br />
end</p>
<p>def b_class_method<br />
puts &#8220;b_class_metbod&#8221;<br />
end</p>
<p>end</p>
<p>class MyClass<br />
include InstanceMethods<br />
extend ClassMethods</p>
<p>def MyClass.a_class_method<br />
puts &#8220;Mine class Method&#8221;<br />
end</p>
<p>def an_instance_method<br />
puts &#8220;Mine instance&#8221;<br />
end<br />
end</p>
<p>my_class = MyClass.new<br />
puts my_class.an_instance_method<br />
puts MyClass.a_class_method<br />
puts MyClass.b_class_method</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/uncategorized/02/16/526/ruby-classes-and-instances-override/2009/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>seesaw gem configuration</title>
		<link>http://www.gudasoft.com/english/development/rails-development/11/10/269/seesaw-gem-configuration/2008</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/11/10/269/seesaw-gem-configuration/2008#comments</comments>
		<pubDate>Mon, 10 Nov 2008 03:20:35 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=269</guid>
		<description><![CDATA[I cant find good examples and help in Internet for seesaw gem. Maybe it is used only by very experirienced rails persons. I will publish my configurations in case they are helpfull to some one. guda@guda-desktop:~/system3/config$ cat seesaw.yml --- restart_cmd: sudo kill -HUP `cat /usr/local/nginx/logs/nginx.pid` config_symlink: http_cluster/cluster.conf mongrel_config_path: /home/mongrel/system3/current/config/mongrel_cluster.yml config_path: /home/mongrel/system3/current/config config_files: all: cluster_all.conf 1: [...]]]></description>
			<content:encoded><![CDATA[<p>I cant find good examples and help in Internet for seesaw gem. Maybe it is used only by very experirienced rails persons.</p>
<p>I will publish my configurations in case they are helpfull to some one.</p>
<p><code>
<pre>
guda@guda-desktop:~/system3/config$ cat seesaw.yml
---
restart_cmd: sudo kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
config_symlink: http_cluster/cluster.conf
mongrel_config_path: /home/mongrel/system3/current/config/mongrel_cluster.yml
config_path: /home/mongrel/system3/current/config
config_files:
  all: cluster_all.conf
  1: cluster_1.conf
  2: cluster_2.conf
symlink_cmd: ln -sf
</pre>
<p></code></p>
<p>here is where my nginx conf link points</p>
<p><code>
<pre>
guda@guda-desktop:~/system3/config/http_cluster$ ls -l
total 16
-rw-r--r-- 1 guda guda 152 2008-11-07 17:17 cluster_1.conf
-rw-r--r-- 1 guda guda 152 2008-11-07 17:17 cluster_2.conf
-rw-r--r-- 1 guda guda 277 2008-11-07 17:17 cluster_all.conf
lrwxrwxrwx 1 guda guda  66 2008-11-08 01:30 cluster.conf -> /home/mongrel/system3/current/config/http_cluster/cluster_all.conf
</pre>
<p></code></p>
<p>and in deploy.rb I have this task rewritten.</p>
<p><code>
<pre>
set :seesaw_conf, "#{current_path}/config/seesaw.yml"
namespace :deploy do
  desc <<-DESC
  Restart the Mongrel processes on the app server using seesaw
  DESC
  task :restart, :roles => :app do
    run <<-CMD
      cd #{current_path} ; #{mongrel_rails} seesaw::bounce -C #{seesaw_conf}
    CMD
#    send(run_method, "cd #{current_path}; #{mongrel_rails} seesaw::bounce -C #{seesaw_conf}")
  end
end
</pre>
<p></code></p>
<p>I am not sure that this is the perfect way of configurating the seesaw. I think that I have some mistakes in the path configurations, and because of that I have to patch the capistrano restart task.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/11/10/269/seesaw-gem-configuration/2008/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing notes for Rails on Debian/Ubunto</title>
		<link>http://www.gudasoft.com/english/development/rails-development/11/06/246/installing-notes-for-rails-on-debianubunto/2008</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/11/06/246/installing-notes-for-rails-on-debianubunto/2008#comments</comments>
		<pubDate>Thu, 06 Nov 2008 20:17:13 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=246</guid>
		<description><![CDATA[Debian Etch with backports Add this line in sources.list to get rails &#62; 1.8.5 in rails etch deb http://www.backports.org/debian etch-backports main contrib non-free # deb ftp://ftp.nz.debian.org/backports etch-backports main contrib non-free apt-get install debian-backports-keyring aptitude update # some ruby stuff aptitude install -t etch-backports ruby1.8-dev libmysqlclient15off libmysqlclient15-dev mysql-common mysql-client libmysql-ruby1.8 # some system utils/libs aptitude install [...]]]></description>
			<content:encoded><![CDATA[<p>Debian Etch with backports</p>
<p>Add this line in sources.list to get rails &gt; 1.8.5 in rails etch</p>
<pre><code>deb http://www.backports.org/debian etch-backports main contrib non-free
# deb ftp://ftp.nz.debian.org/backports etch-backports main contrib non-free
apt-get install debian-backports-keyring
aptitude update

# some ruby stuff
aptitude install -t etch-backports ruby1.8-dev libmysqlclient15off libmysqlclient15-dev mysql-common mysql-client libmysql-ruby1.8

# some system utils/libs
aptitude install apt-utils build-essential mysql-server mysql-common mysql-client memcached libxslt1-dev libpcre3-dev zlib1g-dev unzip gzip mytop  openssl

aptitude install -t etch-backports libopenssl-ruby

# gems
gem install rails mongrel mongrel_cluster -y
</code></pre>
<p>check this <a href="http://kete.net.nz/documentation/topics/show/116">step-by-step</a></p>
<p>Image magick linux howto &#8211; http://rmagick.rubyforge.org/install2-linux.html</p>
<pre><code>aptitude install libmagick9-dev  imagemagick librmagick-ruby1.8 imagemagick librmagick-ruby-doc  libmagick9-dev ruby1.8-dev</code></pre>
<pre><code>

# for version 1 of imagemagick we use this rmagick, else try it without the -v
gem install rmagick -v 1.15.12 

# lets test it
&gt; irb
require 'rubygems'
require 'RMagick'
Magick::CenterGravity
puts Magick::Long_version

# or with 

ruby -rrubygems -e "require 'RMagick'; puts Magick::Long_version;" 

</code></pre>
<p>I love this tutorial on <a href="http://www.rubyinside.com/how-to-install-a-ruby-18-stack-on-ubuntu-810-from-scratch-1566.html">rubyinside</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/11/06/246/installing-notes-for-rails-on-debianubunto/2008/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Chunks for the String method.</title>
		<link>http://www.gudasoft.com/english/development/09/10/125/chunks-for-the-string-method/2008</link>
		<comments>http://www.gudasoft.com/english/development/09/10/125/chunks-for-the-string-method/2008#comments</comments>
		<pubDate>Wed, 10 Sep 2008 08:59:47 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[open]]></category>
		<category><![CDATA[source]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=125</guid>
		<description><![CDATA[If you want to generate some sort of chunks from a large strings you can use the following method. You give as a param an array of arrays, each array is pointing with % the start position of the chunk and the last position. class String def String.random_alphanumeric(size=16) (1..size).collect { (i = Kernel.rand(62); i += [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to generate some sort of chunks from a large strings you can use the following method.<br />
You give as a param an array of arrays, each array is pointing with % the start position of the chunk and the last position.</p>
<p><code><br />
class String</p>
<p>  def String.random_alphanumeric(size=16)<br />
    (1..size).collect { (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }.join<br />
  end</p>
<p>  def chunkanize(parts = [[0,4], [48, 52], [95, 100]])<br />
    return [self] if self.size <= 1</p>
<p>    # working with words<br />
    terms_array = self.split(/ /)<br />
    join_type = " "</p>
<p>    # working with letters<br />
    if terms_array.size <= 100<br />
      terms_array = self.split(//)<br />
      join_type = ""<br />
    end</p>
<p>    one_percent = terms_array.size.to_f / 100</p>
<p>    parts.collect do |part|<br />
      start = part[0]<br />
      stop = part[1]<br />
      terms_array[(start * one_percent)..(stop * one_percent)].join(join_type)<br />
    end<br />
  end</p>
<p>end<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/09/10/125/chunks-for-the-string-method/2008/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails caching notes</title>
		<link>http://www.gudasoft.com/english/development/rails-development/08/26/111/rails-caching/2008</link>
		<comments>http://www.gudasoft.com/english/development/rails-development/08/26/111/rails-caching/2008#comments</comments>
		<pubDate>Tue, 26 Aug 2008 19:31:02 +0000</pubDate>
		<dc:creator>guda</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.gudasoft.com/?p=111</guid>
		<description><![CDATA[General Notes Very nice tutorial for rails 2.1 caching. API references: Fragments, Sweepers, the Store Post how to move the page cache in a folder with some server examples Observing Controllers with Sweepers Here is described how you can use the Sweepers to observe controller actions. I totaly agree that the documenation is very bad [...]]]></description>
			<content:encoded><![CDATA[<h2>General Notes</h2>
<p>Very nice <a href="http://www.ibm.com/developerworks/web/library/wa-rails1/">tutorial</a> for rails 2.1 caching.</p>
<p>API references: <a href="http://api.rubyonrails.org/classes/ActionController/Caching/Fragments.html#M000641">Fragments,</a> <a href="http://api.rubyonrails.org/classes/ActionController/Caching/Sweeping.html">Sweepers,</a> the <a href="http://api.rubyonrails.org/classes/ActiveSupport/Cache/MemoryStore.html">Store</a></p>
<p><a href="http://www.fngtps.com/2006/01/lazy-sweeping-the-rails-page-cache">Post</a> how to move the page cache in a folder with some server examples</p>
<h2>Observing Controllers with Sweepers</h2>
<p><a href="http://codelevy.com/articles/2008/03/04/rails-caching-sweepers-controllers-and-models">Here</a> is described how you can use the <a href="http://api.rubyonrails.org/classes/ActionController/Caching/Sweeping.html">Sweepers</a> to observe controller actions. I totaly agree that the documenation is very bad on the sweepers and it is like a rule book of <a href="http://www.wizards.com/magic/">MTG</a> than usefull rdoc.</p>
<p>Here is what I have found on the naming of the callbacks.</p>
<p>Checking the source code in <a href="file:///var/lib/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sweeping.rb">sweeping.rb</a> shows that the callbacks that are used for the controller are constructed in this way:<br />
<code><br />
controller_callback_method_name = "#{timing}_#{controller.controller_name.underscore}"<br />
action_callback_method_name     = "#{controller_callback_method_name}_#{controller.action_name}"</code></p>
<p>This means that the method which will be called in the sweeper will be named</p>
<ul>
<li>after/before_user &#8211; for the controller UserController</li>
<li>after/before_user_login &#8211; for the action login in the controller UserController</li>
</ul>
<p>Here is an example.</p>
<pre>class Dagens::UserController &lt; Dagens::BaseController
  cache_sweeper DagensAgentSweeper, :only =&gt; [:do_login, :do_delete_account, :do_logout]
  def do_login
  end
  ....
end

class DagensAgentSweeper &lt; ActionController::Caching::Sweeper
  observe DagensAgent

  def after_user_do_login
    puts "after do login \n \n \n \n \n \n \n "
    expire_cache_for(@logged_user)
  end
end</pre>
<h2>Skipping callbacks from an observer</h2>
<p>I know that it is not good idea, but some times there is no time/way to do skip it. I have found a plugin and this post <a href="http://integrumbles.com/2007/12/12/skipping-activerecord-callback-methods">here</a>. I have choose to use the second one in my project. Here is the example</p>
<pre>class DagensAgentSweeper &lt; ActionController::Caching::Sweeper
  observe DagensAgent

  def self.skip_callback(callback, &amp;block)
    method = instance_method(callback)
    remove_method(callback) if respond_to?(callback)
    define_method(callback) { true }
    result = yield
    remove_method(callback)
    define_method(callback, method)
    result
  end
........
end</pre>
<p>And later in the controller&#8230;.model&#8230;</p>
<pre>      DagensAgentSweeper.skip_callback(:after_update) do
        @agent.shown_times += 1
        @agent.save
      end
</pre>
<h2>timed_fragment_cache</h2>
<p>Some patches on the <a href="http://www.ruzee.com/blog/2008/07/timed_fragment_cache-on-rails-21/ ">timed_fragment_cache</a> plugin.</p>
<p>Note how  Jolyon Says suggest to expire the cache when you have time zone :  <code>when_fragment_expired ‘tags_home_page’, Time.now + 10.minutes do</code></p>
<p>I have notice that timed_fragment_cache (or the patch) have a problem with expiring the cache from the controller. In the documenation it is stated that it is ok to expire the cache only in the controller with</p>
<p><code>when_fragment_expired  "_last_update",  Time.now + 1.minutes  do</code></p>
<p>and there is no need to expire it in the view, but you MUST expire it in the view.</p>
<p><code>cache "_last_update" do</code></p>
<p>must be</p>
<p><code>cache "_last_update", Time.now + 1.minutes  do</code></p>
<pre></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gudasoft.com/english/development/rails-development/08/26/111/rails-caching/2008/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

