<?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:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Chinnakarupan's Weblog</title>
	<atom:link href="http://chinnakarupan.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://chinnakarupan.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Sun, 01 Jun 2008 17:41:43 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='chinnakarupan.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/3147267cca50bef813277d0e443301d2?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Chinnakarupan's Weblog</title>
		<link>http://chinnakarupan.wordpress.com</link>
	</image>
			<item>
		<title>Ruby, Testing</title>
		<link>http://chinnakarupan.wordpress.com/2008/06/01/ruby-testing/</link>
		<comments>http://chinnakarupan.wordpress.com/2008/06/01/ruby-testing/#comments</comments>
		<pubDate>Sun, 01 Jun 2008 17:41:43 +0000</pubDate>
		<dc:creator>chinnakarupan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chinnakarupan.wordpress.com/2008/06/01/ruby-testing/</guid>
		<description><![CDATA[In Ruby -&#62; Test::unit::TestCase is easy
require &#8216;test/unit&#8217;
&#160;
the name of the class to be tested is Roman then the testing class will TestRoman &#60; Test::Unit::TestCase
and a simple method
def test_simple
assert_equal (&#8220;expected_result&#8221;, call_to the method of class to be checked &#8211;&#62;actual result)
end
for testing a particular method&#8230;.
ruby test_roman.rb &#8211;name &#8220;name of the method&#8221;
location of the test file should
$:.unshift File.join(File.dirname(__FILE__),&#8221;..&#8221;,&#8221;lib&#8221;)
require&#8230;.the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=47&subd=chinnakarupan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In Ruby -&gt; Test::unit::TestCase is easy</p>
<p>require &#8216;test/unit&#8217;</p>
<p>&nbsp;</p>
<p>the name of the class to be tested is Roman then the testing class will TestRoman &lt; Test::Unit::TestCase</p>
<p>and a simple method</p>
<p>def test_simple</p>
<p>assert_equal (&#8220;expected_result&#8221;, call_to the method of class to be checked &#8211;&gt;actual result)</p>
<p>end</p>
<p>for testing a particular method&#8230;.</p>
<p>ruby test_roman.rb &#8211;name &#8220;name of the method&#8221;</p>
<p>location of the test file should</p>
<p>$:.unshift File.join(File.dirname(__FILE__),&#8221;..&#8221;,&#8221;lib&#8221;)</p>
<p>require&#8230;.the file to be tested (since require will bring the location of the file in previous line)</p>
<p>Test suite&#8230;</p>
<p>require &#8216;test/unit&#8217; followed by all the test file names&#8230;it is as simple</p>
<p>require &#8216;test_roman&#8217;</p>
<p>require &#8216;test_music&#8217;</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/chinnakarupan.wordpress.com/47/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/chinnakarupan.wordpress.com/47/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chinnakarupan.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chinnakarupan.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chinnakarupan.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chinnakarupan.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chinnakarupan.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chinnakarupan.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chinnakarupan.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chinnakarupan.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chinnakarupan.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chinnakarupan.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=47&subd=chinnakarupan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chinnakarupan.wordpress.com/2008/06/01/ruby-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/182af385245a1b714f893a7289254658?s=96&#38;d=identicon" medium="image">
			<media:title type="html">chinnakarupan</media:title>
		</media:content>
	</item>
		<item>
		<title>Ruby &#8211; Numeric</title>
		<link>http://chinnakarupan.wordpress.com/2008/06/01/ruby-numeric/</link>
		<comments>http://chinnakarupan.wordpress.com/2008/06/01/ruby-numeric/#comments</comments>
		<pubDate>Sun, 01 Jun 2008 00:28:11 +0000</pubDate>
		<dc:creator>chinnakarupan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chinnakarupan.wordpress.com/2008/06/01/ruby-numeric/</guid>
		<description><![CDATA[Numeric
Integer Float
FixNum BigNum Rational ComplexNum
nan?
zero?/nonzero?
finite?/infinite?,integer?
ceil,floor,round,
divmod,quo,remainder
next,succ,step(10,2),times,chr,
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=46&subd=chinnakarupan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Numeric</p>
<p>Integer Float</p>
<p>FixNum BigNum Rational ComplexNum</p>
<p>nan?</p>
<p>zero?/nonzero?</p>
<p>finite?/infinite?,integer?</p>
<p>ceil,floor,round,</p>
<p>divmod,quo,remainder</p>
<p>next,succ,step(10,2),times,chr,</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/chinnakarupan.wordpress.com/46/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/chinnakarupan.wordpress.com/46/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chinnakarupan.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chinnakarupan.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chinnakarupan.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chinnakarupan.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chinnakarupan.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chinnakarupan.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chinnakarupan.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chinnakarupan.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chinnakarupan.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chinnakarupan.wordpress.com/46/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=46&subd=chinnakarupan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chinnakarupan.wordpress.com/2008/06/01/ruby-numeric/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/182af385245a1b714f893a7289254658?s=96&#38;d=identicon" medium="image">
			<media:title type="html">chinnakarupan</media:title>
		</media:content>
	</item>
		<item>
		<title>ruby rake</title>
		<link>http://chinnakarupan.wordpress.com/2008/04/21/ruby-rake/</link>
		<comments>http://chinnakarupan.wordpress.com/2008/04/21/ruby-rake/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 13:13:36 +0000</pubDate>
		<dc:creator>chinnakarupan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chinnakarupan.wordpress.com/2008/04/21/ruby-rake/</guid>
		<description><![CDATA[ruby is make like utility.Make utility makes a install with all the options and config you want .Rake is similar to Make
within a rails application go to that directory ask the rake to tell about itself
rake -T
rake rails:freeze:gems
rake doc:rails : will install the rdoc for the rails &#8211;&#62; the activerecord#find etc&#8230;in the html format in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=44&subd=chinnakarupan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>ruby is make like utility.Make utility makes a install with all the options and config you want .Rake is similar to Make</p>
<p>within a rails application go to that directory ask the rake to tell about itself</p>
<p>rake -T</p>
<p>rake rails:freeze:gems</p>
<p>rake doc:rails : will install the rdoc for the rails &#8211;&gt; the activerecord#find etc&#8230;in the html format in the doc folder</p>
<p>rdoc *.rb *.c -o I:\sites\music_library\doc would generate the ruby style documentation in html for all the .rb files and .c files and output to the -o directory mentioned.</p>
<p>gem install &#8220;rspec&#8221;</p>
<p>ruby script/plugin install svn://rubyforge.org/var/svn/rspec/tags/REL_1_0_8/rspec_on_rails</p>
<p>ruby script/generate rspec</p>
<p>rake spec</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/chinnakarupan.wordpress.com/44/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/chinnakarupan.wordpress.com/44/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chinnakarupan.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chinnakarupan.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chinnakarupan.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chinnakarupan.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chinnakarupan.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chinnakarupan.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chinnakarupan.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chinnakarupan.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chinnakarupan.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chinnakarupan.wordpress.com/44/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=44&subd=chinnakarupan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chinnakarupan.wordpress.com/2008/04/21/ruby-rake/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/182af385245a1b714f893a7289254658?s=96&#38;d=identicon" medium="image">
			<media:title type="html">chinnakarupan</media:title>
		</media:content>
	</item>
		<item>
		<title>Ruby : Math</title>
		<link>http://chinnakarupan.wordpress.com/2008/04/21/ruby-math/</link>
		<comments>http://chinnakarupan.wordpress.com/2008/04/21/ruby-math/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 03:13:51 +0000</pubDate>
		<dc:creator>chinnakarupan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chinnakarupan.wordpress.com/2008/04/21/ruby-math/</guid>
		<description><![CDATA[Math is a module which has a lot of useful Methods.
To convert from one class to another  just call the class name followed by parameter.
Integer(field)
Float(field)
String(field)
All other method are applied on the object itself like 3.div 3 or 12.divmod 5 which divides and gives the balance. or you can remainder to get the remainder alone.
you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=45&subd=chinnakarupan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Math is a module which has a lot of useful Methods.</p>
<p>To convert from one class to another  just call the class name followed by parameter.</p>
<p>Integer(field)</p>
<p>Float(field)</p>
<p>String(field)</p>
<p>All other method are applied on the object itself like 3.div 3 or 12.divmod 5 which divides and gives the balance. or you can remainder to get the remainder alone.</p>
<p>you can question the number just like normal language like</p>
<p>.zero? .nonzero? .infinity? .finite? .nan? .integer? .float? .ciel .floor .round .next .chr .log .sqrt .exp .length</p>
<p>To get constants since it is a Module<strong>  Math::PI</strong></p>
<p><strong>Prime numbers : Prime.new : p.next,p.succ.</strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/chinnakarupan.wordpress.com/45/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/chinnakarupan.wordpress.com/45/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chinnakarupan.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chinnakarupan.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chinnakarupan.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chinnakarupan.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chinnakarupan.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chinnakarupan.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chinnakarupan.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chinnakarupan.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chinnakarupan.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chinnakarupan.wordpress.com/45/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=45&subd=chinnakarupan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chinnakarupan.wordpress.com/2008/04/21/ruby-math/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/182af385245a1b714f893a7289254658?s=96&#38;d=identicon" medium="image">
			<media:title type="html">chinnakarupan</media:title>
		</media:content>
	</item>
		<item>
		<title>rails basics</title>
		<link>http://chinnakarupan.wordpress.com/2008/04/21/rails-basics/</link>
		<comments>http://chinnakarupan.wordpress.com/2008/04/21/rails-basics/#comments</comments>
		<pubDate>Mon, 21 Apr 2008 03:13:26 +0000</pubDate>
		<dc:creator>chinnakarupan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chinnakarupan.wordpress.com/2008/04/21/rails-basics/</guid>
		<description><![CDATA[render(:controller=&#62;&#8217;say&#8217; ,:action=&#62;&#8217;hello&#8217;)
render(:partial =&#62; &#8216;form&#8217;)
redirect(:controller=&#62;&#8217;say&#8217; :action=&#62;&#8217;hello&#8217;)
link_to(&#8216;mylink&#8217;,:controller= &#62;&#8217;say&#8217;,:action=&#62;&#8217;hello&#8217;,:id=&#62;1)
params.inspect
logger.warn,logger.error,logger.info,logger.fatal
(ActionView only)   debug(params)
( FormHelpers only)
&#60;input type =&#8217;text&#8217; name=album[title]/&#62; can be written as
&#60;%= form_tag(:action=&#62;&#8217;create&#8217;) do %&#62;
&#60;%= text_field(:album, :title) %&#62;
&#60;%= datetime_select(:album, :release_date) %&#62;
&#60;%= submit_tag(&#8220;name of button&#8221;) %&#62;
&#60;%= end %&#62;
form_tag
form
&#160;
error_messages_for(:album)  &#8212;&#62; debug(album.errors)
validates_presence_of :artist
before_filter(controller) :method  nly/:except =&#62;[]
after_filter(controller) :method  nly
Model inherits from ActiveRecord::Base which has methods like find,find_by_id,find_by_sql,save,update,destroy
Controller is inherited [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=43&subd=chinnakarupan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>render(:controller=&gt;&#8217;say&#8217; ,:action=&gt;&#8217;hello&#8217;)</p>
<p>render(:partial =&gt; &#8216;form&#8217;)</p>
<p>redirect(:controller=&gt;&#8217;say&#8217; :action=&gt;&#8217;hello&#8217;)</p>
<p>link_to(&#8216;mylink&#8217;,:controller= &gt;&#8217;say&#8217;,:action=&gt;&#8217;hello&#8217;,:id=&gt;1)</p>
<p>params.inspect</p>
<p>logger.warn,logger.error,logger.info,logger.fatal</p>
<p>(ActionView only)   debug(params)</p>
<p>( FormHelpers only)</p>
<p>&lt;input type =&#8217;text&#8217; name=album[title]/&gt; can be written as</p>
<p>&lt;%= form_tag(:action=&gt;&#8217;create&#8217;) do %&gt;</p>
<p>&lt;%= text_field(:album, :title) %&gt;</p>
<p>&lt;%= datetime_select(:album, :release_date) %&gt;</p>
<p>&lt;%= submit_tag(&#8220;name of button&#8221;) %&gt;</p>
<p>&lt;%= end %&gt;</p>
<p>form_tag</p>
<p>form</p>
<p>&nbsp;</p>
<p>error_messages_for(:album)  &#8212;&gt; debug(album.errors)</p>
<p>validates_presence_of :artist</p>
<p>before_filter(controller) :method <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> nly/:except =&gt;[]</p>
<p>after_filter(controller) :method <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> nly</p>
<p>Model inherits from ActiveRecord::Base which has methods like find,find_by_id,find_by_sql,save,update,destroy</p>
<p>Controller is inherited from ApplicationController</p>
<p>stylesheet_link_tag</p>
<p>layout(controller)</p>
<p>render(:layout=&gt;false/&#8217;standard&#8217;) / render_without_layout</p>
<p>before_create(ActiveRecord::Base)</p>
<p>after_create(ActiveRecord::Base)</p>
<p><strong><u>flash[:notice] = &#8217;successful created&#8217;</u></strong></p>
<p>Database table end with s&#8230;Albums,Artists,</p>
<p>But the model is singular and the controller is</p>
<p><strong><u>Sql</u></strong></p>
<p>1)find(:all,  &#8211;&gt; :first,:last,1&#8230;.</p>
<p>(where clause) :conditions= &gt;["release_date &lt;= ?","YYYY-MM-DD HH:MM:SS"] &#8211;&gt; sql inject attack&#8230;</p>
<p> <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> rder=&gt;&#8217;release_date ASC&#8217;</p>
<p>:limit =&gt; 10 , <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> ffset =&gt; 5</p>
<p>&nbsp;</p>
<p>        {<br />
          :primary_key =&gt; &#8220;int(11) DEFAULT NULL auto_increment PRIMARY KEY&#8221;,<br />
          :string      =&gt; { :name =&gt; &#8220;varchar&#8221;, :limit =&gt; 255 },<br />
          :text        =&gt; { :name =&gt; &#8220;text&#8221; },<br />
          :integer     =&gt; { :name =&gt; &#8220;int&#8221;, :limit =&gt; 11 },<br />
          :float       =&gt; { :name =&gt; &#8220;float&#8221; },<br />
          :decimal     =&gt; { :name =&gt; &#8220;decimal&#8221; },<br />
          :datetime    =&gt; { :name =&gt; &#8220;datetime&#8221; },<br />
          :timestamp   =&gt; { :name =&gt; &#8220;datetime&#8221; },<br />
          :time        =&gt; { :name =&gt; &#8220;time&#8221; },<br />
          :date        =&gt; { :name =&gt; &#8220;date&#8221; },<br />
          :binary      =&gt; { :name =&gt; &#8220;blob&#8221; },<br />
          :boolean     =&gt; { :name =&gt; &#8220;tinyint&#8221;, :limit =&gt; 1 }<br />
        }</p>
<p>
2)create a new model and call .save(will return true / false)</p>
<p>3)destroy : instance of the model.destroy</p>
<p>4)update_attributes : instance of the model.update(params&#8211;&gt;hash)</p>
<p><strong>PARAMS</strong></p>
<p>is a hash.so to get the params say params[:key] eg params[:id]</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/chinnakarupan.wordpress.com/43/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/chinnakarupan.wordpress.com/43/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chinnakarupan.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chinnakarupan.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chinnakarupan.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chinnakarupan.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chinnakarupan.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chinnakarupan.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chinnakarupan.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chinnakarupan.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chinnakarupan.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chinnakarupan.wordpress.com/43/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=43&subd=chinnakarupan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chinnakarupan.wordpress.com/2008/04/21/rails-basics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/182af385245a1b714f893a7289254658?s=96&#38;d=identicon" medium="image">
			<media:title type="html">chinnakarupan</media:title>
		</media:content>
	</item>
		<item>
		<title>ruby gems</title>
		<link>http://chinnakarupan.wordpress.com/2008/04/20/ruby-gems/</link>
		<comments>http://chinnakarupan.wordpress.com/2008/04/20/ruby-gems/#comments</comments>
		<pubDate>Sun, 20 Apr 2008 01:37:21 +0000</pubDate>
		<dc:creator>chinnakarupan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chinnakarupan.wordpress.com/2008/04/19/ruby-gems/</guid>
		<description><![CDATA[http://docs.rubygems.org/read/book/2
gem -v : would give the version
gem list &#8211;local : list of all gems in the system with thier version number.if there was 2 version then it would give them in descending order
gem outdated : would give list of gems which are outdate
gem update : would update all the gems.
gem update &#8211;include-dependencies &#8211;no-rdoc
&#160;
gem cleanup : [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=42&subd=chinnakarupan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://docs.rubygems.org/read/book/2">http://docs.rubygems.org/read/book/2</a></p>
<p>gem -v : would give the version</p>
<p>gem list &#8211;local : list of all gems in the system with thier version number.if there was 2 version then it would give them in descending order</p>
<p>gem outdated : would give list of gems which are outdate</p>
<p>gem update : would update all the gems.</p>
<p>gem update &#8211;include-dependencies &#8211;no-rdoc</p>
<p>&nbsp;</p>
<p>gem cleanup : would clean the older version when there are 2 version available</p>
<p>gem uninstall y4mr : would uninstall that gem</p>
<p>gem install &#8211;remote y4mr : would install that gem from the remote repository&#8230;</p>
<p>gem install -v=2.0.2 rails would install a particular version of rails</p>
<p>gem dependency rails : would list all the dependencies for a gem</p>
<p>gem query -n &#8216;rai.*&#8217; : (-n &#8212;&gt; regular expression ) would query the gem which matches in thier name . you can make it remote by say &#8211;remote</p>
<p>gem unpack : would unpack all the gems to the rails/vendor/plugin</p>
<p>rails . : would get the new updated gems</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/chinnakarupan.wordpress.com/42/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/chinnakarupan.wordpress.com/42/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chinnakarupan.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chinnakarupan.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chinnakarupan.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chinnakarupan.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chinnakarupan.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chinnakarupan.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chinnakarupan.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chinnakarupan.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chinnakarupan.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chinnakarupan.wordpress.com/42/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=42&subd=chinnakarupan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chinnakarupan.wordpress.com/2008/04/20/ruby-gems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/182af385245a1b714f893a7289254658?s=96&#38;d=identicon" medium="image">
			<media:title type="html">chinnakarupan</media:title>
		</media:content>
	</item>
		<item>
		<title>$0 , __FILE__</title>
		<link>http://chinnakarupan.wordpress.com/2008/03/18/0-__file__/</link>
		<comments>http://chinnakarupan.wordpress.com/2008/03/18/0-__file__/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 19:24:39 +0000</pubDate>
		<dc:creator>chinnakarupan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chinnakarupan.wordpress.com/2008/03/18/0-__file__/</guid>
		<description><![CDATA[$0 is the file which load any other ruby file which is contained in __FILE__&#8230;.
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=41&subd=chinnakarupan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>$0 is the file which load any other ruby file which is contained in __FILE__&#8230;.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/chinnakarupan.wordpress.com/41/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/chinnakarupan.wordpress.com/41/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chinnakarupan.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chinnakarupan.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chinnakarupan.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chinnakarupan.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chinnakarupan.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chinnakarupan.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chinnakarupan.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chinnakarupan.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chinnakarupan.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chinnakarupan.wordpress.com/41/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=41&subd=chinnakarupan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chinnakarupan.wordpress.com/2008/03/18/0-__file__/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/182af385245a1b714f893a7289254658?s=96&#38;d=identicon" medium="image">
			<media:title type="html">chinnakarupan</media:title>
		</media:content>
	</item>
		<item>
		<title>Splat Operator in Ruby</title>
		<link>http://chinnakarupan.wordpress.com/2008/03/18/splat-operator-in-ruby/</link>
		<comments>http://chinnakarupan.wordpress.com/2008/03/18/splat-operator-in-ruby/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 19:08:51 +0000</pubDate>
		<dc:creator>chinnakarupan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chinnakarupan.wordpress.com/2008/03/18/splat-operator-in-ruby/</guid>
		<description><![CDATA[* is called the splat operator in ruby .The first time you come across is for variable argument.that is exactly what you will be using it for.it should be used as the last argument.
name,*rest_of_address = address[]
would put the first argument to name and rest to the * argument&#8230;
THe other thing about it is it gives [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=40&subd=chinnakarupan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>* is called the splat operator in ruby .The first time you come across is for variable argument.that is exactly what you will be using it for.it should be used as the last argument.</p>
<p>name,*rest_of_address = address[]</p>
<p>would put the first argument to name and rest to the * argument&#8230;</p>
<p>THe other thing about it is it gives a copy of the variable not the reference&#8230;.</p>
<p>what you can do with this on Struct and Hash is split it&#8230;.using splat as an array and get it individual&#8230;</p>
<p>you can use even in the case statement..to check the equal to</p>
<p>and *array passed on to the other array will flatten it..</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/chinnakarupan.wordpress.com/40/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/chinnakarupan.wordpress.com/40/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chinnakarupan.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chinnakarupan.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chinnakarupan.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chinnakarupan.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chinnakarupan.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chinnakarupan.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chinnakarupan.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chinnakarupan.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chinnakarupan.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chinnakarupan.wordpress.com/40/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=40&subd=chinnakarupan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chinnakarupan.wordpress.com/2008/03/18/splat-operator-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/182af385245a1b714f893a7289254658?s=96&#38;d=identicon" medium="image">
			<media:title type="html">chinnakarupan</media:title>
		</media:content>
	</item>
		<item>
		<title>Structures in Ruby</title>
		<link>http://chinnakarupan.wordpress.com/2008/03/18/structures-in-ruby/</link>
		<comments>http://chinnakarupan.wordpress.com/2008/03/18/structures-in-ruby/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 18:55:18 +0000</pubDate>
		<dc:creator>chinnakarupan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chinnakarupan.wordpress.com/2008/03/18/structures-in-ruby/</guid>
		<description><![CDATA[If you wanted just a storage variable in terms of big structure with no code on them .The best way is to call Struct.new followed by what ever structure fields  you want on them.Once the structure is created you can create a new on it by just calling the name of the Structure .new [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=39&subd=chinnakarupan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you wanted just a storage variable in terms of big structure with no code on them .The best way is to call Struct.new followed by what ever structure fields  you want on them.Once the structure is created you can create a new on it by just calling the name of the Structure .new and intialize all the fields in it.You can directly access all the fields directly on it&#8230;</p>
<p>to perform some operations on it&#8230;.</p>
<p>class Symbol<br />
  def to_proc<br />
    Proc.new { |*args| args.shift.__send__(self, *args) }<br />
  end<br />
end</p>
<p>PhoneNumber = Struct.new :area_code<br />
*phone_numbers = PhoneNumber.new(904), PhoneNumber.new(646), PhoneNumber.new(616)<br />
area_codes = phone_numbers.collect &amp;:area_code #=&gt; [904, 646, 616]</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/chinnakarupan.wordpress.com/39/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/chinnakarupan.wordpress.com/39/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chinnakarupan.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chinnakarupan.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chinnakarupan.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chinnakarupan.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chinnakarupan.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chinnakarupan.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chinnakarupan.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chinnakarupan.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chinnakarupan.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chinnakarupan.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=39&subd=chinnakarupan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chinnakarupan.wordpress.com/2008/03/18/structures-in-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/182af385245a1b714f893a7289254658?s=96&#38;d=identicon" medium="image">
			<media:title type="html">chinnakarupan</media:title>
		</media:content>
	</item>
		<item>
		<title>Ruby &#8211; Date/Time</title>
		<link>http://chinnakarupan.wordpress.com/2008/03/13/ruby-datetime/</link>
		<comments>http://chinnakarupan.wordpress.com/2008/03/13/ruby-datetime/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 19:07:37 +0000</pubDate>
		<dc:creator>chinnakarupan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://chinnakarupan.wordpress.com/2008/03/13/ruby-datetime/</guid>
		<description><![CDATA[Time.now : will give the time now&#8230;
 %a &#8211; The abbreviated weekday name (&#8220;Sun&#8221;)
%A &#8211; The full weekday name (&#8220;Sunday&#8221;)
%b &#8211; The abbreviated month name (&#8220;Jan&#8221;)
%B &#8211; The full month name (&#8220;January&#8221;)
%c &#8211; The preferred local date and time representation
%d &#8211; Day of the month (01..31)
%H &#8211; Hour of the day, 24-hour clock (00..23)
%I &#8211; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=38&subd=chinnakarupan&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Time.now : will give the time now&#8230;</p>
<p> %a &#8211; The abbreviated weekday name (&#8220;Sun&#8221;)<br />
%A &#8211; The full weekday name (&#8220;Sunday&#8221;)<br />
%b &#8211; The abbreviated month name (&#8220;Jan&#8221;)<br />
%B &#8211; The full month name (&#8220;January&#8221;)<br />
%c &#8211; The preferred local date and time representation<br />
%d &#8211; Day of the month (01..31)<br />
%H &#8211; Hour of the day, 24-hour clock (00..23)<br />
%I &#8211; Hour of the day, 12-hour clock (01..12)<br />
%j &#8211; Day of the year (001..366)<br />
%m &#8211; Month of the year (01..12)<br />
%M &#8211; Minute of the hour (00..59)<br />
%p &#8211; Meridian indicator (&#8220;AM&#8221; or &#8220;PM&#8221;)<br />
%S &#8211; Second of the minute (00..60)<br />
%U &#8211; Week number of the current year,<br />
starting with the first Sunday as the first<br />
day of the first week (00..53)<br />
%W &#8211; Week number of the current year,<br />
starting with the first Monday as the first<br />
day of the first week (00..53)<br />
%w &#8211; Day of the week (Sunday is 0, 0..6)<br />
%x &#8211; Preferred representation for the date alone, no time<br />
%X &#8211; Preferred representation for the time alone, no date<br />
%y &#8211; Year without a century (00..99)<br />
%Y &#8211; Year with century<br />
%Z &#8211; Time zone name<br />
%% &#8211; Literal &#8220;%&#8221; character</p>
<p>t = Time.now<br />
<strong>t.strftime</strong>(&#8220;Printed on %m/%d/%Y&#8221;) #=&gt; &#8220;Printed on 04/09/2003&#8243;<br />
<strong>t.strftime(&#8220;at %I:%M%p&#8221;)</strong> #=&gt; &#8220;at 08:56AM&#8221;</p>
<p>to create a new time stamp Time.mktime(yyyy,mm,dd,hh,mm,ss)</p>
<p>commonly used methods are Time.year,month,day,wday,yday,hour,min,sec,zone or the cannonical time.</p>
<p>Time.ctime,Time.utc(universal time,GMT),Time.dst?(daylight saving time),</p>
<p>You can use the normal compare eql?/&lt;=&gt;/ subtracting(gives in terms of seconds)/ you can add seconds .say if you want add 24 hours you say Time.now + 24 * 60 * 60</p>
<p><strong><u>Date</u></strong></p>
<p>Date.today: to get today&#8217;s date</p>
<p>Date.new(yyyy,mm,dd)</p>
<p>commonly used are to_s,succ,next,leap, to add and subtract just use + / &#8211; (it will done in terms of days). to add /subtract months use &gt;&gt; / &lt;&lt;.</p>
<p>downto/upto methods can be used for countdowns on the date object using another date object as parameter.. d1.upto(d2){ |d| block }</p>
<p><strong>parsedate: require &#8220;parsedate.rb&#8221; p parsedate (&#8220;12/24/2008&#8243;)</strong></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/chinnakarupan.wordpress.com/38/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/chinnakarupan.wordpress.com/38/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chinnakarupan.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chinnakarupan.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chinnakarupan.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chinnakarupan.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chinnakarupan.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chinnakarupan.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chinnakarupan.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chinnakarupan.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chinnakarupan.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chinnakarupan.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chinnakarupan.wordpress.com&blog=1988799&post=38&subd=chinnakarupan&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chinnakarupan.wordpress.com/2008/03/13/ruby-datetime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/182af385245a1b714f893a7289254658?s=96&#38;d=identicon" medium="image">
			<media:title type="html">chinnakarupan</media:title>
		</media:content>
	</item>
	</channel>
</rss>