<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>hasan&#039;s blog (বল্গ) &#187; ruby on rails</title>
	<atom:link href="http://we4tech.wordpress.com/category/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://we4tech.wordpress.com</link>
	<description>work for fun!!!</description>
	<lastBuildDate>Wed, 25 Jan 2012 11:56:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='we4tech.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/77f5f3e5f84d83c83da12540728f5cb3?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>hasan&#039;s blog (বল্গ) &#187; ruby on rails</title>
		<link>http://we4tech.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://we4tech.wordpress.com/osd.xml" title="hasan&#039;s blog (বল্গ)" />
	<atom:link rel='hub' href='http://we4tech.wordpress.com/?pushpress=hub'/>
		<item>
		<title>WellTreat.Us a Ruby on Rails based SaaS platform to build your restaurant and business web site on it :)</title>
		<link>http://we4tech.wordpress.com/2010/09/28/welltreat-us-a-ruby-on-rails-based-saas-platform-to-build-your-restaurant-and-business-web-site-on-it/</link>
		<comments>http://we4tech.wordpress.com/2010/09/28/welltreat-us-a-ruby-on-rails-based-saas-platform-to-build-your-restaurant-and-business-web-site-on-it/#comments</comments>
		<pubDate>Tue, 28 Sep 2010 05:37:26 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[SaaS]]></category>
		<category><![CDATA[WellTreat.US]]></category>

		<guid isPermaLink="false">http://we4tech.wordpress.com/?p=579</guid>
		<description><![CDATA[So i guess my blog title reflects what i&#8217;m trying to make point here, YES! This is all about running well treat us as a SaaS platform. Let me draw a line between those who already got it or those who yet struggling well, frankly speaking my weekend goes with my newly started start up &#8230; <a href="http://we4tech.wordpress.com/2010/09/28/welltreat-us-a-ruby-on-rails-based-saas-platform-to-build-your-restaurant-and-business-web-site-on-it/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=579&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So i guess my blog title reflects what i&#8217;m trying to make point here, YES! This is all about running well treat us as a SaaS platform.</p>
<p>Let me draw a line between those who already got it or those who yet struggling <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
well, frankly speaking my weekend goes with my newly started start up “<a href="http://welltreat.us">http://welltreat.us</a>”</p>
<p>i guess many of those who already have been there might think “Well Treat Us” as a simple platform for reviewing restaurant. This is very true! Indeed, this is a review platform!!</p>
<p>But the fact is far behind the simple review platform <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  “Well Treat Us” is a platform for reviewing ANYTHING that matters in our daily LIFE <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Wait a minute! Did you get it ? “Well Treat Us” domain was intentionally picked up so it could be related with “store.WellTreat.Us”, “electricians.WellTreat.Us”, “CarService.WellTreat.Us”, “BookAuthor.WellTreat.Us”, “Movie.WellTreat.Us”, “Newspaper.WellTreat.Us”, “Doctor.WellTreat.Us”, “Government.WellTreat.Us” and it goes on&#8230;</p>
<p>so if you are still not getting the idea! I should blame myself for not succeeding to reaching those above words through your tough skull <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>anyway! In a brief, “Well Treat Us is a platform to read review about our daily mostly used services and products. It helps people and business to grow mutually with feedbacks from each other.”</p>
<p>Ah! let&#8217;s back into the topic <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>So by now you should have understood, “Well Treat Us” is a platform where it can be used for reviewing on anythings, though currently you can only see “http://restaurant.welltreat.us” but at certain point you would be able to see everything that matters your daily living. (we promise)</p>
<p>Keeping this in mind, we have been developing WellTreatUs platform following agile and lean mindset. Since our inception we have been adding each and every features based on our visitors opinion. Perhaps you spoke that over review or over facebook fan page or in a friendly discussion, we are listening and keeping  your wishes in our product feature list (product backlog). So we can give more efforts to bring those for you <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . we suggest you better don&#8217;t feel shy to share what cross your mind.</p>
<p>So let&#8217;s back to the main topic <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>“Well Treat Us” as a SaaS (Software As a Service) how that stands up ?</h2>
<p>Well, as i&#8217;ve already mentioned well treat us is built on the concept of “topic”.<br />
In every data structure there is dependent parent object which we call “topic” so whatever goes through the “Well Treat Us” every contents are put under specific “topic”. This topic based architecture helped us to isolate and identify separate type of contents. (ie. Doctors, books, restaurants, donors, stores etc..)</p>
<h2>Just imagine your web site is built on “Well Treat Us” CMS</h2>
<p>So as “Well Treat Us” is a platform for hosting several topics dependent review platform, we kept another side around which enables us to provide a complete make over using your own preference to build your own business web site or e-commerce store.</p>
<p>Let me make it more understandable. As you can see today you can browse any restaurant page which looks like the following picture  -<br />
<a href="http://restaurant.welltreat.us/t/restaurants/captains-world/4?l=en">http://restaurant.welltreat.us/t/restaurants/captains-world/4?l=en</a></p>
<p style="text-align:center;"><a href="http://we4tech.files.wordpress.com/2010/09/screen-shot-2010-09-27-at-6-06-31-pm1.png?w=300"><img class="aligncenter size-medium wp-image-582" title="Screen shot 2010-09-27 at 6.06.31 PM" src="http://we4tech.files.wordpress.com/2010/09/screen-shot-2010-09-27-at-6-06-31-pm1.png?w=300&#038;h=160" alt="" width="300" height="160" /></a></p>
<p>As you can see every restaurant page comes with a simple predefined attributes, such as title, description, tags, location, images and so on. Which can be varied from topic to topic, for example – doctors review site might need different attributes than what we have with restaurant. Fortunately everything could be configured over topic administration system as we have in well treat us admin panel.</p>
<p><a href="http://we4tech.files.wordpress.com/2010/09/screen-shot-e0a7a8e0a7a6e0a7a7e0a7a6-e0a7a6e0a7af-e0a7a8e0a7ae-at-e0a7a7-e0a7a8e0a7af-e0a7a6e0a7a7-e0a6aae0a782e0a6b0e0a78de0a6ace0a6be.png"><img class="aligncenter size-medium wp-image-593" title="Screen shot ২০১০-০৯-২৮ at ১.২৯.০১ পূর্বাহ্ণ" src="http://we4tech.files.wordpress.com/2010/09/screen-shot-e0a7a8e0a7a6e0a7a7e0a7a6-e0a7a6e0a7af-e0a7a8e0a7ae-at-e0a7a7-e0a7a8e0a7af-e0a7a6e0a7a7-e0a6aae0a782e0a6b0e0a78de0a6ace0a6be.png?w=300&#038;h=117" alt="" width="300" height="117" /></a></p>
<h2>A different make over as your wish!</h2>
<p>“Well Treat Us” is not only about having multiple topics based review platform it is also about creating web site for your own business need. Where “Well Treat Us” as SaaS comes into play.<br />
The following image is an illustration how it could help you to build your web site as your own wishes and preferences. Check it out -</p>
<p><a href="http://we4tech.files.wordpress.com/2010/09/screen-shot-2010-09-27-at-6-10-10-pm.png"><img class="aligncenter size-medium wp-image-583" title="Screen shot 2010-09-27 at 6.10.10 PM" src="http://we4tech.files.wordpress.com/2010/09/screen-shot-2010-09-27-at-6-10-10-pm.png?w=300&#038;h=224" alt="" width="300" height="224" /></a></p>
<p>Also don&#8217;t forget about having your own web site address (ie. <a href="http://laalshop.com">Http://laalshop.com</a>) and so much customization that you can do with any CMS these days. (like joomla, sitefinity etc..)</p>
<p>“Well Treat Us” Web Site Content Management System &#8211; “We kept Everything Visual!”<br />
Till now we haven&#8217;t unveiled the GREAT secret about “Well Treat Us”, you might be wondering what that could be ? Well you know! You know! <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  the secret is all about secret we shouldn&#8217;t unveil it <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  well here is the secret -</p>
<p>“We have build “Well Treat Us” for our own usages” it means, we haven&#8217;t built it for having another fancy service around, we built it because we meant it we wanted it. We kept it mind that we are gonna use it for our own purposes. Our business ideas and web sites will be built on it.</p>
<p>So you can understand, how much efforts we give only to keep it more useable for our own demand. We have been doing it with passion for us and for our clients.</p>
<p>Let us show you some examples, how does it looks, when you have a web site on well treat us SaaS platform</p>
<div id="attachment_583" class="wp-caption aligncenter" style="width: 310px"><a href="http://we4tech.files.wordpress.com/2010/09/screen-shot-2010-09-27-at-6-10-10-pm.png"><img class="size-medium wp-image-583" title="Screen shot 2010-09-27 at 6.10.10 PM" src="http://we4tech.files.wordpress.com/2010/09/screen-shot-2010-09-27-at-6-10-10-pm.png?w=300&#038;h=224" alt="" width="300" height="224" /></a><p class="wp-caption-text">A web site built on “Well Treat Us SaaS paltform”</p></div>
<div id="attachment_585" class="wp-caption aligncenter" style="width: 310px"><a href="http://we4tech.files.wordpress.com/2010/09/screen-shot-2010-09-27-at-6-22-34-pm.png"><img class="size-medium wp-image-585" title="Screen shot 2010-09-27 at 6.22.34 PM" src="http://we4tech.files.wordpress.com/2010/09/screen-shot-2010-09-27-at-6-22-34-pm.png?w=300&#038;h=284" alt="" width="300" height="284" /></a><p class="wp-caption-text">This is an example, how your web site&#039;s featured images are administrated over the admin panel.</p></div>
<div id="attachment_586" class="wp-caption aligncenter" style="width: 310px"><a href="http://we4tech.files.wordpress.com/2010/09/screen-shot-e0a7a8e0a7a6e0a7a7e0a7a6-e0a7a6e0a7af-e0a7a8e0a7ae-at-e0a7a7-e0a7a7e0a7aa-e0a7aae0a7a8-e0a6aae0a782e0a6b0e0a78de0a6ace0a6be.png"><img class="size-medium wp-image-586" title="Screen shot ২০১০-০৯-২৮ at ১.১৪.৪২ পূর্বাহ্ণ" src="http://we4tech.files.wordpress.com/2010/09/screen-shot-e0a7a8e0a7a6e0a7a7e0a7a6-e0a7a6e0a7af-e0a7a8e0a7ae-at-e0a7a7-e0a7a7e0a7aa-e0a7aae0a7a8-e0a6aae0a782e0a6b0e0a78de0a6ace0a6be.png?w=300&#038;h=242" alt="" width="300" height="242" /></a><p class="wp-caption-text">This is another example which demonstrates how easy it is to let you manage your web site menu on the fly.</p></div>
<div id="attachment_587" class="wp-caption aligncenter" style="width: 310px"><a href="http://we4tech.files.wordpress.com/2010/09/screen-shot-e0a7a8e0a7a6e0a7a7e0a7a6-e0a7a6e0a7af-e0a7a8e0a7ae-at-e0a7a7-e0a7a7e0a7ae-e0a7a6e0a7ac-e0a6aae0a782e0a6b0e0a78de0a6ace0a6be.png"><img class="size-medium wp-image-587" title="Screen shot ২০১০-০৯-২৮ at ১.১৮.০৬ পূর্বাহ্ণ" src="http://we4tech.files.wordpress.com/2010/09/screen-shot-e0a7a8e0a7a6e0a7a7e0a7a6-e0a7a6e0a7af-e0a7a8e0a7ae-at-e0a7a7-e0a7a7e0a7ae-e0a7a6e0a7ac-e0a6aae0a782e0a6b0e0a78de0a6ace0a6be.png?w=300&#038;h=232" alt="" width="300" height="232" /></a><p class="wp-caption-text">Ah! what a easy way to create a new content with SEO friendly url <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p></div>
<div id="attachment_588" class="wp-caption aligncenter" style="width: 270px"><a href="http://we4tech.files.wordpress.com/2010/09/screen-shot-e0a7a8e0a7a6e0a7a7e0a7a6-e0a7a6e0a7af-e0a7a8e0a7ae-at-e0a7a7-e0a7a7e0a7af-e0a7a7e0a7ad-e0a6aae0a782e0a6b0e0a78de0a6ace0a6be.png"><img class="size-medium wp-image-588" title="Screen shot ২০১০-০৯-২৮ at ১.১৯.১৭ পূর্বাহ্ণ" src="http://we4tech.files.wordpress.com/2010/09/screen-shot-e0a7a8e0a7a6e0a7a7e0a7a6-e0a7a6e0a7af-e0a7a8e0a7ae-at-e0a7a7-e0a7a7e0a7af-e0a7a7e0a7ad-e0a6aae0a782e0a6b0e0a78de0a6ace0a6be.png?w=260&#038;h=300" alt="" width="260" height="300" /></a><p class="wp-caption-text">It&#039;s your web site, you got freedom and control, so you better add as much video clip as you want <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  -</p></div>
<div id="attachment_589" class="wp-caption aligncenter" style="width: 232px"><a href="http://we4tech.files.wordpress.com/2010/09/screen-shot-e0a7a8e0a7a6e0a7a7e0a7a6-e0a7a6e0a7af-e0a7a8e0a7ae-at-e0a7a7-e0a7a8e0a7a7-e0a7a8e0a7ad-e0a6aae0a782e0a6b0e0a78de0a6ace0a6be.png"><img class="size-medium wp-image-589" title="Screen shot ২০১০-০৯-২৮ at ১.২১.২৭ পূর্বাহ্ণ" src="http://we4tech.files.wordpress.com/2010/09/screen-shot-e0a7a8e0a7a6e0a7a7e0a7a6-e0a7a6e0a7af-e0a7a8e0a7ae-at-e0a7a7-e0a7a8e0a7a7-e0a7a8e0a7ad-e0a6aae0a782e0a6b0e0a78de0a6ace0a6be.png?w=222&#038;h=300" alt="" width="222" height="300" /></a><p class="wp-caption-text">Also control total number of items to be displayed -</p></div>
<div id="attachment_595" class="wp-caption aligncenter" style="width: 310px"><a href="http://we4tech.files.wordpress.com/2010/09/screen-shot-e0a7a8e0a7a6e0a7a7e0a7a6-e0a7a6e0a7af-e0a7a8e0a7ae-at-e0a7a7e0a7a7-e0a7a9e0a7a9-e0a7a6e0a7ac-e0a6aae0a782e0a6b0e0a78de0a6ac.png"><img class="size-medium wp-image-595" title="Screen shot ২০১০-০৯-২৮ at ১১.৩৩.০৬ পূর্বাহ্ণ" src="http://we4tech.files.wordpress.com/2010/09/screen-shot-e0a7a8e0a7a6e0a7a7e0a7a6-e0a7a6e0a7af-e0a7a8e0a7ae-at-e0a7a7e0a7a7-e0a7a9e0a7a9-e0a7a6e0a7ac-e0a6aae0a782e0a6b0e0a78de0a6ac.png?w=300&#038;h=144" alt="" width="300" height="144" /></a><p class="wp-caption-text">Also you are king of your own content edit it live on the site in edit mode so you can see how might appear on screen <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p></div>
<p>I guess i should have completed my post bit earlier <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  but my passion toke me further. Anyway! Thanks for reading the whole thing <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>best wishes,</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/579/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/579/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/579/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/579/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/579/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/579/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/579/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/579/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/579/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/579/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/579/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/579/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/579/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/579/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=579&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2010/09/28/welltreat-us-a-ruby-on-rails-based-saas-platform-to-build-your-restaurant-and-business-web-site-on-it/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<georss:point>23.709921 90.407143</georss:point>
		<geo:lat>23.709921</geo:lat>
		<geo:long>90.407143</geo:long>
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>

		<media:content url="http://we4tech.files.wordpress.com/2010/09/screen-shot-2010-09-27-at-6-06-31-pm1.png?w=300" medium="image">
			<media:title type="html">Screen shot 2010-09-27 at 6.06.31 PM</media:title>
		</media:content>

		<media:content url="http://we4tech.files.wordpress.com/2010/09/screen-shot-e0a7a8e0a7a6e0a7a7e0a7a6-e0a7a6e0a7af-e0a7a8e0a7ae-at-e0a7a7-e0a7a8e0a7af-e0a7a6e0a7a7-e0a6aae0a782e0a6b0e0a78de0a6ace0a6be.png?w=300" medium="image">
			<media:title type="html">Screen shot ২০১০-০৯-২৮ at ১.২৯.০১ পূর্বাহ্ণ</media:title>
		</media:content>

		<media:content url="http://we4tech.files.wordpress.com/2010/09/screen-shot-2010-09-27-at-6-10-10-pm.png?w=300" medium="image">
			<media:title type="html">Screen shot 2010-09-27 at 6.10.10 PM</media:title>
		</media:content>

		<media:content url="http://we4tech.files.wordpress.com/2010/09/screen-shot-2010-09-27-at-6-10-10-pm.png?w=300" medium="image">
			<media:title type="html">Screen shot 2010-09-27 at 6.10.10 PM</media:title>
		</media:content>

		<media:content url="http://we4tech.files.wordpress.com/2010/09/screen-shot-2010-09-27-at-6-22-34-pm.png?w=300" medium="image">
			<media:title type="html">Screen shot 2010-09-27 at 6.22.34 PM</media:title>
		</media:content>

		<media:content url="http://we4tech.files.wordpress.com/2010/09/screen-shot-e0a7a8e0a7a6e0a7a7e0a7a6-e0a7a6e0a7af-e0a7a8e0a7ae-at-e0a7a7-e0a7a7e0a7aa-e0a7aae0a7a8-e0a6aae0a782e0a6b0e0a78de0a6ace0a6be.png?w=300" medium="image">
			<media:title type="html">Screen shot ২০১০-০৯-২৮ at ১.১৪.৪২ পূর্বাহ্ণ</media:title>
		</media:content>

		<media:content url="http://we4tech.files.wordpress.com/2010/09/screen-shot-e0a7a8e0a7a6e0a7a7e0a7a6-e0a7a6e0a7af-e0a7a8e0a7ae-at-e0a7a7-e0a7a7e0a7ae-e0a7a6e0a7ac-e0a6aae0a782e0a6b0e0a78de0a6ace0a6be.png?w=300" medium="image">
			<media:title type="html">Screen shot ২০১০-০৯-২৮ at ১.১৮.০৬ পূর্বাহ্ণ</media:title>
		</media:content>

		<media:content url="http://we4tech.files.wordpress.com/2010/09/screen-shot-e0a7a8e0a7a6e0a7a7e0a7a6-e0a7a6e0a7af-e0a7a8e0a7ae-at-e0a7a7-e0a7a7e0a7af-e0a7a7e0a7ad-e0a6aae0a782e0a6b0e0a78de0a6ace0a6be.png?w=260" medium="image">
			<media:title type="html">Screen shot ২০১০-০৯-২৮ at ১.১৯.১৭ পূর্বাহ্ণ</media:title>
		</media:content>

		<media:content url="http://we4tech.files.wordpress.com/2010/09/screen-shot-e0a7a8e0a7a6e0a7a7e0a7a6-e0a7a6e0a7af-e0a7a8e0a7ae-at-e0a7a7-e0a7a8e0a7a7-e0a7a8e0a7ad-e0a6aae0a782e0a6b0e0a78de0a6ace0a6be.png?w=222" medium="image">
			<media:title type="html">Screen shot ২০১০-০৯-২৮ at ১.২১.২৭ পূর্বাহ্ণ</media:title>
		</media:content>

		<media:content url="http://we4tech.files.wordpress.com/2010/09/screen-shot-e0a7a8e0a7a6e0a7a7e0a7a6-e0a7a6e0a7af-e0a7a8e0a7ae-at-e0a7a7e0a7a7-e0a7a9e0a7a9-e0a7a6e0a7ac-e0a6aae0a782e0a6b0e0a78de0a6ac.png?w=300" medium="image">
			<media:title type="html">Screen shot ২০১০-০৯-২৮ at ১১.৩৩.০৬ পূর্বাহ্ণ</media:title>
		</media:content>
	</item>
		<item>
		<title>Ruby Twitter OAuth API : 401 Unauthorized error also says Failed to validate oauth signature and token</title>
		<link>http://we4tech.wordpress.com/2010/09/20/ruby-twitter-oauth-api-401-unauthorized-error-also-says-failed-to-validate-oauth-signature-and-token/</link>
		<comments>http://we4tech.wordpress.com/2010/09/20/ruby-twitter-oauth-api-401-unauthorized-error-also-says-failed-to-validate-oauth-signature-and-token/#comments</comments>
		<pubDate>Mon, 20 Sep 2010 08:10:32 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[OAuth]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://we4tech.wordpress.com/?p=575</guid>
		<description><![CDATA[Ah! what a waste, after trying out for couple of hours i&#8217;ve suddenly found out a blessing post from &#8220;blaine garrett&#8221; . hussss! he really got it fixed through synchronizing system time. my system time was around 30 mins beyond twitter server time. so far i can assume, this problem was occurring due to twitter &#8230; <a href="http://we4tech.wordpress.com/2010/09/20/ruby-twitter-oauth-api-401-unauthorized-error-also-says-failed-to-validate-oauth-signature-and-token/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=575&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ah! what a waste, after trying out for couple of hours i&#8217;ve suddenly found out a blessing post from <a href="http://blainegarrett.com/2009/07/14/failed-to-validate-oauth-signature-and-token-on-twitter-oauth-check-your-cloc/">&#8220;blaine garrett&#8221;</a> . hussss! he really got it fixed through synchronizing system time. my system time was around 30 mins beyond twitter server time.</p>
<p>so far i can assume, this problem was occurring due to twitter oauth service call validation, since the attached timestamp (through OAuth timestamp or some other header which was carrying request time stamp) was giving far beyond time (ie 30 mins beyond in my case). thus twitter was rejecting the request.</p>
<p>anyway, after synchronizing my system date and time, i can see it&#8217;s working.</p>
<p>thanks &#8220;baline garrett&#8221; <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/575/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/575/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/575/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=575&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2010/09/20/ruby-twitter-oauth-api-401-unauthorized-error-also-says-failed-to-validate-oauth-signature-and-token/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<georss:point>23.709921 90.407143</georss:point>
		<geo:lat>23.709921</geo:lat>
		<geo:long>90.407143</geo:long>
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>
	</item>
		<item>
		<title>Ruby process &amp; ActiveRecord data set executing in multi cores</title>
		<link>http://we4tech.wordpress.com/2010/01/29/ruby-process-and-activerecord-data-set-executing-in-multicores/</link>
		<comments>http://we4tech.wordpress.com/2010/01/29/ruby-process-and-activerecord-data-set-executing-in-multicores/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 19:34:43 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[framework]]></category>
		<category><![CDATA[multicore process]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[tekSymmetry.net]]></category>

		<guid isPermaLink="false">http://we4tech.wordpress.com/?p=557</guid>
		<description><![CDATA[Now these days! multi core process is more available than getting a single core processor. perhaps single core is soon getting in Zoo! (oops! perhaps in museum) here i demonstrated how we have executed a big chunk of data over multicores processor. <a href="http://we4tech.wordpress.com/2010/01/29/ruby-process-and-activerecord-data-set-executing-in-multicores/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=557&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>You know what! in one of <a href="http://www.teksymmetry.com">our</a> (tekSymmetry LLC) projects, we have so many background calculations,<br />
which usually takes so many hours to get fully completed. ever since we have introduced those processes,<br />
we were having problem with it&#8217;s execution time. sometimes it get&#8217;s in nerve</p>
<p>as you know a single ruby process can use a single processor&#8217;s core at a time.<br />
this is probable one of the reasons why muli processes based deployment<br />
strategy is picked by ruby on rails community.</p>
<p>anyway, these days our servers got more than one core! more precisely,<br />
in our case each of our production server got 8 cores based intel xeon processor.</p>
<p>so you see the question rose if we could run those long running expensive process in multicores<br />
our system could have better chance to get faster!.</p>
<p>well this blog post is intended for showing you the technique how we have done it in ruby on rails.</p>
<h3>for better understanding, let me give you some hints so you can get the context -</h3>
<ul>
<li>we have big database table rows!</li>
<li>processing a single row doesn&#8217;t require anything from the same database table.</li>
<li>we are using linux (in our case debian lenny)</li>
</ul>
<h3>so here is the way we have done it -</h3>
<ol>
<li>we took the max rows count for the main query</li>
<li>and divided by the number of cores we have</li>
<li>then we forked child process with each subset of the rows</li>
<li>and executed the logic and related stuffs!</li>
<li>on the parent process we initiated a loop where it was checking the newly forked process status</li>
<li>if all the pid files (which are generated by the newly forked children) are removed,<br />
parent process will flag it as successful execution thus it will end the loop.</li>
</ol>
<p>so you see, it is damn! simple <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> _) and it is working for us <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> _),<br />
it has improved our execution time 8x faster, because of getting 8 cores in new server.</p>
<p>here is the code in ruby how we did it. (we created a helper &#8220;<strong>multicore_execution_helper.rb</strong>&#8220;  and <strong>included</strong> in model, thus <strong>execute_in_multicores</strong> became usable)</p>
<pre><a name="l1">1    </a>module MulticoreExecutionHelper
<a name="l2">2    </a>
<a name="l3">3    </a>  def execute_in_multicores(
<a name="l4">4    </a>      p_cores, p_total_rows, p_model, p_conditions = {}, &amp;block)
<a name="l5">5    </a>
<a name="l6">6    </a>    p_cores == 2 if p_cores.to_i == 0
<a name="l7">7    </a>    total_items_per_core = p_total_rows / p_cores
<a name="l8">8    </a>    logger.info "[BATCH-PROCESS-LOG] Total processes - #{p_cores}, " +
<a name="l9">9    </a>                "total rows - #{p_total_rows} [#{total_items_per_core} / 1 core]"
<a name="l10">10   </a>
<a name="l11">11   </a>    # Create job id for each process
<a name="l12">12   </a>    job_ids = p_cores.times.collect{|i| rand.to_s }
<a name="l13">13   </a>
<a name="l14">14   </a>    # Fork process for each core and execute the block
<a name="l15">15   </a>    p_cores.times do |offset|
<a name="l16">16   </a>      Process.fork do
<a name="l17">17   </a>        logger.info "[BATCH-PROCESS-LOG] Starting thread - #{offset} " +
<a name="l18">18   </a>                    "assigned # #{job_ids[offset]}"
<a name="l19">19   </a>
<a name="l20">20   </a>        # Keep job track through the created process pid file.
<a name="l21">21   </a>        pid_file = File.join(RAILS_ROOT, 'tmp/pids/', "#{job_ids[offset]}.pid")
<a name="l22">22   </a>        File.open(pid_file, 'w') {|f| f.puts Process.pid.to_s}
<a name="l23">23   </a>
<a name="l24">24   </a>        # Since fork process is created from the sample of the parent
<a name="l25">25   </a>        # process's memory so we need to reconnect all live connections.
<a name="l26">26   </a>        begin
<a name="l27">27   </a>          ActiveRecord::Base.connection.reconnect!
<a name="l28">28   </a>
<a name="l29">29   </a>          # Retrieve data from the specific row through the defined
<a name="l30">30   </a>          # offset and limit
<a name="l31">31   </a>          teams = p_model.find(
<a name="l32">32   </a>              :all, {
<a name="l33">33   </a>                  <img src='http://s1.wp.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> ffset =&gt; (offset * total_items_per_core),
<a name="l34">34   </a>                  :limit =&gt; total_items_per_core}.merge(p_conditions))
<a name="l35">35   </a>
<a name="l36">36   </a>          block.call(teams)
<a name="l37">37   </a>        rescue =&gt; $e
<a name="l38">38   </a>          logger.error "[BATCH-PROCESS-LOG] Exception raised during " +
<a name="l39">39   </a>                       "execution - #{$e.inspect}"
<a name="l40">40   </a>        end
<a name="l41">41   </a>
<a name="l42">42   </a>        # Remove pid since we are done here!
<a name="l43">43   </a>        FileUtils.rm(pid_file)
<a name="l44">44   </a>      end
<a name="l45">45   </a>    end
<a name="l46">46   </a>
<a name="l47">47   </a>    # monitor whether the process is completed or still in progress
<a name="l48">48   </a>    # don't return this method unless all the forked processes have
<a name="l49">49   </a>    # completed their job
<a name="l50">50   </a>    sleep(2)
<a name="l51">51   </a>
<a name="l52">52   </a>    while 1 do
<a name="l53">53   </a>      fully_completed = true
<a name="l54">54   </a>      for job_id in job_ids
<a name="l55">55   </a>        pid_file = File.join(RAILS_ROOT, 'tmp/pids/', "#{job_id}.pid")
<a name="l56">56   </a>        if fully_completed &amp;&amp; File.exists?(pid_file)
<a name="l57">57   </a>          fully_completed = false
<a name="l58">58   </a>          break
<a name="l59">59   </a>        end
<a name="l60">60   </a>      end
<a name="l61">61   </a>
<a name="l62">62   </a>      break if fully_completed
<a name="l63">63   </a>      sleep(2)
<a name="l64">64   </a>      logger.debug '[BATCH-PROCESS-LOG] again...'
<a name="l65">65   </a>    end
<a name="l66">66   </a>  end
<a name="l67">67   </a>
<a name="l68">68   </a>end
<a name="l69">69   </a></pre>
<h3>here is the usages code -</h3>
<pre><a name="l143">143  </a>      execute_in_multicores(p_total_cores, SomeStuff.count, SomeStuff) do |some_stuffs|
<a name="l144">144  </a>        # Do.. whatever you wanna do with the stuff here! these are gonna run on multicores!
<a name="l151">151  </a>      end

see it is really simple! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> _) if you like it let me know! how much you like it <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> _)
<a href="http://github.com/we4tech/rails_multicore_execution_helper/blob/master/multicore_execution_helper.rb">here you can find the code on github</a> 

best wishes!</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/557/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/557/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/557/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/557/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/557/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/557/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/557/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/557/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=557&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2010/01/29/ruby-process-and-activerecord-data-set-executing-in-multicores/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<georss:point>23.709921 90.407143</georss:point>
		<geo:lat>23.709921</geo:lat>
		<geo:long>90.407143</geo:long>
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>
	</item>
		<item>
		<title>Ruby on Rails demo application presentation is picked by slideshare&#8217;s editor</title>
		<link>http://we4tech.wordpress.com/2010/01/24/ruby-on-rails-demo-application-presentation-is-picked-by-slideshares-editor/</link>
		<comments>http://we4tech.wordpress.com/2010/01/24/ruby-on-rails-demo-application-presentation-is-picked-by-slideshares-editor/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 05:09:32 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://we4tech.wordpress.com/?p=551</guid>
		<description><![CDATA[Today morning i was informed by an email that my slide on slideshare is picked by their editor to keep it on their featured slides list. it was really too great things for me. i congrats those slideshare&#8217;s guys! you can check out slide here - here is the moment i locked it up on &#8230; <a href="http://we4tech.wordpress.com/2010/01/24/ruby-on-rails-demo-application-presentation-is-picked-by-slideshares-editor/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=551&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today morning i was informed by an email that my slide on slideshare is picked by their editor to keep it on their featured slides list.</p>
<p>it was really too great things for me. i congrats those slideshare&#8217;s guys!</p>
<p>you can check out slide here -</p>
<iframe src='http://www.slideshare.net/slideshow/embed_code/2977125' width='510' height='418'></iframe>
<p>here is the moment i locked it up on screen shot!</p>
<p><a href="http://we4tech.files.wordpress.com/2010/01/screen-shot-2010-01-24-at-10-40-34-am.png"><img class="aligncenter size-medium wp-image-555" title="Screen shot 2010-01-24 at 10.40.34 AM" src="http://we4tech.files.wordpress.com/2010/01/screen-shot-2010-01-24-at-10-40-34-am.png?w=277&#038;h=300" alt="" width="277" height="300" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/551/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/551/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/551/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/551/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/551/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/551/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/551/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/551/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=551&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2010/01/24/ruby-on-rails-demo-application-presentation-is-picked-by-slideshares-editor/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>

		<media:content url="http://we4tech.files.wordpress.com/2010/01/screen-shot-2010-01-24-at-10-40-34-am.png?w=277" medium="image">
			<media:title type="html">Screen shot 2010-01-24 at 10.40.34 AM</media:title>
		</media:content>
	</item>
		<item>
		<title>debugging rails internal query execution</title>
		<link>http://we4tech.wordpress.com/2008/09/15/debugging-rails-internal-query-execution/</link>
		<comments>http://we4tech.wordpress.com/2008/09/15/debugging-rails-internal-query-execution/#comments</comments>
		<pubDate>Mon, 15 Sep 2008 00:03:54 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[active record]]></category>
		<category><![CDATA[Introduction]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[www.somewhereinads.net]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/debugging-rails-internal-query-execution/</guid>
		<description><![CDATA[while we were working with somewhere in&#8230; ads project we came up with some debugging and performance mesuring tool, here in my post i will describe how you can use it for yourself. query debugging &#8211; query debugging tool logs every executed query from active record and keep them in memory and using assisting template &#8230; <a href="http://we4tech.wordpress.com/2008/09/15/debugging-rails-internal-query-execution/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=418&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>while we were working with <a href="http://www.somewhereinads.net">somewhere in&#8230; ads</a> project we came up with some debugging and performance mesuring tool, here in my post i will describe how you can use it for yourself.</p>
<p><em><strong>query debugging &#8211; </strong></em><br />
<img class="aligncenter size-medium wp-image-429" title="picture-16" src="http://we4tech.files.wordpress.com/2008/09/picture-16.png?w=300&#038;h=237" alt="picture-16" width="300" height="237" /><br />
query debugging tool logs every executed query from active record and keep them in memory and using assisting template code it display all executed query from the active page.</p>
<p>also it executes query with mysql &#8220;explain&#8221; keyword. so on the same window you can see mysql query execution plan.<br />
it helped us to track down queries which were not hitting the right index.<br />
this is very simple trick &#8211; go through the code below -</p>
<blockquote>
<blockquote><p>module DebugUtil<br />
class QueryDebug<br />
@@QUERIES = {}<br />
def self.add(p_query, p_report)<br />
@@QUERIES[p_query] = p_report<br />
end</p>
<p>def self.queries<br />
q = @@QUERIES<br />
clean<br />
return q<br />
end</p>
<p>def self.clean<br />
@@QUERIES = {}<br />
end<br />
end<br />
end</p></blockquote>
<p>QueryDebug class keeps all executed query and their explained resultset in to the static array. so later in template QueryDebug::queries is invoked to get all executed query for the current page.</p>
<p>here is how we trap the query execution from active record -</p>
<blockquote><p>if defined?(QUERY_DEBUG_ENABLED) &amp;&amp; QUERY_DEBUG_ENABLED<br />
ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do<br />
alias __existing_execute_method execute</p>
<p>def execute(sql, name = nil)<br />
if sql.match(/^SELECT/i)<br />
report = []<br />
@connection.query(&#8220;explain #{sql}&#8221;).each do |row|<br />
report &lt; &lt; row<br />
end<br />
DebugUtil::QueryDebug.add(sql, report)<br />
end<br />
__existing_execute_method(sql, name)<br />
end<br />
end</p>
<p>Object.class_eval do<br />
def raise_during_query_debug<br />
raise DebugUtil::QueryDebug::queries.inspect<br />
end<br />
end<br />
end</p></blockquote>
<p>you can see we have used &#8220;QUERY_DEBUG_ENABLED&#8221; constant to ensure whether this is enabled by intention.<br />
now see how we are rendering on our template.</p></blockquote>
<blockquote><p><!--�-->query debug</p>
<ol style="padding:5px;">
<li>
<table style="background:lightgreen none repeat scroll 0 0;width:100%;" border="1" cellpadding="5">
<tbody>
<tr>
<td></td>
<td rowspan="2">checked</td>
</tr>
<tr></tr>
<tr>
<td>&lt; %= row.join(&#8220;</td>
<td>&#8220;) % &gt;</td>
</tr>
</tbody>
</table>
</li>
</ol>
<p><!--�--></p></blockquote>
<p>we put this code in common layout. so it renders on every page. thats all <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/418/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/418/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/418/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/418/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/418/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=418&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2008/09/15/debugging-rails-internal-query-execution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>

		<media:content url="http://we4tech.files.wordpress.com/2008/09/picture-16.png?w=300" medium="image">
			<media:title type="html">picture-16</media:title>
		</media:content>
	</item>
		<item>
		<title>time based cache expiry for rails action cache</title>
		<link>http://we4tech.wordpress.com/2008/06/23/time-based-cache-expiry-for-rails-action-cache/</link>
		<comments>http://we4tech.wordpress.com/2008/06/23/time-based-cache-expiry-for-rails-action-cache/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 16:54:30 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[cache]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/time-based-cache-expiry-for-rails-action-cache/</guid>
		<description><![CDATA[rails has excellent support for caching action, page, query and so on. rails default behavior is more than expected for most of the project. though i was looking for some time based expiry function on &#8220;caches_action&#8221; functionality. unfortunately there wasn&#8217;t anything so here is a simple trick i have used to make it work with &#8230; <a href="http://we4tech.wordpress.com/2008/06/23/time-based-cache-expiry-for-rails-action-cache/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=414&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>rails has excellent support for caching action, page, query and so on.<br />
rails default behavior is more than expected for most of the project. though i was looking for some time based expiry function on &#8220;caches_action&#8221; functionality. unfortunately there wasn&#8217;t anything so here is a simple trick i have used to make it work with different url and time based expiration.</p>
<p>i added <strong>&#8220;caches_action :recent&#8221;</strong> on my controller and added the following protected method -</p>
<blockquote><p>protected<br />
def fragment_cache_key(p_args)<br />
cache_key = &#8220;cache_key_#{request.path}#{request.headers["QUERY_STRING"]}&#8221;.gsub(/=/, &#8220;&#8221;)<br />
action_cache_key = get_from_cache(cache_key)<br />
if action_cache_key<br />
return action_cache_key<br />
else<br />
action_cache_key = Digest::MD5::hexdigest(&#8220;#{rand}#{Time.now}&#8221;)<br />
add_to_cache(cache_key, action_cache_key, {:expiry =&gt; 1.hours})<br />
return action_cache_key<br />
end</p>
<p>end</p></blockquote>
<p>actually i generate key and stored them inside my memcached instance with an hour expiry limit.<br />
so when memcache invalidates my cache my action cache is also get invalidated.</p>
<p>so thus rails default action cache work with time limit <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>don&#8217;t think this is all, i suppose to cleanup the previously created cache file so i won&#8217;t get unnecessary store consumption .</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/414/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/414/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/414/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=414&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2008/06/23/time-based-cache-expiry-for-rails-action-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>
	</item>
		<item>
		<title>nginx on debian box</title>
		<link>http://we4tech.wordpress.com/2008/05/24/nginx-on-debian-box/</link>
		<comments>http://we4tech.wordpress.com/2008/05/24/nginx-on-debian-box/#comments</comments>
		<pubDate>Sat, 24 May 2008 16:58:44 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[configuration]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/nginx-on-debian-box/</guid>
		<description><![CDATA[i had a tough time to configure nginx on my debian production environment. the recent stable release from nginx is 0.6.x but on debian repository it was 0.4.x, so i had to build it from the source and install it. since i had an old 0.4.x instance of nginx, installation wasn&#8217;t as smooth as i &#8230; <a href="http://we4tech.wordpress.com/2008/05/24/nginx-on-debian-box/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=410&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>i had a tough time to configure nginx on my debian production environment.<br />
the recent stable release from nginx is 0.6.x but on debian repository it was 0.4.x, so i had to build it from the source and install it.</p>
<p>since i had an old 0.4.x instance of nginx, installation wasn&#8217;t as smooth as i was expecting. here i would try to show how i have resolved those broken issues and made my way to run nginx to reverse proxy my backend mongrel instances.</p>
<p>i took several attemtps to remove the existing 0.4.x instance of nginx but i failed.<br />
i used &#8220;aptitude remove nginx&#8221; i ended with the following error -</p>
<blockquote><p>Reading package lists&#8230; Done<br />
Building dependency tree<br />
Reading state information&#8230; Done<br />
The following packages will be REMOVED:<br />
nginx<br />
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.<br />
Need to get 0B of archives.<br />
After unpacking 582kB disk space will be freed.<br />
Do you want to continue [Y/n]?<br />
(Reading database &#8230; 78227 files and directories currently installed.)<br />
Removing nginx &#8230;<br />
Stopping nginx: nginx.<br />
Stopping nginx: invoke-rc.d: initscript nginx, action &#8220;stop&#8221; failed.<br />
dpkg: error processing nginx (&#8211;remove):<br />
subprocess pre-removal script returned error exit status 1<br />
Starting nginx: nginx.<br />
Errors were encountered while processing:<br />
nginx<br />
E: Sub-process /usr/bin/dpkg returned an error code (1)</p></blockquote>
<p>though this is not my real error code but it has similarity, i took it from the following url -</p>
<p>http://sudhanshuraheja.com/2007/09/remove-nginx-from-ubuntu-fiesty-fawn.html</p>
<p>this blog author had some suggestion, but that wasn&#8217;t working for me, so i tried in different way -<br />
i executed &#8220;sudo apt-get build-dep nginx&#8221; i found this tips from one of the blog comments<br />
the comment author explained in this way -</p>
<blockquote><p>&#8220;this should install everything required to build the package (compiler, headers/libs, packaging tools). Usually on a fresh install I do this to get everything required to build zope.Then issue &#8220;apt-get source nginx&#8221; (you need deb-src sources in /etc/apt/sources.list). This will download nginx sources (original tarball, diff, and uncompressed sources with patches applied). Just cd in source dir, make your modifications and use &#8220;dpkg-buildpackage -rfakeroot -b&#8221; (this requires fakeroot package). In parent directory you should get new deb files ready to install, with start/stops scripts and your patches. Just take care of package update that will surely remove your nginx version.&#8221;</p></blockquote>
<p>if you want service script to initiate nginx on startup follow the link -<br />
<a href="http://blog.labratz.net/articles/2006/10/03/rails-deployment-apache-lighttpd-nginx-mongrel-cluster">http://blog.labratz.net/articles/2006/10/03/rails-deployment-apache-lighttpd-nginx-mongrel-cluster</a></p>
<p>best wishes,</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/410/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/410/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/410/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/410/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/410/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/410/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/410/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/410/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/410/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/410/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/410/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/410/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/410/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/410/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/410/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/410/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=410&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2008/05/24/nginx-on-debian-box/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>
	</item>
		<item>
		<title>upcoming project mojar_workflow, workflow engine in ruby</title>
		<link>http://we4tech.wordpress.com/2008/02/10/upcoming-project-mojar_workflow-workflow-engine-in-ruby/</link>
		<comments>http://we4tech.wordpress.com/2008/02/10/upcoming-project-mojar_workflow-workflow-engine-in-ruby/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 07:59:25 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[enterprise]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/upcoming-project-mojar_workflow-workflow-engine-in-ruby/</guid>
		<description><![CDATA[hi, we just kicking start a new open source ruby based workflow engine project &#8220;mojar workflow&#8220;. we named it after our deshi word &#8220;mojar&#8221; reason is very clear to spread out this word. mojar workflow, is integral solution to execute a flow of business rules. for example - you have an action where you have &#8230; <a href="http://we4tech.wordpress.com/2008/02/10/upcoming-project-mojar_workflow-workflow-engine-in-ruby/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=396&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>hi,<br />
we just kicking start a new open source ruby based workflow engine project <strong>&#8220;<a href="http://rubyforge.org/projects/mojarworkflow/">mojar workflow</a>&#8220;</strong>.<br />
we named it after our deshi word &#8220;mojar&#8221; reason is very clear to<br />
spread out this word.</p>
<p>mojar workflow, is integral solution to execute a flow of business<br />
rules. for example -</p>
<p>you have an action where you have the following set of rules -<br />
1. start transaction<br />
2. verify user account<br />
3. verify user balance<br />
4. verify user dues<br />
5. reduce dues from balance<br />
6. complete transaction</p>
<p>after few days you got a new requirement, where you suppose to reduce<br />
user dues by the 10% because of company new discount policy.<br />
so you have to implement the following rules -<br />
1. start transaction<br />
2. verify user account<br />
3. verify user balance<br />
4. verify user dues<br />
5. reduce dues by 10% of discount<br />
5. reduce discounted dues from balance<br />
6. complete transaction</p>
<p>to implement such scenario you have to again code in your stable<br />
release. but using mojar workflow, you can add that new concern from<br />
the abstract flow maintenance layer. where you can define this flow in<br />
yaml file or an xml document.</p>
<p>keep your eyes on -<br />
<a href="http://rubyforge.org/projects/mojarworkflow/">http://rubyforge.org/projects/mojarworkflow/</a></p>
<p>best wishes,</p>
</p>
<p><!--acc585eaf45842d4a72b95f260dd36c8--></p>
</p>
<p><!--c329955b83bf724dfaa8a090a5ee57e0-->
</p>
<p><!--22ad517e94d773d73a81892dc6e71324--></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/396/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/396/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/396/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/396/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/396/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/396/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/396/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/396/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/396/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/396/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=396&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2008/02/10/upcoming-project-mojar_workflow-workflow-engine-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>
	</item>
		<item>
		<title>rails plugin symlinked broken on 1.2.5, fixed from 2.0</title>
		<link>http://we4tech.wordpress.com/2007/11/29/rails-plugin-symlinked-bronken-with-125-fixed-from-20/</link>
		<comments>http://we4tech.wordpress.com/2007/11/29/rails-plugin-symlinked-bronken-with-125-fixed-from-20/#comments</comments>
		<pubDate>Thu, 29 Nov 2007 07:27:44 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[bug]]></category>
		<category><![CDATA[Introduction]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/rails-plugin-symlinked-bronken-with-125-fixed-from-20/</guid>
		<description><![CDATA[i was trying to build a rails plugin. my project was in different directory so i symlinked the directory under &#8220;vendor/plugins/..&#8221;. but i couldn&#8217;t find it working. so after passing few times, i could successfully run my plugin under rails 2.0-RC2. so later i compared lookup.rb file from the 1.5 and 2.0-RC2 release. the defecting &#8230; <a href="http://we4tech.wordpress.com/2007/11/29/rails-plugin-symlinked-bronken-with-125-fixed-from-20/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=387&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>i was trying to build a rails plugin. my project was in different directory so i symlinked the directory under &#8220;vendor/plugins/..&#8221;. but i couldn&#8217;t find it working.</p>
<p>so after passing few times, i could successfully run my plugin under rails 2.0-RC2. so later i compared lookup.rb file from the 1.5 and 2.0-RC2 release.</p>
<p>the defecting code was the following lines &#8211; (1.5)</p>
<blockquote><p>def use_component_sources!<br />
# &#8230;.<br />
sources &lt; &lt; PathSource.new(:lib, &#8220;#{::RAILS_ROOT}/lib/generators&#8221;)<br />
sources &lt;&lt; PathSource.new(:vendor, &#8220;#{::RAILS_ROOT}/vendor/generators&#8221;)<br />
sources &lt;&lt; PathSource.new(:plugins, &#8220;#{::RAILS_ROOT}/vendor/plugins/**/generators&#8221;)<br />
# &#8230;.<br />
end</p>
</p>
</p>
</blockquote>
<p>the fixed version &#8211; (2.0-RC2)</p>
</p>
<blockquote><p>def use_component_sources!<br />
# &#8230;</p>
<p>sources &lt; &lt; PathSource.new(:lib, &#8220;#{::RAILS_ROOT}/lib/generators&#8221;)<br />
sources &lt;&lt; PathSource.new(:vendor, &#8220;#{::RAILS_ROOT}/vendor/generators&#8221;)<br />
sources &lt;&lt; PathSource.new(:plugins, &#8220;#{::RAILS_ROOT}/vendor/plugins/*/**/generators&#8221;)<br />
sources &lt;&lt; PathSource.new(:plugins, &#8220;#{::RAILS_ROOT}/vendor/plugins/*/**/rails_generators&#8221;)<br />
end<br />
# &#8230;<br />
end</p>
</p>
</p>
</blockquote>
<p>i also checked out rails bug tracker i found <a href="http://dev.rubyonrails.org/ticket/4245">a bug was pointed</a> to this issue  and apparently which was fixed on the following change set.<br />
<a href="http://dev.rubyonrails.org/changeset/6101">http://dev.rubyonrails.org/changeset/6101</a></p>
<p><!--25afbcab5c504b15449f0a354df446c8--></p>
</p>
<p><!--155e1a099f8daa0dd0bad14147b4475b-->
</p>
<p><!--d1d53d53e53dd45a15c06cbd867808fd--></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/387/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/387/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/387/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/387/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/387/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=387&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2007/11/29/rails-plugin-symlinked-bronken-with-125-fixed-from-20/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>
	</item>
		<item>
		<title>simple fragment cache implementation on ruby on rails</title>
		<link>http://we4tech.wordpress.com/2007/11/17/simple-fragment-cache-implementation-on-ruby-on-rails/</link>
		<comments>http://we4tech.wordpress.com/2007/11/17/simple-fragment-cache-implementation-on-ruby-on-rails/#comments</comments>
		<pubDate>Fri, 16 Nov 2007 21:00:55 +0000</pubDate>
		<dc:creator>nhm tanveer hossain khan</dc:creator>
				<category><![CDATA[cache]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://hasan.we4tech.com/simple-fragment-cache-implementation-on-ruby-on-rails</guid>
		<description><![CDATA[i was getting serious performance problem with one of my projects. so i came up with a simple fragment cache implementation on ruby on rails. after implementing this stuff, i replaced &#8220;render(:partial =&#62; &#8230;)&#8221; with the following method - render_from_cache_or_render(:cache_key =&#62;”cache key”, :cache_expire_after =&#62; ConstantHelper::TAG_CLOUD_EXPIRED_IN, # minutes :partial =&#62; “….”) let&#8217;s have a look on &#8230; <a href="http://we4tech.wordpress.com/2007/11/17/simple-fragment-cache-implementation-on-ruby-on-rails/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=385&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>i was getting serious performance problem with one of my projects. so i came up with a simple fragment cache implementation on ruby on rails.</p>
<p>after implementing this stuff, i replaced &#8220;render(:partial =&gt; &#8230;)&#8221; with the following method -</p>
<blockquote>
<pre>render_from_cache_or_render(:cache_key =&gt;”cache key”, :cache_expire_after =&gt; ConstantHelper::TAG_CLOUD_EXPIRED_IN, # minutes :partial =&gt; “….”)</pre>
</blockquote>
<p>let&#8217;s have a look on my implementation -</p>
<blockquote><p>def render_from_cache_or_render(p_args)</p>
<p>return render(p_args) if true == p_args[:cache_off]</p>
<p># check from cache<br />
cache_key = p_args[:cache_key]<br />
cached_content = CacheService.get_cache(cache_key)</p>
<p>if not cached_content.nil? and not cached_content.empty?<br />
return cached_content<br />
else<br />
content = render(p_args)<br />
# cache expire time if defined<br />
cache_expire_time_in_minutes = p_args[:cache_expire_after] || 60<br />
CacheService.add_cache(cache_key, cache_expire_time_in_minutes, content)<br />
return content<br />
end<br />
end</p></blockquote>
<p>actually, my implemented &#8220;CacheService&#8221; class is simply storing all cache in a hash map.<br />
when some cache was requested for peek, cache expiry was checked before returning the cached value.</p>
<p>for CacheService implementation look at the bottom of my post.</p>
<p>anyway, after implementing and utilizing this stuff, i gained 70+ requests capability per second. fyi, before applying cache it was around 10 per second.</p>
<blockquote><p>module Cache<br />
class Item<br />
attr_accessor :key, :expire_time, :content, :created_on</p>
<p>def initialize(p_key, p_expire_time, p_content)<br />
@key = p_key<br />
@expire_time = p_expire_time * 60 # in minutes<br />
@content = p_content<br />
@created_on = Time.now<br />
end<br />
end<br />
end</p>
<p>class CacheService<br />
@@CACHES = {}<br />
@@CACHE_EXPIRE_TIMES = {}</p>
<p>def self.add_cache(p_key, p_expire_time, p_content)<br />
cache_item = Cache::Item.new(p_key, p_expire_time, p_content)<br />
@@CACHES[p_key.to_sym] = cache_item<br />
end</p>
<p>def self.get_cache(p_key)<br />
# load content from cache<br />
cached_content = @@CACHES[p_key.to_sym]<br />
return nil if cached_content.nil?</p>
<p># verify cache validity<br />
return cached_content.content if not expired?(cached_content)<br />
return nil<br />
end</p>
<p>private<br />
def self.expired?(p_cache)<br />
# find time difference<br />
time_difference = Time.now &#8211; p_cache.created_on<br />
return true if time_difference &gt; p_cache.expire_time<br />
end<br />
end</p></blockquote>
<p>best wishes,<!--3d03e28513b3f05efbe65bc64219c415--></p>
<p><!--f6265e57e7aec9039f352fd813fc9a58--></p>
<p><!--5d693aaea750a2e28b4ea43ff6938b40--></p>
<p><!--4d046ce81eef3b7632a83741ad51e2d5--></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/we4tech.wordpress.com/385/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/we4tech.wordpress.com/385/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/we4tech.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/we4tech.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/we4tech.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/we4tech.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/we4tech.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/we4tech.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/we4tech.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/we4tech.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/we4tech.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/we4tech.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/we4tech.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/we4tech.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/we4tech.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/we4tech.wordpress.com/385/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=we4tech.wordpress.com&amp;blog=537526&amp;post=385&amp;subd=we4tech&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://we4tech.wordpress.com/2007/11/17/simple-fragment-cache-implementation-on-ruby-on-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bb774de244da2d6e7f39a189b905077?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hasan</media:title>
		</media:content>
	</item>
	</channel>
</rss>
