<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-360436152455172110</id><updated>2024-09-16T16:49:03.177-07:00</updated><title type='text'>Reddy On Rails more than Ruby</title><subtitle type='html'>You want Ruby? We can do it! Hire us for Ruby on Rails, CoffeeScript, BackBone.js, MongoDb, _underscore.js,dojo,Extjs,jQuery,Node.js,LAMP, AJAX &#xa;&#xa;info {at} rubyassist {dot} com</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://reddyonrails.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>79</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-1400216141931036668</id><published>2014-12-18T14:13:00.000-08:00</published><updated>2014-12-18T14:13:35.494-08:00</updated><title type='text'>Security issues with git : upted required for Git clients</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre&gt;Even though the issue may not affect Linux users, if you are a
hosting service whose users may fetch from your service to Windows
or Mac OS X machines, you are strongly encouraged to update to
protect such users who use existing versions of Git.&lt;/pre&gt;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;source :  &lt;/pre&gt;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&amp;nbsp;&lt;a href=&quot;http://article.gmane.org/gmane.linux.kernel/1853266&quot;&gt;http://article.gmane.org/gmane.linux.kernel/1853266&lt;/a&gt;&lt;/pre&gt;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&amp;nbsp;Updated versions on Github are here :&lt;/pre&gt;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt; &lt;a href=&quot;https://windows.github.com/&quot;&gt;GitHub for Windows&lt;/a&gt; and &lt;a href=&quot;https://mac.github.com/&quot;&gt;GitHub for Mac&lt;/a&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/1400216141931036668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/1400216141931036668'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2014/12/security-issues-with-git-upted-required.html' title='Security issues with git : upted required for Git clients'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-976098932119445906</id><published>2014-11-06T10:18:00.002-08:00</published><updated>2014-11-06T10:18:51.285-08:00</updated><title type='text'>making underscore.js dependency to angular js</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;copy-paste-block&quot;&gt;
&lt;span&gt;&lt;br /&gt;var app = angular.module(&#39;app&#39;, [&#39;underscore&#39;]);&lt;br /&gt;app.controller(&#39;AppController&#39;, [&#39;$scope&#39;, &#39;_&#39;, function ($scope, _) {&lt;br /&gt;&amp;nbsp; initialize = function () {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; _.keys($scope);&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;&amp;nbsp; initialize();&lt;br /&gt;}]);&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;copy-paste-block&quot;&gt;
&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;copy-paste-block&quot;&gt;
&lt;span&gt;underscore.factory(&#39;_&#39;, function () {&lt;br /&gt;&amp;nbsp; return window._;&lt;br /&gt;});&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/976098932119445906'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/976098932119445906'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2014/11/making-underscorejs-dependency-to.html' title='making underscore.js dependency to angular js'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-5580533463088971588</id><published>2014-05-08T13:52:00.002-07:00</published><updated>2014-05-08T13:55:07.040-07:00</updated><title type='text'>Ruby 2.1.0 some useful changes</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;return in lambda&lt;/b&gt;&lt;br /&gt;
def yield_me&lt;br /&gt;
&amp;nbsp;yield&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
def run&lt;br /&gt;
&amp;nbsp; yield_me(&amp;amp;lambda {return &quot;call from lambda&quot;})&lt;br /&gt;
&amp;nbsp; &quot;call from run method&quot;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
run&amp;nbsp;&amp;nbsp; #=&amp;gt; &quot;call from run method&quot;&lt;br /&gt;
The example above would have returned &quot;call from lambda&quot; in&amp;nbsp; Ruby&amp;nbsp; previous ruby versions&lt;br /&gt;
---------------------------------------------------------------------------------------------------------------&lt;br /&gt;
&lt;b&gt;#singleton_class?&lt;/b&gt;&lt;br /&gt;
class Test&lt;br /&gt;
&amp;nbsp; singleton_class?&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #=&amp;gt; false&lt;br /&gt;
&amp;nbsp; class &amp;lt;&amp;lt; self&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; singleton_class?&amp;nbsp;&amp;nbsp; #=&amp;gt; true&lt;br /&gt;
&amp;nbsp; end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
Object#singleton_method&lt;br /&gt;
class Test&lt;br /&gt;
&amp;nbsp; def self.one&lt;br /&gt;
&amp;nbsp; end&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; def two&lt;br /&gt;
&amp;nbsp; end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;# returns class method&lt;/i&gt;&lt;br /&gt;
Test.singleton_method(:one)&amp;nbsp;&amp;nbsp;&amp;nbsp; #=&amp;gt; #&lt;method: test.one=&quot;&quot;&gt;&lt;br /&gt;# doesn&#39;t return instance method&lt;br /&gt;Test.singleton_method(:two)&amp;nbsp;&amp;nbsp; #=&amp;gt; #&lt;nameerror: br=&quot;&quot; singleton=&quot;&quot; undefined=&quot;&quot;&gt;-----------------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;b&gt;Method#original_name&lt;/b&gt;&lt;br /&gt;To return the un-aliased name.&lt;br /&gt;class Example&lt;br /&gt;&amp;nbsp; def foo&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;foo&quot;&lt;br /&gt;&amp;nbsp; end&lt;br /&gt;&amp;nbsp; alias bar foo&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;example = Example.new&lt;br /&gt;example.method(:foo).original_name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #=&amp;gt; :foo&lt;br /&gt;example.method(:bar).original_name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #=&amp;gt; :foo&lt;br /&gt;Example.instance_method(:bar).original_name&amp;nbsp;&amp;nbsp; #=&amp;gt; :foo&lt;/nameerror:&gt;&lt;/method:&gt;&lt;br /&gt;
&lt;method: test.one=&quot;&quot;&gt;&lt;nameerror: br=&quot;&quot; singleton=&quot;&quot; undefined=&quot;&quot;&gt;&lt;br /&gt;&lt;/nameerror:&gt;&lt;/method:&gt;
&lt;method: test.one=&quot;&quot;&gt;&lt;nameerror: br=&quot;&quot; singleton=&quot;&quot; undefined=&quot;&quot;&gt;&lt;br /&gt;&lt;/nameerror:&gt;&lt;/method:&gt;
&lt;method: test.one=&quot;&quot;&gt;&lt;nameerror: br=&quot;&quot; singleton=&quot;&quot; undefined=&quot;&quot;&gt;&lt;br /&gt;&lt;/nameerror:&gt;&lt;/method:&gt;
&lt;method: test.one=&quot;&quot;&gt;&lt;nameerror: br=&quot;&quot; singleton=&quot;&quot; undefined=&quot;&quot;&gt;For more changes please visit here:&amp;nbsp;&lt;/nameerror:&gt;&lt;/method:&gt;&lt;br /&gt;
&lt;method: test.one=&quot;&quot;&gt;&lt;nameerror: br=&quot;&quot; singleton=&quot;&quot; undefined=&quot;&quot;&gt;&lt;br /&gt;&lt;/nameerror:&gt;&lt;/method:&gt;
&lt;a href=&quot;https://github.com/ruby/ruby/blob/v2_1_0/NEWS&quot;&gt;&lt;method: test.one=&quot;&quot;&gt;&lt;nameerror: br=&quot;&quot; singleton=&quot;&quot; undefined=&quot;&quot;&gt;https://github.com/ruby/ruby/blob/v2_1_0/NEWS&lt;/nameerror:&gt;&lt;/method:&gt;&lt;/a&gt;&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/5580533463088971588'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/5580533463088971588'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2014/05/ruby-210-some-useful-changes.html' title='Ruby 2.1.0 some useful changes'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-240799917029869223</id><published>2014-03-28T10:57:00.000-07:00</published><updated>2014-03-28T10:57:42.404-07:00</updated><title type='text'>Ruby 2.1 and Garbage Collection issue and memory bloats in production unicorn and Phusion passenger</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Are you working with Unicorn and getting memory leak issues with ruby 2.1 . A better explained scenario on memory allocation on heap with huge strings ,array and hashes in Ruby 2.1 by this author himself here :&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.atdot.net/~ko1/activities/rubyconf2013-ko1_pub.pdf&quot;&gt;&amp;nbsp;http://www.atdot.net/~ko1/activities/rubyconf2013-ko1_pub.pdf&amp;nbsp;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Whats the problem?&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;byline author vcard&quot;&gt;&lt;span class=&quot;fn&quot;&gt;Tim Robertson explained this scenario&amp;nbsp;&lt;/span&gt;&lt;/span&gt; in his blog :&lt;br /&gt;
&lt;a href=&quot;http://www.omniref.com/blog/blog/2014/03/27/ruby-garbage-collection-still-not-ready-for-production/&quot;&gt;http://www.omniref.com/blog/blog/2014/03/27/ruby-garbage-collection-still-not-ready-for-production/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Well not sure about unicorn solution but Aman Gupta has a solution for &lt;a href=&quot;https://www.phusionpassenger.com/&quot;&gt;Phusion Passenger&lt;/a&gt;&lt;i&gt;.&lt;/i&gt;&lt;br /&gt;
&lt;i&gt;as &lt;/i&gt;&lt;a href=&quot;http://tmm1.net/ruby21-oobgc/&quot;&gt;announced an Out-Of-Band garbage collector for Ruby 2.1&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;Here is the Phusion Passenger blog on that one and usage.&amp;nbsp;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;title&quot; style=&quot;text-align: left;&quot;&gt;
&lt;a href=&quot;http://blog.phusion.nl/2014/01/31/phusion-passenger-now-supports-the-new-ruby-2-1-out-of-band-gc/&quot; rel=&quot;bookmark&quot; title=&quot;Permanent link to Phusion Passenger now supports the new Ruby 2.1 Out-Of-Band GC&quot;&gt;Phusion Passenger now supports the new Ruby 2.1 Out-Of-Band GC.&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;title&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;title&quot; style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/240799917029869223'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/240799917029869223'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2014/03/ruby-21-and-garbage-collection-issue.html' title='Ruby 2.1 and Garbage Collection issue and memory bloats in production unicorn and Phusion passenger'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-6054553530665784938</id><published>2013-08-08T18:18:00.002-07:00</published><updated>2013-08-08T18:18:25.959-07:00</updated><title type='text'>Ruby 1.9.3 (Rails 3) Ruby 2.0 (Rails 4) Performance test and improvements</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Using Mac OS and Webrick in local environment&lt;br /&gt;time -p bundle exec rake environment&lt;br /&gt;real 6.69&lt;br /&gt;user 4.76&lt;br /&gt;sys 0.79&lt;br /&gt;&lt;br /&gt;export RUBY_GC_MALLOC_LIMIT=1000000000&lt;br /&gt;export RUBY_FREE_MIN=500000&lt;br /&gt;export RUBY_HEAP_MIN_SLOTS=40000&lt;br /&gt;&lt;br /&gt;AFTER we set the above exports , check the below performance &lt;br /&gt;time -p bundle exec rake environment&lt;br /&gt;real 5.36&lt;br /&gt;user 3.19&lt;br /&gt;sys 1.05&lt;br /&gt;&lt;br /&gt;Also tested in request to response scenario using apache bench with 100 requests&lt;br /&gt;Ruby 1.9.3 (Rails 3)&lt;br /&gt;------------------------------------------------------------------------------------------&lt;br /&gt;ab -n 100 -c 1 http://localhost:3000/&lt;br /&gt;------------------------------------------------------------------------------------------&lt;br /&gt;BEFORE FLAGS SET&amp;nbsp; (ruby-1.9.3-p194 [ x86_64 ])&lt;br /&gt;------------------------------&lt;br /&gt;Server Software:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WEBrick/1.3.1&lt;br /&gt;Server Hostname:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 127.0.0.1&lt;br /&gt;Server Port:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3000&lt;br /&gt;&lt;br /&gt;Document Path:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&lt;br /&gt;Document Length:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 96050 bytes&lt;br /&gt;&lt;br /&gt;Concurrency Level:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;br /&gt;Time taken for tests:&amp;nbsp;&amp;nbsp; 391.883 seconds&lt;br /&gt;Complete requests:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&lt;br /&gt;Failed requests:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 13&lt;br /&gt;&amp;nbsp;&amp;nbsp; (Connect: 0, Receive: 0, Length: 13, Exceptions: 0)&lt;br /&gt;Write errors:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;br /&gt;Total transferred:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9698686 bytes&lt;br /&gt;HTML transferred:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9604985 bytes&lt;br /&gt;Requests per second:&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.26 [#/sec] (mean)&lt;br /&gt;Time per request:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3918.831 [ms] (mean)&lt;br /&gt;Time per request:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3918.831 [ms] (mean, across all concurrent requests)&lt;br /&gt;Transfer rate:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 24.17 [Kbytes/sec] received&lt;br /&gt;&lt;br /&gt;Connection Times (ms)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; min&amp;nbsp; mean[+/-sd] median&amp;nbsp;&amp;nbsp; max&lt;br /&gt;Connect:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2963 3585 583.6&amp;nbsp;&amp;nbsp; 3430&amp;nbsp;&amp;nbsp;&amp;nbsp; 5625&lt;br /&gt;Processing:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp; 334 2625.5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 26154&lt;br /&gt;Waiting:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp; 333 2625.5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; 26153&lt;br /&gt;Total:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2963 3919 2905.2&amp;nbsp;&amp;nbsp; 3430&amp;nbsp;&amp;nbsp; 31529&lt;br /&gt;&lt;br /&gt;Percentage of the requests served within a certain time (ms)&lt;br /&gt;&amp;nbsp; 50%&amp;nbsp;&amp;nbsp; 3430&lt;br /&gt;&amp;nbsp; 66%&amp;nbsp;&amp;nbsp; 3532&lt;br /&gt;&amp;nbsp; 75%&amp;nbsp;&amp;nbsp; 3623&lt;br /&gt;&amp;nbsp; 80%&amp;nbsp;&amp;nbsp; 3710&lt;br /&gt;&amp;nbsp; 90%&amp;nbsp;&amp;nbsp; 4407&lt;br /&gt;&amp;nbsp; 95%&amp;nbsp;&amp;nbsp; 6346&lt;br /&gt;&amp;nbsp; 98%&amp;nbsp;&amp;nbsp; 7244&lt;br /&gt;&amp;nbsp; 99%&amp;nbsp; 31529&lt;br /&gt;&amp;nbsp;100%&amp;nbsp; 31529 (longest request)&lt;br /&gt;---------------------------------------------------------------&lt;br /&gt;AFTER FLAGS SET&amp;nbsp; (ruby-1.9.3-p194 [ x86_64 ])&lt;br /&gt;---------------------------------------------------------------&lt;br /&gt;export RUBY_GC_MALLOC_LIMIT=1000000000&lt;br /&gt;export RUBY_FREE_MIN=500000&lt;br /&gt;export RUBY_HEAP_MIN_SLOTS=40000&lt;br /&gt;&lt;br /&gt;Server Software:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WEBrick/1.3.1&lt;br /&gt;Server Hostname:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 127.0.0.1&lt;br /&gt;Server Port:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3000&lt;br /&gt;&lt;br /&gt;Document Path:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /&lt;br /&gt;Document Length:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 96050 bytes&lt;br /&gt;&lt;br /&gt;Concurrency Level:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;br /&gt;Time taken for tests:&amp;nbsp;&amp;nbsp; 368.903 seconds&lt;br /&gt;Complete requests:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&lt;br /&gt;Failed requests:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 14&lt;br /&gt;&amp;nbsp;&amp;nbsp; (Connect: 0, Receive: 0, Length: 14, Exceptions: 0)&lt;br /&gt;Write errors:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;br /&gt;Total transferred:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9714323 bytes&lt;br /&gt;HTML transferred:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 9620622 bytes&lt;br /&gt;Requests per second:&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.27 [#/sec] (mean)&lt;br /&gt;Time per request:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3689.025 [ms] (mean)&lt;br /&gt;Time per request:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3689.025 [ms] (mean, across all concurrent requests)&lt;br /&gt;Transfer rate:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 25.72 [Kbytes/sec] received&lt;br /&gt;&lt;br /&gt;Connection Times (ms)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; min&amp;nbsp; mean[+/-sd] median&amp;nbsp;&amp;nbsp; max&lt;br /&gt;Connect:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2563 3388 634.5&amp;nbsp;&amp;nbsp; 3395&amp;nbsp;&amp;nbsp;&amp;nbsp; 5351&lt;br /&gt;Processing:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp; 301 2692.0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; 26860&lt;br /&gt;Waiting:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp; 301 2692.0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp; 26859&lt;br /&gt;Total:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2563 3689 2973.1&amp;nbsp;&amp;nbsp; 3397&amp;nbsp;&amp;nbsp; 32211&lt;br /&gt;&lt;br /&gt;Percentage of the requests served within a certain time (ms)&lt;br /&gt;&amp;nbsp; 50%&amp;nbsp;&amp;nbsp; 3397&lt;br /&gt;&amp;nbsp; 66%&amp;nbsp;&amp;nbsp; 3656&lt;br /&gt;&amp;nbsp; 75%&amp;nbsp;&amp;nbsp; 3753&lt;br /&gt;&amp;nbsp; 80%&amp;nbsp;&amp;nbsp; 3809&lt;br /&gt;&amp;nbsp; 90%&amp;nbsp;&amp;nbsp; 3928&lt;br /&gt;&amp;nbsp; 95%&amp;nbsp;&amp;nbsp; 5208&lt;br /&gt;&amp;nbsp; 98%&amp;nbsp;&amp;nbsp; 6949&lt;br /&gt;&amp;nbsp; 99%&amp;nbsp; 32211&lt;br /&gt;&amp;nbsp;100%&amp;nbsp; 32211 (longest request)&lt;br /&gt;----------------------------------------------------&lt;br /&gt;&lt;br /&gt;Ruby 2.0 (Rails 4)&lt;br /&gt;-------------------------------------------------------------------------------------------------------&lt;br /&gt;&amp;nbsp;ab -n 100 -c 1 http://127.0.0.1:3000/&lt;br /&gt;------------------------------------------------------------------------------------------------------&lt;br /&gt;Server Software:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WEBrick/1.3.1&lt;br /&gt;Server Hostname:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 127.0.0.1&lt;br /&gt;Server Port:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3000&lt;br /&gt;&lt;br /&gt;Document Path:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /?locale=uk&lt;br /&gt;Document Length:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20815 bytes&lt;br /&gt;&lt;br /&gt;Concurrency Level:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;br /&gt;Time taken for tests:&amp;nbsp;&amp;nbsp; 181.485 seconds&lt;br /&gt;Complete requests:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&lt;br /&gt;Failed requests:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;br /&gt;&amp;nbsp;&amp;nbsp; (Connect: 0, Receive: 0, Length: 5, Exceptions: 0)&lt;br /&gt;Write errors:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;br /&gt;Total transferred:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2185395 bytes&lt;br /&gt;HTML transferred:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2081495 bytes&lt;br /&gt;Requests per second:&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.55 [#/sec] (mean)&lt;br /&gt;Time per request:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1814.851 [ms] (mean)&lt;br /&gt;Time per request:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1814.851 [ms] (mean, across all concurrent requests)&lt;br /&gt;Transfer rate:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11.76 [Kbytes/sec] received&lt;br /&gt;&lt;br /&gt;Connection Times (ms)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; min&amp;nbsp; mean[+/-sd] median&amp;nbsp;&amp;nbsp; max&lt;br /&gt;Connect:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 37 1590 658.0&amp;nbsp;&amp;nbsp; 1678&amp;nbsp;&amp;nbsp;&amp;nbsp; 5320&lt;br /&gt;Processing:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp; 225 918.2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 8042&lt;br /&gt;Waiting:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp; 225 917.9&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; 8041&lt;br /&gt;Total:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1585 1815 818.9&amp;nbsp;&amp;nbsp; 1679&amp;nbsp;&amp;nbsp;&amp;nbsp; 8079&lt;br /&gt;&lt;br /&gt;Percentage of the requests served within a certain time (ms)&lt;br /&gt;&amp;nbsp; 50%&amp;nbsp;&amp;nbsp; 1679&lt;br /&gt;&amp;nbsp; 66%&amp;nbsp;&amp;nbsp; 1685&lt;br /&gt;&amp;nbsp; 75%&amp;nbsp;&amp;nbsp; 1690&lt;br /&gt;&amp;nbsp; 80%&amp;nbsp;&amp;nbsp; 1694&lt;br /&gt;&amp;nbsp; 90%&amp;nbsp;&amp;nbsp; 1749&lt;br /&gt;&amp;nbsp; 95%&amp;nbsp;&amp;nbsp; 1995&lt;br /&gt;&amp;nbsp; 98%&amp;nbsp;&amp;nbsp; 6240&lt;br /&gt;&amp;nbsp; 99%&amp;nbsp;&amp;nbsp; 8079&lt;br /&gt;&amp;nbsp;100%&amp;nbsp;&amp;nbsp; 8079 (longest request)&lt;br /&gt;-------------------------------------------------------------------------------------------------&lt;br /&gt;AFTER FLAG SET (Ruby 2.0 (Rails 4)&lt;br /&gt;export RUBY_GC_MALLOC_LIMIT=1000000000&lt;br /&gt;export RUBY_FREE_MIN=500000&lt;br /&gt;export RUBY_HEAP_MIN_SLOTS=40000&lt;br /&gt;----------&lt;br /&gt;Server Software:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WEBrick/1.3.1&lt;br /&gt;Server Hostname:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 127.0.0.1&lt;br /&gt;Server Port:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3000&lt;br /&gt;&lt;br /&gt;Document Path:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /?locale=uk&lt;br /&gt;Document Length:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 20815 bytes&lt;br /&gt;&lt;br /&gt;Concurrency Level:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;br /&gt;Time taken for tests:&amp;nbsp;&amp;nbsp; 172.496 seconds&lt;br /&gt;Complete requests:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 100&lt;br /&gt;Failed requests:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12&lt;br /&gt;&amp;nbsp;&amp;nbsp; (Connect: 0, Receive: 0, Length: 12, Exceptions: 0)&lt;br /&gt;Write errors:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;br /&gt;Total transferred:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2185386 bytes&lt;br /&gt;HTML transferred:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2081486 bytes&lt;br /&gt;Requests per second:&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.58 [#/sec] (mean)&lt;br /&gt;Time per request:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1724.962 [ms] (mean)&lt;br /&gt;Time per request:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1724.962 [ms] (mean, across all concurrent requests)&lt;br /&gt;Transfer rate:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12.37 [Kbytes/sec] received&lt;br /&gt;&lt;br /&gt;Connection Times (ms)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; min&amp;nbsp; mean[+/-sd] median&amp;nbsp;&amp;nbsp; max&lt;br /&gt;Connect:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 36&amp;nbsp; 350 695.0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 40&amp;nbsp;&amp;nbsp;&amp;nbsp; 3408&lt;br /&gt;Processing:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 1374 737.0&amp;nbsp;&amp;nbsp; 1564&amp;nbsp;&amp;nbsp;&amp;nbsp; 3935&lt;br /&gt;Waiting:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0 1374 736.6&amp;nbsp;&amp;nbsp; 1563&amp;nbsp;&amp;nbsp;&amp;nbsp; 3934&lt;br /&gt;Total:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1582 1725 406.2&amp;nbsp;&amp;nbsp; 1607&amp;nbsp;&amp;nbsp;&amp;nbsp; 3973&lt;br /&gt;&lt;br /&gt;Percentage of the requests served within a certain time (ms)&lt;br /&gt;&amp;nbsp; 50%&amp;nbsp;&amp;nbsp; 1607&lt;br /&gt;&amp;nbsp; 66%&amp;nbsp;&amp;nbsp; 1617&lt;br /&gt;&amp;nbsp; 75%&amp;nbsp;&amp;nbsp; 1640&lt;br /&gt;&amp;nbsp; 80%&amp;nbsp;&amp;nbsp; 1651&lt;br /&gt;&amp;nbsp; 90%&amp;nbsp;&amp;nbsp; 1909&lt;br /&gt;&amp;nbsp; 95%&amp;nbsp;&amp;nbsp; 3031&lt;br /&gt;&amp;nbsp; 98%&amp;nbsp;&amp;nbsp; 3408&lt;br /&gt;&amp;nbsp; 99%&amp;nbsp;&amp;nbsp; 3973&lt;br /&gt;&amp;nbsp;100%&amp;nbsp;&amp;nbsp; 3973 (longest request)&lt;br /&gt;&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/6054553530665784938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/6054553530665784938'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2013/08/ruby-193-rails-3-ruby-20-rails-4.html' title='Ruby 1.9.3 (Rails 3) Ruby 2.0 (Rails 4) Performance test and improvements'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-6890705079890019975</id><published>2013-08-06T14:57:00.000-07:00</published><updated>2013-08-06T14:57:10.596-07:00</updated><title type='text'>Upgrading tips for Ruby 2.0 &amp; Rails 4 from Ruby 1.9.3 &amp; Rails 3</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Ruby&amp;nbsp; 2.0&lt;br /&gt;1. mostly compatible with Ruby 1.9.3 version&lt;br /&gt;3. more refinements and code related features;&lt;br /&gt;4. Asynchronous exception handling API&lt;br /&gt;5. More built in libraries&lt;br /&gt;6. Debugging support(DTrace,TracePoint)&lt;br /&gt;7. Performace enhancements like GC optimization and better method dispatch &lt;br /&gt;8. Customize VM ENV variables&lt;br /&gt;&lt;br /&gt;Rails 4.0 &lt;br /&gt;0.Test coverage is should be good before starting an upgrade.&lt;br /&gt;1. By default thread safe: so have to use gems which are thread safe&lt;br /&gt;2. better utf-8 support &lt;br /&gt;3. better with unicorn like servers&lt;br /&gt;4. Rails 4 prefers Ruby 2.0 and requires 1.9.3 or newer.&lt;br /&gt;5. Some ActionController classes moved to ActionDispatch&lt;br /&gt;6.secret_key_base upgraded carefully , cookies signed based on the new secret_key_base in Rails 4.x are not backwards compatible with Rails( Wait for all users to accommodate new token )&lt;br /&gt;7. Better caching (https://gist.github.com/szimek/1669330)&lt;br /&gt;8.Official upgrade link&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; http://edgeguides.rubyonrails.org/upgrading_ruby_on_rails.html&lt;br /&gt;
9. buy a book to upgrade rails 4 ?&amp;nbsp; here is the link : https://leanpub.com/upgradetorails4&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/6890705079890019975'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/6890705079890019975'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2013/08/upgrading-tips-for-ruby-20-rails-4-from.html' title='Upgrading tips for Ruby 2.0 &amp; Rails 4 from Ruby 1.9.3 &amp; Rails 3'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-8499286661663300916</id><published>2013-07-19T15:11:00.000-07:00</published><updated>2013-07-19T15:13:26.275-07:00</updated><title type='text'>Ruby &#39;and&#39; &#39;or&#39;  vs &amp;&amp; , || precedence</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Just like in maths :&amp;nbsp; Order of Operations - BODMAS&amp;nbsp;&amp;nbsp; or &lt;br /&gt;
&lt;br /&gt;
In general programming languages, &lt;b&gt;&amp;amp;&amp;amp;&lt;/b&gt; has higher precedence than &lt;b&gt;||&lt;/b&gt; operator.&lt;br /&gt;
&lt;br /&gt;
But in Ruby it is not like that as&lt;b&gt; and or&lt;/b&gt;&amp;nbsp; have same order of precedence. &lt;br /&gt;
&lt;br /&gt;
Lets see one example :&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&quot;a&quot; || &quot;b&quot; &amp;amp;&amp;amp; &quot;c&quot;&amp;nbsp;&lt;/b&gt; will be assumed as&amp;nbsp; =&amp;gt; &lt;b&gt;&quot;a&quot; || (&quot;b&quot; &amp;amp;&amp;amp; &quot;c&quot;) &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;output: &quot;a&quot;&amp;nbsp; (&quot;b&quot;, &quot;c&quot; are never called) &lt;/u&gt;&lt;/b&gt;&lt;u&gt;why as &quot;a&quot; is always true. &lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
here &amp;amp;&amp;amp; has higher precedence than ||&lt;br /&gt;
&lt;br /&gt;
Lets see with and or operations&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&quot;a&quot; or &quot;b&quot; and &quot;c&quot;&amp;nbsp;&lt;/b&gt; will be assumed as&amp;nbsp; =&amp;gt; &lt;b&gt;(&quot;a&quot;&amp;nbsp; or &quot;b&quot;) and &quot;c&quot;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;output: &quot;c&quot;&amp;nbsp; &lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/8499286661663300916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/8499286661663300916'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2013/07/ruby-and-or-vs-precedence.html' title='Ruby &#39;and&#39; &#39;or&#39;  vs &amp;&amp; , || precedence'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-4542434162052173608</id><published>2013-07-18T11:54:00.001-07:00</published><updated>2013-07-18T11:54:14.066-07:00</updated><title type='text'>helpful GIT command aliases </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
[alias]&lt;br /&gt;&amp;nbsp;&amp;nbsp; st = status -sb&lt;br /&gt;&amp;nbsp;&amp;nbsp; ci = commit&lt;br /&gt;&amp;nbsp;&amp;nbsp; br = branch&lt;br /&gt;
&amp;nbsp;&amp;nbsp; df = diff&lt;br /&gt;&amp;nbsp;&amp;nbsp; lg = log --pretty=format:&#39;%Cred%h%Creset -%Creset %s %Cgreen(%cr) %C(bold blue)&amp;lt;%an&amp;gt;%Creset&#39;&lt;br /&gt;&amp;nbsp;&amp;nbsp; lg = log -p&lt;br /&gt;&amp;nbsp;&amp;nbsp; co = checkout&lt;br /&gt;&amp;nbsp;&amp;nbsp; cp = cherry-pick&lt;br /&gt;&amp;nbsp;&amp;nbsp; tree = log --graph --decorate --pretty=oneline --abbrev-commit --all&lt;br /&gt;&amp;nbsp;&amp;nbsp; pom = push origin master&lt;br /&gt;&amp;nbsp;&amp;nbsp; amend = commit --amend -C HEAD&lt;br /&gt;
&amp;nbsp;&amp;nbsp; wdiff = diff --color-words&lt;br /&gt;
&amp;nbsp;&amp;nbsp; standup = log --since yesterday --author jreddy@reddyonrails.com&lt;br /&gt;&amp;nbsp;&amp;nbsp; rst = reset --hard&lt;br /&gt;
&amp;nbsp;&amp;nbsp; pr = pull --rebase&lt;br /&gt;
&lt;br /&gt;
You can also add aliases like so, and they will get added to your &lt;code&gt;.gitconfig&lt;/code&gt; file automatically.&lt;br /&gt;

&lt;pre&gt;$ git config –-global --edit
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/4542434162052173608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/4542434162052173608'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2013/07/helpful-git-command-aliases.html' title='helpful GIT command aliases '/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-2798620124883153242</id><published>2013-04-09T15:45:00.000-07:00</published><updated>2013-04-09T15:45:20.968-07:00</updated><title type='text'>Error running &#39;requirements_brew_libs_install libksba&#39;  or libgpg-error Ruby 2.0.0 on MAC, brew and RVM</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Problem:&amp;nbsp; &lt;br /&gt;
If you have problem installing ruby 2.0.0 on your mac using rvm and brew. And the problem could be timeout error .&lt;br /&gt;
&lt;br /&gt;
rvm install ruby-2.0.0-p0&lt;br /&gt;
&lt;br /&gt;Installing requirements for osx, might require sudo password.&lt;br /&gt;Already up-to-date.&lt;br /&gt;Installing required packages: libksba....&lt;br /&gt;^CError running &#39;requirements_brew_libs_install libksba&#39;,&lt;br /&gt;please read /Users/XXX/.rvm/log/ruby-2.0.0-p0/package_install_libksba.log&lt;br /&gt;
&lt;br /&gt;
log file :&lt;br /&gt;
&lt;br /&gt;
(curl: (56) Recv failure: Operation timed out)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Solution:&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
vi&amp;nbsp; /usr/local/Library/Formula/libgpg-error.rb &lt;br /&gt;
Replace: url &#39;ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.9.tar.gz&#39;&lt;br /&gt;
with&amp;nbsp; url &#39;http://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.11.tar.gz&#39;&lt;br /&gt;
&lt;br /&gt;
same case with libksba&lt;br /&gt;
&lt;br /&gt;
This should works if it complain sha1 stuff replace expected one on ruby code.&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/2798620124883153242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/2798620124883153242'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2013/04/error-running-requirementsbrewlibsinsta.html' title='Error running &#39;requirements_brew_libs_install libksba&#39;  or libgpg-error Ruby 2.0.0 on MAC, brew and RVM'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-5820056588652817927</id><published>2013-03-28T12:30:00.000-07:00</published><updated>2013-03-28T12:30:11.142-07:00</updated><title type='text'>Brew Update issue</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre&gt;&lt;code&gt;$ brew update
error: The following untracked working tree files would be overwritten by merge:
    Library/Formula/libmusicbrainz.rb
Please move or remove them before you can merge.
Aborting
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;Solution:&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;rm /usr/local/Library/Formula/libmusicbrainz.rb
brew update&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/5820056588652817927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/5820056588652817927'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2013/03/brew-update-issue.html' title='Brew Update issue'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-4876792117052082533</id><published>2013-01-24T22:15:00.004-08:00</published><updated>2013-03-18T21:54:27.888-07:00</updated><title type='text'>Rails pg gem &#39;0.14.1&#39; on Mac fails and solution</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
pg.c: In function ‘Init_pg_ext’:&lt;br /&gt;
pg.c:384: error: ‘PQPING_OK’ undeclared (first use in this function)&lt;br /&gt;
pg.c:384: error: (Each undeclared identifier is reported only once&lt;br /&gt;
pg.c:384: error: for each function it appears in.)&lt;br /&gt;
pg.c:386: error: ‘PQPING_REJECT’ undeclared (first use in this function)&lt;br /&gt;
pg.c:388: error: ‘PQPING_NO_RESPONSE’ undeclared (first use in this function)&lt;br /&gt;
pg.c:390: error: ‘PQPING_NO_ATTEMPT’ undeclared (first use in this function)&lt;br /&gt;
make: *** [pg.o] Error 1&lt;br /&gt;
&lt;br /&gt;
Solution:&lt;br /&gt;
env ARCHFLAGS=&quot;-arch x86_64&quot; gem install pg -- --with-pg-config=/Library/PostgreSQL/9.2/bin/pg_config&lt;br /&gt;
&lt;br /&gt;
EDIT : &lt;br /&gt;
If you dont know where your pg_config is. Assume you are on Linux/Mac system, using the command &#39;find&#39; should help&lt;br /&gt;
&lt;br /&gt;


&lt;pre class=&quot;default prettyprint prettyprinted&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;find &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt; &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;name pg_config&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;default prettyprint prettyprinted&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;default prettyprint prettyprinted&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/4876792117052082533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/4876792117052082533'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2013/01/rails-pg-gem-0141-on-mac-fails-and.html' title='Rails pg gem &#39;0.14.1&#39; on Mac fails and solution'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-2321981624882770054</id><published>2013-01-24T21:53:00.000-08:00</published><updated>2013-01-24T21:53:01.639-08:00</updated><title type='text'>How to copy postgresql data from heroku production</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Steps to get the copy of heroku deployed application database to localhost . &lt;br /&gt;
&lt;br /&gt;
1 step: Create a backup on heroku production&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; heroku pgbackups:capture --expire&lt;br /&gt;
&lt;br /&gt;
2 step:&amp;nbsp; Get the latest back up to local by curl method&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; curl -o backup.dump `heroku pgbackups:url`&lt;br /&gt;
3 step: Restore to localhost database using the followng comand&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp; pg_restore --verbose --clean --no-acl --no-owner -h localhost -d your_database_name&amp;nbsp; backup.dump&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/2321981624882770054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/2321981624882770054'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2013/01/how-to-copy-postgresql-data-from-heroku.html' title='How to copy postgresql data from heroku production'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-4368402982639467933</id><published>2012-11-16T13:35:00.001-08:00</published><updated>2012-11-16T13:35:27.196-08:00</updated><title type='text'>In Ruby,  private methods are visible in derived classes</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;
    class Base
    private
      def hello&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;&amp;nbsp;     end
    end
&lt;/code&gt;&lt;/pre&gt;
then methods in the derived class can call it:
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;
    class Derived &amp;lt; Base
      def say
        hello # this is allowed in Ruby
      end
    end&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;Simply to say this :&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;in C++ and OOP languages, “private” means “private to this class”,&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;while in Ruby it means “private to that instance”. Again here class is itself an object :-)&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;code&quot;&gt;&lt;code&gt;Thats means private method will have only one receiver that is self.&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/4368402982639467933'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/4368402982639467933'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2012/11/in-ruby-private-methods-are-visible-in.html' title='In Ruby,  private methods are visible in derived classes'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-4712868285392302219</id><published>2012-10-18T11:17:00.003-07:00</published><updated>2012-10-18T11:50:33.812-07:00</updated><title type='text'>Features of Ruby on Rails 4.0</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Features of Rails 4.0:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; •&amp;nbsp;&amp;nbsp;&amp;nbsp; strong_parameters&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; •&amp;nbsp;&amp;nbsp;&amp;nbsp; Rails.queue&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; •&amp;nbsp;&amp;nbsp;&amp;nbsp; Turbolinks&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; •&amp;nbsp;&amp;nbsp;&amp;nbsp; Russian Doll Caching (cache_digests)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; •&amp;nbsp;&amp;nbsp;&amp;nbsp; ActionController::Live (streaming)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; •&amp;nbsp;&amp;nbsp;&amp;nbsp; PATCH verb&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; •&amp;nbsp;&amp;nbsp;&amp;nbsp; Routing concerns&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; •&amp;nbsp;&amp;nbsp;&amp;nbsp; Extraction of activeresource&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; •&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveRecord::Relation changes and improvements&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; •&amp;nbsp;&amp;nbsp;&amp;nbsp; Removal of plugin support (not gems; only those that are installed in vendor/plugins)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; •&amp;nbsp;&amp;nbsp;&amp;nbsp; Removal of Rails 2 finder syntax&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; •&amp;nbsp;&amp;nbsp;&amp;nbsp; Deprecation of most dynamic finders&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; •&amp;nbsp;&amp;nbsp;&amp;nbsp; Deprecation of eager-evaluated scopes&lt;br /&gt;
&lt;br /&gt;
Slide deck: &lt;a href=&quot;https://speakerdeck.com/u/alindeman/p/rails-4-dot-0-whirlwind-tour&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;speakerdeck.com/u/alindeman/p/rails-4-dot-0-whirlwind-tour&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Video:&amp;nbsp; &lt;a href=&quot;http://vimeo.com/51181496&quot;&gt;http://vimeo.com/51181496&lt;/a&gt;&lt;/div&gt;
</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/4712868285392302219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/4712868285392302219'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2012/10/features-of-ruby-on-rails-40.html' title='Features of Ruby on Rails 4.0'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-8359906352479691387</id><published>2012-07-15T17:00:00.005-07:00</published><updated>2012-07-15T17:00:38.952-07:00</updated><title type='text'>tooltipclass.js for drop down options when mouse over</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;pre&gt;&lt;b&gt;code : &lt;a href=&quot;https://github.com/reddyonrails/tooltipclass.js&quot;&gt;https://github.com/reddyonrails/tooltipclass.js &lt;/a&gt;&lt;/b&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;b&gt;Description:&lt;/b&gt;
 This code is to tooltip drop down option when mouse over. TooltipClass uses json data source .
If this datasource is empty will fetch from ajax url passed from source list url.

You can set a template for each tooltip for drop down box.

sample source params to select particular select box.

&lt;b&gt;Usage:&lt;/b&gt;
&lt;span style=&quot;color: blue;&quot;&gt;var dataSourceList = {
    &#39;portfolio&#39;: {
        &#39;targetElement&#39;: &#39;#analysisjob_portfolio_id&#39;,
        &#39;url&#39;: &#39;/portfolios&#39;,
        &#39;sourceName&#39;: &#39;portfolio&#39;,
        &#39;primaryKey&#39;: &#39;portfolio.PortfolioId&#39;,
        &#39;jasonData&#39;: {},
        &#39;template&#39;: &quot;&quot; +
            &quot;&amp;lt;%= item.Name%&amp;gt;&quot; + &quot;
&quot; +
            &quot;&lt;i&gt;&amp;lt;%= item.Description%&amp;gt;&lt;/i&gt;&quot; + &quot;
&quot; +
            &quot;&quot;
     }
}&lt;/span&gt;
targetElement : select box id
url: ajax url to fetch data
sourceName: json root
primaryKey: key with which we search for json data for each option
template: you can define tooltip structure

loadSource and call tooltipify function like this :
      &lt;span style=&quot;color: blue;&quot;&gt; var source = dataSourceList.portfolio
       var test = TooltipClass.initialize(source);
        test.toolTipfy();&lt;/span&gt;
&lt;b&gt;
Requirements:&lt;/b&gt;
&lt;a href=&quot;http://twitter.github.com/bootstrap/javascript.html&quot;&gt;http://twitter.github.com/bootstrap/javascript.html&lt;/a&gt; (tooltip,popover)
jquery
underscore.js

Tested in firefox&lt;/pre&gt;
&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/8359906352479691387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/8359906352479691387'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2012/07/tooltipclassjs-for-drop-down-options.html' title='tooltipclass.js for drop down options when mouse over'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-1790723384702168604</id><published>2011-05-25T10:16:00.000-07:00</published><updated>2011-05-25T10:16:05.577-07:00</updated><title type='text'>Kaminari plugin with column_sorting and jquery_ajax</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;pre&gt;&lt;a href=&quot;https://github.com/reddyonrails/Kaminari_column_sorting_jquery_ajax&quot;&gt;https://github.com/reddyonrails/Kaminari_column_sorting_jquery_ajax&lt;/a&gt;&lt;/pre&gt;&lt;pre&gt;The above example code for column sorting through ajax calls when doing pagination.

Better to use sorting image arrows for column heading for visual appealing&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;Please visit for original kaminari pagination plugin here.
&lt;a href=&quot;https://github.com/amatsuda/kaminari&quot;&gt;https://github.com/amatsuda/kaminari&lt;/a&gt;
 &lt;/pre&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/1790723384702168604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/1790723384702168604'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2011/05/kaminari-plugin-with-columnsorting-and.html' title='Kaminari plugin with column_sorting and jquery_ajax'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-4495838138184705103</id><published>2011-04-28T13:56:00.000-07:00</published><updated>2011-04-28T13:56:09.291-07:00</updated><title type='text'>For those using MacPorts, ImageMagick 6.6.5 and Ruby 1.9.2.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;If anybody get this error :&lt;br /&gt;
/gems/carrierwave-0.5.3/lib/carrierwave/processing/rmagick.rb:248: [BUG] Segmentation fault&lt;br /&gt;
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.7.0]&lt;br /&gt;
&lt;br /&gt;
Theses are the steps to avoid it (Port).&lt;br /&gt;
&lt;code&gt;port uninstall ImageMagick&lt;/code&gt;&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;port edit ImageMagick&lt;/code&gt;&lt;br /&gt;
Add &lt;code&gt;--disable-openmp&lt;/code&gt; to &lt;code&gt;configure.args&lt;/code&gt; (near line 100)&lt;code&gt;&amp;nbsp;&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;port install ImageMagick&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
Uninstall imagemagick:&lt;br /&gt;
&lt;pre class=&quot;lang-rb prettyprint&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;brew remove imagemagick&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;Delete the cache:&lt;br /&gt;
&lt;pre class=&quot;lang-rb prettyprint&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;rm &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;rf &lt;/span&gt;&lt;span class=&quot;str&quot;&gt;&#39;brew --cache imagemagick&#39;&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;Then re-install the package with this flag:&lt;br /&gt;
&lt;pre class=&quot;lang-rb prettyprint&quot;&gt;&lt;code&gt;&lt;span class=&quot;pln&quot;&gt;brew install &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;f imagemagick &lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;--&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;disable&lt;/span&gt;&lt;span class=&quot;pun&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;pln&quot;&gt;openmp&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/4495838138184705103'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/4495838138184705103'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2011/04/for-those-using-macports-imagemagick.html' title='For those using MacPorts, ImageMagick 6.6.5 and Ruby 1.9.2.'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-6518496843514831781</id><published>2011-02-14T15:27:00.000-08:00</published><updated>2011-02-14T15:27:51.863-08:00</updated><title type='text'>how to stop Rspec run on first failure :rspec tip</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div class=&quot;steps&quot;&gt; &lt;ul&gt;&lt;li&gt;&lt;span class=&quot;keyword&quot;&gt;Edit&amp;nbsp;&lt;/span&gt; &quot;spec/spec_helper.rb&quot; with: &lt;div class=&quot;pre&quot;&gt;&lt;pre&gt;RSpec.configure {|config| config.fail_fast = true}&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;Set&amp;nbsp; the fail_fast option to tell RSpec to stop the run on first failure.&lt;br /&gt;
&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/6518496843514831781'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/6518496843514831781'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2011/02/how-to-stop-rspec-run-on-first-failure.html' title='how to stop Rspec run on first failure :rspec tip'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-310895298846354895</id><published>2011-01-31T14:40:00.000-08:00</published><updated>2011-01-31T14:46:49.961-08:00</updated><title type='text'>Restful routes for non ID( primary key ) rails 3</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Lets suppose that you have a Profile model, and&amp;nbsp; you have a &lt;tt&gt;resources :profiles&lt;/tt&gt; route.&lt;br /&gt;
&lt;br /&gt;
Generally, &lt;tt&gt;profile_path&lt;/tt&gt; will build a path with the profile object’s ‘id’ in it: &lt;br /&gt;
&lt;pre&gt;profile &lt;span class=&quot;punct&quot;&gt;=&lt;/span&gt; profile&lt;span class=&quot;punct&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;ident&quot;&gt;find_by_name&lt;/span&gt;&lt;span class=&quot;punct&quot;&gt;(&#39;jaganreddy&lt;/span&gt;&lt;span class=&quot;punct&quot;&gt;&#39;)&lt;/span&gt;
  profile&lt;span class=&quot;ident&quot;&gt;_path&lt;/span&gt;&lt;span class=&quot;punct&quot;&gt;(&lt;/span&gt;profile&lt;span class=&quot;punct&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;comment&quot;&gt;# =&amp;gt; &quot;/&lt;/span&gt;profile&lt;span class=&quot;comment&quot;&gt;s/1&quot;&lt;/span&gt;&lt;/pre&gt;You can override &lt;tt&gt;to_param&lt;/tt&gt; in your model to make &lt;tt&gt;profile_path&lt;/tt&gt; build a path using the profile’s name instead of the profile’s id: &lt;br /&gt;
&lt;pre&gt;&lt;b&gt;&lt;span class=&quot;keyword&quot;&gt;class &lt;/span&gt;&lt;span class=&quot;class&quot;&gt;Profile&lt;/span&gt; &lt;span class=&quot;punct&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord::Base&lt;/b&gt;&lt;/pre&gt;&lt;pre&gt;&lt;b&gt;    &lt;span class=&quot;keyword&quot;&gt;def to_param&lt;/span&gt; &lt;span class=&quot;comment&quot;&gt;# overridding default behaviour&lt;/span&gt;&lt;/b&gt;&lt;/pre&gt;&lt;pre&gt;&lt;b&gt;&lt;span class=&quot;comment&quot;&gt;&amp;nbsp;&lt;/span&gt;      &lt;span class=&quot;ident&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/pre&gt;&lt;pre&gt;&lt;b&gt;&lt;span class=&quot;keyword&quot;&gt;    end&lt;/span&gt;&lt;/b&gt;&lt;/pre&gt;&lt;pre&gt;&lt;b&gt;&lt;span class=&quot;keyword&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;end&lt;/span&gt;&lt;/b&gt;
    
  

  profile &lt;span class=&quot;punct&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;constant&quot;&gt;Profile&lt;/span&gt;&lt;span class=&quot;punct&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;ident&quot;&gt;find_by_name&lt;/span&gt;&lt;span class=&quot;punct&quot;&gt;(&#39;jaganreddy&lt;/span&gt;&lt;span class=&quot;punct&quot;&gt;&#39;)&lt;/span&gt;
  &lt;span class=&quot;ident&quot;&gt;profile_path&lt;/span&gt;&lt;span class=&quot;punct&quot;&gt;(profile&lt;/span&gt;&lt;span class=&quot;punct&quot;&gt;)&lt;/span&gt;  &lt;span class=&quot;comment&quot;&gt;# =&amp;gt; &quot;/profiles/jaganreddy&quot;&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;Also take care for nested resources too&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;&lt;b&gt;In your controller always looks for  
&lt;span class=&quot;constant&quot; style=&quot;color: blue;&quot;&gt;Profile&lt;/span&gt;&lt;span class=&quot;punct&quot; style=&quot;color: blue;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;ident&quot; style=&quot;color: blue;&quot;&gt;find_by_name&lt;/span&gt;&lt;span class=&quot;punct&quot; style=&quot;color: blue;&quot;&gt;(params[:id]&lt;/span&gt;&lt;span class=&quot;punct&quot; style=&quot;color: blue;&quot;&gt;)&lt;/span&gt;
&lt;/b&gt;&lt;/pre&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/310895298846354895'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/310895298846354895'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2011/01/restful-routes-for-non-id-primary-key.html' title='Restful routes for non ID( primary key ) rails 3'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-7482643956694324193</id><published>2011-01-26T13:53:00.000-08:00</published><updated>2011-01-26T13:58:19.323-08:00</updated><title type='text'>how to set primary key and autoincrement on non id column using  rails 3 -- sqlite</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;sqlite_adopter uses&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; def default_primary_key_type&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if supports_autoincrement?&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL&#39;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &#39;INTEGER PRIMARY KEY NOT NULL&#39;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;br /&gt;
and under the create table definition the line says: &lt;br /&gt;
table_definition.primary_key(options[:primary_key] || Base.get_primary_key(table_name.to_s.singularize)) unless options[:id] == false &lt;br /&gt;
&lt;br /&gt;
that means we should not set :id =&amp;gt; false ... many people will do to avoid id column..&amp;nbsp; this is fine&lt;br /&gt;
but if you want&amp;nbsp; other column as primary key add at table definition not at column definition.(dont add :id =&amp;gt; false)..&lt;br /&gt;
&lt;br /&gt;
adding primary_key at table definition will take care of removing id column.&amp;nbsp; the following line will also add t ocolumn definition&lt;br /&gt;
&amp;nbsp; &#39;INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL&#39;&lt;br /&gt;
&amp;nbsp;ofcourse based on sqlite3 version...&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; def supports_autoincrement? #:nodoc:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sqlite_version &amp;gt;= &#39;3.1.0&#39;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;br /&gt;
&amp;nbsp;Note: so autoincrement for :primary_key is hard coded&lt;br /&gt;
sample:&lt;br /&gt;
create_table :students, :primary_key =&amp;gt; student_id do |t|&lt;br /&gt;
&amp;nbsp;&amp;nbsp; t.string :name&lt;br /&gt;
end&lt;br /&gt;
it generates students table as follows;&lt;br /&gt;
&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt; students;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; student_id : primary key autoincrement&lt;/div&gt;&lt;div style=&quot;color: blue;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; name :&amp;nbsp;&amp;nbsp; varchar&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
This is for what i am using version of rails : 3.0.3&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/7482643956694324193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/7482643956694324193'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2011/01/how-to-set-primary-key-and.html' title='how to set primary key and autoincrement on non id column using  rails 3 -- sqlite'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-4939096613122196449</id><published>2011-01-10T12:04:00.000-08:00</published><updated>2011-01-10T12:04:46.822-08:00</updated><title type='text'>undefined method `user_signed_in? with Rails 3.0.3 - Devise</title><content type='html'>I just started a new rails 3.0.3 application after doing a gem update &lt;br /&gt;
(loaded rails 3.0.3 and devise 1.1.5) and I got the same error. This &lt;br /&gt;
was following the default devise install instructions.&lt;br /&gt;
&lt;br /&gt;
answer:&lt;br /&gt;
for got to add&lt;br /&gt;
devise_for :users in routes.rb</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/4939096613122196449'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/4939096613122196449'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2011/01/undefined-method-usersignedin-with.html' title='undefined method `user_signed_in? with Rails 3.0.3 - Devise'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-1294895768605190082</id><published>2010-11-05T14:09:00.000-07:00</published><updated>2010-11-05T14:09:58.472-07:00</updated><title type='text'>Date sort in ruby from array can have date formats ,non date formats</title><content type='html'>Date sorting(ruby) from array is easy if array contain strings with proper date formats. Sometime invalid date formats raise argument error.&lt;br /&gt;
&lt;br /&gt;
Sample i have used&amp;nbsp; for date column attribute as follows.&lt;br /&gt;
def sort_on_mature_date(listings)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; listings.sort do |x,y|&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x_matures_on = x.when_does_it_mature? #date type&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; y_matures_on = y.when_does_it_mature? #date type&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; begin&amp;nbsp; Date.parse(x_matures_on)&amp;nbsp;&amp;nbsp; rescue&amp;nbsp; x_matures_on=&quot;1900-1-1&quot; end&amp;nbsp;&amp;nbsp;&amp;nbsp; #string could be not a date like &quot;now&quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; begin Date.parse(y_matures_on) rescue y_matures_on=&quot;1900-1-1&quot; end&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date.parse(x_matures_on)&amp;lt;=&amp;gt;Date.parse(y_matures_on)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;br /&gt;
&amp;nbsp; end</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/1294895768605190082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/1294895768605190082'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2010/11/date-sort-in-ruby-from-array-can-have.html' title='Date sort in ruby from array can have date formats ,non date formats'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-8776924529429490717</id><published>2010-10-22T11:18:00.000-07:00</published><updated>2010-10-22T11:33:39.203-07:00</updated><title type='text'>Rails rounded corner box helper</title><content type='html'>Here is the helper include in your rails app. You need to take care of images .&lt;br /&gt;
#usage:&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;%top = {&quot;background-image&quot;=&amp;gt;&quot;url(&#39;/images/accept_box_top.png&#39;)&quot;,:height=&amp;gt;&quot;6px&quot;,:width=&amp;gt;&quot;328px&quot;}%&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;lt;%mid = {&quot;background-image&quot;=&amp;gt;&quot;url(&#39;/images/accept_box_mid.png&#39;)&quot;,:height=&amp;gt;&quot;405px&quot;,:width=&amp;gt;&quot;auto&quot;}%&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;lt;%bottom = {&quot;background-image&quot;=&amp;gt;&quot;url(&#39;/images/accept_box_bottom.png&#39;)&quot;,:height=&amp;gt;&quot;9px&quot;,:width=&amp;gt;&quot;auto&quot;}%&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;lt;%content = {&quot;padding&quot;=&amp;gt;&quot;15px 28px 22px 26px&quot;}%&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;lt;%=round_box(top,mid,bottom,content){|f|&amp;nbsp; &quot;nice box&quot;} %&amp;gt;&lt;/span&gt; &lt;br /&gt;
&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
Make sure that you pass right height and width. It automatically renders the box and content inside.&lt;br /&gt;
If you want you also add extra css attributes too!&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;color: orange;&quot;&gt;#round_box_helper.rb&lt;br /&gt;
&lt;br /&gt;
module RoundBoxHelper&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; def round_box(top, mid,bottom,content,&amp;amp;b)&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; css_elements( top,mid,bottom,content)+&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;&amp;lt;div class = &#39;accept_gift_box&#39;&amp;gt;&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div class=&#39;accept_gift_box_top&#39;&amp;gt;&amp;lt;/div&amp;gt;&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div class=&#39;accept_gift_box_mid&#39;&amp;gt;&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div&lt;br/&gt; class=&#39;accept_gift_box_content&#39;&amp;gt;&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br/&gt; &quot;+b.call+&quot;&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/div&amp;gt;&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;div class=&#39;accept_gift_box_bottom&#39;&amp;gt; &amp;lt;/div&amp;gt;&lt;br/&gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;/div&amp;gt;&quot;&lt;br/&gt;&lt;br /&gt;
&amp;nbsp; end&lt;br/&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; def css_elements top,mid,bottom,content&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;&amp;lt;style type=&#39;text/css&#39;&amp;gt; &quot; +&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;.accept_gift_box_top{&quot;+&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parse_styles( top )+&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;}&quot;+&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;.accept_gift_box_mid{&quot;+&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parse_styles( mid )+&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;}&quot;+&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;.accept_gift_box_bottom{&quot;+&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parse_styles( bottom )+&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;}&quot;+&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;.accept_gift_box_content{&quot;+&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parse_styles( content )+&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;}&quot;+&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;.accept_gift_box{&quot;+&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;float:left;&quot;+&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;}&quot;+&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &quot;&amp;lt;/style&amp;gt;&quot;&lt;br/&gt;&lt;br /&gt;
&amp;nbsp; end&lt;br/&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; def parse_styles el&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; str=&quot;&quot;&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; el.each_pair do |attr,value|&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; str = str+attr.to_s+&quot;:&quot;+value.to_s+&quot;;&quot;&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;br/&gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; str&lt;br/&gt;&lt;br /&gt;
&amp;nbsp; end&lt;br/&gt;&lt;br /&gt;
&lt;br /&gt;
end&lt;/div&gt;&lt;br/&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/8776924529429490717'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/8776924529429490717'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2010/10/rails-rounded-corner-box-helper.html' title='Rails rounded corner box helper'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-2878352585338186417</id><published>2010-09-28T09:45:00.000-07:00</published><updated>2010-09-28T09:47:47.773-07:00</updated><title type='text'>width and top of invisible element in IE may  give 0 zero using jQuery</title><content type='html'>jQuery element width for invisible element in IE will not give exact result.&lt;br /&gt;
But&amp;nbsp; in Firefox it works perfectly.&lt;br /&gt;
&lt;br /&gt;
$(e).width() //using jQuery to get the width.&lt;br /&gt;
&lt;br /&gt;
i have used a way to solve this one by showing, calculate width and hiding the element.&lt;br /&gt;
&lt;br /&gt;
$(e).&lt;br /&gt;
show(). // to get the width of visible element ==&amp;gt; IE issue&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; css({zoom: 1,left:$(e).position().left-parseInt($(e).width()),top:$(e).position().top}).&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hide().</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/2878352585338186417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/2878352585338186417'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2010/09/width-and-top-of-invisible-element-in.html' title='width and top of invisible element in IE may  give 0 zero using jQuery'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-360436152455172110.post-2750581848262581229</id><published>2010-09-28T09:34:00.000-07:00</published><updated>2010-09-28T09:37:34.766-07:00</updated><title type='text'>jQuery animation effect slide bug in IE 7</title><content type='html'>The best example is for this ind of bug is presented by ryan as follows&lt;br /&gt;&lt;br /&gt;http://www.ryancramer.com/misc/jquery_slide/#&lt;br /&gt;&lt;br /&gt; the slide effects of jquery may not work 100% correctly in IE  6 &amp;amp; IE 7 .  Effects are misbehave like effects complete till 50% or so...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So i have used show call back function to rescue the bug.. Though it is 100% not correct but once the effects renders second time it works perfectly.&lt;br /&gt;&lt;br /&gt;So make it show and show it again..with less duration.. to avoid flickering effect.&lt;br /&gt;&lt;br /&gt;$(&quot;my_element&quot;).show(1,function(){$(this).show(&quot;slide&quot;,{direction:&quot;right&quot;})})</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/2750581848262581229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/360436152455172110/posts/default/2750581848262581229'/><link rel='alternate' type='text/html' href='http://reddyonrails.blogspot.com/2010/09/jquery-animation-effect-slide-bug-in-ie.html' title='jQuery animation effect slide bug in IE 7'/><author><name>Jagan Reddy</name><uri>http://www.blogger.com/profile/17987992266620378604</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry></feed>