<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Dhaval Parikh</title>
	<atom:link href="http://blog.dhavalparikh.co.in/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.dhavalparikh.co.in</link>
	<description>Ruby on Rails, Stock Markets, Technology news and info - Its all about my passion</description>
	<lastBuildDate>Thu, 24 Jun 2010 12:06:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Handling cookie over flow problem in rails</title>
		<link>http://blog.dhavalparikh.co.in/2010/06/handling-cookie-over-flow-problem/</link>
		<comments>http://blog.dhavalparikh.co.in/2010/06/handling-cookie-over-flow-problem/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 06:47:15 +0000</pubDate>
		<dc:creator>Dhaval Parikh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cookie overflow]]></category>
		<category><![CDATA[flash notice overflow error]]></category>
		<category><![CDATA[handle cookie over flow + rails]]></category>

		<guid isPermaLink="false">http://blog.dhavalparikh.co.in/?p=287</guid>
		<description><![CDATA[Are you getting cookie overflow error when you are loading a lot of flash[:notices] ?? Something like CGI::Session::CookieStore::CookieOverflow if so here is a solution for it Just write this method in ur controller before_filter :session_cleanup def session_cleanup backup = session.data.clone reset_session backup.each { &#124;k, v&#124; session[k] = v unless k.is_a?(String) &#38;&#38; k =~ /^as:/ } [...]]]></description>
			<content:encoded><![CDATA[<p>Are you getting cookie overflow error when you are loading a lot of flash[:notices] ??</p>
<p>Something like CGI::Session::CookieStore::CookieOverflow</p>
<p>if so here is a solution for it</p>
<p>Just write this method in ur controller</p>
<p>before_filter :session_cleanup</p>
<p>def session_cleanup<br />
backup = session.data.clone<br />
reset_session<br />
backup.each { |k, v| session[k] = v unless k.is_a?(String)  &amp;&amp; k<br />
=~ /^as:/ }<br />
end</p>
<p>What this will do is it will clear old data thats already there in the session and restore this one.</p>
<p>The above method wont work if your data size is &gt;= 4k in that case the only solution is to use another session store.</p>
<p>Hope this helps <img src='http://blog.dhavalparikh.co.in/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  &#8230; Njoi</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2010%2F06%2Fhandling-cookie-over-flow-problem%2F&amp;title=Handling%20cookie%20over%20flow%20problem%20in%20rails&amp;bodytext=Are%20you%20getting%20cookie%20overflow%20error%20when%20you%20are%20loading%20a%20lot%20of%20flash%5B%3Anotices%5D%20%3F%3F%0D%0A%0D%0ASomething%20like%20CGI%3A%3ASession%3A%3ACookieStore%3A%3ACookieOverflow%0D%0A%0D%0Aif%20so%20here%20is%20a%20solution%20for%20it%0D%0A%0D%0AJust%20write%20this%20method%20in%20ur%20controller%0D%0A%0D%0Abefore_filter%20%3Asession" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2010_2F06_2Fhandling-cookie-over-flow-problem_2F_amp_title=Handling_20cookie_20over_20flow_20problem_20in_20rails_amp_bodytext=Are_20you_20getting_20cookie_20overflow_20error_20when_20you_20are_20loading_20a_20lot_20of_20flash_5B_3Anotices_5D_20_3F_3F_0D_0A_0D_0ASomething_20like_20CGI_3A_3ASession_3A_3ACookieStore_3A_3ACookieOverflow_0D_0A_0D_0Aif_20so_20here_20is_20a_20solution_20for_20it_0D_0A_0D_0AJust_20write_20this_20method_20in_20ur_20controller_0D_0A_0D_0Abefore_filter_20_3Asession&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2010%2F06%2Fhandling-cookie-over-flow-problem%2F&amp;title=Handling%20cookie%20over%20flow%20problem%20in%20rails&amp;notes=Are%20you%20getting%20cookie%20overflow%20error%20when%20you%20are%20loading%20a%20lot%20of%20flash%5B%3Anotices%5D%20%3F%3F%0D%0A%0D%0ASomething%20like%20CGI%3A%3ASession%3A%3ACookieStore%3A%3ACookieOverflow%0D%0A%0D%0Aif%20so%20here%20is%20a%20solution%20for%20it%0D%0A%0D%0AJust%20write%20this%20method%20in%20ur%20controller%0D%0A%0D%0Abefore_filter%20%3Asession" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2010_2F06_2Fhandling-cookie-over-flow-problem_2F_amp_title=Handling_20cookie_20over_20flow_20problem_20in_20rails_amp_notes=Are_20you_20getting_20cookie_20overflow_20error_20when_20you_20are_20loading_20a_20lot_20of_20flash_5B_3Anotices_5D_20_3F_3F_0D_0A_0D_0ASomething_20like_20CGI_3A_3ASession_3A_3ACookieStore_3A_3ACookieOverflow_0D_0A_0D_0Aif_20so_20here_20is_20a_20solution_20for_20it_0D_0A_0D_0AJust_20write_20this_20method_20in_20ur_20controller_0D_0A_0D_0Abefore_filter_20_3Asession&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2010%2F06%2Fhandling-cookie-over-flow-problem%2F&amp;t=Handling%20cookie%20over%20flow%20problem%20in%20rails" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2010_2F06_2Fhandling-cookie-over-flow-problem_2F_amp_t=Handling_20cookie_20over_20flow_20problem_20in_20rails&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2010%2F06%2Fhandling-cookie-over-flow-problem%2F&amp;title=Handling%20cookie%20over%20flow%20problem%20in%20rails&amp;annotation=Are%20you%20getting%20cookie%20overflow%20error%20when%20you%20are%20loading%20a%20lot%20of%20flash%5B%3Anotices%5D%20%3F%3F%0D%0A%0D%0ASomething%20like%20CGI%3A%3ASession%3A%3ACookieStore%3A%3ACookieOverflow%0D%0A%0D%0Aif%20so%20here%20is%20a%20solution%20for%20it%0D%0A%0D%0AJust%20write%20this%20method%20in%20ur%20controller%0D%0A%0D%0Abefore_filter%20%3Asession" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2010_2F06_2Fhandling-cookie-over-flow-problem_2F_amp_title=Handling_20cookie_20over_20flow_20problem_20in_20rails_amp_annotation=Are_20you_20getting_20cookie_20overflow_20error_20when_20you_20are_20loading_20a_20lot_20of_20flash_5B_3Anotices_5D_20_3F_3F_0D_0A_0D_0ASomething_20like_20CGI_3A_3ASession_3A_3ACookieStore_3A_3ACookieOverflow_0D_0A_0D_0Aif_20so_20here_20is_20a_20solution_20for_20it_0D_0A_0D_0AJust_20write_20this_20method_20in_20ur_20controller_0D_0A_0D_0Abefore_filter_20_3Asession&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2010%2F06%2Fhandling-cookie-over-flow-problem%2F" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2010_2F06_2Fhandling-cookie-over-flow-problem_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2010%2F06%2Fhandling-cookie-over-flow-problem%2F&amp;title=Handling%20cookie%20over%20flow%20problem%20in%20rails" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2010_2F06_2Fhandling-cookie-over-flow-problem_2F_amp_title=Handling_20cookie_20over_20flow_20problem_20in_20rails&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2010%2F06%2Fhandling-cookie-over-flow-problem%2F&amp;title=Handling%20cookie%20over%20flow%20problem%20in%20rails" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2010_2F06_2Fhandling-cookie-over-flow-problem_2F_amp_title=Handling_20cookie_20over_20flow_20problem_20in_20rails&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Handling%20cookie%20over%20flow%20problem%20in%20rails%20-%20http%3A%2F%2Fblog.dhavalparikh.co.in%2F2010%2F06%2Fhandling-cookie-over-flow-problem%2F" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=Handling_20cookie_20over_20flow_20problem_20in_20rails_20-_20http_3A_2F_2Fblog.dhavalparikh.co.in_2F2010_2F06_2Fhandling-cookie-over-flow-problem_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2010%2F06%2Fhandling-cookie-over-flow-problem%2F&amp;submitHeadline=Handling%20cookie%20over%20flow%20problem%20in%20rails&amp;submitSummary=Are%20you%20getting%20cookie%20overflow%20error%20when%20you%20are%20loading%20a%20lot%20of%20flash%5B%3Anotices%5D%20%3F%3F%0D%0A%0D%0ASomething%20like%20CGI%3A%3ASession%3A%3ACookieStore%3A%3ACookieOverflow%0D%0A%0D%0Aif%20so%20here%20is%20a%20solution%20for%20it%0D%0A%0D%0AJust%20write%20this%20method%20in%20ur%20controller%0D%0A%0D%0Abefore_filter%20%3Asession&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz" onclick="pageTracker._trackPageview('/outgoing/buzz.yahoo.com/submit/?submitUrl=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2010_2F06_2Fhandling-cookie-over-flow-problem_2F_amp_submitHeadline=Handling_20cookie_20over_20flow_20problem_20in_20rails_amp_submitSummary=Are_20you_20getting_20cookie_20overflow_20error_20when_20you_20are_20loading_20a_20lot_20of_20flash_5B_3Anotices_5D_20_3F_3F_0D_0A_0D_0ASomething_20like_20CGI_3A_3ASession_3A_3ACookieStore_3A_3ACookieOverflow_0D_0A_0D_0Aif_20so_20here_20is_20a_20solution_20for_20it_0D_0A_0D_0AJust_20write_20this_20method_20in_20ur_20controller_0D_0A_0D_0Abefore_filter_20_3Asession_amp_submitCategory=science_amp_submitAssetType=text&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.dhavalparikh.co.in/2010/06/handling-cookie-over-flow-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Read XML file using Hpricot in Rails</title>
		<link>http://blog.dhavalparikh.co.in/2010/06/read-xml-file-using-hpricot-in-rails/</link>
		<comments>http://blog.dhavalparikh.co.in/2010/06/read-xml-file-using-hpricot-in-rails/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 06:24:59 +0000</pubDate>
		<dc:creator>Dhaval Parikh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[hpricot + rails]]></category>
		<category><![CDATA[read xml + rails]]></category>
		<category><![CDATA[xml + hpricot + rails]]></category>

		<guid isPermaLink="false">http://blog.dhavalparikh.co.in/?p=280</guid>
		<description><![CDATA[Here is a small post on how to read an xml file using Hpricot in your Rails application. First of all you need to install hpricot with the following command gem install hpricot Here is a sample xml file which I want to read. You can just paste the following code and create .xml  file [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a small post on how to read an xml file using Hpricot in your Rails application.</p>
<p>First of all you need to install hpricot with the following command</p>
<p>gem install hpricot</p>
<p>Here is a sample xml file which I want to read. You can just paste the following code and create .xml  file</p>
<p>&lt;profiles&gt;</p>
<p>&lt;profile&gt;<br />
&lt;name&gt; test &lt;/name&gt;</p>
<p>&lt;user_ids&gt;<br />
&lt;user_id&gt;39&lt;/user_id&gt;<br />
&lt;/user_ids&gt;<br />
&lt;/profile&gt;</p>
<p>&lt;profile&gt;<br />
&lt;name&gt; test 123&lt;/name&gt;</p>
<p>&lt;user_ids&gt;<br />
&lt;user_id&gt;39&lt;/user_id&gt;<br />
&lt;user_id&gt;46&lt;/user_id&gt;<br />
&lt;/user_ids&gt;<br />
&lt;/profile&gt;<br />
&lt;/profiles&gt;</p>
<p>Now here comes the code to read this file. Don&#8217;t forget to add require &#8216;hpricot&#8217; in the controller where you are putting this code.</p>
<p>test = Hpricot::XML(File.open(“test.xml”, “r”))</p>
<p>(test/:profile).each do |pro| render :text=&gt;(((pro.at(“name”).innerHTML.strip).to_s)+”=&gt;”+(pro.at(“   _id”).innerHTML.strip).to_s).inspect and return false<br />
end</p>
<p>Remove .inspect and return false once u get the required output</p>
<p>Hope this helps. If you have any doubts just post a message and I will try to reply.</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2010%2F06%2Fread-xml-file-using-hpricot-in-rails%2F&amp;title=Read%20XML%20file%20using%20Hpricot%20in%20Rails&amp;bodytext=Here%20is%20a%20small%20post%20on%20how%20to%20read%20an%20xml%20file%20using%20Hpricot%20in%20your%20Rails%20application.%0D%0A%0D%0AFirst%20of%20all%20you%20need%20to%20install%20hpricot%20with%20the%20following%20command%0D%0A%0D%0Agem%20install%20hpricot%0D%0A%0D%0AHere%20is%20a%20sample%20xml%20file%20which%20I%20want%20to%20read.%20You%20can%20just%20pas" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2010_2F06_2Fread-xml-file-using-hpricot-in-rails_2F_amp_title=Read_20XML_20file_20using_20Hpricot_20in_20Rails_amp_bodytext=Here_20is_20a_20small_20post_20on_20how_20to_20read_20an_20xml_20file_20using_20Hpricot_20in_20your_20Rails_20application._0D_0A_0D_0AFirst_20of_20all_20you_20need_20to_20install_20hpricot_20with_20the_20following_20command_0D_0A_0D_0Agem_20install_20hpricot_0D_0A_0D_0AHere_20is_20a_20sample_20xml_20file_20which_20I_20want_20to_20read._20You_20can_20just_20pas&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2010%2F06%2Fread-xml-file-using-hpricot-in-rails%2F&amp;title=Read%20XML%20file%20using%20Hpricot%20in%20Rails&amp;notes=Here%20is%20a%20small%20post%20on%20how%20to%20read%20an%20xml%20file%20using%20Hpricot%20in%20your%20Rails%20application.%0D%0A%0D%0AFirst%20of%20all%20you%20need%20to%20install%20hpricot%20with%20the%20following%20command%0D%0A%0D%0Agem%20install%20hpricot%0D%0A%0D%0AHere%20is%20a%20sample%20xml%20file%20which%20I%20want%20to%20read.%20You%20can%20just%20pas" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2010_2F06_2Fread-xml-file-using-hpricot-in-rails_2F_amp_title=Read_20XML_20file_20using_20Hpricot_20in_20Rails_amp_notes=Here_20is_20a_20small_20post_20on_20how_20to_20read_20an_20xml_20file_20using_20Hpricot_20in_20your_20Rails_20application._0D_0A_0D_0AFirst_20of_20all_20you_20need_20to_20install_20hpricot_20with_20the_20following_20command_0D_0A_0D_0Agem_20install_20hpricot_0D_0A_0D_0AHere_20is_20a_20sample_20xml_20file_20which_20I_20want_20to_20read._20You_20can_20just_20pas&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2010%2F06%2Fread-xml-file-using-hpricot-in-rails%2F&amp;t=Read%20XML%20file%20using%20Hpricot%20in%20Rails" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2010_2F06_2Fread-xml-file-using-hpricot-in-rails_2F_amp_t=Read_20XML_20file_20using_20Hpricot_20in_20Rails&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2010%2F06%2Fread-xml-file-using-hpricot-in-rails%2F&amp;title=Read%20XML%20file%20using%20Hpricot%20in%20Rails&amp;annotation=Here%20is%20a%20small%20post%20on%20how%20to%20read%20an%20xml%20file%20using%20Hpricot%20in%20your%20Rails%20application.%0D%0A%0D%0AFirst%20of%20all%20you%20need%20to%20install%20hpricot%20with%20the%20following%20command%0D%0A%0D%0Agem%20install%20hpricot%0D%0A%0D%0AHere%20is%20a%20sample%20xml%20file%20which%20I%20want%20to%20read.%20You%20can%20just%20pas" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2010_2F06_2Fread-xml-file-using-hpricot-in-rails_2F_amp_title=Read_20XML_20file_20using_20Hpricot_20in_20Rails_amp_annotation=Here_20is_20a_20small_20post_20on_20how_20to_20read_20an_20xml_20file_20using_20Hpricot_20in_20your_20Rails_20application._0D_0A_0D_0AFirst_20of_20all_20you_20need_20to_20install_20hpricot_20with_20the_20following_20command_0D_0A_0D_0Agem_20install_20hpricot_0D_0A_0D_0AHere_20is_20a_20sample_20xml_20file_20which_20I_20want_20to_20read._20You_20can_20just_20pas&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2010%2F06%2Fread-xml-file-using-hpricot-in-rails%2F" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2010_2F06_2Fread-xml-file-using-hpricot-in-rails_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2010%2F06%2Fread-xml-file-using-hpricot-in-rails%2F&amp;title=Read%20XML%20file%20using%20Hpricot%20in%20Rails" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2010_2F06_2Fread-xml-file-using-hpricot-in-rails_2F_amp_title=Read_20XML_20file_20using_20Hpricot_20in_20Rails&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2010%2F06%2Fread-xml-file-using-hpricot-in-rails%2F&amp;title=Read%20XML%20file%20using%20Hpricot%20in%20Rails" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2010_2F06_2Fread-xml-file-using-hpricot-in-rails_2F_amp_title=Read_20XML_20file_20using_20Hpricot_20in_20Rails&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Read%20XML%20file%20using%20Hpricot%20in%20Rails%20-%20http%3A%2F%2Fblog.dhavalparikh.co.in%2F2010%2F06%2Fread-xml-file-using-hpricot-in-rails%2F" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=Read_20XML_20file_20using_20Hpricot_20in_20Rails_20-_20http_3A_2F_2Fblog.dhavalparikh.co.in_2F2010_2F06_2Fread-xml-file-using-hpricot-in-rails_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2010%2F06%2Fread-xml-file-using-hpricot-in-rails%2F&amp;submitHeadline=Read%20XML%20file%20using%20Hpricot%20in%20Rails&amp;submitSummary=Here%20is%20a%20small%20post%20on%20how%20to%20read%20an%20xml%20file%20using%20Hpricot%20in%20your%20Rails%20application.%0D%0A%0D%0AFirst%20of%20all%20you%20need%20to%20install%20hpricot%20with%20the%20following%20command%0D%0A%0D%0Agem%20install%20hpricot%0D%0A%0D%0AHere%20is%20a%20sample%20xml%20file%20which%20I%20want%20to%20read.%20You%20can%20just%20pas&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz" onclick="pageTracker._trackPageview('/outgoing/buzz.yahoo.com/submit/?submitUrl=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2010_2F06_2Fread-xml-file-using-hpricot-in-rails_2F_amp_submitHeadline=Read_20XML_20file_20using_20Hpricot_20in_20Rails_amp_submitSummary=Here_20is_20a_20small_20post_20on_20how_20to_20read_20an_20xml_20file_20using_20Hpricot_20in_20your_20Rails_20application._0D_0A_0D_0AFirst_20of_20all_20you_20need_20to_20install_20hpricot_20with_20the_20following_20command_0D_0A_0D_0Agem_20install_20hpricot_0D_0A_0D_0AHere_20is_20a_20sample_20xml_20file_20which_20I_20want_20to_20read._20You_20can_20just_20pas_amp_submitCategory=science_amp_submitAssetType=text&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.dhavalparikh.co.in/2010/06/read-xml-file-using-hpricot-in-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up FTP or SFTP server using vsftpd on ubuntu</title>
		<link>http://blog.dhavalparikh.co.in/2009/11/setting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu/</link>
		<comments>http://blog.dhavalparikh.co.in/2009/11/setting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 05:46:46 +0000</pubDate>
		<dc:creator>Dhaval Parikh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[sftp server]]></category>
		<category><![CDATA[sftp slicehost]]></category>
		<category><![CDATA[vsftpd]]></category>
		<category><![CDATA[vsftpd slicehost]]></category>
		<category><![CDATA[vsftpd ubuntu]]></category>

		<guid isPermaLink="false">http://blog.dhavalparikh.co.in/?p=277</guid>
		<description><![CDATA[Recently I was given a task to configure FTP server so that the user can upload files through FTP. I found VSFTPD really a good solution for it. Its very simple to configure Here are the steps 1) Install vsftpd using the following command sudo apt-get install vsftpd 2) On doing so it will get [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was given a task to configure FTP server so that the user can upload files through FTP. I found VSFTPD really a good solution for it. Its very simple to configure Here are the steps</p>
<p>1) Install vsftpd using the following command</p>
<p><span><span style="margin-left: 0px ! important;"><code>sudo apt-get install vsftpd</code></span></span><br />
2) On doing so it will get installed in /etc path by default. To confirm the same go to /etc/<span><span style="margin-left: 0px ! important;"><code>vsftpd.conf using</code></span></span></p>
<p>sudo nano /etc/vsftpd.conf</p>
<p>Now if you want to allow local users to login find local_enable=YES  and uncomment it</p>
<p>To disable anonymous ftp change anonymous_enable=YES to anonymous_enable=NO</p>
<p>Uncommenting the line (write_enable=YES) will let ftp users upload content to the server. (Thats what I wanted to do)</p>
<p>Thats all its done. Restart the server using</p>
<p>sudo /etc/init.d/vsftpd restart</p>
<p>This is how you will be able to allow ftp login.</p>
<p>But if u have many sites hosted on a server and you want to allow to access only one particular site to a certain user you need to do the following</p>
<p>1) create groups for specific sites using</p>
<p>groupadd site1<br />
chgrp -R site1 /var/www/site1</p>
<p>2) Add user to that group</p>
<p>useradd -G site1 username</p>
<p>3) Give permission to a particular group</p>
<p>chmod -R  g+w /var/www/site1/*</p>
<p>I think thats all. You should be able to access your server using ftp and even upload content on it.</p>
<p>Oh yes one more thing was I wanted the user to go directly to the folder where i wanted him to upload the file. So for that you need to change the root path/home path. For this u need to open passwd file in /etc using</p>
<p>nano /etc/passwd</p>
<p>Looks for the ftp access and the username You will find the current path. In most cases it will be /home change that to your preferred one.</p>
<p>Hmm Thats it..</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F11%2Fsetting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu%2F&amp;title=Setting%20up%20FTP%20or%20SFTP%20server%20using%20vsftpd%20on%20ubuntu&amp;bodytext=Recently%20I%20was%20given%20a%20task%20to%20configure%20FTP%20server%20so%20that%20the%20user%20can%20upload%20files%20through%20FTP.%20I%20found%20VSFTPD%20really%20a%20good%20solution%20for%20it.%20Its%20very%20simple%20to%20configure%20Here%20are%20the%20steps%0D%0A%0D%0A1%29%20Install%20vsftpd%20using%20the%20following%20command%0D%0A%0D%0Asudo%20" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F11_2Fsetting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu_2F_amp_title=Setting_20up_20FTP_20or_20SFTP_20server_20using_20vsftpd_20on_20ubuntu_amp_bodytext=Recently_20I_20was_20given_20a_20task_20to_20configure_20FTP_20server_20so_20that_20the_20user_20can_20upload_20files_20through_20FTP._20I_20found_20VSFTPD_20really_20a_20good_20solution_20for_20it._20Its_20very_20simple_20to_20configure_20Here_20are_20the_20steps_0D_0A_0D_0A1_29_20Install_20vsftpd_20using_20the_20following_20command_0D_0A_0D_0Asudo_20&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F11%2Fsetting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu%2F&amp;title=Setting%20up%20FTP%20or%20SFTP%20server%20using%20vsftpd%20on%20ubuntu&amp;notes=Recently%20I%20was%20given%20a%20task%20to%20configure%20FTP%20server%20so%20that%20the%20user%20can%20upload%20files%20through%20FTP.%20I%20found%20VSFTPD%20really%20a%20good%20solution%20for%20it.%20Its%20very%20simple%20to%20configure%20Here%20are%20the%20steps%0D%0A%0D%0A1%29%20Install%20vsftpd%20using%20the%20following%20command%0D%0A%0D%0Asudo%20" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F11_2Fsetting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu_2F_amp_title=Setting_20up_20FTP_20or_20SFTP_20server_20using_20vsftpd_20on_20ubuntu_amp_notes=Recently_20I_20was_20given_20a_20task_20to_20configure_20FTP_20server_20so_20that_20the_20user_20can_20upload_20files_20through_20FTP._20I_20found_20VSFTPD_20really_20a_20good_20solution_20for_20it._20Its_20very_20simple_20to_20configure_20Here_20are_20the_20steps_0D_0A_0D_0A1_29_20Install_20vsftpd_20using_20the_20following_20command_0D_0A_0D_0Asudo_20&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F11%2Fsetting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu%2F&amp;t=Setting%20up%20FTP%20or%20SFTP%20server%20using%20vsftpd%20on%20ubuntu" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F11_2Fsetting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu_2F_amp_t=Setting_20up_20FTP_20or_20SFTP_20server_20using_20vsftpd_20on_20ubuntu&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F11%2Fsetting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu%2F&amp;title=Setting%20up%20FTP%20or%20SFTP%20server%20using%20vsftpd%20on%20ubuntu&amp;annotation=Recently%20I%20was%20given%20a%20task%20to%20configure%20FTP%20server%20so%20that%20the%20user%20can%20upload%20files%20through%20FTP.%20I%20found%20VSFTPD%20really%20a%20good%20solution%20for%20it.%20Its%20very%20simple%20to%20configure%20Here%20are%20the%20steps%0D%0A%0D%0A1%29%20Install%20vsftpd%20using%20the%20following%20command%0D%0A%0D%0Asudo%20" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F11_2Fsetting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu_2F_amp_title=Setting_20up_20FTP_20or_20SFTP_20server_20using_20vsftpd_20on_20ubuntu_amp_annotation=Recently_20I_20was_20given_20a_20task_20to_20configure_20FTP_20server_20so_20that_20the_20user_20can_20upload_20files_20through_20FTP._20I_20found_20VSFTPD_20really_20a_20good_20solution_20for_20it._20Its_20very_20simple_20to_20configure_20Here_20are_20the_20steps_0D_0A_0D_0A1_29_20Install_20vsftpd_20using_20the_20following_20command_0D_0A_0D_0Asudo_20&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F11%2Fsetting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu%2F" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F11_2Fsetting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F11%2Fsetting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu%2F&amp;title=Setting%20up%20FTP%20or%20SFTP%20server%20using%20vsftpd%20on%20ubuntu" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F11_2Fsetting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu_2F_amp_title=Setting_20up_20FTP_20or_20SFTP_20server_20using_20vsftpd_20on_20ubuntu&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F11%2Fsetting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu%2F&amp;title=Setting%20up%20FTP%20or%20SFTP%20server%20using%20vsftpd%20on%20ubuntu" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F11_2Fsetting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu_2F_amp_title=Setting_20up_20FTP_20or_20SFTP_20server_20using_20vsftpd_20on_20ubuntu&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Setting%20up%20FTP%20or%20SFTP%20server%20using%20vsftpd%20on%20ubuntu%20-%20http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F11%2Fsetting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu%2F" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=Setting_20up_20FTP_20or_20SFTP_20server_20using_20vsftpd_20on_20ubuntu_20-_20http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F11_2Fsetting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F11%2Fsetting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu%2F&amp;submitHeadline=Setting%20up%20FTP%20or%20SFTP%20server%20using%20vsftpd%20on%20ubuntu&amp;submitSummary=Recently%20I%20was%20given%20a%20task%20to%20configure%20FTP%20server%20so%20that%20the%20user%20can%20upload%20files%20through%20FTP.%20I%20found%20VSFTPD%20really%20a%20good%20solution%20for%20it.%20Its%20very%20simple%20to%20configure%20Here%20are%20the%20steps%0D%0A%0D%0A1%29%20Install%20vsftpd%20using%20the%20following%20command%0D%0A%0D%0Asudo%20&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz" onclick="pageTracker._trackPageview('/outgoing/buzz.yahoo.com/submit/?submitUrl=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F11_2Fsetting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu_2F_amp_submitHeadline=Setting_20up_20FTP_20or_20SFTP_20server_20using_20vsftpd_20on_20ubuntu_amp_submitSummary=Recently_20I_20was_20given_20a_20task_20to_20configure_20FTP_20server_20so_20that_20the_20user_20can_20upload_20files_20through_20FTP._20I_20found_20VSFTPD_20really_20a_20good_20solution_20for_20it._20Its_20very_20simple_20to_20configure_20Here_20are_20the_20steps_0D_0A_0D_0A1_29_20Install_20vsftpd_20using_20the_20following_20command_0D_0A_0D_0Asudo_20_amp_submitCategory=science_amp_submitAssetType=text&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.dhavalparikh.co.in/2009/11/setting-up-ftp-or-sftp-server-using-vsftpd-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Deploy or Configure Rails on a Ubuntu Server</title>
		<link>http://blog.dhavalparikh.co.in/2009/09/deploy-or-configure-rails-on-a-ubuntu-server/</link>
		<comments>http://blog.dhavalparikh.co.in/2009/09/deploy-or-configure-rails-on-a-ubuntu-server/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 17:20:23 +0000</pubDate>
		<dc:creator>Dhaval Parikh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[configur rails on ubuntu]]></category>
		<category><![CDATA[deploy rails application]]></category>
		<category><![CDATA[rails + ubuntu + mysql + nginx]]></category>
		<category><![CDATA[rails on ubuntu]]></category>

		<guid isPermaLink="false">http://blog.dhavalparikh.co.in/?p=267</guid>
		<description><![CDATA[I have configured many servers till now on different OS. Like CentOs, Fedora and Ubuntu. From all the Operating systems Ubuntu is my favorite. The reason is its rails friendly according to me. Also Fedora is also good but I like Ubuntu more might be just bcoz I am more used to it Talking about [...]]]></description>
			<content:encoded><![CDATA[<p>I have configured many servers till now on different OS. Like CentOs, Fedora and Ubuntu. From all the Operating systems Ubuntu is my favorite. The reason is its rails friendly according to me. Also Fedora is also good but I like Ubuntu more might be just bcoz I am more used to it <img src='http://blog.dhavalparikh.co.in/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Talking about configuring rails app on an Ubuntu server takes following steps on a plain slice</p>
<p>1) Step 1 will be to install basic ruby gems and other packages</p>
<p>If its a blank slice you might also need to update ur repos using</p>
<p>apt-get update before u start installing ruby and other required libraries</p>
<p>sudo aptitude install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 libopenssl-ruby sqlite3 libsqlite3-ruby1.8.</p>
<p>2) Create simlinks</p>
<p>sudo ln -s /usr/bin/ruby1.8 /usr/bin/ruby<br />
sudo ln -s /usr/bin/ri1.8 /usr/bin/ri<br />
sudo ln -s /usr/bin/rdoc1.8 /usr/bin/rdoc<br />
sudo ln -s /usr/bin/irb1.8 /usr/bin/irb</p>
<p>3) Install Ruby gems (Make sure you have the latest version from <a href="http://rubyforge.org/frs/?group_id=126" target="_blank" onclick="pageTracker._trackPageview('/outgoing/rubyforge.org/frs/?group_id=126&amp;referer=');">http://rubyforge.org/frs/?group_id=126</a></p>
<p>We will use the 1.3.2 version. Get the tar version from <a href="http://rubyforge.org/frs/download.php/55066/rubygems-1.3.2.tgz using wget http://rubyforge.org/frs/download.php/55066/rubygems-1.3.2.tgz" target="_blank" onclick="pageTracker._trackPageview('/outgoing/rubyforge.org/frs/download.php/55066/rubygems-1.3.2.tgz_using_wget_http_//rubyforge.org/frs/download.php/55066/rubygems-1.3.2.tgz?referer=');">http://rubyforge.org/frs/download.php/55066/rubygems-1.3.2.tgz using wget http://rubyforge.org/frs/download.php/55066/rubygems-1.3.2.tgz</a>.</p>
<p>Then do  tar xzvf rubygems-1.3.2.tgz</p>
<p>cd  rubygems-1.3.2</p>
<p>sudo ruby setup.rb (to install the setup)</p>
<p>then do simlink sudo ln -s /usr/bin/gem1.8 /usr/bin/gem</p>
<p>4) Then install rails (most important <img src='http://blog.dhavalparikh.co.in/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> )</p>
<p>gem install rails -v 2.2.2 (make sure u specify the version u want to install else it will install the latest one)</p>
<p>5) Next step will be database. I use MySql and so here is the procedure  for it</p>
<p>sudo aptitude install mysql-server mysql-client libmysqlclient15-dev</p>
<p>You will be prompted to enter password 2-3 times while the installation is on. Don&#8217;t forget to setup a password.</p>
<p>6) Then comes one important part which is mysql-ruby library. Most people forget this and then MySql don&#8217;t work for them.</p>
<p>sudo aptitude install libmysql-ruby1.8</p>
<p>I think that&#8217;s all for Ruby + Rails + Ruby gems + Mysql</p>
<p>7) Since you are using Ubuntu make sure u have installed all the essentials things using</p>
<p>aptitude install build-essential.</p>
<p>This will install cc, gcc and other core required libraries. which will help u in installing gems and configuring them.</p>
<p>8 ) Like I said before you will now also require gem. And the most common one is ImageMagick and Rmagick you can install them using</p>
<p>sudo apt-get install imagemagick</p>
<p>sudo apt-get install libmagick9-dev</p>
<p>sudo gem install rmagick</p>
<p>These 3 steps works in most cases. If it doesn&#8217;t work for you let me know via comment and I shall help u in solving it. You may also visit my previously written blog post on <a href="http://blog.dhavalparikh.co.in/2008/02/rmagick-installation-on-ubuntu/" target="_blank">http://blog.dhavalparikh.co.in/2008/02/rmagick-installation-on-ubuntu/</a></p>
<p>9) Some other important ones are capistrano and git which u might require to install. Not covering them as of now.</p>
<p>10) You might also require nginx for webserver (I use Nginx so I am writing about it).</p>
<p>sudo aptitude install nginx</p>
<p>This will install nginx. For more information about nginx and its configuration you may visit my previous posts on</p>
<p><a href="http://blog.dhavalparikh.co.in/2008/11/nginx-configuration-expiry-headers-and-gzip-component-with-rails-nginxconf/" target="_blank">http://blog.dhavalparikh.co.in/2008/11/nginx-configuration-expiry-headers-and-gzip-component-with-rails-nginxconf/</a></p>
<p>That&#8217;s more than what you need to run a basic rails apps. But I think these are essentials for a good rails app deployment.</p>
<p>You can even read more about Mongrel Clustering with Nginx on my posts which could be again a part of server configuration</p>
<p><a href="http://blog.dhavalparikh.co.in/2008/11/mongrel-clustering-with-rails/" target="_blank">http://blog.dhavalparikh.co.in/2008/11/mongrel-clustering-with-rails/</a></p>
<p>I think thats all. If you have any doubts or problems write me a comment and I shall reply u ASAP.</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F09%2Fdeploy-or-configure-rails-on-a-ubuntu-server%2F&amp;title=Deploy%20or%20Configure%20Rails%20on%20a%20Ubuntu%20Server&amp;bodytext=I%20have%20configured%20many%20servers%20till%20now%20on%20different%20OS.%20Like%20CentOs%2C%20Fedora%20and%20Ubuntu.%20From%20all%20the%20Operating%20systems%20Ubuntu%20is%20my%20favorite.%20The%20reason%20is%20its%20rails%20friendly%20according%20to%20me.%20Also%20Fedora%20is%20also%20good%20but%20I%20like%20Ubuntu%20more%20might%20be%20" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F09_2Fdeploy-or-configure-rails-on-a-ubuntu-server_2F_amp_title=Deploy_20or_20Configure_20Rails_20on_20a_20Ubuntu_20Server_amp_bodytext=I_20have_20configured_20many_20servers_20till_20now_20on_20different_20OS._20Like_20CentOs_2C_20Fedora_20and_20Ubuntu._20From_20all_20the_20Operating_20systems_20Ubuntu_20is_20my_20favorite._20The_20reason_20is_20its_20rails_20friendly_20according_20to_20me._20Also_20Fedora_20is_20also_20good_20but_20I_20like_20Ubuntu_20more_20might_20be_20&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F09%2Fdeploy-or-configure-rails-on-a-ubuntu-server%2F&amp;title=Deploy%20or%20Configure%20Rails%20on%20a%20Ubuntu%20Server&amp;notes=I%20have%20configured%20many%20servers%20till%20now%20on%20different%20OS.%20Like%20CentOs%2C%20Fedora%20and%20Ubuntu.%20From%20all%20the%20Operating%20systems%20Ubuntu%20is%20my%20favorite.%20The%20reason%20is%20its%20rails%20friendly%20according%20to%20me.%20Also%20Fedora%20is%20also%20good%20but%20I%20like%20Ubuntu%20more%20might%20be%20" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F09_2Fdeploy-or-configure-rails-on-a-ubuntu-server_2F_amp_title=Deploy_20or_20Configure_20Rails_20on_20a_20Ubuntu_20Server_amp_notes=I_20have_20configured_20many_20servers_20till_20now_20on_20different_20OS._20Like_20CentOs_2C_20Fedora_20and_20Ubuntu._20From_20all_20the_20Operating_20systems_20Ubuntu_20is_20my_20favorite._20The_20reason_20is_20its_20rails_20friendly_20according_20to_20me._20Also_20Fedora_20is_20also_20good_20but_20I_20like_20Ubuntu_20more_20might_20be_20&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F09%2Fdeploy-or-configure-rails-on-a-ubuntu-server%2F&amp;t=Deploy%20or%20Configure%20Rails%20on%20a%20Ubuntu%20Server" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F09_2Fdeploy-or-configure-rails-on-a-ubuntu-server_2F_amp_t=Deploy_20or_20Configure_20Rails_20on_20a_20Ubuntu_20Server&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F09%2Fdeploy-or-configure-rails-on-a-ubuntu-server%2F&amp;title=Deploy%20or%20Configure%20Rails%20on%20a%20Ubuntu%20Server&amp;annotation=I%20have%20configured%20many%20servers%20till%20now%20on%20different%20OS.%20Like%20CentOs%2C%20Fedora%20and%20Ubuntu.%20From%20all%20the%20Operating%20systems%20Ubuntu%20is%20my%20favorite.%20The%20reason%20is%20its%20rails%20friendly%20according%20to%20me.%20Also%20Fedora%20is%20also%20good%20but%20I%20like%20Ubuntu%20more%20might%20be%20" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F09_2Fdeploy-or-configure-rails-on-a-ubuntu-server_2F_amp_title=Deploy_20or_20Configure_20Rails_20on_20a_20Ubuntu_20Server_amp_annotation=I_20have_20configured_20many_20servers_20till_20now_20on_20different_20OS._20Like_20CentOs_2C_20Fedora_20and_20Ubuntu._20From_20all_20the_20Operating_20systems_20Ubuntu_20is_20my_20favorite._20The_20reason_20is_20its_20rails_20friendly_20according_20to_20me._20Also_20Fedora_20is_20also_20good_20but_20I_20like_20Ubuntu_20more_20might_20be_20&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F09%2Fdeploy-or-configure-rails-on-a-ubuntu-server%2F" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F09_2Fdeploy-or-configure-rails-on-a-ubuntu-server_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F09%2Fdeploy-or-configure-rails-on-a-ubuntu-server%2F&amp;title=Deploy%20or%20Configure%20Rails%20on%20a%20Ubuntu%20Server" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F09_2Fdeploy-or-configure-rails-on-a-ubuntu-server_2F_amp_title=Deploy_20or_20Configure_20Rails_20on_20a_20Ubuntu_20Server&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F09%2Fdeploy-or-configure-rails-on-a-ubuntu-server%2F&amp;title=Deploy%20or%20Configure%20Rails%20on%20a%20Ubuntu%20Server" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F09_2Fdeploy-or-configure-rails-on-a-ubuntu-server_2F_amp_title=Deploy_20or_20Configure_20Rails_20on_20a_20Ubuntu_20Server&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Deploy%20or%20Configure%20Rails%20on%20a%20Ubuntu%20Server%20-%20http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F09%2Fdeploy-or-configure-rails-on-a-ubuntu-server%2F" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=Deploy_20or_20Configure_20Rails_20on_20a_20Ubuntu_20Server_20-_20http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F09_2Fdeploy-or-configure-rails-on-a-ubuntu-server_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F09%2Fdeploy-or-configure-rails-on-a-ubuntu-server%2F&amp;submitHeadline=Deploy%20or%20Configure%20Rails%20on%20a%20Ubuntu%20Server&amp;submitSummary=I%20have%20configured%20many%20servers%20till%20now%20on%20different%20OS.%20Like%20CentOs%2C%20Fedora%20and%20Ubuntu.%20From%20all%20the%20Operating%20systems%20Ubuntu%20is%20my%20favorite.%20The%20reason%20is%20its%20rails%20friendly%20according%20to%20me.%20Also%20Fedora%20is%20also%20good%20but%20I%20like%20Ubuntu%20more%20might%20be%20&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz" onclick="pageTracker._trackPageview('/outgoing/buzz.yahoo.com/submit/?submitUrl=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F09_2Fdeploy-or-configure-rails-on-a-ubuntu-server_2F_amp_submitHeadline=Deploy_20or_20Configure_20Rails_20on_20a_20Ubuntu_20Server_amp_submitSummary=I_20have_20configured_20many_20servers_20till_20now_20on_20different_20OS._20Like_20CentOs_2C_20Fedora_20and_20Ubuntu._20From_20all_20the_20Operating_20systems_20Ubuntu_20is_20my_20favorite._20The_20reason_20is_20its_20rails_20friendly_20according_20to_20me._20Also_20Fedora_20is_20also_20good_20but_20I_20like_20Ubuntu_20more_20might_20be_20_amp_submitCategory=science_amp_submitAssetType=text&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.dhavalparikh.co.in/2009/09/deploy-or-configure-rails-on-a-ubuntu-server/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>My Gmail hangs up and is very slow what should I do?</title>
		<link>http://blog.dhavalparikh.co.in/2009/08/my-gmail-hangs-up-and-is-very-slow-what-should-i-do/</link>
		<comments>http://blog.dhavalparikh.co.in/2009/08/my-gmail-hangs-up-and-is-very-slow-what-should-i-do/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 04:33:39 +0000</pubDate>
		<dc:creator>Dhaval Parikh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[gmail issue with firefox]]></category>
		<category><![CDATA[slow gmail]]></category>

		<guid isPermaLink="false">http://blog.dhavalparikh.co.in/?p=257</guid>
		<description><![CDATA[Well if that&#8217;s the problem you are facing then its not ur fault or nothing is wrong with your pc. Something is wrong with Gmail. Especially when you are using Firefox 3.5 you are sure to face this issue unless ur lucky. Last month when i upgraded my browser to FF 3.5 I started facing [...]]]></description>
			<content:encoded><![CDATA[<p>Well if that&#8217;s the problem you are facing then its not ur fault or nothing is wrong with your pc. Something is wrong with Gmail. Especially when you are using Firefox 3.5 you are sure to face this issue unless ur lucky.</p>
<p>Last month when i upgraded my browser to FF 3.5 I started facing the issue and realized that the issue was with Firefox and not Gmail since it was working properly in safari and other browsers. So as usual I googled and found this <span style="display: block; padding-left: 6em;"><span><a href="http://groups.google.com/group/mozilla.support.firefox/browse_thread/thread/805c8e689b64b8d2/adf482dcb49bb423" target="_blank" onclick="pageTracker._trackPageview('/outgoing/groups.google.com/group/mozilla.support.firefox/browse_thread/thread/805c8e689b64b8d2/adf482dcb49bb423?referer=');">http://groups.google.com/group/mozilla.support.firefox/browse_thread/thread/805c8e689b64b8d2/adf482dcb49bb423</a></span></span></p>
<p>So I came to know that I am not the only one facing the issue. Then I tried couple of suggestions given in the thread and finally I have the list and solution for solving this problem. Here are the steps which you need to follow to get things working properly.</p>
<p>1) Clear history, cache every thing using the Clear history option in your browser</p>
<p>2) Next step is open GMail go to settings and check the last option <span class="rc">Browser connection: Select </span><span class="rS">Don&#8217;t always use https. Using Https will make things secure but slow. so let Gmail manage it on its own.</span></p>
<p>3) Look if you are using Firebug (A Mozilla Addon especially used by web developers) . If you are using that Disable it dont keep it running all the time.</p>
<p>4) Now finally the labs section. Gmail has many new features in the lab section. Try to disable the ones you don&#8217;t need.</p>
<p>5) Remove all unwanted add-ons</p>
<p>I think thats all restart Firefox and things should be alrite. If you are still facing issues Post me a comment and I shall help you out.</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F08%2Fmy-gmail-hangs-up-and-is-very-slow-what-should-i-do%2F&amp;title=My%20Gmail%20hangs%20up%20and%20is%20very%20slow%20what%20should%20I%20do%3F&amp;bodytext=Well%20if%20that%27s%20the%20problem%20you%20are%20facing%20then%20its%20not%20ur%20fault%20or%20nothing%20is%20wrong%20with%20your%20pc.%20Something%20is%20wrong%20with%20Gmail.%20Especially%20when%20you%20are%20using%20Firefox%203.5%20you%20are%20sure%20to%20face%20this%20issue%20unless%20ur%20lucky.%0D%0A%0D%0ALast%20month%20when%20i%20upgraded%20" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F08_2Fmy-gmail-hangs-up-and-is-very-slow-what-should-i-do_2F_amp_title=My_20Gmail_20hangs_20up_20and_20is_20very_20slow_20what_20should_20I_20do_3F_amp_bodytext=Well_20if_20that_27s_20the_20problem_20you_20are_20facing_20then_20its_20not_20ur_20fault_20or_20nothing_20is_20wrong_20with_20your_20pc._20Something_20is_20wrong_20with_20Gmail._20Especially_20when_20you_20are_20using_20Firefox_203.5_20you_20are_20sure_20to_20face_20this_20issue_20unless_20ur_20lucky._0D_0A_0D_0ALast_20month_20when_20i_20upgraded_20&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F08%2Fmy-gmail-hangs-up-and-is-very-slow-what-should-i-do%2F&amp;title=My%20Gmail%20hangs%20up%20and%20is%20very%20slow%20what%20should%20I%20do%3F&amp;notes=Well%20if%20that%27s%20the%20problem%20you%20are%20facing%20then%20its%20not%20ur%20fault%20or%20nothing%20is%20wrong%20with%20your%20pc.%20Something%20is%20wrong%20with%20Gmail.%20Especially%20when%20you%20are%20using%20Firefox%203.5%20you%20are%20sure%20to%20face%20this%20issue%20unless%20ur%20lucky.%0D%0A%0D%0ALast%20month%20when%20i%20upgraded%20" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F08_2Fmy-gmail-hangs-up-and-is-very-slow-what-should-i-do_2F_amp_title=My_20Gmail_20hangs_20up_20and_20is_20very_20slow_20what_20should_20I_20do_3F_amp_notes=Well_20if_20that_27s_20the_20problem_20you_20are_20facing_20then_20its_20not_20ur_20fault_20or_20nothing_20is_20wrong_20with_20your_20pc._20Something_20is_20wrong_20with_20Gmail._20Especially_20when_20you_20are_20using_20Firefox_203.5_20you_20are_20sure_20to_20face_20this_20issue_20unless_20ur_20lucky._0D_0A_0D_0ALast_20month_20when_20i_20upgraded_20&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F08%2Fmy-gmail-hangs-up-and-is-very-slow-what-should-i-do%2F&amp;t=My%20Gmail%20hangs%20up%20and%20is%20very%20slow%20what%20should%20I%20do%3F" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F08_2Fmy-gmail-hangs-up-and-is-very-slow-what-should-i-do_2F_amp_t=My_20Gmail_20hangs_20up_20and_20is_20very_20slow_20what_20should_20I_20do_3F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F08%2Fmy-gmail-hangs-up-and-is-very-slow-what-should-i-do%2F&amp;title=My%20Gmail%20hangs%20up%20and%20is%20very%20slow%20what%20should%20I%20do%3F&amp;annotation=Well%20if%20that%27s%20the%20problem%20you%20are%20facing%20then%20its%20not%20ur%20fault%20or%20nothing%20is%20wrong%20with%20your%20pc.%20Something%20is%20wrong%20with%20Gmail.%20Especially%20when%20you%20are%20using%20Firefox%203.5%20you%20are%20sure%20to%20face%20this%20issue%20unless%20ur%20lucky.%0D%0A%0D%0ALast%20month%20when%20i%20upgraded%20" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F08_2Fmy-gmail-hangs-up-and-is-very-slow-what-should-i-do_2F_amp_title=My_20Gmail_20hangs_20up_20and_20is_20very_20slow_20what_20should_20I_20do_3F_amp_annotation=Well_20if_20that_27s_20the_20problem_20you_20are_20facing_20then_20its_20not_20ur_20fault_20or_20nothing_20is_20wrong_20with_20your_20pc._20Something_20is_20wrong_20with_20Gmail._20Especially_20when_20you_20are_20using_20Firefox_203.5_20you_20are_20sure_20to_20face_20this_20issue_20unless_20ur_20lucky._0D_0A_0D_0ALast_20month_20when_20i_20upgraded_20&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F08%2Fmy-gmail-hangs-up-and-is-very-slow-what-should-i-do%2F" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F08_2Fmy-gmail-hangs-up-and-is-very-slow-what-should-i-do_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F08%2Fmy-gmail-hangs-up-and-is-very-slow-what-should-i-do%2F&amp;title=My%20Gmail%20hangs%20up%20and%20is%20very%20slow%20what%20should%20I%20do%3F" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F08_2Fmy-gmail-hangs-up-and-is-very-slow-what-should-i-do_2F_amp_title=My_20Gmail_20hangs_20up_20and_20is_20very_20slow_20what_20should_20I_20do_3F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F08%2Fmy-gmail-hangs-up-and-is-very-slow-what-should-i-do%2F&amp;title=My%20Gmail%20hangs%20up%20and%20is%20very%20slow%20what%20should%20I%20do%3F" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F08_2Fmy-gmail-hangs-up-and-is-very-slow-what-should-i-do_2F_amp_title=My_20Gmail_20hangs_20up_20and_20is_20very_20slow_20what_20should_20I_20do_3F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=My%20Gmail%20hangs%20up%20and%20is%20very%20slow%20what%20should%20I%20do%3F%20-%20http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F08%2Fmy-gmail-hangs-up-and-is-very-slow-what-should-i-do%2F" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=My_20Gmail_20hangs_20up_20and_20is_20very_20slow_20what_20should_20I_20do_3F_20-_20http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F08_2Fmy-gmail-hangs-up-and-is-very-slow-what-should-i-do_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F08%2Fmy-gmail-hangs-up-and-is-very-slow-what-should-i-do%2F&amp;submitHeadline=My%20Gmail%20hangs%20up%20and%20is%20very%20slow%20what%20should%20I%20do%3F&amp;submitSummary=Well%20if%20that%27s%20the%20problem%20you%20are%20facing%20then%20its%20not%20ur%20fault%20or%20nothing%20is%20wrong%20with%20your%20pc.%20Something%20is%20wrong%20with%20Gmail.%20Especially%20when%20you%20are%20using%20Firefox%203.5%20you%20are%20sure%20to%20face%20this%20issue%20unless%20ur%20lucky.%0D%0A%0D%0ALast%20month%20when%20i%20upgraded%20&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz" onclick="pageTracker._trackPageview('/outgoing/buzz.yahoo.com/submit/?submitUrl=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F08_2Fmy-gmail-hangs-up-and-is-very-slow-what-should-i-do_2F_amp_submitHeadline=My_20Gmail_20hangs_20up_20and_20is_20very_20slow_20what_20should_20I_20do_3F_amp_submitSummary=Well_20if_20that_27s_20the_20problem_20you_20are_20facing_20then_20its_20not_20ur_20fault_20or_20nothing_20is_20wrong_20with_20your_20pc._20Something_20is_20wrong_20with_20Gmail._20Especially_20when_20you_20are_20using_20Firefox_203.5_20you_20are_20sure_20to_20face_20this_20issue_20unless_20ur_20lucky._0D_0A_0D_0ALast_20month_20when_20i_20upgraded_20_amp_submitCategory=science_amp_submitAssetType=text&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.dhavalparikh.co.in/2009/08/my-gmail-hangs-up-and-is-very-slow-what-should-i-do/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Background Process (threading and forking) with spawn plugin in rails</title>
		<link>http://blog.dhavalparikh.co.in/2009/06/background-process-threading-and-forking-with-spawn-plugin-in-rails/</link>
		<comments>http://blog.dhavalparikh.co.in/2009/06/background-process-threading-and-forking-with-spawn-plugin-in-rails/#comments</comments>
		<pubDate>Sun, 21 Jun 2009 04:00:22 +0000</pubDate>
		<dc:creator>Dhaval Parikh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[background process in rails]]></category>
		<category><![CDATA[forking]]></category>
		<category><![CDATA[threading]]></category>

		<guid isPermaLink="false">http://blog.dhavalparikh.co.in/?p=248</guid>
		<description><![CDATA[Do you have a process which takes a long amount of time before you display the result to the user? First of all make sure that your code is correct and you are following Rails standards. If thats alrite then you should do that process in background. Doing a process in background means that you [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">Do you have a process which takes a long amount of time before you display the result to the user? First of all make sure that your code is correct and you are following Rails standards. If thats alrite then you should do that process in background. Doing a process in background means that you start a asynchronous process as a separate process thread which keeps on running in background thus not interfering in user process. (Hope this clarifies what i mean by background process)</p>
<p style="text-align: left;">Now the question is how to do it and how its beneficial ??</p>
<p style="text-align: left;">Well by doing a background process you don&#8217;t keep a user waiting on your site. this helps the user to visit other parts of your site and since he gets faster responses he gets attached to your site and thats what you want being a website owner.</p>
<p style="text-align: left;">Now how to do it is the main thing. Well there are couple of plugins which claims to do this type of tasks.</p>
<p style="text-align: left;"><span class="name"><a href="http://agilewebdevelopment.com/plugins/backgroundrb" onclick="pageTracker._trackPageview('/outgoing/agilewebdevelopment.com/plugins/backgroundrb?referer=');">BackgrounDRb</a></span></p>
<p style="text-align: left;"><span class="name"><a href="http://agilewebdevelopment.com/plugins/backgroundfu" onclick="pageTracker._trackPageview('/outgoing/agilewebdevelopment.com/plugins/backgroundfu?referer=');">BackgroundFu</a></span></p>
<p style="text-align: left;"><span class="name"><a href="http://agilewebdevelopment.com/plugins/bj" onclick="pageTracker._trackPageview('/outgoing/agilewebdevelopment.com/plugins/bj?referer=');">Bj</a></span></p>
<p style="text-align: left;">But My Favourite is SPAWN plugin availabe on <a href="http://github.com/tra/spawn/tree/master" onclick="pageTracker._trackPageview('/outgoing/github.com/tra/spawn/tree/master?referer=');">http://github.com/tra/spawn/tree/master</a></p>
<p style="text-align: left;">Although the contents below are mentioned on the above link I m putting it here for your reference.</p>
<pre style="text-align: left;">Spawn
=====

This plugin provides a 'spawn' method to easily fork OR thread
long-running sections of code so that your application can return
results to your users more quickly.This plugin works by creating new
database connections in ActiveRecord::Base for the spawned block.

The plugin also patches ActiveRecord::Base to handle some known
 bugs when using threads (see lib/patches.rb).

Usage
-----

Here's a simple example of how to demonstrate the spawn plugin.
In one of your controllers, insert this code
(after installing the plugin of course):

  spawn do
    logger.info("I feel sleepy...")
    sleep 11
    logger.info("Time to wake up!")
  end

If everything is working correctly, your controller should finish quickly
then you'll see the last log message several seconds later.

If you need to wait for the spawned processes/threads, then pass the
objects returned by spawn to Spawn::wait(), like this:

  N.times do |i|
    # spawn N blocks of code
    spawn_ids[i] = spawn do
      something(i)
    end
  end
  # wait for all N blocks of code to finish running
  wait(spawn_ids)

If you want your forked child to run at a lower priority than
the parent process, pass in the :nice option like this:

  spawn(:nice =&gt; 7) do
    do_something_nicely
  end

By default, spawn will use the fork to spawn child processes.
You can configure it to do threading either by telling the spawn
method when you call it or by configuring your environment.
For example, this is how you can tell spawn to use threading on the call,

  spawn(:method =&gt; :thread) do
    something
  end

When using the :thread setting,
spawn will check to make sure that you have set
allow_concurrency=true in your configuration.
If you want this setting then
put this line in one of your environment config files: 

  config.active_record.allow_concurrency = true

If it is not set, then spawn will raise an exception.

To (optionally) configure the spawn method in your configuration,
add a line to your configuration file(s) like this:

  Spawn::method :thread

If you don't set any configuration, the :method will default to :fork.  To
specify different values for different environments, pass the environment as
the 2nd argument:

  Spawn::method :fork, 'production'
  Spawn::method :yield, 'test'

This allows you to set your production and development
environments to use different methods according to your needs.

Forking vs. Threading
---------------------

There are several tradeoffs for using threading vs. forking.
Forking was chosen as the default primarily because it requires
no configuration to get it working out of the box.

Forking advantages:
  - more reliable? - the ActiveRecord code is generally not
    deemed to be thread-safe.
    Even though spawn attempts to patch known problems with the
    threaded implementation, there are no guarantees.
    Forking is heavier but should be fairly reliable.
  - keep running - this could also be a disadvantage,
    but you may find you want to fork
    off a process that could have a life longer than its parent.
    For example, maybe you
    want to restart your server without killing the spawned processes.
    We don't necessarily condone this (i.e. haven't tried it)
    but it's technically possible.
  - easier - forking works out of the box with spawn,
    threading requires you set allow_concurrency=true.
    Also, beware of automatic reloading of classes in
    development mode (config.cache_classes = false).

Threading advantages:
  - less filling - threads take less resources...
    how much less?  it depends.
    Some flavors of Unix are pretty efficient at forking
    so the threading advantage may not be as big as you think...
    but then again, maybe it's more than you think.  <img src='http://blog.dhavalparikh.co.in/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />
  - debugging - you can set breakpoints in your threads

I guess now its more clear to you what is Threading,Forking &amp; bg procee</pre>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fbackground-process-threading-and-forking-with-spawn-plugin-in-rails%2F&amp;title=Background%20Process%20%28threading%20and%20forking%29%20with%20spawn%20plugin%20in%20rails&amp;bodytext=Do%20you%20have%20a%20process%20which%20takes%20a%20long%20amount%20of%20time%20before%20you%20display%20the%20result%20to%20the%20user%3F%20First%20of%20all%20make%20sure%20that%20your%20code%20is%20correct%20and%20you%20are%20following%20Rails%20standards.%20If%20thats%20alrite%20then%20you%20should%20do%20that%20process%20in%20background.%20" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fbackground-process-threading-and-forking-with-spawn-plugin-in-rails_2F_amp_title=Background_20Process_20_28threading_20and_20forking_29_20with_20spawn_20plugin_20in_20rails_amp_bodytext=Do_20you_20have_20a_20process_20which_20takes_20a_20long_20amount_20of_20time_20before_20you_20display_20the_20result_20to_20the_20user_3F_20First_20of_20all_20make_20sure_20that_20your_20code_20is_20correct_20and_20you_20are_20following_20Rails_20standards._20If_20thats_20alrite_20then_20you_20should_20do_20that_20process_20in_20background._20&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fbackground-process-threading-and-forking-with-spawn-plugin-in-rails%2F&amp;title=Background%20Process%20%28threading%20and%20forking%29%20with%20spawn%20plugin%20in%20rails&amp;notes=Do%20you%20have%20a%20process%20which%20takes%20a%20long%20amount%20of%20time%20before%20you%20display%20the%20result%20to%20the%20user%3F%20First%20of%20all%20make%20sure%20that%20your%20code%20is%20correct%20and%20you%20are%20following%20Rails%20standards.%20If%20thats%20alrite%20then%20you%20should%20do%20that%20process%20in%20background.%20" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fbackground-process-threading-and-forking-with-spawn-plugin-in-rails_2F_amp_title=Background_20Process_20_28threading_20and_20forking_29_20with_20spawn_20plugin_20in_20rails_amp_notes=Do_20you_20have_20a_20process_20which_20takes_20a_20long_20amount_20of_20time_20before_20you_20display_20the_20result_20to_20the_20user_3F_20First_20of_20all_20make_20sure_20that_20your_20code_20is_20correct_20and_20you_20are_20following_20Rails_20standards._20If_20thats_20alrite_20then_20you_20should_20do_20that_20process_20in_20background._20&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fbackground-process-threading-and-forking-with-spawn-plugin-in-rails%2F&amp;t=Background%20Process%20%28threading%20and%20forking%29%20with%20spawn%20plugin%20in%20rails" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fbackground-process-threading-and-forking-with-spawn-plugin-in-rails_2F_amp_t=Background_20Process_20_28threading_20and_20forking_29_20with_20spawn_20plugin_20in_20rails&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fbackground-process-threading-and-forking-with-spawn-plugin-in-rails%2F&amp;title=Background%20Process%20%28threading%20and%20forking%29%20with%20spawn%20plugin%20in%20rails&amp;annotation=Do%20you%20have%20a%20process%20which%20takes%20a%20long%20amount%20of%20time%20before%20you%20display%20the%20result%20to%20the%20user%3F%20First%20of%20all%20make%20sure%20that%20your%20code%20is%20correct%20and%20you%20are%20following%20Rails%20standards.%20If%20thats%20alrite%20then%20you%20should%20do%20that%20process%20in%20background.%20" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fbackground-process-threading-and-forking-with-spawn-plugin-in-rails_2F_amp_title=Background_20Process_20_28threading_20and_20forking_29_20with_20spawn_20plugin_20in_20rails_amp_annotation=Do_20you_20have_20a_20process_20which_20takes_20a_20long_20amount_20of_20time_20before_20you_20display_20the_20result_20to_20the_20user_3F_20First_20of_20all_20make_20sure_20that_20your_20code_20is_20correct_20and_20you_20are_20following_20Rails_20standards._20If_20thats_20alrite_20then_20you_20should_20do_20that_20process_20in_20background._20&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fbackground-process-threading-and-forking-with-spawn-plugin-in-rails%2F" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fbackground-process-threading-and-forking-with-spawn-plugin-in-rails_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fbackground-process-threading-and-forking-with-spawn-plugin-in-rails%2F&amp;title=Background%20Process%20%28threading%20and%20forking%29%20with%20spawn%20plugin%20in%20rails" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fbackground-process-threading-and-forking-with-spawn-plugin-in-rails_2F_amp_title=Background_20Process_20_28threading_20and_20forking_29_20with_20spawn_20plugin_20in_20rails&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fbackground-process-threading-and-forking-with-spawn-plugin-in-rails%2F&amp;title=Background%20Process%20%28threading%20and%20forking%29%20with%20spawn%20plugin%20in%20rails" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fbackground-process-threading-and-forking-with-spawn-plugin-in-rails_2F_amp_title=Background_20Process_20_28threading_20and_20forking_29_20with_20spawn_20plugin_20in_20rails&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Background%20Process%20%28threading%20and%20forking%29%20with%20spawn%20plugin%20in%20rails%20-%20http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fbackground-process-threading-and-forking-with-spawn-plugin-in-rails%2F" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=Background_20Process_20_28threading_20and_20forking_29_20with_20spawn_20plugin_20in_20rails_20-_20http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fbackground-process-threading-and-forking-with-spawn-plugin-in-rails_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fbackground-process-threading-and-forking-with-spawn-plugin-in-rails%2F&amp;submitHeadline=Background%20Process%20%28threading%20and%20forking%29%20with%20spawn%20plugin%20in%20rails&amp;submitSummary=Do%20you%20have%20a%20process%20which%20takes%20a%20long%20amount%20of%20time%20before%20you%20display%20the%20result%20to%20the%20user%3F%20First%20of%20all%20make%20sure%20that%20your%20code%20is%20correct%20and%20you%20are%20following%20Rails%20standards.%20If%20thats%20alrite%20then%20you%20should%20do%20that%20process%20in%20background.%20&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz" onclick="pageTracker._trackPageview('/outgoing/buzz.yahoo.com/submit/?submitUrl=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fbackground-process-threading-and-forking-with-spawn-plugin-in-rails_2F_amp_submitHeadline=Background_20Process_20_28threading_20and_20forking_29_20with_20spawn_20plugin_20in_20rails_amp_submitSummary=Do_20you_20have_20a_20process_20which_20takes_20a_20long_20amount_20of_20time_20before_20you_20display_20the_20result_20to_20the_20user_3F_20First_20of_20all_20make_20sure_20that_20your_20code_20is_20correct_20and_20you_20are_20following_20Rails_20standards._20If_20thats_20alrite_20then_20you_20should_20do_20that_20process_20in_20background._20_amp_submitCategory=science_amp_submitAssetType=text&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.dhavalparikh.co.in/2009/06/background-process-threading-and-forking-with-spawn-plugin-in-rails/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Step by Step Twitter OAuth Integration with Rails</title>
		<link>http://blog.dhavalparikh.co.in/2009/06/step-by-step-twitter-oauth-integration-with-rails/</link>
		<comments>http://blog.dhavalparikh.co.in/2009/06/step-by-step-twitter-oauth-integration-with-rails/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 03:14:36 +0000</pubDate>
		<dc:creator>Dhaval Parikh</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[OAuth + twitter + rails]]></category>
		<category><![CDATA[OAuth integration with rails]]></category>
		<category><![CDATA[rails OAuth and Twitter]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://blog.dhavalparikh.co.in/?p=231</guid>
		<description><![CDATA[There are many articles posted under this topic but none of them have all information or a Step by Step guide of how to integrate OAuth for use with Twitter Apps and Rails. So thought of posting one here. Here are few steps which you should follow. The code below is same as provided by [...]]]></description>
			<content:encoded><![CDATA[<p class="claimcode">There are many articles posted under this topic but none of them have all information or a Step by Step guide of how to integrate OAuth for use with Twitter Apps and Rails.</p>
<p>So thought of posting one here. Here are few steps which you should follow. The code below is same as provided by the twitter wiki but i have made couple of changes and organized it to make it simple to understand</p>
<p>Step 1 : = You need to get your consumer key and consumer secret # from the twitter OAuth site under this link twitteroauth.</p>
<p>Step 2 := Install OAuth Gem with &#8220;gem install oauth&#8221; command on ur terminal</p>
<p>Step 3 := Generate a Scaffold using the following command and then migrate the table called &#8220;users&#8221; to ur database</p>
<p>ruby script/generate scaffold user screen_name:string token:string secret:string</p>
<p>rake db:migrate</p>
<p>Step 4 := Add the following code to your User Controller. Replace the key and secret code with yours <img src='http://blog.dhavalparikh.co.in/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>def self.consumer</p>
<p># The readkey and readsecret below are the values you get during registration</p>
<p>OAuth::Consumer.new(&#8220;OmwO7wsjtYHjquu6bd6C4w&#8221;, &#8220;j1kZ6yzsqChkeQtToErUx2LnPQMsSPkXMkiy4F82sPA&#8221;,{ :site=&gt;&#8221;http://twitter.com&#8221; })</p>
<p>end</p>
<p>def create</p>
<p>@request_token = UsersController.consumer.get_request_token</p>
<p>session[:request_token] = @request_token.token</p>
<p>session[:request_token_secret] = @request_token.secret</p>
<p># Send to twitter.com to authorize</p>
<p>redirect_to @request_token.authorize_url</p>
<p>return</p>
<p>end</p>
<p>Now this is an important part where you need to set the call back url Which u will define while you register your app at twitter OAuth site. Again add this to the UserController</p>
<p>def callback<br />
@request_token = OAuth::RequestToken.new(UsersController.consumer,<br />
session[:request_token],<br />
session[:request_token_secret])<br />
# Exchange the request token for an access token.<br />
@access_token = @request_token.get_access_token<br />
@response = UsersController.consumer.request(:get, &#8216;/account/verify_credentials.json&#8217;,<br />
@access_token, { :scheme =&gt; :query_string })<br />
case @response<br />
when Net::HTTPSuccess<br />
user_info = JSON.parse(@response.body)<br />
unless user_info['screen_name']<br />
flash[:notice] = &#8220;Authentication failed&#8221;<br />
redirect_to :action =&gt; :index<br />
return<br />
end</p>
<p># We have an authorized user, save the information to the database.<br />
@user = User.new({ :screen_name =&gt; user_info['screen_name'],:token =&gt; @access_token.token,:secret =&gt; @access_token.secret })<br />
@user.save!<br />
# Redirect to the show page<br />
redirect_to(@user)<br />
else<br />
RAILS_DEFAULT_LOGGER.error &#8220;Failed to get user info via OAuth&#8221;<br />
# The user might have rejected this application. Or there was some other error during the request.<br />
flash[:notice] = &#8220;Authentication failed&#8221;<br />
redirect_to :action =&gt; :index<br />
return<br />
end<br />
end<br />
end</p>
<p>As you can see from the comments this callback action exchanges the request token for an access token. Since the user is going to need to type in the username and password at Twitter I avoid prompting for it and instead we fetch that using a call to verify_credentials. This saves duplicate entry and makes it easier on the user. This also prevents users with multiple accounts from giving you one username and then using another when they login to twitter. The access token and secret are what is needed to act on behalf of a user, so those are saved to the database. The show action then uses this information to display some data like so:</p>
<p>def show<br />
@user = User.find(params[:id])<br />
# Get this users favorites via OAuth<br />
@access_token = OAuth::AccessToken.new(UsersController.consumer, @user.token, @user.secret)<br />
RAILS_DEFAULT_LOGGER.error &#8220;Making OAuth request for #{@user.inspect} with #{@access_token.inspect}&#8221;<br />
@response = UsersController.consumer.request(:get, &#8216;/favorites.json&#8217;, @access_token,<br />
{ :scheme =&gt; :query_string })<br />
case @response<br />
when Net::HTTPSuccess<br />
@favorites = JSON.parse(@response.body)<br />
respond_to do |format|<br />
format.html # show.html.erb<br />
end<br />
else<br />
RAILS_DEFAULT_LOGGER.error &#8220;Failed to get favorites via OAuth for #{@user}&#8221;<br />
# The user might have rejected this application. Or there was some other error during the request.<br />
flash[:notice] = &#8220;Authentication failed&#8221;<br />
redirect_to :action =&gt; :index<br />
return<br />
end</p>
<p>Finally the views</p>
<p>&lt;p&gt;<br />
&lt;b&gt;Screen name:&lt;/b&gt;<br />
&lt;%=h @user.screen_name %&gt;<br />
&lt;/p&gt;<br />
&lt;ul&gt;<br />
&lt;% @favorites.each do |fav| %&gt;<br />
&lt;li&gt;&lt;b&gt;&lt;%= fav['user']['screen_name']  %&gt;&lt;/b&gt;: &lt;%=h fav['text']  %&gt;&lt;/li&gt;<br />
&lt;% end %&gt;<br />
&lt;/ul&gt;</p>
<p>and</p>
<p>the new.html.erb</p>
<p>&lt;h1&gt;New user&lt;/h1&gt;</p>
<p>&lt;% form_for(@user) do |f| %&gt;<br />
&lt;%= f.error_messages %&gt;<br />
&lt;p&gt;<br />
We&#8217;ll be sending you to Twitter in a moment to login and grant us access.<br />
Once you allow us in we&#8217;ll give you the super-cool feature<br />
you&#8217;bve heard about.<br />
&lt;/p&gt;<br />
&lt;p&gt;<br />
&lt;%= f.submit &#8220;Grant Access&#8221; %&gt;<br />
&lt;/p&gt;<br />
&lt;% end %&gt;<br />
&lt;%= link_to &#8216;Back&#8217;, users_path %&gt;</p>
<p>Also Add validates_presence_of to the User model for screen_name, token and secret.</p>
<p>And in the routes.rb set the following route</p>
<p>map.connect &#8216;/callback&#8217;, :controller =&gt; &#8216;users&#8217;, :action =&gt; &#8216;callback&#8217;</p>
<p>Thats it you are ready for the twitter Login. Start the server and open localhost:3000/users<br />
and you will see the magic.</p>
<p>These are all the steps. Post me a comment if you still face any isssues.</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fstep-by-step-twitter-oauth-integration-with-rails%2F&amp;title=Step%20by%20Step%20Twitter%20OAuth%20Integration%20with%20Rails&amp;bodytext=There%20are%20many%20articles%20posted%20under%20this%20topic%20but%20none%20of%20them%20have%20all%20information%20or%20a%20Step%20by%20Step%20guide%20of%20how%20to%20integrate%20OAuth%20for%20use%20with%20Twitter%20Apps%20and%20Rails.%0D%0A%0D%0ASo%20thought%20of%20posting%20one%20here.%20Here%20are%20few%20steps%20which%20you%20should%20follow" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fstep-by-step-twitter-oauth-integration-with-rails_2F_amp_title=Step_20by_20Step_20Twitter_20OAuth_20Integration_20with_20Rails_amp_bodytext=There_20are_20many_20articles_20posted_20under_20this_20topic_20but_20none_20of_20them_20have_20all_20information_20or_20a_20Step_20by_20Step_20guide_20of_20how_20to_20integrate_20OAuth_20for_20use_20with_20Twitter_20Apps_20and_20Rails._0D_0A_0D_0ASo_20thought_20of_20posting_20one_20here._20Here_20are_20few_20steps_20which_20you_20should_20follow&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fstep-by-step-twitter-oauth-integration-with-rails%2F&amp;title=Step%20by%20Step%20Twitter%20OAuth%20Integration%20with%20Rails&amp;notes=There%20are%20many%20articles%20posted%20under%20this%20topic%20but%20none%20of%20them%20have%20all%20information%20or%20a%20Step%20by%20Step%20guide%20of%20how%20to%20integrate%20OAuth%20for%20use%20with%20Twitter%20Apps%20and%20Rails.%0D%0A%0D%0ASo%20thought%20of%20posting%20one%20here.%20Here%20are%20few%20steps%20which%20you%20should%20follow" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fstep-by-step-twitter-oauth-integration-with-rails_2F_amp_title=Step_20by_20Step_20Twitter_20OAuth_20Integration_20with_20Rails_amp_notes=There_20are_20many_20articles_20posted_20under_20this_20topic_20but_20none_20of_20them_20have_20all_20information_20or_20a_20Step_20by_20Step_20guide_20of_20how_20to_20integrate_20OAuth_20for_20use_20with_20Twitter_20Apps_20and_20Rails._0D_0A_0D_0ASo_20thought_20of_20posting_20one_20here._20Here_20are_20few_20steps_20which_20you_20should_20follow&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fstep-by-step-twitter-oauth-integration-with-rails%2F&amp;t=Step%20by%20Step%20Twitter%20OAuth%20Integration%20with%20Rails" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fstep-by-step-twitter-oauth-integration-with-rails_2F_amp_t=Step_20by_20Step_20Twitter_20OAuth_20Integration_20with_20Rails&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fstep-by-step-twitter-oauth-integration-with-rails%2F&amp;title=Step%20by%20Step%20Twitter%20OAuth%20Integration%20with%20Rails&amp;annotation=There%20are%20many%20articles%20posted%20under%20this%20topic%20but%20none%20of%20them%20have%20all%20information%20or%20a%20Step%20by%20Step%20guide%20of%20how%20to%20integrate%20OAuth%20for%20use%20with%20Twitter%20Apps%20and%20Rails.%0D%0A%0D%0ASo%20thought%20of%20posting%20one%20here.%20Here%20are%20few%20steps%20which%20you%20should%20follow" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fstep-by-step-twitter-oauth-integration-with-rails_2F_amp_title=Step_20by_20Step_20Twitter_20OAuth_20Integration_20with_20Rails_amp_annotation=There_20are_20many_20articles_20posted_20under_20this_20topic_20but_20none_20of_20them_20have_20all_20information_20or_20a_20Step_20by_20Step_20guide_20of_20how_20to_20integrate_20OAuth_20for_20use_20with_20Twitter_20Apps_20and_20Rails._0D_0A_0D_0ASo_20thought_20of_20posting_20one_20here._20Here_20are_20few_20steps_20which_20you_20should_20follow&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fstep-by-step-twitter-oauth-integration-with-rails%2F" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fstep-by-step-twitter-oauth-integration-with-rails_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fstep-by-step-twitter-oauth-integration-with-rails%2F&amp;title=Step%20by%20Step%20Twitter%20OAuth%20Integration%20with%20Rails" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fstep-by-step-twitter-oauth-integration-with-rails_2F_amp_title=Step_20by_20Step_20Twitter_20OAuth_20Integration_20with_20Rails&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fstep-by-step-twitter-oauth-integration-with-rails%2F&amp;title=Step%20by%20Step%20Twitter%20OAuth%20Integration%20with%20Rails" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fstep-by-step-twitter-oauth-integration-with-rails_2F_amp_title=Step_20by_20Step_20Twitter_20OAuth_20Integration_20with_20Rails&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Step%20by%20Step%20Twitter%20OAuth%20Integration%20with%20Rails%20-%20http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fstep-by-step-twitter-oauth-integration-with-rails%2F" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=Step_20by_20Step_20Twitter_20OAuth_20Integration_20with_20Rails_20-_20http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fstep-by-step-twitter-oauth-integration-with-rails_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fstep-by-step-twitter-oauth-integration-with-rails%2F&amp;submitHeadline=Step%20by%20Step%20Twitter%20OAuth%20Integration%20with%20Rails&amp;submitSummary=There%20are%20many%20articles%20posted%20under%20this%20topic%20but%20none%20of%20them%20have%20all%20information%20or%20a%20Step%20by%20Step%20guide%20of%20how%20to%20integrate%20OAuth%20for%20use%20with%20Twitter%20Apps%20and%20Rails.%0D%0A%0D%0ASo%20thought%20of%20posting%20one%20here.%20Here%20are%20few%20steps%20which%20you%20should%20follow&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz" onclick="pageTracker._trackPageview('/outgoing/buzz.yahoo.com/submit/?submitUrl=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fstep-by-step-twitter-oauth-integration-with-rails_2F_amp_submitHeadline=Step_20by_20Step_20Twitter_20OAuth_20Integration_20with_20Rails_amp_submitSummary=There_20are_20many_20articles_20posted_20under_20this_20topic_20but_20none_20of_20them_20have_20all_20information_20or_20a_20Step_20by_20Step_20guide_20of_20how_20to_20integrate_20OAuth_20for_20use_20with_20Twitter_20Apps_20and_20Rails._0D_0A_0D_0ASo_20thought_20of_20posting_20one_20here._20Here_20are_20few_20steps_20which_20you_20should_20follow_amp_submitCategory=science_amp_submitAssetType=text&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.dhavalparikh.co.in/2009/06/step-by-step-twitter-oauth-integration-with-rails/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Google Page Speed Tool as a Firebug Add-on Similiar to Yslow</title>
		<link>http://blog.dhavalparikh.co.in/2009/06/google-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow/</link>
		<comments>http://blog.dhavalparikh.co.in/2009/06/google-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow/#comments</comments>
		<pubDate>Fri, 05 Jun 2009 15:10:54 +0000</pubDate>
		<dc:creator>Dhaval Parikh</dc:creator>
				<category><![CDATA[Firebug addon]]></category>
		<category><![CDATA[google page speed]]></category>
		<category><![CDATA[Technology News]]></category>

		<guid isPermaLink="false">http://blog.dhavalparikh.co.in/?p=224</guid>
		<description><![CDATA[I just found a gr8 tool to measure page loading speed which is an important aspect for any website. initially google used to use this plugin for the internal measurement but now its open to all and i think every web developer should use it. I just installed it and found that its similiar to [...]]]></description>
			<content:encoded><![CDATA[<p>I just found a gr8 tool to measure page loading speed which is an important aspect for any website. initially google used to use this plugin for the internal measurement but now its open to all and i think every web developer should use it.</p>
<p>I just installed it and found that its similiar to Yslow. Here is the detail as per the google page speed site</p>
<table class="columns" border="0">
<tbody>
<tr>
<td></td>
<td>
<h2>What is Page Speed?</h2>
<p>Page Speed is an open-source Firefox/Firebug Add-on. Webmasters and web developers can use Page Speed to evaluate the performance of their web pages and to get suggestions on how to improve them.</td>
</tr>
<tr>
<td></td>
<td>
<h2>How does Page Speed work?</h2>
<p>Page Speed performs several tests on a site&#8217;s web server configuration and front-end code. These tests are based on a set of best practices known to enhance web page performance. Webmasters who run Page Speed on their pages get a set of scores for each page, as well as helpful suggestions on how to improve its performance.</td>
</tr>
<tr>
<td></td>
<td>
<h2>Why should you use Page Speed?</h2>
<p>By using Page Speed, you can:</p>
<ul>
<li>Make your site faster.</li>
<li>Keep Internet users engaged with your site.</li>
<li>Reduce your bandwidth and hosting costs.</li>
<li>Improve the web!</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Looks a gr8 and a promising tool. Inorder to try it visit http://code.google.com/speed/page-speed/download.html and njoy</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fgoogle-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow%2F&amp;title=Google%20Page%20Speed%20Tool%20as%20a%20Firebug%20Add-on%20Similiar%20to%20Yslow&amp;bodytext=I%20just%20found%20a%20gr8%20tool%20to%20measure%20page%20loading%20speed%20which%20is%20an%20important%20aspect%20for%20any%20website.%20initially%20google%20used%20to%20use%20this%20plugin%20for%20the%20internal%20measurement%20but%20now%20its%20open%20to%20all%20and%20i%20think%20every%20web%20developer%20should%20use%20it.%0D%0A%0D%0AI%20just" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fgoogle-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow_2F_amp_title=Google_20Page_20Speed_20Tool_20as_20a_20Firebug_20Add-on_20Similiar_20to_20Yslow_amp_bodytext=I_20just_20found_20a_20gr8_20tool_20to_20measure_20page_20loading_20speed_20which_20is_20an_20important_20aspect_20for_20any_20website._20initially_20google_20used_20to_20use_20this_20plugin_20for_20the_20internal_20measurement_20but_20now_20its_20open_20to_20all_20and_20i_20think_20every_20web_20developer_20should_20use_20it._0D_0A_0D_0AI_20just&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fgoogle-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow%2F&amp;title=Google%20Page%20Speed%20Tool%20as%20a%20Firebug%20Add-on%20Similiar%20to%20Yslow&amp;notes=I%20just%20found%20a%20gr8%20tool%20to%20measure%20page%20loading%20speed%20which%20is%20an%20important%20aspect%20for%20any%20website.%20initially%20google%20used%20to%20use%20this%20plugin%20for%20the%20internal%20measurement%20but%20now%20its%20open%20to%20all%20and%20i%20think%20every%20web%20developer%20should%20use%20it.%0D%0A%0D%0AI%20just" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fgoogle-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow_2F_amp_title=Google_20Page_20Speed_20Tool_20as_20a_20Firebug_20Add-on_20Similiar_20to_20Yslow_amp_notes=I_20just_20found_20a_20gr8_20tool_20to_20measure_20page_20loading_20speed_20which_20is_20an_20important_20aspect_20for_20any_20website._20initially_20google_20used_20to_20use_20this_20plugin_20for_20the_20internal_20measurement_20but_20now_20its_20open_20to_20all_20and_20i_20think_20every_20web_20developer_20should_20use_20it._0D_0A_0D_0AI_20just&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fgoogle-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow%2F&amp;t=Google%20Page%20Speed%20Tool%20as%20a%20Firebug%20Add-on%20Similiar%20to%20Yslow" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fgoogle-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow_2F_amp_t=Google_20Page_20Speed_20Tool_20as_20a_20Firebug_20Add-on_20Similiar_20to_20Yslow&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fgoogle-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow%2F&amp;title=Google%20Page%20Speed%20Tool%20as%20a%20Firebug%20Add-on%20Similiar%20to%20Yslow&amp;annotation=I%20just%20found%20a%20gr8%20tool%20to%20measure%20page%20loading%20speed%20which%20is%20an%20important%20aspect%20for%20any%20website.%20initially%20google%20used%20to%20use%20this%20plugin%20for%20the%20internal%20measurement%20but%20now%20its%20open%20to%20all%20and%20i%20think%20every%20web%20developer%20should%20use%20it.%0D%0A%0D%0AI%20just" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fgoogle-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow_2F_amp_title=Google_20Page_20Speed_20Tool_20as_20a_20Firebug_20Add-on_20Similiar_20to_20Yslow_amp_annotation=I_20just_20found_20a_20gr8_20tool_20to_20measure_20page_20loading_20speed_20which_20is_20an_20important_20aspect_20for_20any_20website._20initially_20google_20used_20to_20use_20this_20plugin_20for_20the_20internal_20measurement_20but_20now_20its_20open_20to_20all_20and_20i_20think_20every_20web_20developer_20should_20use_20it._0D_0A_0D_0AI_20just&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fgoogle-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow%2F" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fgoogle-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fgoogle-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow%2F&amp;title=Google%20Page%20Speed%20Tool%20as%20a%20Firebug%20Add-on%20Similiar%20to%20Yslow" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fgoogle-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow_2F_amp_title=Google_20Page_20Speed_20Tool_20as_20a_20Firebug_20Add-on_20Similiar_20to_20Yslow&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fgoogle-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow%2F&amp;title=Google%20Page%20Speed%20Tool%20as%20a%20Firebug%20Add-on%20Similiar%20to%20Yslow" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fgoogle-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow_2F_amp_title=Google_20Page_20Speed_20Tool_20as_20a_20Firebug_20Add-on_20Similiar_20to_20Yslow&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Google%20Page%20Speed%20Tool%20as%20a%20Firebug%20Add-on%20Similiar%20to%20Yslow%20-%20http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fgoogle-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow%2F" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=Google_20Page_20Speed_20Tool_20as_20a_20Firebug_20Add-on_20Similiar_20to_20Yslow_20-_20http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fgoogle-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F06%2Fgoogle-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow%2F&amp;submitHeadline=Google%20Page%20Speed%20Tool%20as%20a%20Firebug%20Add-on%20Similiar%20to%20Yslow&amp;submitSummary=I%20just%20found%20a%20gr8%20tool%20to%20measure%20page%20loading%20speed%20which%20is%20an%20important%20aspect%20for%20any%20website.%20initially%20google%20used%20to%20use%20this%20plugin%20for%20the%20internal%20measurement%20but%20now%20its%20open%20to%20all%20and%20i%20think%20every%20web%20developer%20should%20use%20it.%0D%0A%0D%0AI%20just&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz" onclick="pageTracker._trackPageview('/outgoing/buzz.yahoo.com/submit/?submitUrl=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F06_2Fgoogle-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow_2F_amp_submitHeadline=Google_20Page_20Speed_20Tool_20as_20a_20Firebug_20Add-on_20Similiar_20to_20Yslow_amp_submitSummary=I_20just_20found_20a_20gr8_20tool_20to_20measure_20page_20loading_20speed_20which_20is_20an_20important_20aspect_20for_20any_20website._20initially_20google_20used_20to_20use_20this_20plugin_20for_20the_20internal_20measurement_20but_20now_20its_20open_20to_20all_20and_20i_20think_20every_20web_20developer_20should_20use_20it._0D_0A_0D_0AI_20just_amp_submitCategory=science_amp_submitAssetType=text&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.dhavalparikh.co.in/2009/06/google-page-speed-tool-as-a-firebug-add-on-similiar-to-yslow/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nifty at 4300 how much more? Is it an end to the bear market?</title>
		<link>http://blog.dhavalparikh.co.in/2009/05/nifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market/</link>
		<comments>http://blog.dhavalparikh.co.in/2009/05/nifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market/#comments</comments>
		<pubDate>Wed, 20 May 2009 10:37:27 +0000</pubDate>
		<dc:creator>Dhaval Parikh</dc:creator>
				<category><![CDATA[bear market rally]]></category>
		<category><![CDATA[new bull run]]></category>
		<category><![CDATA[nifty views]]></category>
		<category><![CDATA[Stock Markets]]></category>

		<guid isPermaLink="false">http://blog.dhavalparikh.co.in/?p=206</guid>
		<description><![CDATA[Hey all After a long time I am posting something about stock markets. The reason is everyone was bearish and no one was ready to listen to ne thing negative so I stopped posting. And thats 100% true. Now I am seeing people coming back (especially my friends who were trading aggressively in the last [...]]]></description>
			<content:encoded><![CDATA[<p>Hey all</p>
<p>After a long time I am posting something about stock markets. The reason is everyone was bearish and no one was ready to listen to ne thing negative so I stopped posting. And thats 100% true. Now I am seeing people coming back (especially my friends who were trading aggressively in the last bull run) and asking me about their holdings and talking about stock markets especially after the 2 upper circuits on back of election results.</p>
<p>Just before few weeks most of the analyst described every rally as a bear market rally. No one was expecting the NIFTY to cross 3800 levels. Everyone seemed to be bearish on market. Everyone was backing their views by talking about bad economic conditions, negative global cues blah blah.. Now with the election results things seem to have changed totally. People are no longer talking about global cues, economic condition and it seems that bulls have returned into business. Now suddenly India seems to have decoupled from global markets. and with the same govt coming into power people have again started talking about 8% GDP and so on.</p>
<p>What has changed in these few days that people have forgotten every thing and are just buying blindly? Brokerages are talking about 20k levels on sensex http://in.news.yahoo.com/48/20090520/1237/tbs-market-watchers-predict-new-high-by.html. FII&#8217;s suddenly overweight on India and you will see every thing turned Bullish from Bearish. (Especially those who were bearish just 2 weeks back <img src='http://blog.dhavalparikh.co.in/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  This sounds really funny to me but most importantly its very confusing for those who are stuck with their holding which they bought when markets was @ 18k-20k and are thinking to hold or sell.</p>
<p>According to me the current movement in the market is because of over excitement and is overdone. People are putting in money blindly since there is a left out feeling. Every thing is moving up.. Personally I don&#8217;t feel that this rally should sustain. People already holding stocks should book out profits and stay with cash. &#8220;CASH IS KING&#8221; and no one will argue that. Profit booking to my mind is never a bad thing to do. If your investments have doubled book out capital and hold on to the profits. I just noticed that even companies which have posted net loss are moving up 10% &#8211; 20% every day. Reminds me of the last leg of the bull rally when each and every single stock was moving.</p>
<p>Ne ways having said that I think one must book profits and we could see nifty coming back to 3800 levels or even less going forward. And as and when economic conditions improve one should again start investing or buy stocks which are available at dirt cheap price going forward.</p>
<p>Though I cannot term this move as a bear market rally or a bull market but I am sure about one thing that the valuations doesn&#8217;t seem to be cheap any more and economic environment has not changed. So profit booking will be the ideal strategy.</p>
<p>Hope you have liked this post. If you have any questions pls post a comment and I shall reply.</p>
<p>Thanks</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F05%2Fnifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market%2F&amp;title=Nifty%20at%204300%20how%20much%20more%3F%20Is%20it%20an%20end%20to%20the%20bear%20market%3F&amp;bodytext=Hey%20all%0D%0A%0D%0AAfter%20a%20long%20time%20I%20am%20posting%20something%20about%20stock%20markets.%20The%20reason%20is%20everyone%20was%20bearish%20and%20no%20one%20was%20ready%20to%20listen%20to%20ne%20thing%20negative%20so%20I%20stopped%20posting.%20And%20thats%20100%25%20true.%20Now%20I%20am%20seeing%20people%20coming%20back%20%28especially%20" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F05_2Fnifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market_2F_amp_title=Nifty_20at_204300_20how_20much_20more_3F_20Is_20it_20an_20end_20to_20the_20bear_20market_3F_amp_bodytext=Hey_20all_0D_0A_0D_0AAfter_20a_20long_20time_20I_20am_20posting_20something_20about_20stock_20markets._20The_20reason_20is_20everyone_20was_20bearish_20and_20no_20one_20was_20ready_20to_20listen_20to_20ne_20thing_20negative_20so_20I_20stopped_20posting._20And_20thats_20100_25_20true._20Now_20I_20am_20seeing_20people_20coming_20back_20_28especially_20&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F05%2Fnifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market%2F&amp;title=Nifty%20at%204300%20how%20much%20more%3F%20Is%20it%20an%20end%20to%20the%20bear%20market%3F&amp;notes=Hey%20all%0D%0A%0D%0AAfter%20a%20long%20time%20I%20am%20posting%20something%20about%20stock%20markets.%20The%20reason%20is%20everyone%20was%20bearish%20and%20no%20one%20was%20ready%20to%20listen%20to%20ne%20thing%20negative%20so%20I%20stopped%20posting.%20And%20thats%20100%25%20true.%20Now%20I%20am%20seeing%20people%20coming%20back%20%28especially%20" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F05_2Fnifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market_2F_amp_title=Nifty_20at_204300_20how_20much_20more_3F_20Is_20it_20an_20end_20to_20the_20bear_20market_3F_amp_notes=Hey_20all_0D_0A_0D_0AAfter_20a_20long_20time_20I_20am_20posting_20something_20about_20stock_20markets._20The_20reason_20is_20everyone_20was_20bearish_20and_20no_20one_20was_20ready_20to_20listen_20to_20ne_20thing_20negative_20so_20I_20stopped_20posting._20And_20thats_20100_25_20true._20Now_20I_20am_20seeing_20people_20coming_20back_20_28especially_20&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F05%2Fnifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market%2F&amp;t=Nifty%20at%204300%20how%20much%20more%3F%20Is%20it%20an%20end%20to%20the%20bear%20market%3F" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F05_2Fnifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market_2F_amp_t=Nifty_20at_204300_20how_20much_20more_3F_20Is_20it_20an_20end_20to_20the_20bear_20market_3F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F05%2Fnifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market%2F&amp;title=Nifty%20at%204300%20how%20much%20more%3F%20Is%20it%20an%20end%20to%20the%20bear%20market%3F&amp;annotation=Hey%20all%0D%0A%0D%0AAfter%20a%20long%20time%20I%20am%20posting%20something%20about%20stock%20markets.%20The%20reason%20is%20everyone%20was%20bearish%20and%20no%20one%20was%20ready%20to%20listen%20to%20ne%20thing%20negative%20so%20I%20stopped%20posting.%20And%20thats%20100%25%20true.%20Now%20I%20am%20seeing%20people%20coming%20back%20%28especially%20" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F05_2Fnifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market_2F_amp_title=Nifty_20at_204300_20how_20much_20more_3F_20Is_20it_20an_20end_20to_20the_20bear_20market_3F_amp_annotation=Hey_20all_0D_0A_0D_0AAfter_20a_20long_20time_20I_20am_20posting_20something_20about_20stock_20markets._20The_20reason_20is_20everyone_20was_20bearish_20and_20no_20one_20was_20ready_20to_20listen_20to_20ne_20thing_20negative_20so_20I_20stopped_20posting._20And_20thats_20100_25_20true._20Now_20I_20am_20seeing_20people_20coming_20back_20_28especially_20&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F05%2Fnifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market%2F" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F05_2Fnifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F05%2Fnifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market%2F&amp;title=Nifty%20at%204300%20how%20much%20more%3F%20Is%20it%20an%20end%20to%20the%20bear%20market%3F" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F05_2Fnifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market_2F_amp_title=Nifty_20at_204300_20how_20much_20more_3F_20Is_20it_20an_20end_20to_20the_20bear_20market_3F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F05%2Fnifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market%2F&amp;title=Nifty%20at%204300%20how%20much%20more%3F%20Is%20it%20an%20end%20to%20the%20bear%20market%3F" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F05_2Fnifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market_2F_amp_title=Nifty_20at_204300_20how_20much_20more_3F_20Is_20it_20an_20end_20to_20the_20bear_20market_3F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=Nifty%20at%204300%20how%20much%20more%3F%20Is%20it%20an%20end%20to%20the%20bear%20market%3F%20-%20http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F05%2Fnifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market%2F" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=Nifty_20at_204300_20how_20much_20more_3F_20Is_20it_20an_20end_20to_20the_20bear_20market_3F_20-_20http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F05_2Fnifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F05%2Fnifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market%2F&amp;submitHeadline=Nifty%20at%204300%20how%20much%20more%3F%20Is%20it%20an%20end%20to%20the%20bear%20market%3F&amp;submitSummary=Hey%20all%0D%0A%0D%0AAfter%20a%20long%20time%20I%20am%20posting%20something%20about%20stock%20markets.%20The%20reason%20is%20everyone%20was%20bearish%20and%20no%20one%20was%20ready%20to%20listen%20to%20ne%20thing%20negative%20so%20I%20stopped%20posting.%20And%20thats%20100%25%20true.%20Now%20I%20am%20seeing%20people%20coming%20back%20%28especially%20&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz" onclick="pageTracker._trackPageview('/outgoing/buzz.yahoo.com/submit/?submitUrl=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F05_2Fnifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market_2F_amp_submitHeadline=Nifty_20at_204300_20how_20much_20more_3F_20Is_20it_20an_20end_20to_20the_20bear_20market_3F_amp_submitSummary=Hey_20all_0D_0A_0D_0AAfter_20a_20long_20time_20I_20am_20posting_20something_20about_20stock_20markets._20The_20reason_20is_20everyone_20was_20bearish_20and_20no_20one_20was_20ready_20to_20listen_20to_20ne_20thing_20negative_20so_20I_20stopped_20posting._20And_20thats_20100_25_20true._20Now_20I_20am_20seeing_20people_20coming_20back_20_28especially_20_amp_submitCategory=science_amp_submitAssetType=text&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.dhavalparikh.co.in/2009/05/nifty-at-4300-how-much-more-is-it-an-end-to-the-bear-market/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>localization or internationalization in rails</title>
		<link>http://blog.dhavalparikh.co.in/2009/05/localization-or-internationalization-in-rails/</link>
		<comments>http://blog.dhavalparikh.co.in/2009/05/localization-or-internationalization-in-rails/#comments</comments>
		<pubDate>Wed, 20 May 2009 09:46:22 +0000</pubDate>
		<dc:creator>Dhaval Parikh</dc:creator>
				<category><![CDATA[globalite plugin]]></category>
		<category><![CDATA[globalite plugin error]]></category>
		<category><![CDATA[internationalization in rails]]></category>
		<category><![CDATA[localization in rails]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[time_select tag error]]></category>

		<guid isPermaLink="false">http://blog.dhavalparikh.co.in/?p=203</guid>
		<description><![CDATA[Most of the new websites are having the feature of localization or internationalization on their site. With introduction of rails 2.3 this feature is provided by default But if you are still working in rails 2.0 or 2.1 then GlobalLite is the solution for you.. http://code.google.com/p/globalite/ How ever while implement it in one of my [...]]]></description>
			<content:encoded><![CDATA[<p>Most of the new websites are having the feature of localization or internationalization on their site. With introduction of rails 2.3 this feature is provided by default But if you are still working in rails 2.0 or 2.1 then GlobalLite is the solution for you.. http://code.google.com/p/globalite/</p>
<p>How ever while implement it in one of my projects I noticed that the localized date time module used in the plugin has a problem when you have time_select tag in your form.</p>
<p>So when you use a time_select tag in your form it will generate an error message “Can’t convert nil into string”. The problem is in the file called localized_action_view.rb which you will find  in plugins/globalite/lib/rails folder.</p>
<p>Apply the code below to get it fixed</p>
<p>def select_month(date, options = {}, html_options = {})<br />
if options[:locale]<br />
@original_locale = Locale.code<br />
Locale.code = options[:locale]<br />
end<br />
val = date ? (date.kind_of?(Fixnum) ? date : date.month) : ”<br />
if options[:use_hidden]<br />
hidden_html(options[:field_name] || ‘month’, val, options)<br />
else<br />
month_options = []<br />
monthnames = :date_helper_month_names.l<br />
abbr_monthnames = :date_helper_abbr_month_names.l<br />
month_names = options[:use_month_names] || (options[:use_short_month] ? abbr_monthnames : monthnames)<br />
month_names.unshift(nil) if month_names.size &lt; 13<br />
1.upto(12) do |month_number|<br />
month_name = if options[:use_month_numbers]<br />
month_number<br />
elsif options[:add_month_numbers]<br />
month_number.to_s + ‘ &#8211; ‘ + month_names[month_number]<br />
else<br />
month_names[month_number]<br />
end</p>
<p>month_options &lt;&lt; ((val == month_number) ?<br />
%(&lt;option value=”#{month_number}” selected=”selected”&gt;#{month_name}&lt;/option&gt;\n) :<br />
%(&lt;option value=”#{month_number}”&gt;#{month_name}&lt;/option&gt;\n)<br />
)<br />
end<br />
@selector = select_html(options[:field_name] || ‘month’, month_options, options)<br />
Locale.code = @original_locale if options[:locale]<br />
return @selector<br />
end<br />
#  Locale.code = @original_locale if options[:locale]<br />
#  return @selector<br />
end</p>
<p>You may even Comment the date module in the code  plugins/globalite/lib/rails/localized_action_view.rb</p>
<p>this will make use of default rails date time. so nothing will get affected if you do this. But the solution mentioned about is a better one.</p>
<p>Njoi the power of Internationalization and make sure site global.</p>



Share and Enjoy:


	<a rel="nofollow"  target="_blank" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F05%2Flocalization-or-internationalization-in-rails%2F&amp;title=localization%20or%20internationalization%20in%20rails&amp;bodytext=Most%20of%20the%20new%20websites%20are%20having%20the%20feature%20of%20localization%20or%20internationalization%20on%20their%20site.%20With%20introduction%20of%20rails%202.3%20this%20feature%20is%20provided%20by%20default%20But%20if%20you%20are%20still%20working%20in%20rails%202.0%20or%202.1%20then%20GlobalLite%20is%20the%20solution" title="Digg" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F05_2Flocalization-or-internationalization-in-rails_2F_amp_title=localization_20or_20internationalization_20in_20rails_amp_bodytext=Most_20of_20the_20new_20websites_20are_20having_20the_20feature_20of_20localization_20or_20internationalization_20on_20their_20site._20With_20introduction_20of_20rails_202.3_20this_20feature_20is_20provided_20by_20default_20But_20if_20you_20are_20still_20working_20in_20rails_202.0_20or_202.1_20then_20GlobalLite_20is_20the_20solution&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/digg.png" title="Digg" alt="Digg" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://delicious.com/post?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F05%2Flocalization-or-internationalization-in-rails%2F&amp;title=localization%20or%20internationalization%20in%20rails&amp;notes=Most%20of%20the%20new%20websites%20are%20having%20the%20feature%20of%20localization%20or%20internationalization%20on%20their%20site.%20With%20introduction%20of%20rails%202.3%20this%20feature%20is%20provided%20by%20default%20But%20if%20you%20are%20still%20working%20in%20rails%202.0%20or%202.1%20then%20GlobalLite%20is%20the%20solution" title="del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F05_2Flocalization-or-internationalization-in-rails_2F_amp_title=localization_20or_20internationalization_20in_20rails_amp_notes=Most_20of_20the_20new_20websites_20are_20having_20the_20feature_20of_20localization_20or_20internationalization_20on_20their_20site._20With_20introduction_20of_20rails_202.3_20this_20feature_20is_20provided_20by_20default_20But_20if_20you_20are_20still_20working_20in_20rails_202.0_20or_202.1_20then_20GlobalLite_20is_20the_20solution&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/delicious.png" title="del.icio.us" alt="del.icio.us" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.facebook.com/share.php?u=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F05%2Flocalization-or-internationalization-in-rails%2F&amp;t=localization%20or%20internationalization%20in%20rails" title="Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?u=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F05_2Flocalization-or-internationalization-in-rails_2F_amp_t=localization_20or_20internationalization_20in_20rails&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/facebook.png" title="Facebook" alt="Facebook" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F05%2Flocalization-or-internationalization-in-rails%2F&amp;title=localization%20or%20internationalization%20in%20rails&amp;annotation=Most%20of%20the%20new%20websites%20are%20having%20the%20feature%20of%20localization%20or%20internationalization%20on%20their%20site.%20With%20introduction%20of%20rails%202.3%20this%20feature%20is%20provided%20by%20default%20But%20if%20you%20are%20still%20working%20in%20rails%202.0%20or%202.1%20then%20GlobalLite%20is%20the%20solution" title="Google Bookmarks" onclick="pageTracker._trackPageview('/outgoing/www.google.com/bookmarks/mark?op=edit_amp_bkmk=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F05_2Flocalization-or-internationalization-in-rails_2F_amp_title=localization_20or_20internationalization_20in_20rails_amp_annotation=Most_20of_20the_20new_20websites_20are_20having_20the_20feature_20of_20localization_20or_20internationalization_20on_20their_20site._20With_20introduction_20of_20rails_202.3_20this_20feature_20is_20provided_20by_20default_20But_20if_20you_20are_20still_20working_20in_20rails_202.0_20or_202.1_20then_20GlobalLite_20is_20the_20solution&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/googlebookmark.png" title="Google Bookmarks" alt="Google Bookmarks" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://technorati.com/faves?add=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F05%2Flocalization-or-internationalization-in-rails%2F" title="Technorati" onclick="pageTracker._trackPageview('/outgoing/technorati.com/faves?add=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F05_2Flocalization-or-internationalization-in-rails_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/technorati.png" title="Technorati" alt="Technorati" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F05%2Flocalization-or-internationalization-in-rails%2F&amp;title=localization%20or%20internationalization%20in%20rails" title="StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F05_2Flocalization-or-internationalization-in-rails_2F_amp_title=localization_20or_20internationalization_20in_20rails&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/stumbleupon.png" title="StumbleUpon" alt="StumbleUpon" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://reddit.com/submit?url=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F05%2Flocalization-or-internationalization-in-rails%2F&amp;title=localization%20or%20internationalization%20in%20rails" title="Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F05_2Flocalization-or-internationalization-in-rails_2F_amp_title=localization_20or_20internationalization_20in_20rails&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/reddit.png" title="Reddit" alt="Reddit" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://twitter.com/home?status=localization%20or%20internationalization%20in%20rails%20-%20http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F05%2Flocalization-or-internationalization-in-rails%2F" title="Twitter" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=localization_20or_20internationalization_20in_20rails_20-_20http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F05_2Flocalization-or-internationalization-in-rails_2F&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/twitter.png" title="Twitter" alt="Twitter" class="sociable-hovers" /></a>
	<a rel="nofollow"  target="_blank" href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fblog.dhavalparikh.co.in%2F2009%2F05%2Flocalization-or-internationalization-in-rails%2F&amp;submitHeadline=localization%20or%20internationalization%20in%20rails&amp;submitSummary=Most%20of%20the%20new%20websites%20are%20having%20the%20feature%20of%20localization%20or%20internationalization%20on%20their%20site.%20With%20introduction%20of%20rails%202.3%20this%20feature%20is%20provided%20by%20default%20But%20if%20you%20are%20still%20working%20in%20rails%202.0%20or%202.1%20then%20GlobalLite%20is%20the%20solution&amp;submitCategory=science&amp;submitAssetType=text" title="Yahoo! Buzz" onclick="pageTracker._trackPageview('/outgoing/buzz.yahoo.com/submit/?submitUrl=http_3A_2F_2Fblog.dhavalparikh.co.in_2F2009_2F05_2Flocalization-or-internationalization-in-rails_2F_amp_submitHeadline=localization_20or_20internationalization_20in_20rails_amp_submitSummary=Most_20of_20the_20new_20websites_20are_20having_20the_20feature_20of_20localization_20or_20internationalization_20on_20their_20site._20With_20introduction_20of_20rails_202.3_20this_20feature_20is_20provided_20by_20default_20But_20if_20you_20are_20still_20working_20in_20rails_202.0_20or_202.1_20then_20GlobalLite_20is_20the_20solution_amp_submitCategory=science_amp_submitAssetType=text&amp;referer=');"><img src="http://blog.dhavalparikh.co.in/wp-content/plugins/sociable/images/yahoobuzz.png" title="Yahoo! Buzz" alt="Yahoo! Buzz" class="sociable-hovers" /></a>


<br/><br/>]]></content:encoded>
			<wfw:commentRss>http://blog.dhavalparikh.co.in/2009/05/localization-or-internationalization-in-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
