<?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: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-7658573079763034733</id><updated>2012-01-23T07:25:37.498+05:30</updated><category term='pagination'/><category term='JQuery'/><category term='jEditable'/><category term='Agile'/><category term='Ruby'/><category term='BDD'/><category term='ajax'/><category term='Retrospectives'/><category term='Rails'/><category term='Rails 3.1'/><category term='Scrum'/><category term='Rails 3'/><category term='Sprint'/><category term='Spreadsheet gem'/><category term='migration'/><category term='cucumber'/><category term='Oracle'/><category term='mongodb'/><category term='Ruby 1.9.2'/><category term='JQgrid'/><category term='Rspec'/><title type='text'>easy_software = Agile.find(ruby_on_rails)</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>19</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-1931919699485253009</id><published>2012-01-23T07:13:00.001+05:30</published><updated>2012-01-23T07:25:10.777+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ruby'/><title type='text'>Tip of the day</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;On my current project I had to calculate date of Wednesday in nth week in mth year.&lt;br /&gt;&lt;br /&gt;Here is the trick:&lt;br /&gt;&lt;a href="https://github.com/gouravtiwari/date-extension/blob/master/lib/core_extensions/date.rb"&gt;date-extension&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-1931919699485253009?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/1931919699485253009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=1931919699485253009' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/1931919699485253009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/1931919699485253009'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2012/01/tip-of-day.html' title='Tip of the day'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-2239174583979601387</id><published>2011-12-23T22:24:00.003+05:30</published><updated>2012-01-23T07:25:37.506+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Rails 3.1'/><title type='text'>Rails upgrade from 3.0.7 to 3.1 and asset pipe-lining</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Following my previous blog, I happen to work on another rails upgrade at the beginning of my new project. This time rails 3.0.7 to 3.1. I though, I should document these steps, as it might help myself or someone else in future.&lt;br /&gt;&lt;br /&gt;I googled and found a good discussion on &lt;a href="http://stackoverflow.com/questions/7288361/how-to-upgrade-a-rails-3-0-app-to-rails-3-1"&gt;stack-overflow&lt;/a&gt;. As &lt;a href="http://stackoverflow.com/users/253363/forrest-ye"&gt;Forrest Ye&lt;/a&gt;&amp;nbsp;gave the right answer, I began the migration step by step, as it is written:&lt;br /&gt;"Edit Gemfile, change Rails gem version&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;gem 'rails', '3.1.0'&lt;/blockquote&gt;&lt;br /&gt;Also adds new gems introduced in 3.1.0&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;group :assets do&lt;br /&gt;&amp;nbsp; gem 'sass-rails', "~&amp;gt; 3.1.0"&lt;br /&gt;&amp;nbsp; gem 'coffee-rails', "~&amp;gt; 3.1.0"&lt;br /&gt;&amp;nbsp; gem 'uglifier'&lt;br /&gt;end&lt;br /&gt;gem 'jquery-rails'&lt;/blockquote&gt;run&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;bundle update rails&lt;/blockquote&gt;Then run rake rails:update and resolve conflicts."&lt;br /&gt;&lt;div&gt;&lt;br /&gt;I found few conflicts and before accepting them, I tried to understand:&lt;br /&gt;&lt;br /&gt;1. config/application.rb: &lt;br /&gt;I paid attention to:&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;config.assets.enabled = true&lt;br /&gt;config.assets.version = '1.0' &lt;/blockquote&gt;which means you are enabling assets pipe-lining &amp;nbsp;which is one of the feature of rails 3.1, I accepted the changes.&lt;br /&gt;2. config/environments/development.rb:&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;config.action_view.debug_rjs = true&lt;/blockquote&gt;which has been deprecated, so this line should be deleted, if you are using rjs in views, debugging is not supported now.&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;config.assets.compress = false&lt;/blockquote&gt;which means assets compression is off in development, I accepted the changes.&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;config.assets.debug = true&lt;/blockquote&gt;&lt;div&gt;it means, you can see the assets being loaded in logs. I accepted this change.&lt;/div&gt;&lt;div&gt;3. config/environments/production.rb&lt;/div&gt;&lt;div&gt;I saw again configuration related to asset pipeline:&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;config.assets.compress = true&lt;br /&gt;config.assets.compile = false&lt;br /&gt;config.assets.digest = true&lt;/blockquote&gt;Simply, accept these changes.&lt;br /&gt;&lt;br /&gt;Once this is done, move all assets from public/images, public/javascripts, public/stylesheets to app/assets/ directory. Again, you have to make sure, that you&lt;br /&gt;Include css/javascript links in your layout file like this&lt;br /&gt;&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;&amp;lt;%= stylesheet_link_tag "application" %&amp;gt;&lt;br /&gt;&amp;lt;%= javascript_include_tag "application" %&amp;gt;&lt;/blockquote&gt;Again, it is important to understand the behavior of asset pipeline and how it works. For example, in application.js file, you will have:&lt;/div&gt;&lt;div&gt;&lt;blockquote class="tr_bq"&gt;//= require_tree .&lt;/blockquote&gt;&lt;/div&gt;&lt;div&gt;that means, all the files from assets/javascripts directory will be loaded automatically, as application is being loaded, in hierarchical format. If you do need js files in sequence, mention that above this line, e.g.:&lt;/div&gt;&lt;div&gt;//= require jquery&amp;nbsp;&lt;/div&gt;&lt;div&gt;//= require jquery_ujs&lt;/div&gt;&lt;div&gt;//= require highcharts&lt;/div&gt;&lt;div&gt;//= require_tree .&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Similarly you have application.css file, which will load assets in hierarchy, so override it if needed.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;One important thing I noticed is about images, which are embedded in stylesheets. I had stylesheet.css as:&lt;/div&gt;&lt;blockquote class="tr_bq"&gt;/*&lt;br /&gt;*= require_self&lt;br /&gt;*= require_tree .&lt;br /&gt;*/&lt;br /&gt;#header {  height:20px; }&lt;br /&gt;body {background-image:url&lt;b&gt;(../images/mainBack.png)&lt;/b&gt; !important; background-repeat:repeat-x;}&lt;/blockquote&gt;&amp;nbsp;So, after moving images to app/assets/images directory, I have to remove the relative path of the image:&lt;br /&gt;&lt;blockquote class="tr_bq"&gt;body {background-image:url&lt;b&gt;(mainBack.png)&lt;/b&gt;&amp;nbsp;!important; background-repeat:repeat-x;}&lt;/blockquote&gt;&lt;div&gt;Similarly for all other styles and that is it!&lt;/div&gt;&lt;blockquote class="tr_bq"&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-2239174583979601387?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/2239174583979601387/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=2239174583979601387' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/2239174583979601387'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/2239174583979601387'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2011/12/rails-upgrade-from-307-to-31-and-asset.html' title='Rails upgrade from 3.0.7 to 3.1 and asset pipe-lining'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-4123463107495272496</id><published>2011-09-11T20:38:00.003+05:30</published><updated>2011-09-11T20:38:46.144+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Rails 3'/><title type='text'>Rails upgrade from 2.3.5 to 3.0.9</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Few weeks back I did rails upgrade for my current project from rails 2.3.5 to rails 3.0.9 (on Windows 7).&lt;br /&gt;&lt;br /&gt;I began with &lt;a href="http://edgeguides.rubyonrails.org/3_0_release_notes.html#upgrading-to-rails-3"&gt;rails 3 upgrade guide&lt;/a&gt;.&amp;nbsp;So, first step was to install ruby 187, which I already had&amp;nbsp;on my system with &lt;a href="http://www.ruby-on-rails-outsourcing.com/2010/07/28/ruby-version-manager-for-windows/"&gt;pik&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;There is a good series on rails on upgrading to rails 3 from Ryan Bates:&lt;br /&gt;http://asciicasts.com/episodes/226-upgrading-to-rails-3-part-1&lt;br /&gt;http://asciicasts.com/episodes/226-upgrading-to-rails-3-part-2&lt;br /&gt;http://asciicasts.com/episodes/226-upgrading-to-rails-3-part-3&lt;br /&gt;&lt;br /&gt;Some how the &lt;a href="http://omgbloglol.com/post/364624593/rails-upgrade-is-now-an-official-plugin"&gt;rails-upgrade-plugin&lt;/a&gt; did not work for me (as I was working on Windows 7) .&lt;br /&gt;&lt;br /&gt;I then followed&amp;nbsp;&lt;a href="http://omgbloglol.com/post/353978923/the-path-to-rails-3-approaching-the-upgrade%20step-by-step"&gt;the-path-to-rails-3-approaching-the-upgrade step-by-step&lt;/a&gt;&amp;nbsp;and I got application 80% upgraded, the rest 20% was a tough part.&lt;br /&gt;&lt;br /&gt;In this blog, I am writing about challenges I faced in this process.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ul style="text-align: left;"&gt;&lt;li&gt;&lt;b&gt;Installing rails 3.0.9 gem&lt;/b&gt;:&lt;br /&gt;Somehow gem install rails shown errors:&lt;br /&gt;C:\myapp&amp;gt;gem install rails&lt;br /&gt;Successfully installed rails-3.0.9&lt;br /&gt;1 gem installed&lt;br /&gt;&lt;br /&gt;Installing ri documentation for rails-3.0.9...&lt;br /&gt;file 'lib' not found&lt;br /&gt;Installing RDoc documentation for rails-3.0.9...&lt;br /&gt;file 'lib' not found&lt;br /&gt;&lt;br /&gt;I used,&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: monospace;"&gt;C:\myapp&amp;gt;gem install rails --no-rdoc --no-ri&lt;/span&gt;Successfully installed rails-3.0.9&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: monospace;"&gt;1 gem installed&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;routes.rb&lt;br /&gt;&lt;/b&gt;I had to update the routes.rb file and I found one really helpful link:&amp;nbsp;http://stackoverflow.com/questions/3103765/routing-in-rails-3-map-with-options&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Deprecation warning for cookie_store:&lt;br /&gt;&lt;/b&gt;DEPRECATION WARNING: ActionController::Base.session= is deprecated. Please configure it on your application with config.session_store :cookie_store, :key =&amp;gt; '....'. (called from C:/myapp/config/initializers/session_store.rb:7)&lt;br /&gt;&lt;br /&gt;So, I did:&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; white-space: pre;"&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;module&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="typ" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;Myapp&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; white-space: pre;"&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;class&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="typ" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;Application&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&amp;lt;&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="typ" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;Rails&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;::&lt;/span&gt;&lt;span class="typ" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;Application&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee;"&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; white-space: pre;"&gt;&amp;nbsp; &amp;nbsp; config&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; white-space: pre;"&gt;.&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; white-space: pre;"&gt;session_store &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; white-space: pre;"&gt;:&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;span class="Apple-style-span" style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;"&gt;&lt;span class="Apple-style-span" style="font-size: 14px; white-space: pre;"&gt;cookie_store,       :key =&amp;gt; '_myapp_session',  :secret =&amp;gt; 'some-secret-string-very-long'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;"&gt;&lt;span class="Apple-style-span" style="font-size: 14px; white-space: pre;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;Also, I removed&amp;nbsp;C:/myapp/config/initializers/session_store.rb file.&lt;br /&gt;Reference: http://stackoverflow.com/questions/3720379/sqlsessionstore-in-rails-3 and&amp;nbsp;&lt;a href="http://apidock.com/rails/ActiveRecord/SessionStore"&gt;http://apidock.com/rails/ActiveRecord/SessionStore&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Logging the deprecation warnings&lt;/b&gt;&lt;br /&gt;I saw another warning:&lt;br /&gt;You did not specify how  you would like Rails to report deprecation notices for your development  environment, please set config.active_support.deprecation to :log at config/environments/development.rb&lt;br /&gt;&lt;br /&gt;So, I updated development.rb (and other &lt;environments&gt;.rb files):&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee;"&gt;&lt;span class="typ" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;span class="Apple-style-span" style="color: darkblue;"&gt;&lt;span class="Apple-style-span" style="font-size: 14px; white-space: pre;"&gt;Myapp::Application.configure do&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="white-space: pre;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee;"&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; white-space: pre;"&gt;&amp;nbsp; &amp;nbsp; config&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; white-space: pre;"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee;"&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;span class="Apple-style-span" style="font-family: monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: 14px; white-space: pre;"&gt;active_support.deprecation = :log&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/environments&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;consider_all_requests_local&amp;nbsp;warning&lt;br /&gt;&lt;/b&gt;DEPRECATION WARNING:  ActionController::Base.consider_all_requests_local= is deprecated.  Please configure it on your application with  config.consider_all_requests_local=.&lt;br /&gt;&lt;br /&gt;So, I added this snippet in config/environments/development.rb&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; white-space: pre;"&gt;&lt;span class="Apple-style-span" style="color: darkblue;"&gt;Myapp::Application.configure do&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee;"&gt;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: monospace; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; white-space: pre;"&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;    &lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;config&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;.&lt;/span&gt;&lt;/code&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman'; white-space: normal;"&gt;consider_all_requests_local&lt;/span&gt;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;span class="Apple-style-span" style="font-family: monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: 14px; white-space: pre;"&gt; = true&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: 14px; white-space: pre;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Some easy once&lt;br /&gt;&lt;/b&gt;1. DEPRECATION WARNING: RAILS_ENV is deprecated. Please use ::Rails.env.&lt;br /&gt;So, wherever I was using RAILS_ENV, I replaced with Rails.env&lt;br /&gt;&lt;br /&gt;2. DEPRECATION WARNING: RAILS_ROOT is deprecated. Please use  ::Rails.root.to_s.&lt;br /&gt;So, wherever I was using RAILS_ROOT, I replaced with Rails.root.to_s&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;ActionMailer warnings&lt;br /&gt;&lt;/b&gt;1. When you need to set character set for action mailer, you specify in initializer.rb, which throws this warning:&lt;br /&gt;DEPRECATION WARNING: ActionMailer::Base.default_charset=value is  deprecated, use default :charset =&amp;gt; value instead&lt;br /&gt;&lt;br /&gt;I passed hash to the default method in application.rb:&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee; color: darkblue;"&gt;&lt;span class="Apple-style-span" style="color: black;"&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; white-space: pre;"&gt;&lt;span class="Apple-style-span" style="color: darkblue;"&gt;Myapp::Application.configure do&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee;"&gt;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: monospace; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; white-space: pre;"&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;    &lt;/span&gt;&lt;/code&gt;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;span class="Apple-style-span" style="font-family: monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: 14px; white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: small; white-space: normal;"&gt;default :charset =&amp;gt; 'utf-8'&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;2 Similarly the mime version we set in initializers:&lt;br /&gt;DEPRECATION WARNING: ActionMailer::Base.default_mime_version=value is  deprecated, use default :mime_version =&amp;gt; value instead.&lt;br /&gt;&lt;br /&gt;I passed hash to the default method in application.rb:&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee;"&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; white-space: pre;"&gt;&lt;span class="Apple-style-span" style="color: darkblue;"&gt;Myapp::Application.configure do&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee;"&gt;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: monospace; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; white-space: pre;"&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;    &lt;/span&gt;&lt;/code&gt;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;span class="Apple-style-span" style="font-family: monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: 14px; white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: small; white-space: normal;"&gt;default :mime_version =&amp;gt; '1.0'&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;3. For multipart emails the setting has to be adjusted:&lt;br /&gt;DEPRECATION WARNING:  ActionMailer::Base.default_implicit_parts_order=value is deprecated, use  default :implicit_parts_order =&amp;gt; value instead&lt;br /&gt;This is again can be passed to default method:&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee;"&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; white-space: pre;"&gt;&lt;span class="Apple-style-span" style="color: darkblue;"&gt;Myapp::Application.configure do&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee;"&gt;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: monospace; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline; white-space: pre;"&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;   &lt;span class="Apple-style-span" style="color: black; font-family: 'Times New Roman'; font-size: small; white-space: normal;"&gt;&amp;nbsp; default :parts_order&amp;nbsp;=&amp;gt;&amp;nbsp;&lt;span class="Apple-style-span" style="background-color: white; font-family: monospace; font-size: 12px; line-height: 16px;"&gt;[ "text/plain", "text/enriched", "text/html" ]&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;html_safe in view?&lt;br /&gt;&lt;/b&gt;For 2-3 hours I struggled to find the reason, why the select tag was not producing the tags. When I found it I understand that this is again a security addition to convert strings into html safe form. So, all your '&amp;amp;lt;' will be converted to '&amp;lt;' and all '&amp;amp;gt;' will be converted into '&amp;gt;'. I actually added &lt;b&gt;.html_safe&lt;/b&gt;&amp;nbsp;at the end of each string in view and that showed all the tags finally.&lt;br /&gt;&lt;br /&gt;Reference:&amp;nbsp;&lt;a href="http://stackoverflow.com/questions/4409865/rails-3-select-tag-not-producing-dom-elements"&gt;rails-3-select-tag-not-producing-dom-elements&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Removed config.action_view.cache_template_loading, use config.cache_classes instead&lt;/b&gt;&lt;br /&gt;Reference:&amp;nbsp;https://github.com/rails/rails/commit/83e29b9773ac113ceacb1e36c2f333d692de2573&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Rspec&lt;br /&gt;&lt;/b&gt;I was using rspec and here is the deprecation warning I got:&lt;br /&gt;*****************************************************************&lt;br /&gt;DEPRECATION WARNING: you are using a deprecated constant that will&amp;nbsp;be removed from a future version of RSpec.&lt;br /&gt;C:/cit/spec/controllers/activity_logs_controller_spec.rb:1:in `require'&lt;br /&gt;* Spec is deprecated.&lt;br /&gt;* RSpec is the new top-level module in RSpec-2&lt;br /&gt;***************************************************************&lt;br /&gt;***************************************************************&lt;br /&gt;DEPRECATION WARNING: you are using deprecated behaviour that will&amp;nbsp;be removed from a future version of RSpec.&lt;br /&gt;C:/cit/spec/spec_helper.rb:17&lt;br /&gt;* Spec::Runner.configure is deprecated.&lt;br /&gt;* please use RSpec.configure instead.&lt;br /&gt;&lt;br /&gt;So, I have to use rspec-rails-2 which supports rails 3.&lt;br /&gt;Reference: http://groups.google.com/group/cukes/browse_thread/thread/40c4c2aea1c07afe/cb63eb7f0b733646?lnk=raot&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Ajax stopped working&lt;/b&gt;&lt;br /&gt;I was using jQuery as javascript library, and I found somehow the ajax calls stopped working after the upgrade. I later found that there is a security threat and a fix for that is available&lt;br /&gt;Here is what I had to do:&lt;br /&gt;&lt;br /&gt;Step#1. In application.html.erb, I had to include csrf_meta_tag:&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #333333; font-family: monospace; font-size: 12px; white-space: pre;"&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee; color: darkblue; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px;"&gt;&lt;span class="Apple-style-span" style="color: black; font-family: 'Times New Roman'; font-size: small; white-space: normal;"&gt;&lt;span class="Apple-style-span" style="background-color: white; color: #333333; font-family: monospace; font-size: 12px; white-space: pre;"&gt;&amp;lt;%= javascript_include_tag :defaults %&amp;gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: 12px; white-space: pre;"&gt;&amp;lt;%= csrf_meta_tag %&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: white;"&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: 12px; white-space: pre;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: 12px; white-space: pre;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;Step#2. I added this snippet to application.js:&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: monospace;"&gt;&lt;span class="Apple-style-span" style="white-space: pre-wrap;"&gt;&lt;span class="Apple-style-span" style="background-color: #eeeeee; color: darkblue; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; white-space: pre;"&gt;&lt;span class="Apple-style-span" style="color: black; font-family: 'Times New Roman'; font-size: small; white-space: normal;"&gt;&lt;span class="Apple-style-span" style="font-family: monospace;"&gt;&lt;span class="Apple-style-span" style="white-space: pre-wrap;"&gt;$(document).ajaxSend(function(e, xhr, options) {&lt;/span&gt;&lt;/span&gt;&amp;nbsp; var token = $("meta[name='csrf-token']").attr("content");&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: monospace;"&gt;&lt;span class="Apple-style-span" style="white-space: pre-wrap;"&gt;  xhr.setRequestHeader("X-CSRF-Token", token);&lt;/span&gt;&lt;/span&gt;});&lt;/span&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Reference:&amp;nbsp;&lt;a href="http://weblog.rubyonrails.org/2011/2/8/csrf-protection-bypass-in-ruby-on-rails"&gt;csrf-protection-bypass-in-ruby-on-rails&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;RackBaseURI instead of RailsBaseURI&lt;/b&gt;&lt;br /&gt;I was using RailsBaseURI in apache, but after upgrade to Rails 3, I had to update it to RackBaseURI&lt;br /&gt;Reference:&amp;nbsp;&lt;a href="http://www.modrails.com/documentation/Users%20guide%20Apache.html#RackBaseURI"&gt;RackBaseURI&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Last but not least, I was using &lt;b&gt;valid?&lt;/b&gt; method in helper to check if the object is valid or not and based on that I was displaying certain fields, which was working fine in Rails 2. &amp;nbsp;In Rails 3 &lt;b&gt;valid?&lt;/b&gt; method will trigger validations as well, which caused field_with_errors div to show-up all the time (even when the validation should not happen). I changed the logic to not use valid? method to display other fields and it solved the problem.&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-4123463107495272496?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/4123463107495272496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=4123463107495272496' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/4123463107495272496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/4123463107495272496'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2011/09/rails-upgrade-from-235-to-309.html' title='Rails upgrade from 2.3.5 to 3.0.9'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><thr:total>0</thr:total><georss:featurename>New York, NY, USA</georss:featurename><georss:point>40.7143528 -74.0059731</georss:point><georss:box>40.5217853 -74.3218301 40.9069203 -73.69011610000001</georss:box></entry><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-6136153101295310653</id><published>2011-08-15T20:07:00.000+05:30</published><updated>2011-08-15T20:07:31.821+05:30</updated><title type='text'>From Team to Wow Team</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;a href="http://www.slideshare.net/GouravTiwari/agile-conf-2011fromteamtowowteam-anagileteamsjourney"&gt;Agile Conf 2011 presentation slides&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-6136153101295310653?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/6136153101295310653/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=6136153101295310653' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/6136153101295310653'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/6136153101295310653'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2011/08/from-team-to-wow-team.html' title='From Team to Wow Team'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-1711506258696175874</id><published>2011-03-24T20:43:00.001+05:30</published><updated>2011-03-25T02:08:18.795+05:30</updated><title type='text'>development on Windows deploying to Linux with cruise and bundler?</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;In my previous &lt;a href="http://gouravtiwari.blogspot.com/2011/03/bundler-with-rails-222.html"&gt;post&lt;/a&gt;, I set-up bundler with rails-2.2.2 application. Soon after that, I found myself in another trouble.&lt;br /&gt;&lt;br /&gt;When I set-up bundler, I had to create &lt;b&gt;Gemfile&lt;/b&gt; for the gems required by my rails application. Also, when I run &lt;b&gt;bundle install&lt;/b&gt;&amp;nbsp;command, it creates &lt;b&gt;Gemfile.lock&lt;/b&gt;&amp;nbsp;file, this file holds various information:&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;/div&gt;&lt;ul style="text-align: left;"&gt;&lt;li&gt;Gem repositories (sources)&lt;/li&gt;&lt;li&gt;Which version of gem the application is using (gem specification)&lt;/li&gt;&lt;li&gt;If there is any dependency of any gem, then what they are&lt;/li&gt;&lt;li&gt;Platform details&lt;/li&gt;&lt;/ul&gt;In my current project, I use Windows 7 as development machine, there is a &lt;a href="http://en.wikipedia.org/wiki/CruiseControl"&gt;cruise&lt;/a&gt; server on linux machine, I am committing my code to a&amp;nbsp;&lt;a href="http://subversion.tigris.org/"&gt;subversion&lt;/a&gt;&amp;nbsp;repository and once the build passes on cruise it deploys to a linux server. Every time I run bundle install, it creates a Gemfile.lock with windows version of gems and platform details for windows. If I commit Gemfile and Gemfile.lock, it fails the build and I have to manually login to cruise box and remove those files and re-run bundle install command, so that it generates the Gemfile and Gemfile.lock for linux environment, so that on integration and production servers, the Gemfile and Gemfile.lock will remain with linux version and there is no failures there. This was a pain.&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;I wrote a ruby script to do this job for me. With this script, I removed everything windows specific in Gemfile and Gemfile.lock I can think of. Here is what I did (look at:&amp;nbsp;&lt;a href="https://github.com/gouravtiwari/windows_linux_fix_for_bundler"&gt;https://github.com/gouravtiwari/windows_linux_fix_for_bundler&lt;/a&gt;&amp;nbsp;for source code)&lt;/div&gt;&lt;ul style="text-align: left;"&gt;&lt;li&gt;I extended cruise:init rake task(created fix.rake in lib), to include my ruby script.&lt;/li&gt;&lt;li&gt;In the script, I am removing windows traces, updating the platform details, running bundle command and then committing the latest Gemfile and Gemgfile.lock toSVN.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;This way, if by mistake I am committing Gemfile and Gemfile.lock to SVN, I don't need to go to cruise and re-generate Gemfile and Gemfile.lock.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-1711506258696175874?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/1711506258696175874/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=1711506258696175874' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/1711506258696175874'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/1711506258696175874'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2011/03/development-on-windows-deploying-to.html' title='development on Windows deploying to Linux with cruise and bundler?'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-3273875283564813313</id><published>2011-03-04T19:45:00.000+05:30</published><updated>2011-03-04T19:45:43.129+05:30</updated><title type='text'>Bundler with rails-2.2.2</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div&gt;I am working on a rails application, which is on rails-2.2.2. I have used bundler on rails-3 application, but never tried bundler for rails-2.2.2. The benefit of bundler is huge, it is gem manager for rails application. So, now no pain of vendoring/localizing gems in rails application.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://gembundler.com/"&gt;gembundler.com&lt;/a&gt; gives step-by-step process on how to install/configure bundler for rails-2.3.x and rails-3.x applications. So, I wanted to find out how does it work with rails-2.2.2 application.&lt;br /&gt;&lt;br /&gt;So, here is how I did.&lt;br /&gt;&lt;ul style="text-align: left;"&gt;&lt;li&gt;First of all I have installed bundler&lt;br /&gt;gem install bundler // installed bundler 1.0.10&lt;/li&gt;&lt;li&gt;Updated rubygems&lt;br /&gt;gem update --system // rubygems &amp;gt; 1.3.6&lt;/li&gt;&lt;li&gt;Created config/preinitializer.rb file with below content:&lt;br /&gt;begin&lt;br /&gt;&amp;nbsp; require "rubygems"&lt;br /&gt;&amp;nbsp; require "bundler"&lt;br /&gt;rescue LoadError&lt;br /&gt;&amp;nbsp; raise "Could not load the bundler gem. Install it with `gem install bundler`."&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;if Gem::Version.new(Bundler::VERSION) &amp;lt;= Gem::Version.new("0.9.24")&lt;br /&gt;&amp;nbsp; raise RuntimeError, "Your bundler version is too old for Rails 2.3." +&lt;br /&gt;&amp;nbsp;&amp;nbsp; "Run `gem install bundler` to upgrade."&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;begin&lt;br /&gt;&amp;nbsp; # Set up load paths for all bundled gems&lt;br /&gt;&amp;nbsp; ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)&lt;br /&gt;&amp;nbsp; Bundler.setup&lt;br /&gt;rescue Bundler::GemNotFound&lt;br /&gt;&amp;nbsp; raise RuntimeError, "Bundler couldn't find some gems." +&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Did you run `bundle install`?"&lt;br /&gt;end&lt;br /&gt;&amp;nbsp;&lt;/li&gt;&lt;li&gt;Created Gemfile with something similar:&lt;br /&gt;require 'rubygems'&lt;br /&gt;source 'http://rubygems.org'&lt;br /&gt;source 'http://gemcutter.org'&lt;br /&gt;source 'http://gems.github.com'&lt;br /&gt;&lt;br /&gt;gem 'rails', '2.2.2'&lt;br /&gt;gem 'hpricot', '0.6.0'&lt;br /&gt;gem "composite_primary_keys", '1.0.8'&lt;br /&gt;gem 'javan-whenever', '0.3.7'&lt;br /&gt;gem 'mysql', '2.8.1'&lt;br /&gt;gem 'activerecord-oracle_enhanced-adapter', '1.1.9'&lt;br /&gt;gem 'ruby-oci8', '1.0.3'&lt;br /&gt;&lt;br /&gt;group :test do&lt;br /&gt;&amp;nbsp; gem 'mocha', '0.9.5'&lt;br /&gt;&amp;nbsp; gem 'rspec',&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '1.3.1', :require =&amp;gt; 'spec'&lt;br /&gt;&amp;nbsp; gem 'rspec-rails',&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '1.3.3'&lt;br /&gt;&amp;nbsp; gem 'database_cleaner',&amp;nbsp; '0.5.0'&lt;br /&gt;&amp;nbsp; gem 'capybara'&lt;br /&gt;&amp;nbsp; gem 'ruby-debug'&lt;br /&gt;&amp;nbsp; gem 'factory_girl'&lt;br /&gt;end&lt;/li&gt;&lt;li&gt;From the application root, I ran:&lt;br /&gt;bundle install&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;That is it and I have my application up and running with bundler. Once I tested my application, I removed gems folder from &lt;application-name&gt;/vendor (no need for localized version of gems now.)&lt;br /&gt;&lt;/application-name&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-3273875283564813313?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/3273875283564813313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=3273875283564813313' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/3273875283564813313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/3273875283564813313'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2011/03/bundler-with-rails-222.html' title='Bundler with rails-2.2.2'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-5358030532621019742</id><published>2011-01-28T21:27:00.001+05:30</published><updated>2011-01-28T22:06:08.264+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ruby 1.9.2'/><category scheme='http://www.blogger.com/atom/ns#' term='Ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='Rails 3'/><category scheme='http://www.blogger.com/atom/ns#' term='mongodb'/><category scheme='http://www.blogger.com/atom/ns#' term='Rails'/><title type='text'>mongodb with Rails 3</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Few days back, I did introspection and thought, as a developer:&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;/div&gt;&lt;ol style="text-align: left;"&gt;&lt;li&gt;How many languages I know?&lt;/li&gt;&lt;li&gt;How many databases I have worked with?&lt;/li&gt;&lt;li&gt;Which frameworks I am comfortable working with?&lt;/li&gt;&lt;li&gt;Do I know the latest technologies in my field?&lt;/li&gt;&lt;/ol&gt;I then realized that working on PHP 4, PHP 5, Ruby 1.8.6 doesn't mean that I know the latest cutting edge technologies. I should try learning may be Ruby 1.9.2, or may be a new language. I have worked with MySQL, Oracle, but what's new? I should try working with some other database, may be Mongodb. I did work on Drupal 4.7.x, 5.7.x and also on Rails 2.0.x to 2.3.x, but may be I should try Rails 3.&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;Then I downloaded Ruby 1.9.2, with &lt;a href="http://blog.benhall.me.uk/2010/08/installing-rails-30-ruby-192-and-pik-on.html"&gt;pik&lt;/a&gt;, so I can continue work on the project work(ruby 1.8.6), as well as try out rails 3. Needless to say Rails 3.x is far better than it's predecessor Rails 2.x. &lt;a href="http://gembundler.com/git.html"&gt;bundler&amp;nbsp;&lt;/a&gt;&amp;nbsp;is just awesome! But I was so used to use ActiveRecord (with mysql and oracle), I was not able to think how would I work without it on a Rails project.&amp;nbsp;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;I first tried &lt;a href="http://www.mongodb.org/"&gt;mongodb online&lt;/a&gt;&amp;nbsp;(Try it out section) and felt it different, but complete. Whatever basic operations you can perform in mysql/oracle, you can do it in that tutorial.&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;I&lt;a href="http://www.mongodb.org/display/DOCS/Rails+3+-+Getting+Started"&gt; installed Rails 3.0.3 without ActiveRecord and installed mongodb&lt;/a&gt; to give it a try. It is really different and it amazes you by the fact that how easy to use it with rails. ActiveRecord syntax will not work, but mongo mapper has it's own syntax. In two-three hours I had my basic application with Rails 3 and mongodb on windows7 machine up and running (including learning curve and thanks to &lt;a href="http://asciicasts.com/episodes/194-mongodb-and-mongomapper"&gt;mongodb and mongo mapper asciicast&lt;/a&gt;&amp;nbsp;and Ryan Bates for &lt;a href="https://github.com/ryanb/nifty-generators"&gt;nifty_generators&lt;/a&gt;)&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;Once I was done with my rails3-mongodb test application, I realized that MySQL and Oracle are not end of the world. There are better and different things that I should learn. It is much faster to install and configure Ruby 1.9.2 + mongodb + rails 3 and get the application up and running as compared to Ruby 1.9.2 + MySQL/OracleXE (10g) + rails 3 from scratch.&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;I would love to hear comments/similar experiences :)&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-5358030532621019742?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/5358030532621019742/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=5358030532621019742' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/5358030532621019742'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/5358030532621019742'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2011/01/mongodb-with-rails-3.html' title='mongodb with Rails 3'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-1087352527538220089</id><published>2011-01-04T04:37:00.001+05:30</published><updated>2011-01-28T22:06:49.051+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sprint'/><category scheme='http://www.blogger.com/atom/ns#' term='Scrum'/><category scheme='http://www.blogger.com/atom/ns#' term='Agile'/><category scheme='http://www.blogger.com/atom/ns#' term='Retrospectives'/><title type='text'>Building High Performance Team</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_q-Yw-1yDoHc/TSJTN5IagDI/AAAAAAAAHtE/umuuOrwNJK8/s1600/matrix.JPG" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;‘High Performance Team’, a phrase that one always dreams to be a part of some day.&amp;nbsp; A team that inspires other teams to achieve what they would generally consider way above their potential. A team, where there is no place for finger pointing, rut and panic(even in crucial times). I am working in a team which is high performing and I would like to uncover the challenges we faced and how we overcome those as a team.&lt;br /&gt;&lt;br /&gt;We never thought that one day we will be a successful and high performing team nor did it happen overnight. We faced the moments of finger pointing, failures, boredom and heated discussions during the initial phase. We slowly made use of continuous ‘retrospection’ from ‘Scrum’, which helped a lot. We found that retrospection never hurts, even if you don’t have any failure since last retrospection, you may find better ways of doing the same thing. We saw that rhythm is important, as repetition reduces complexity. So, we tried continuous improvement in everything, be it very small discussion, a big deployment or regular review meeting with product owners and sponsors. Soon, we found our key mantra, ‘rhythm’ and we stick to it.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Challenges:&lt;/b&gt;&lt;br /&gt;I believe most of the teams face these challenges, but since our team was very small(one developer, one hands-on architect and one product owner) and our sprints were small (one week), these became crucial for various reasons:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Begin meetings on schedule: &lt;/b&gt;Since we have meetings with different groups and most of the times they are back to back, it became crucial to join meeting on time.&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Meetings, never end on time&lt;/b&gt;: This costs a lot if you have small development cycle, if meetings go beyond their scheduled time, you have to back fill the development hours, may be sometimes by staying late and sometimes working over the weekend to avoid delayed deliveries.&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Distractions from the agenda&lt;/b&gt;: This one is real killer and one of the real cause of the previous challenge. It happened very often in our team, until we found solution for this.&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * No more boring stories (tasks)&lt;/b&gt;: How would you feel if you are given to write automated functional test cases for more than 50 combinative scenarios in a sprint?&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * New Ideas/innovation&lt;/b&gt;: Every team feels that it should innovate something or implement new ideas, that no one around have thought about (which in turn brings confidence and enthusiasm)&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Effective retrospection&lt;/b&gt;: Every Scrum project team does the retrospection, but how can we do it in a better way was a big challenge, as we did not want to do it as a ritual which will die in few days.&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Avoid panicking in crucial times&lt;/b&gt;: I admit, no one can avoid panicking in a production failure, but we all know it will not help either. The challenge was to learn how to avoid panic in crucial moments and keep the calm hat on, so that team can find right solution in instead of a quick and dirty solution.&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Why failures in QA instead of development environment?&lt;/b&gt;: No matter how much we test some issues come-up in QA instead of development, which is a big challenge for any team.&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Demanding stakeholders do not agree for automation testing&lt;/b&gt;: It was always challenging to convince sponsors for automated unit/functional/integration testing. Their question was dead straight, “Why would I spend my money on something which is not a must have feature in my product?”&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Approach to solve these challenges:&lt;/b&gt;&lt;br /&gt;It all started with retrospection and I love saying that retrospection is the best process Scrum has come-up with. It is a forum to brainstorm, rather than asking questions like, why you have done that crap, why you did not build the right code? Who love such questions? I don’t and I don’t think anybody would love it. There are better ways to do the retrospection and I think our team came-up with the right approach.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Effective retrospection:&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; We all do the retrospection in Scrum projects, sometimes every sprint, sometimes on ad-hoc basis. We were doing retrospection, but in three to four weeks, it became boring, we were not getting benefit of the retrospection. Then we tried new approach, we started maintaining ‘retrospection-backlog’. We took ownership of say two items per person per sprint. Until the team agree, that we have worked on those items, we do not close (or mark as done) those items in the backlog. Also, we made those items appear in the stand-up, as whether we have acted on those items or not. Now, we are not addressing them at the end of the sprint, but we were addressing them daily. Result? We close many items in the backlog and suddenly it is working for us. There are many of the retrospection items I have listed in this paper, one I liked most, “Cutting corners never help in a big picture. Shortcuts work for few days, but you have to pay it’s cost in a longer run”.&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Begin meetings on schedule:&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A big challenge, I feel it is very easy to say, that we begin on time, but difficult to follow. We spoke in our retrospective and decided to maintain a backlog on our own, and whoever is late (more than two minutes) three times should give a treat to the team or bring snacks items (we maintain a snacks corner in our team room) or bring small logical game (we have a game zone too!). It really worked!&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Meetings, never end on time:&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Another challenge and another retrospective was waiting for it. One of us volunteered to do time checks in meeting, so that participants talk precisely what is important and it helped to finish meetings on time.&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Distractions from the meeting:&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This one was one of the root cause of previous challenge and we came up with parking lot idea. It is really helpful, if you see someone is distracting the discussion and one of us would raise a hand, which means: ‘Focus!’.&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * No more boring stories (tasks):&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This happened with me, when I was asked to write automated functional test cases for more than 50 combinatorial scenarios in a sprint. It is boring to the death at the same time you have to keep reminding yourself that you are not missing any crucial scenario, otherwise needless to say your efforts are waste. I discussed with my product owner and we came-up with a mutually exclusive and collectively exhaustive(MECE) list of scenarios on ‘matrix based problem solving’ approach.&lt;a href="http://4.bp.blogspot.com/_q-Yw-1yDoHc/TSJTN5IagDI/AAAAAAAAHtE/umuuOrwNJK8/s1600/matrix.JPG" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="240" src="http://4.bp.blogspot.com/_q-Yw-1yDoHc/TSJTN5IagDI/AAAAAAAAHtE/umuuOrwNJK8/s320/matrix.JPG" width="320" /&gt;&lt;/a&gt; It was new for me and in less than one hour we discussed only important scenarios and implemented them, which kept the problem interesting at the same time it helped us to achieve the goal.&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_q-Yw-1yDoHc/TSJTN5IagDI/AAAAAAAAHtE/umuuOrwNJK8/s1600/matrix.JPG" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;/a&gt;&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * New Ideas/innovation:&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; We as a team would like to try out different things, but the pressure of development work never let us do ideas, which we wanted to try-out (for example unit testing of javascript code). We made a retrospective item that as a team we will spend some time to try-out new things, sync-up with the new technologies/we trends. The ‘so what’ for our product owner was, better solution will come upfront when the team, a) learn new things and b) share the ideas/innovations with broader groups. Since we added this as a retrospection item and even product owner voted on that, we found no excuses and started implementing new ideas. Another idea we came-up with was to have backlog for ‘Most Teamish Room goal’ and the acceptance criteria was, if anyone stop by, ‘wow!’ should be the first expression/reaction.&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Books are best friends, how can they help my team?:&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Building a team with collaboration and learning, Do it yourself, workaholics is killer, good enough is fine, pick a fight and how to say you’re sorry, are few of the principles I have learnt from few books I have read. Books not only guide you, but more importantly they keep hammering the concepts, so that you are bound to find a better way of doing the same thing.&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Avoid panicking in crucial times:&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; It happened when ‘we’ as a team tasted failure first time. Again, retrospection came to rescue us. Once we got over the failure, we did the retrospection from a distance (after a week) and found that instead of panicking, it was our cool mind, which helped us. We were very tempted to go with quick and dirty solution, but we waited and thought, ‘Is this the right solution for the long term?’. It helped and this approach became our habit. The key is to, ‘never lose the calmness, never in a crucial situation’.&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Why failures in QA instead of development environment?:&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; We happened to see failures in QA, even when developers do their part of testing in development environment. In our retrospection we brought this and came-up with, ‘Team testing time with freinds’. So, we called few friends who were neither part of development team nor part of sponsors’ group. This strategy worked and we started catching issue in development environment.&lt;br /&gt;&lt;b&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Demanding sponsors do not agree for automation testing&lt;/b&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; We find it difficult to convince sponsors for tech debt or automated testing stories. One of the retrospection item was to present a Scrum factoid at the end of the sprint review meeting, to help sponsors understand the Scrum more. It worked like a charm. More we involved sponsors (though they hesitated initially), more it became easier to convince to them what development team wanted to try to improve the code quality(and obviously to improve the product).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Benefits:&lt;/b&gt;&lt;br /&gt;With the challenges we faced, we uncovered a lot many solutions for variety of problems. Be it technical problem or a process issue, we decided not to be caught up in a rut of work. The benefits were many folded.&lt;br /&gt;&lt;b&gt;Joy of work and flow of energy: &lt;/b&gt;Most importantly team was enjoying the work. No task or deadline pushed us to do something, everything was in flow.&lt;br /&gt;&lt;b&gt;Confidence of stakeholders: &lt;/b&gt;We won the confidence of the sponsors and product owners.&lt;br /&gt;&lt;b&gt;Software Craftsmanship: &lt;/b&gt;We implemented our own ideas (software craftsmanship), which boosted morale and confidence of the team.&lt;br /&gt;&lt;b&gt;No more ‘staying late’ nightmares&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Retrospect everything: &lt;/b&gt;Retrospectives made life much easy. Nothing fell of the cracks, as we were doing retrospection every week.&lt;br /&gt;&lt;b&gt;Celebrations: &lt;/b&gt;Team had a lot to celebrate; their innovation, problem solving approach and knowledge sharing with other teams. Best practices became part of the team activities.&lt;br /&gt;&lt;br /&gt;In all it became a win-win situation for everyone.&lt;br /&gt;&lt;br /&gt;I feel that every team can become a ‘High Performing Team’. It only takes small efforts every sprint, but in a longer run, you will find yourself out of those nightmares of teams with lack of energy, lack of vision and above all lack of self confidence. Retrospection is the best tool Scrum has given and each team will get benefit, if it is used. Finally, if you have the idea implement it, because, world needs execution of ideas (I think I read it in some book, ‘no one likes the idea guy!’).&lt;br /&gt;&lt;br /&gt;I would like to thank my team members, with whom I lived this experience. Also to thank my colleagues and my seniors to inspire me to learn and achieve, they are not directly involved in project activities directly, but always helped with their continuous feedback.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;References:&lt;/b&gt;&amp;nbsp;&amp;nbsp; 1. Rework - http://37signals.com/rework/&lt;br /&gt;&amp;nbsp;&amp;nbsp; 2. Beautiful Teams -Inspiring and Cautionary Tales from Veteran Team Leaders http://oreilly.com/catalog/9780596518028&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-1087352527538220089?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/1087352527538220089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=1087352527538220089' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/1087352527538220089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/1087352527538220089'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2011/01/building-high-performance-team.html' title='Building High Performance Team'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_q-Yw-1yDoHc/TSJTN5IagDI/AAAAAAAAHtE/umuuOrwNJK8/s72-c/matrix.JPG' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-1856375055365942733</id><published>2010-11-20T04:06:00.002+05:30</published><updated>2011-01-28T22:07:51.856+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JQuery'/><category scheme='http://www.blogger.com/atom/ns#' term='jEditable'/><category scheme='http://www.blogger.com/atom/ns#' term='ajax'/><title type='text'>Adding callback to an inline editable input field with jEditable plugin of jQuery</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;In my &lt;a href="http://gouravtiwari.blogspot.com/2010/11/adding-size-to-input-field-with.html"&gt;previous post&lt;/a&gt; I talked about adding size and stylesheets to an inline editable field with &lt;a href="https://github.com/tuupola/jquery_jeditable"&gt;jEditable&lt;/a&gt;.&lt;br /&gt;I have this div:&lt;br /&gt;&lt;br /&gt;&amp;lt;div &amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;div class="mouseover"&amp;gt; Title &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;div class="help_text"&amp;gt; (Click on the Title to edit) &amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;/div &amp;gt;&lt;br /&gt;&lt;br /&gt;I had to add some text next to this field which says "click to edit". When a user clicks on it , I wanted to add a callback function to this field, so that when I click on it title comes in input tag as inline editable and the text in next div (Clieck on the Title to edit) should go away. I found that you can use &lt;b&gt;callback &lt;/b&gt;here just like in any &lt;b&gt;ajax&lt;/b&gt; call.&lt;br /&gt;&lt;br /&gt;Here is what I did:&lt;br /&gt;&lt;br /&gt;$(".mouseover").editable('&amp;lt;custom url&amp;gt;', {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; indicator : '&amp;lt;custom image path&amp;gt;',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; onblur&amp;nbsp;&amp;nbsp;&amp;nbsp; : "submit",&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; placeholder : "click here to edit",&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : "custom_input", &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b&gt;callback&amp;nbsp;&lt;/b&gt; : function(data, settings){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $(this).siblings(".help_text").text("(Click on the label to edit)");&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; });&lt;br /&gt;(posting it ... so that someone else should not spend time in figuring out :)&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-1856375055365942733?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/1856375055365942733/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=1856375055365942733' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/1856375055365942733'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/1856375055365942733'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2010/11/adding-callback-to-inline-editable.html' title='Adding callback to an inline editable input field with jEditable plugin of jQuery'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-3706309830357943303</id><published>2010-11-18T00:17:00.001+05:30</published><updated>2011-01-28T22:08:31.202+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JQuery'/><category scheme='http://www.blogger.com/atom/ns#' term='jEditable'/><title type='text'>Adding size to input field with jEditable plugin of jQuery</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;I am using &lt;a href="https://github.com/tuupola/jquery_jeditable"&gt;jEditable&lt;/a&gt; a jQuery plug-in and is is really cool for inline editing. I stuck when I had to add size(say 50 characters) field and css&amp;nbsp; for an input field which is inline editable.&lt;br /&gt;&lt;br /&gt;Then, I extended jeditable and added my own input type with size and class attributes:&lt;br /&gt;&lt;b&gt;In &lt;i&gt;anything&lt;/i&gt;.js:&lt;/b&gt;&lt;br /&gt;$(document).ready(function(){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; jQuery.editable.addInputType('&lt;b&gt;custom_input&lt;/b&gt;', {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; element : function(settings, original) {&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; var input = $('&amp;lt;input &lt;b&gt;size=50&lt;/b&gt; &lt;b&gt;class="input_inline"&lt;/b&gt;/&amp;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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (settings.width&amp;nbsp; != 'none') { input.attr('width', settings.width);&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (settings.height != 'none') { input.attr('height', settings.height); }&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; /* https://bugzilla.mozilla.org/show_bug.cgi?id=236791 */&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; //input[0].setAttribute('autocomplete','off');&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; input.attr('autocomplete','off');&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; $(this).append(input);&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; return(input);&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; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;$(".mouseover").editable('&amp;lt;custom url&amp;gt;', {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; indicator : '&amp;lt;custom image path&amp;gt;',&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; onblur&amp;nbsp;&amp;nbsp;&amp;nbsp; : "submit",&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; placeholder : "click here to edit",&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : "&lt;b&gt;custom_input&lt;/b&gt;"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;br /&gt;&lt;b&gt;In &lt;i&gt;any&lt;/i&gt;.html:&lt;/b&gt;&lt;br /&gt;&amp;lt;div class="mouseover"&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;so all div with &lt;b&gt;mouseover&lt;/b&gt; class will become inline editable.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-3706309830357943303?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/3706309830357943303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=3706309830357943303' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/3706309830357943303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/3706309830357943303'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2010/11/adding-size-to-input-field-with.html' title='Adding size to input field with jEditable plugin of jQuery'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-2882763746737061876</id><published>2010-11-02T22:49:00.004+05:30</published><updated>2011-01-28T22:09:05.752+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Spreadsheet gem'/><category scheme='http://www.blogger.com/atom/ns#' term='Ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='Rails'/><title type='text'>Give style to your MS Excel sheets in Ruby</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;I recently got a requirement to generate MS Excel workbook with different worksheets in Ruby on Rails. Also, I had to give style to the column headers, set background color for table of content and make columns justified.&lt;br /&gt;&lt;br /&gt;I came across&amp;nbsp;&lt;a href="http://rubyonwindows.blogspot.com/"&gt;http://rubyonwindows.blogspot.com&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="http://spreadsheet.rubyforge.org/"&gt;spreadsheet&lt;/a&gt;&amp;nbsp;links which are very helpful if you want to try anything with MS Excel in Ruby.&lt;br /&gt;&lt;br /&gt;I installed spreadsheet gem (&lt;span class="Apple-style-span" style="font-family: 'Helvetica Neue', Helvetica, Tahoma, sans-serif; font-size: 14px; line-height: 22px;"&gt;sudo gem install spreadsheet&lt;/span&gt;), but giving styles did not seem very straightforward&lt;br /&gt;&lt;ul&gt;&lt;/ul&gt;So, I thought of giving it a shot. Let's first try to create a workbook with three worksheets.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;workbook = Spreadsheet::Workbook.new&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;worksheet_for_books = workbook.create_worksheet(:name =&amp;gt; "Books")&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;worksheet_for_stationaries&amp;nbsp;= workbook.create_worksheet(:name =&amp;gt; "Stationary")&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;worksheet_for_laptops = workbook.create_worksheet(:name =&amp;gt; "Laptops")&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now, set headers in all worksheets:&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;for worksheet in workbook.worksheets&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&amp;nbsp;&amp;nbsp;row = 0&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&amp;nbsp;&amp;nbsp;(0..2).each do |column|&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;worksheet[row, column] = "Name_#{column}"&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&amp;nbsp;&amp;nbsp;end&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In the above code snippet, you might have noted that:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Iterating over worksheet is very simple, just like array.&lt;/li&gt;&lt;li&gt;Setting value to a cell is very simple, just worksheet[row, column] = value&lt;/li&gt;&lt;/ul&gt;Now let's make the column headers bold and justified:&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;format_header = Spreadsheet::Format.new(:weight =&amp;gt; :bold, :align =&amp;gt; :justify)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;for worksheet in workbook.worksheets&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&amp;nbsp;&amp;nbsp;(0..4).each do |column|&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;worksheet.row(0).set_format(column, format_header)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&amp;nbsp;&amp;nbsp;end&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;end&lt;/span&gt;&lt;span style="background-color: #ffd966;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Now let's try to add background color 'yellow' to these headers:&lt;br /&gt;&lt;br /&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;format_header = Spreadsheet::Format.new(:weight =&amp;gt; :&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;bold, :align =&amp;gt; :justify, :pattern_fg_color =&amp;gt; :yellow)&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;for worksheet in workbook.worksheets&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&amp;nbsp;&amp;nbsp;(0..4).each do |column|&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;worksheet.row(0).set_format(column, format_header)&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&amp;nbsp;&amp;nbsp;end&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;end&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;It didn't work! why? no it's not because we have added :pattern_fg_color , you might be thinking :pattern_bg_color is for background, but this is wrong, this is what I found in the references.&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;"Use :pattern_fg_color to set background of a cell"&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Anyways, even this option didn't work for me. I couldn't understand why. But I found a work around(&lt;a href="http://www.developpez.net/forums/d885744/autres-langages/autres-langages/ruby/spreadsheet-gem-changer-couleur-background/"&gt;reference&lt;/a&gt;) and here is the enhanced version:&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;Create color_format class and put it in a library&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;class ColorFormat &amp;lt; Spreadsheet::Format&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&amp;nbsp;&amp;nbsp; def initialize(opts)&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; super opts&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&amp;nbsp;&amp;nbsp; end&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;end&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;And our code will look like:&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;require "color_format"&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;format_header = ColorFormat.new(:weight =&amp;gt; :bol&lt;/span&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;d, :align =&amp;gt; :justify, :pattern_fg_color =&amp;gt; :yellow, :pattern =&amp;gt; 1)&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;for worksheet in workbook.worksheets&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&amp;nbsp;&amp;nbsp;(0..4).each do |column|&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;worksheet.row(0).set_format(column, format_header)&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&amp;nbsp;&amp;nbsp;end&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;end&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;&lt;span class="Apple-style-span" style="background-color: #274e13;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;And that's it!&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-2882763746737061876?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/2882763746737061876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=2882763746737061876' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/2882763746737061876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/2882763746737061876'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2010/11/give-style-to-your-ms-excel-sheets-in.html' title='Give style to your MS Excel sheets in Ruby'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-6113392458842467794</id><published>2010-04-15T21:09:00.003+05:30</published><updated>2011-01-28T22:10:00.047+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='Rails'/><title type='text'>Tip of the day: Keep the database timestamp and Time.now in sync</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;I stumbled across a situation when I have to schedule a job and I have to store today's weekday. I am also storing the schedule's created_at/ updated_at time in datetime format.&lt;br /&gt;&lt;br /&gt;To store today's weekday, I said:&lt;br /&gt;weekday = Time.now.wday&lt;br /&gt;&amp;gt;&amp;gt; 4&amp;nbsp;&amp;nbsp; #Thursday&lt;br /&gt;&lt;br /&gt;When  I stored the record&lt;br /&gt;Schedule.first.created_at.wday&lt;br /&gt;&amp;gt;&amp;gt;  3&amp;nbsp; #Wednesday &lt;br /&gt;&lt;br /&gt;Why?&lt;br /&gt;&lt;br /&gt;I dug in more and here are the facts.&lt;br /&gt;We so say in environment.rb file:&lt;br /&gt;&lt;b&gt;config.&lt;span class="search_hit"&gt;time&lt;/span&gt;_&lt;span class="search_hit"&gt;zone = 'UTC'&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="search_hit"&gt;&lt;span style="font-weight: normal;"&gt;But this applies to only the created_at/updated_at attributes and sets up the default timezone for the database and never applies to &lt;/span&gt;Time.now&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="search_hit"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="search_hit"&gt;&lt;span style="font-weight: normal;"&gt;So to keep &lt;/span&gt;Time.now &lt;span style="font-weight: normal;"&gt;in sync we have to set ENV['TZ'] in environment.rb file.&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="search_hit"&gt;&lt;span style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;span class="search_hit"&gt;&lt;span style="font-weight: normal;"&gt;Again in console:&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;weekday = Time.now.wday&lt;br /&gt;&amp;gt;&amp;gt; 3 &amp;nbsp; #Wednesday&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Schedule.first.created_at.wday&lt;br /&gt;&amp;gt;&amp;gt;  3&amp;nbsp; #Wednesday&lt;br /&gt;&lt;br /&gt;:) &lt;br /&gt;&lt;b&gt;&lt;span class="search_hit"&gt;&lt;span style="font-weight: normal;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-6113392458842467794?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/6113392458842467794/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=6113392458842467794' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/6113392458842467794'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/6113392458842467794'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2010/04/tip-of-day-keep-database-timestamp-and.html' title='Tip of the day: Keep the database timestamp and Time.now in sync'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-3779660565125359818</id><published>2010-04-02T20:59:00.002+05:30</published><updated>2011-01-28T22:10:34.704+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='migration'/><category scheme='http://www.blogger.com/atom/ns#' term='Ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='Oracle'/><category scheme='http://www.blogger.com/atom/ns#' term='Rails'/><title type='text'>Change column type from text to string in oracle</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;I think I have never encountered this issue until today. On my current Ruby on Rails project I am using Oracle as the database. I have a user model, which has an attribute email and the requirement was that a user can have more than one email id (separated by comma). I initially thought that I should use :text type, as I literally forgot that I am writing a migration against oracle database. Later, when the actual requirement come into the picture, I had to revise as user can have just one email-id and I started thinking about changing the type from :text to string.&lt;br /&gt;&lt;br /&gt;There were two reasons to change the column type:&lt;br /&gt;1. As per the requirement, user cannot have so many email-ids&lt;br /&gt;2. Changing the column type from clob to string in oracle would give good performance boost&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I decided to change the column type by simply using :&lt;br /&gt;&lt;b&gt;change_column &lt;/b&gt;:users, :email, :string, :limit =&amp;gt; 4000&lt;br /&gt;&lt;br /&gt;D:\rubyapp&amp;gt;rake db:migrate&lt;br /&gt;(in D:/rubyapp)&lt;br /&gt;==&amp;nbsp; ChangeEmailColumnTypeToStringInUsers: migrating ===========================&lt;br /&gt;-- change_column(:users, :email, :string, {:limit=&amp;gt;4000})&lt;br /&gt;rake aborted!&lt;br /&gt;An error has occurred, all later migrations canceled:&lt;br /&gt;&lt;br /&gt;OCIError: ORA-22859: invalid modification of columns: ALTER TABLE users MODIFY email VARCHAR2(4000)&lt;br /&gt;&lt;br /&gt;(See full trace by running task with --trace)&lt;br /&gt;&lt;br /&gt;Failed! But why?&lt;br /&gt;&lt;br /&gt;I came across: &lt;a href="http://snippets.dzone.com/posts/show/3022"&gt;http://snippets.dzone.com/posts/show/3022&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I followed the same pattern:&lt;br /&gt;1. Add a&amp;nbsp; temporary column with type as string (varchar2 in local)&lt;br /&gt;2. Update all the records and copy text from email column to temporary column&lt;br /&gt;3. Remove email column&lt;br /&gt;4. Rename temporary column to email&lt;br /&gt;&lt;br /&gt;I decided to not to run oracle commands in migration.&lt;br /&gt;&lt;br /&gt;Here is how my migration now looks like:&lt;br /&gt;&lt;br /&gt;class ChangeEmailColumnTypeToStringInUsers &amp;lt; ActiveRecord::Migration&lt;br /&gt;&amp;nbsp; def self.up&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; add_column :users, :email_temp, :string, :limit =&amp;gt; 200&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; User.all.each do |user|&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; user.update_attribute("email_temp", user.email)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; remove_column :users, :email&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rename_column :users, :email_temp, :email&lt;br /&gt;&amp;nbsp; end&lt;br /&gt;&lt;br /&gt;&amp;nbsp; def self.down&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; add_column :users, :email_temp, :text&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; User.all.each do |user|&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; user.update_attribute("email_temp", user.email)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; remove_column :users, :email&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rename_column :users, :email_temp, :email&lt;br /&gt;&amp;nbsp; end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;Very simple!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-3779660565125359818?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/3779660565125359818/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=3779660565125359818' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/3779660565125359818'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/3779660565125359818'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2010/04/change-column-type-frm-text-to-string.html' title='Change column type from text to string in oracle'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-3828202174814006386</id><published>2010-01-08T12:19:00.001+05:30</published><updated>2011-01-28T22:10:51.312+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ruby'/><title type='text'>Truncate string in ruby</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;I was looking for a ruby method in my Ruby on Rails project which can truncate a string, say after 50 characters.&lt;br /&gt;&lt;br /&gt;I found 'truncate' method, which is a rails api method for truncating string in views.&lt;br /&gt;So if have string&lt;br /&gt;str = "Hi, this is Gourav Tiwari, how are you??" # total 40 characters&lt;br /&gt;the truncate method can be used in the ciew like this:&lt;br /&gt;truncate(str, :length =&amp;gt; 25, :ommision =&amp;gt; " - - -")&lt;br /&gt;and the result would be :&lt;br /&gt;"Hi, this is Gourav Tiwari, - - -"&lt;br /&gt;&lt;br /&gt;In ruby I can accomplish same by slice and concatenation:&lt;br /&gt;myproject&amp;gt;ruby script\console&lt;br /&gt;&amp;gt;&amp;gt; str = "Hi, this is Gourav Tiwari, how are you??"&lt;br /&gt;=&amp;gt; "Hi, this is Gourav Tiwari, how are you??"&lt;br /&gt;&amp;gt;&amp;gt; str.slice(0..25)&lt;br /&gt;=&amp;gt; "Hi, this is Gourav Tiwari,"&lt;br /&gt;&amp;gt;&amp;gt; str.slice(0..25) + " - - -"&lt;br /&gt;=&amp;gt; "Hi, this is Gourav Tiwari, - - -"&lt;br /&gt;&lt;br /&gt;Very simple!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-3828202174814006386?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/3828202174814006386/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=3828202174814006386' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/3828202174814006386'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/3828202174814006386'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2010/01/truncate-string-in-ruby.html' title='Truncate string in ruby'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-1705376399044827520</id><published>2010-01-07T08:47:00.010+05:30</published><updated>2011-01-28T22:16:52.736+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JQuery'/><category scheme='http://www.blogger.com/atom/ns#' term='JQgrid'/><category scheme='http://www.blogger.com/atom/ns#' term='pagination'/><category scheme='http://www.blogger.com/atom/ns#' term='Rails'/><title type='text'>Fixing invisible pages in JQGrid</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;Playing more on JQgrid plugin from &lt;/span&gt;&lt;a href="http://www.2dconcept.com/jquery-grid-rails-plugin" style="font-family: Arial,Helvetica,sans-serif;"&gt;2dconcept&lt;/a&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;, I faced a strange issue. Sometimes it skips some pages.&lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;For example if you have total 15 pages, and you navigate till 6th page and then you hit next page button on the grid, it will not show you the 7th page! you have to click next page button once more to see the 8th page. So where the 7th page is gone?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;No, it's not invisible, it's all hidden in json response.&lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;When I saw the response for page 7 (using firbug), it was coming well, but the grid was not showing the 7th page at all. I dug into the library file more and figured out that, if in the response you have a double quote, it will not display that page.&lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;Say you have this json response:&lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;{"page":"1","total":1,"records":"1","rows":[{"id":"7","cell":["gourav tiwari hel"lo!","this","should","be right!"]}]}&lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;See the double quote in the response.&lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;I tried using to_json library method, but it actually removes all the double quotes, even the necessary ones as well. So not a good idea.&lt;/span&gt; &lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;I extended to_jqgrid_json method like this:&lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;i&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;module JqgridJson &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;def to_jqgrid_json(attributes, current_page, per_page, total) &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;json = %Q({"page":"#{current_page}","total":#{total/per_page.to_i+1},"records":"#{total}") &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;if total &amp;gt; 0 &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;json &amp;lt;&amp;lt; %Q(,"rows":[) &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;each do |elem| &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;elem.id ||= index(elem) &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;json &amp;lt;&amp;lt; %Q({"id":"#{elem.id}","cell":[) &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;couples = elem.attributes.symbolize_keys &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;attributes.each do |atr| &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;value = get_atr_value(elem, atr, couples) &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;b&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;value = value.is_a?(String) ? value.gsub(/"/, '\"') : value # added this line&lt;/span&gt;&lt;/b&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt; json &amp;lt;&amp;lt; %Q("#{value}",) &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;end &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;json.chop! &amp;lt;&amp;lt; "]}," &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;end &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;json.chop! &amp;lt;&amp;lt; "]}" &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;else &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;json &amp;lt;&amp;lt; "}" &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;end &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;end&lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;end&lt;/span&gt;&lt;/i&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;And the response become this: &lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;{"page":"1","total":1,"records":"1","rows":[{"id":"7","cell":["gourav tiwari hel\"lo!","this","should","be right!"]}]}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br style="font-family: Arial,Helvetica,sans-serif;" /&gt;&lt;span style="font-family: Arial, Helvetica, sans-serif;"&gt;No invisible page in JQGrid anymore! &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-1705376399044827520?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/1705376399044827520/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=1705376399044827520' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/1705376399044827520'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/1705376399044827520'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2010/01/fixing-invisible-pages-in-jqgrid.html' title='Fixing invisible pages in JQGrid'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-1608223857046796325</id><published>2009-12-03T00:18:00.007+05:30</published><updated>2010-03-16T19:34:00.094+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='JQuery'/><category scheme='http://www.blogger.com/atom/ns#' term='JQgrid'/><category scheme='http://www.blogger.com/atom/ns#' term='Rails'/><title type='text'>Encounter with fascinating JQgrid plugin</title><content type='html'>In one of my earlier projects, there was a requirement from product owners, to show data in grid format. It was way back in summar of 2008. We had to load the whole data by hand-coding the trs and tds in table and shown the results in html table's grid format.&lt;br /&gt;&lt;br /&gt;Back to the current project, I did a little research and found jquery-grid-rails-plugin&lt;br /&gt;I found it pretty useful and up to the mark as far as results are being displayed on the Grid (AJAX calls). You can look at the Demo as well (&lt;a href="http://github.com/ahe/jqgrid_demo_app/tree/master"&gt;http://github.com/ahe/jqgrid_demo_app/tree/master&lt;/a&gt;), also a detailed explanation on installation and usage mentioned here -&amp;gt; &lt;a href="http://www.2dconcept.com/jquery-grid-rails-plugin"&gt;http://www.2dconcept.com/jquery-grid-rails-plugin&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The response is pretty quick, from 1000 records in DB to fetch 25 on one page it took around 500 ms. Also, you can use various JQuery themes if you do not like the default look and feel: &lt;a href="http://jqueryui.com/themeroller"&gt;http://jqueryui.com/themeroller&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Lets take a very small example and see how to use JQgrid:&lt;br /&gt;&lt;br /&gt;I have User controller's index method to write logic to display all users.&lt;br /&gt;User model has attributes as:&lt;br /&gt;id : integer (row id)&lt;br /&gt;name : string&lt;br /&gt;created_at : date&lt;br /&gt;&lt;br /&gt;I have User's view (users/index.html.erb file) to display the grid with above attributes.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Steps:&lt;/span&gt;&lt;br /&gt;1. Install plugin:&lt;span style="color: #33cc00;"&gt; &lt;/span&gt;&lt;span style="color: #33cc00; font-style: italic;"&gt;$ ./script/plugin install git://github.com/ahe/2dc_jqgrid.git&lt;/span&gt;&lt;br /&gt;2. In layout include JS and CSS for grid:&lt;br /&gt;&lt;span style="color: #33cc00; font-style: italic;"&gt;&amp;lt;%= jqgrid_stylesheets %&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #33cc00; font-style: italic;"&gt;&amp;lt;%= jqgrid_javascripts %&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;3.  In User controller:&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;def index&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;users = User.find(:all) do&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt; if params[:_search] == "true"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;   name           =~ "%#{params[:name]}%" if params[:name].present?&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;   created_at     =~ "%#{params[:created_at]}%" if params[:created-at].present?&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt; end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt; paginate :page =&amp;gt; params[:page], :per_page =&amp;gt; params[:rows]   &lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt; order_by "#{params[:sidx]} #{params[:sord]}"&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;respond_to do |format|&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt; format.html&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt; format.json { render :json =&amp;gt; users.to_jqgrid_json([:id, :name, :created_at], params[:page], params[:rows], users.total_entries) } # total entries will get User.all.size&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;4. In view:&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;&amp;lt;%= jqgrid("All users", "users", users_url, # my recommendation as putting /users sometimes does not work in all cases &lt;br /&gt;[   { :field =&amp;gt; "id", :label =&amp;gt; "ID", :width =&amp;gt; 35, :resizable =&amp;gt; false },&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt; { :field =&amp;gt; "name", :label =&amp;gt; "User Name" },&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt; { :field =&amp;gt; "created_at", :label =&amp;gt; "Created on" } &lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;]&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;) %&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now everything is fine, it should work fine and show us the grid with name and created at time.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Problem that I faced:&lt;/span&gt; When you have to show any attribute of model with formatting , there was nothing mention on the blog, like I would like to Capitalize  the name here in the grid (First letter is capital).&lt;br /&gt;&lt;br /&gt;So, I dug into the code and found my solution&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Solution: &lt;/span&gt;&lt;br /&gt;In index I have to change the format.json in index method like this:&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;render :json =&amp;gt; users.to_jqgrid_json([:id, "&lt;/span&gt;&lt;span style="color: #009900; font-style: italic; font-weight: bold;"&gt;name.capitalize&lt;/span&gt;&lt;span style="color: #009900; font-style: italic;"&gt;", :created_at], params[:page], params[:rows], users.total_entries)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and in view I need to change following line as :&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;{ :field =&amp;gt; "&lt;/span&gt;&lt;span style="color: #009900; font-style: italic; font-weight: bold;"&gt;name.capitalize&lt;/span&gt;&lt;span style="color: #009900; font-style: italic;"&gt;", :label =&amp;gt; "User Name" },&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;and it works!&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Another problem:&lt;/span&gt; If  I need to change the format of the created_at, can I do this in controller and view?&lt;br /&gt;&lt;br /&gt;Controller:&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;render :json =&amp;gt; users.to_jqgrid_json([:id, "name.capitalize", 'created_at.strftime("%Y-%m-%d")'], params[:page], params[:rows], users.total_entries)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;View:&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;{ :field =&amp;gt; "name.capitalize", :label =&amp;gt; "User Name" },&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;{ :field =&amp;gt; 'created_at.strftime("%Y-%m-%d")', :label =&amp;gt; "Created on" } &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Answer is&lt;span style="font-weight: bold;"&gt; NO.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Because,  the way jqgrid ruby plugin written, you cannot use method with parameters.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Solution: &lt;/span&gt;I used instance method.&lt;br /&gt;&lt;br /&gt;In model, I wrote:&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;def formatted_created_at&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;created_at.strftime("%Y-%m-%d")&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;def capitalized_name&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;name.capitalize&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In controller:&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;render :json =&amp;gt; users.to_jqgrid_json([:id, &lt;/span&gt;&lt;span style="color: #009900; font-style: italic; font-weight: bold;"&gt;:capitalized_name&lt;/span&gt;&lt;span style="color: #009900; font-style: italic;"&gt;, &lt;/span&gt;&lt;span style="color: #009900; font-style: italic; font-weight: bold;"&gt;:formatted_created_at&lt;/span&gt;&lt;span style="color: #009900; font-style: italic;"&gt;], params[:page], params[:rows], users.total_entries)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In view:&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;{ :field =&amp;gt; "&lt;/span&gt;&lt;span style="color: #009900; font-style: italic; font-weight: bold;"&gt;capitalized_name&lt;/span&gt;&lt;span style="color: #009900; font-style: italic;"&gt;", :label =&amp;gt; "User Name" },&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #009900; font-style: italic;"&gt;{ :field =&amp;gt; "&lt;/span&gt;&lt;span style="color: #009900; font-style: italic; font-weight: bold;"&gt;formatted_created_at&lt;/span&gt;&lt;span style="color: #009900; font-style: italic;"&gt;", :label =&amp;gt; "Created on" } &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That's it!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-1608223857046796325?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/1608223857046796325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=1608223857046796325' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/1608223857046796325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/1608223857046796325'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2009/12/in-one-of-my-earlier-projects-there-was.html' title='Encounter with fascinating JQgrid plugin'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-4811044960555728753</id><published>2008-12-21T13:35:00.001+05:30</published><updated>2011-01-28T22:11:42.761+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='BDD'/><category scheme='http://www.blogger.com/atom/ns#' term='Ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='cucumber'/><category scheme='http://www.blogger.com/atom/ns#' term='Rails'/><title type='text'>Peeler for cucumber on windows</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;span style="font-family: arial; font-size: 100%;"&gt;&lt;a href="http://www.rubyinside.com/cucumber-the-latest-in-ruby-testing-1342.html"&gt;Cucumber&lt;/a&gt; is one of the cornerstone for &lt;a href="http://en.wikipedia.org/wiki/Behavior_Driven_Development"&gt;BDD&lt;/a&gt; in Ruby on Rails. Non technical or business participants can write tests (called as features or stories) in plain English and cucumber allows the developers to execute these tests.&lt;br /&gt;&lt;br /&gt;I was very excited when I started looking at it. In my test.feature file, I have a feature:&lt;span style="font-family: arial; font-size: 100%;"&gt;&lt;br /&gt;&lt;br /&gt;Feature: Grant and revoke access&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: arial;"&gt;To have proper security model&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;User should have proper access&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;Scenario: Revoke access of a user who do not deserves access &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;  Given Gourav is a user who do not deserves access &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;  When system run cron job to verify access &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;  Then Gourav's access should be revoked&lt;/span&gt;&lt;br /&gt;&lt;pre style="font-family: arial;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-family: arial; font-size: 100%;"&gt;&lt;code&gt;&lt;/code&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: 100%;"&gt;There are two ways to execute this file:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1. &lt;/span&gt;Cucumber as a&lt;span style="font-weight: bold;"&gt; plugin &lt;/span&gt;(by rake task)&lt;span style="font-weight: bold;"&gt;:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div style="font-family: arial;"&gt;&lt;span style="font-size: 100%;"&gt;It starts eating 'a' and 'A' characters on windows: &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial;"&gt;&lt;span style="font-size: 100%;"&gt;Feture: Grnt nd revoke ccess # fetures/grnt_nd_revoke_ccess.feture&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial;"&gt;&lt;span style="font-size: 100%;"&gt;To hve proper security model&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial;"&gt;&lt;span style="font-size: 100%;"&gt;User should hve proper ccess&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: arial;"&gt;Scenrio: Revoke ccess of user who do not deserves ccess # fetures/test.feture:5&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: arial;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: arial;"&gt;Given Gourv is  user who do not deserves ccess                                          # fetures/test.feture:6&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: arial;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: arial;"&gt;When system run cron job to verify ccess                                                   # fetures/test.feture:9&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: arial;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div face="arial"&gt;Then Gourv's ccess should be revoked                                                   # fetures/test.feture:10&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family: arial; font-size: 100%;"&gt;&lt;code&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;I went to open source community and worked little bit on &lt;a href="http://rspec.lighthouseapp.com/projects/16211/tickets/81-windows-all-the-a-characters-in-the-output-have-gone-on-strike#ticket-81-36"&gt;issue #81&lt;/a&gt; (first encounter with Opensource community :) ) and found &lt;a href="http://github.com/aslakhellesoy/cucumber/wikis/troubleshooting"&gt;troubleshooting&lt;/a&gt; for this issue. Now "rake features" works well and give proper output.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;2. Cucumber as a &lt;/span&gt;&lt;span style="font-family: arial; font-size: 100%; font-weight: bold;"&gt;gem&lt;/span&gt;&lt;span style="font-family: arial; font-size: 100%;"&gt;:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre style="font-family: arial;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;cucumber features\test.feature It gives:&lt;/span&gt;&lt;/pre&gt;&lt;div face="arial"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div face="arial"&gt;&lt;span style="font-size: 100%;"&gt;Feature: Grant and revoke access # features/test.feature&lt;/span&gt;&lt;span style="font-family: monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div face="arial"&gt;&lt;span style="font-family: monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div face="arial"&gt;To have proper security model&lt;br /&gt;&lt;/div&gt;&lt;div face="arial"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div face="arial"&gt;User should have proper access&lt;br /&gt;&lt;/div&gt;&lt;div face="arial"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div face="arial"&gt;Scenario: Revoke access of a user who do not deserves accessC:/ruby/lib/ruby/gems/1.8/&lt;br /&gt;&lt;/div&gt;&lt;pre style="font-family: arial;"&gt;&lt;span style="font-size: 100%;"&gt;gems/cucumber-0.1.12/bin/../lib/cucumber/tree/scenario.rb:70:in &lt;code&gt;length': undefined method&lt;/code&gt;jlength' for &lt;a href="http://rspec.lighthouseapp.com/projects/16211/tickets/Stri"&gt;Scenario&lt;/a&gt; ng (NoMethodError)&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-family: arial;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;code&gt;&lt;br /&gt;from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/../lib/cucumber/tree/scenario.rb:74:in `max_line_length'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/../lib/cucumber/tree/scenario.rb:78:in `padding_length'&lt;br /&gt;&lt;br /&gt;from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/../lib/cucumber/formatters/pretty_formatter.rb:197:in `p&lt;/code&gt;adding_spaces'&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-family: arial;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;code&gt;&lt;br /&gt;from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/../lib/cucumber/formatters/pretty_formatter.rb:58:in `sc&lt;/code&gt;enario_executing'&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-family: arial;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;code&gt;&lt;br /&gt;from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/../lib/cucumber/broadcaster.rb:15:in `__send__'&lt;br /&gt;&lt;br /&gt;from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/../lib/cucumber/broadcaster.rb:15:in `method_missing'&lt;br /&gt;&lt;br /&gt;from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/../lib/cucumber/broadcaster.rb:13:in `each'&lt;br /&gt;&lt;br /&gt;from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/../lib/cucumber/broadcaster.rb:13:in `method_missing'&lt;br /&gt;&lt;br /&gt;... 12 levels...&lt;br /&gt;&lt;br /&gt;from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/../lib/cucumber/cli.rb:11:in `execute'&lt;br /&gt;&lt;br /&gt;from C:/ruby/lib/ruby/gems/1.8/gems/cucumber-0.1.12/bin/cucumber:6&lt;br /&gt;&lt;br /&gt;from C:/ruby/bin/cucumber:19:in `load'&lt;br /&gt;&lt;br /&gt;from C:/ruby/bin/cucumber:19&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I found a workaround for this:&lt;br /&gt;&lt;/code&gt;&lt;/span&gt;&lt;/pre&gt;&lt;div face="arial"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div face="arial"&gt;&lt;span style="font-size: 100%;"&gt;In file C:\ruby\lib\ruby\gems\1.8\gems\cucumber-0.1.12\lib\cucumber\tree\Scenario.rb on line number 69, I have changed jlength to length:&lt;/span&gt;&lt;/div&gt;&lt;div face="arial"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div face="arial"&gt;&lt;span style="font-size: 100%;"&gt;@length ||= Cucumber.language['scenario'].length + 2 + (@name.nil? ? 0 : @name.length)&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial;"&gt;&lt;span style="font-size: 100%;"&gt;Similarly, in file C:\ruby\lib\ruby\gems\1.8\gems\cucumber-0.1.12\lib\cucumber\tree\step.rb on line number 22 I have changed jlength to length:&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: arial;"&gt;&lt;span style="font-size: 100%;"&gt;keyword.length + 1 + name.length&lt;/span&gt;&lt;/div&gt;&lt;pre style="font-family: arial;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;br /&gt;&lt;br /&gt;But for a better solution I am still working on &lt;a href="http://rspec.lighthouseapp.com/projects/16211/tickets/81-windows-all-the-a-characters-in-the-output-have-gone-on-strike#ticket-81-36"&gt;issue #81&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-4811044960555728753?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/4811044960555728753/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=4811044960555728753' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/4811044960555728753'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/4811044960555728753'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2008/12/peeler-for-cucumber-on-windows.html' title='Peeler for cucumber on windows'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-1670715680510439958</id><published>2008-10-19T21:20:00.000+05:30</published><updated>2008-10-21T07:59:25.364+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='Rails'/><title type='text'>If you smell something stinking, flog it!!!</title><content type='html'>&lt;span style="font-size:85%;"&gt; &lt;span style="font-family:georgia;"&gt;Recently, I joined a new project. Before I get started, my tech lead asked me to go through the code first and find complex parts of it, so that during development I will be careful about those areas.&lt;/span&gt; &lt;/span&gt;&lt;div style="font-family: georgia;"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;I decided to flog it and I came across Ryan Davis's &lt;a href="http://ruby.sadi.st/Flog.html"&gt;flog&lt;/a&gt; tool.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What is Flog?&lt;br /&gt;&lt;/strong&gt;It's a tool, which helps you in finding complex areas of your code. More complex code tells you the chances of more bugs. Flog has some smart algorithm which go to methods of a file and gives points to each command/statement of that method. Say, if..else has 5 points, variable declaration has 1 point etc. So if your methods scores more means they are more complex.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How to do it?&lt;/span&gt;&lt;br /&gt;Since I am working on windows(don't ask me why :) ), it took me some time to find how to use this tool. After a little hassle I found it and here I am showing the same, just like A, B, C. if you know a better way to do it, please do add your suggestions and comments.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Step A: &lt;/span&gt;Install flog as a gem.&lt;br /&gt;Open command prompt:&lt;br /&gt;c:/&gt;gem install flog&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Step B: &lt;/span&gt;Go to your project folder.&lt;br /&gt;c:\&gt;cd my_project&lt;br /&gt;&lt;my&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Step C: &lt;/span&gt;Just flog it!!!&lt;/my&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: georgia;"&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;To get all the flog options:&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: georgia;"&gt;&lt;span style="font-size:85%;"&gt;c:\my_project&gt;flog -h&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:georgia;"&gt;flog options dirs_or_files &lt;/span&gt; &lt;/span&gt;&lt;div style="font-family: georgia;"&gt;&lt;span style="font-size:85%;"&gt;-a      display all flog results, not top 60%  &lt;/span&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:georgia;"&gt;-h      display help  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: georgia;"&gt;&lt;span style="font-size:85%;"&gt;-I=path extend $LOAD_PATH with path &lt;/span&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:georgia;"&gt;-s      display total score only  &lt;/span&gt;&lt;/span&gt;&lt;div style="font-family: georgia;"&gt;&lt;span style="font-size:85%;"&gt;-v      verbosely display progress and errors&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;div style="font-family: georgia;"&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;If you want to flog all controllers, following will flog all the *.rb files in your apps\controllers folder:&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:85%;"&gt;c:\my_project&gt;flog app\controllers\*.rb&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;To flog controllers, models, helpers and libraries, together:&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-size:85%;"&gt;c:\my project&gt;flog app\controllers\*.rb app\models\*.rb app\helpers\*.rb lib\*.rb &lt;/span&gt;&lt;/div&gt;&lt;span style="font-size:85%;"&gt; &lt;/span&gt;&lt;div style="font-family: georgia;"&gt; &lt;/div&gt;&lt;div style="font-family: georgia;"&gt;&lt;span style="font-weight: bold;font-size:85%;" &gt;&lt;br /&gt;Sample method and flog score:&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;class &lt;/span&gt;&lt;span style="font-style: italic;font-size:85%;" &gt;&lt;span style="font-weight: bold;"&gt;PagesController&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_q-Yw-1yDoHc/SP06ZvLnmQI/AAAAAAAACWk/NO2M438pvs0/s1600-h/example.bmp"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" src="http://1.bp.blogspot.com/_q-Yw-1yDoHc/SP06ZvLnmQI/AAAAAAAACWk/NO2M438pvs0/s320/example.bmp" alt="" id="BLOGGER_PHOTO_ID_5259424153674946818" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;def &lt;/span&gt;&lt;span style="font-style: italic; font-weight: bold;font-size:85%;" &gt;show&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;  @page_title = @page.title&lt;br /&gt;  @page_mode = "show"&lt;br /&gt;    respond_to do |format|&lt;br /&gt;      format.html&lt;br /&gt;      format.atom { render :layout =&gt; false }&lt;br /&gt;end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-1670715680510439958?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/1670715680510439958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=1670715680510439958' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/1670715680510439958'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/1670715680510439958'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2008/10/if-you-smell-something-stinking-flog-it.html' title='If you smell something stinking, flog it!!!'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_q-Yw-1yDoHc/SP06ZvLnmQI/AAAAAAAACWk/NO2M438pvs0/s72-c/example.bmp' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7658573079763034733.post-4843041904608572316</id><published>2008-10-14T16:01:00.000+05:30</published><updated>2008-10-21T07:57:06.545+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='Scrum'/><category scheme='http://www.blogger.com/atom/ns#' term='Agile'/><category scheme='http://www.blogger.com/atom/ns#' term='Rspec'/><category scheme='http://www.blogger.com/atom/ns#' term='Rails'/><title type='text'>Agile and Ruby On Rails - hand in hand?</title><content type='html'>&lt;span style="font-family: georgia;"&gt;In my last project, I worked as a developer on "Ruby on Rails". The software methodology was Agile (Scrum). &lt;/span&gt;&lt;b style="font-family: georgia;"&gt;Scrum&lt;/b&gt;&lt;span style="font-family: georgia;"&gt; is an iterative incremental process of software development commonly used with &lt;/span&gt;&lt;a style="font-family: georgia;" href="http://en.wikipedia.org/wiki/Agile_software_development" title="Agile software development"&gt;agile software development&lt;/a&gt;&lt;span style="font-family: georgia;"&gt;).We particularly picked up 1 week iteration (which is called "1 week sprint"). &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: georgia;font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;But why 1 week sprint?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: georgia;"&gt;I was suspicious whether 1 week iteration would be successful. It works this way, end of every one week development team has to show running and production deliverable code and so on, until the final iteration, when client team(Product Owner(s)) says, that this is the product I want. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: georgia;"&gt;Advantage is, the client team have much closer look what functionality they want and they get, so they can ask development team to implement those functionality which are more of client's interest. Every week they can prioritize the items and development team work on high priority items only.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: georgia;font-size:130%;" &gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;And how Ruby On Rails fit in this picture?&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: georgia;"&gt;I did not realized this until the last 4-5 sprints, when all of sudden our client team said that they want to modify the core business logic. I thought, is it possible to implement the change when everything is developed and software is 90% ready? And then, we relied upon unit testing with Rspec (see &lt;/span&gt;&lt;a style="font-family: georgia;" href="http://www.ibm.com/developerworks/web/library/wa-rspec/"&gt;&lt;span style="font-size:100%;"&gt;Behavior-driven testing with RSpec&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: georgia;"&gt;) and functional testing by Rspec stories(see &lt;/span&gt;&lt;a style="font-family: georgia;" href="http://times.usefulinc.com/2008/01/12-rspec-stories"&gt;telling stories by Rspec&lt;/a&gt;&lt;span style="font-family: georgia;"&gt;).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: georgia;"&gt;With unit testing in place covering more than 85% code, we were assured that the changes will go smoothly. Rspec stories on the functional side, assured us that business logic would be as per the client team's need.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold; font-family: georgia;"&gt;Learning &amp;amp; Best Practices:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: georgia;"&gt;In the retrospective of the project, I noted following things which can be useful for other projects:&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li style="font-family: georgia;"&gt;Even if teams are in different location(can be tried with different time zones if possible), they should reserve team hours and should be in conference call. It is not necessary that team members should talk during this call, they can work on some other stuff, but if someone call your name in the conference, and say, "Hey Gourav, could you change this text or could you take a look at business logic?", then Gourav should respond to that.&lt;/li&gt;&lt;li style="font-family: georgia;"&gt;Everyday team should meet for 15 mins, everyone should join that meeting, to say what I did yesterday and what is the plan for next day.&lt;/li&gt;&lt;li style="font-family: georgia;"&gt;Developers should show and explain the functionality they have developed to the client team. It's win-win for both. Developers will get nods and appreciation of their work, which is better for the motivation of team and for client team as well, to get quick demo of the functionality they get, to provide quick feedback to development team.&lt;/li&gt;&lt;li style="font-family: georgia;"&gt;Team gets speed when dedicated UI developer joins the team.&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: georgia;"&gt;Team should have dedicated tester, otherwise it puts more burden on BA(Business Analyst)&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7658573079763034733-4843041904608572316?l=gouravtiwari.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://gouravtiwari.blogspot.com/feeds/4843041904608572316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7658573079763034733&amp;postID=4843041904608572316' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/4843041904608572316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7658573079763034733/posts/default/4843041904608572316'/><link rel='alternate' type='text/html' href='http://gouravtiwari.blogspot.com/2008/10/agile-and-ruby-on-rails-hand-in-hand.html' title='Agile and Ruby On Rails - hand in hand?'/><author><name>Gourav Tiwari</name><uri>https://profiles.google.com/104019318254673160896</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-KzriObdauwc/AAAAAAAAAAI/AAAAAAAAI-E/vOjrfguC8kY/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry></feed>
