<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-20338611</id><updated>2024-03-08T14:20:24.275+05:30</updated><title type='text'>Rubyists in Pune</title><subtitle type='html'>Quick Ruby and Ruby on Rails</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default?alt=atom'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default?alt=atom&amp;start-index=26&amp;max-results=25'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>43</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-20338611.post-116108494674987829</id><published>2006-10-17T17:01:00.000+05:30</published><updated>2007-05-21T07:28:21.794+05:30</updated><title type='text'>Technorati: In top 50,000</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;Today, the &lt;b&gt;&lt;a href=&quot;http://rubylearning.com/&quot; &gt;Learning Ruby&lt;/a&gt;&lt;/b&gt; site was ranked 48,577 by Technorati. This is good news especially since the site&#39;s been &#39;live&#39; for only a month now.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;a href=&quot;http://www.puneruby.com/blog/images/2006/tech.jpg&quot; title=&quot;Learning Ruby&quot;&gt;&lt;img src=&quot;http://www.puneruby.com/blog/images/2006/tech.jpg&quot; alt=&quot;Learning Ruby&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;&lt;br /&gt;Rank 48,577 means that the number of blogs, plus one, that have more than 58 distinct blogs linking to them.&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Technorati:+In+top+50,000&quot; rel=&quot;tag&quot;&gt;Technorati: In top 50,000&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+Study+Notes&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+Tutorials&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+Resources&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F10%2Ftechnorati-in-top-50000.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/116108494674987829/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/116108494674987829' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/116108494674987829'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/116108494674987829'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/10/technorati-in-top-50000.html' title='Technorati: In top 50,000'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-116098441607010249</id><published>2006-10-16T13:01:00.000+05:30</published><updated>2006-10-16T13:12:21.746+05:30</updated><title type='text'>Socket Programming in Ruby</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;I have just published an article that explains how one can do &lt;b&gt;&lt;a href=&quot;http://sitekreator.com/satishtalim/socket_programming.html&quot; &gt;Socket Programming in Ruby&lt;/a&gt;&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;I had been searching the internet for some information on &lt;b&gt;Socket Programming in Ruby&lt;/b&gt;, but had not been successful. The article is a result of that. Do send me your feedback on how you found the article. Was it useful to you? I look forward to your inputs.&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Socket+Programming+in+Ruby&quot; rel=&quot;tag&quot;&gt;Socket Programming in Ruby&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F10%2Fsocket-programming-in-ruby.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/116098441607010249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/116098441607010249' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/116098441607010249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/116098441607010249'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/10/socket-programming-in-ruby.html' title='Socket Programming in Ruby'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-116096444999054836</id><published>2006-10-16T07:35:00.000+05:30</published><updated>2006-10-16T07:40:01.106+05:30</updated><title type='text'>The Ruby Edge</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;&lt;b&gt;&lt;a href=&quot;http://www.rubyedge.com/&quot; &gt;The Ruby Edge&lt;/a&gt;&lt;/b&gt; is a new community driven web site for Ruby and Ruby On Rails news, tips, tricks, tutorials, books, and jobs. It&#39;s a Digg&lt;br /&gt;style site with user voting, commenting, and categorization of user submissions.&lt;br /&gt;&lt;br /&gt;Please stop by and share your Ruby/Rails knowledge.&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/The+Ruby+Edge&quot; rel=&quot;tag&quot;&gt;The Ruby Edge&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F10%2Fruby-edge.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/116096444999054836/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/116096444999054836' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/116096444999054836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/116096444999054836'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/10/ruby-edge.html' title='The Ruby Edge'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-116054291350050618</id><published>2006-10-11T10:25:00.000+05:30</published><updated>2006-10-11T10:43:28.580+05:30</updated><title type='text'>Ruby Certification</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;The &lt;b&gt;&lt;a href=&quot;http://www.javablackbelt.com/QuestionnaireDefDisplay.wwa?questPublicId=01548&quot; &gt;JavaBlackBelt Certification Community&lt;/a&gt;&lt;/b&gt; has added a &lt;b&gt;Ruby - Basic Certification&lt;/b&gt; exam. recently. The objective of this certfication is:&lt;blockquote class=&quot;withline&quot;&gt;&lt;p&gt;To test knowledge of the language core syntax and OO concepts. You should understand that Ruby is a genuine object-oriented language and everything it manipulates with is objects. No specific API knowledge is required. Only the most frequently used built-in classes and methods are covered. The knowledge of any external libraries is not necessary. The given exam covers Ruby 1.8.x features and syntax.&lt;/p&gt;&lt;/blockquote&gt;After completing the free, web-based course &lt;b&gt;&lt;a href=&quot;http://sitekreator.com/satishtalim/index.html&quot; &gt;Learning Ruby&lt;/a&gt;&lt;/b&gt;, it would be beneficial for you to give this test. All the best.&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Ruby+Certification&quot; rel=&quot;tag&quot;&gt;Ruby Certification&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/116054291350050618/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/116054291350050618' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/116054291350050618'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/116054291350050618'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/10/ruby-certification.html' title='Ruby Certification'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115216322540961713</id><published>2006-10-09T10:59:00.000+05:30</published><updated>2007-05-21T07:35:18.492+05:30</updated><title type='text'>Free Study Notes on Ruby</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;I have created a small pdf version of my &lt;b&gt;Ruby&lt;/b&gt; study notes. This can be downloaded from &lt;b&gt;&lt;a href=&quot;http://rubylearning.com/download/downloads.html&quot;&gt;here&lt;/a&gt;&lt;/b&gt;. I am hopeful that it would be useful for students making a shift to &lt;b&gt;Ruby / Rails&lt;/b&gt; and as always feedback and corrections are welcome in the comments. &lt;p&gt;The entire &lt;b&gt;Learning Ruby&lt;/b&gt; courseware is available online &lt;b&gt;&lt;a href=&quot;http://rubylearning.com/&quot; &gt;here&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Free+Study+Notes+on+Ruby&quot; rel=&quot;tag&quot;&gt;Free Study Notes on Ruby&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F07%2Ffree-study-notes-on-ruby-rails.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115216322540961713/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115216322540961713' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115216322540961713'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115216322540961713'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/10/free-study-notes-on-ruby.html' title='Free Study Notes on Ruby'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115829359202007348</id><published>2006-09-15T09:37:00.000+05:30</published><updated>2006-10-03T12:01:47.086+05:30</updated><title type='text'>Free Web-based Ruby Course</title><content type='html'>&lt;div&gt;&lt;p&gt;The free, web-based Ruby course being conducted at the &lt;b&gt;&lt;a href=&quot;http://puneruby.com/forum/viewtopic.php?t=29&quot; &gt;PuneRuby forum&lt;/a&gt;&lt;/b&gt; has been a great success. Participants are from all over the world. What&#39;s nice about this course is that anyone can join anytime and go thro&#39; the topics at their own pace. There&#39;s always a live instructor to help you out with your problems.&lt;/p&gt;&lt;p&gt;The entire &lt;b&gt;Learning Ruby&lt;/b&gt; course is now available online &lt;b&gt;&lt;a href=&quot;http://sitekreator.com/satishtalim/index.html&quot; &gt;here&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;&lt;p&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115829359202007348/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115829359202007348' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115829359202007348'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115829359202007348'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/09/free-web-based-ruby-course.html' title='Free Web-based Ruby Course'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115292428978638891</id><published>2006-07-15T06:12:00.000+05:30</published><updated>2006-07-15T06:19:21.676+05:30</updated><title type='text'>Generate RSS Feed</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;&lt;a href=&quot;mailto:neha120@yahoo.com&quot;&gt;&lt;br /&gt;Neha Gupta&lt;/a&gt; has submitted this Ruby code snippet:&lt;pre class=&quot;javacode&quot;&gt;xml.rss(:class =&amp;gt; &quot;Recipe&quot;, :version =&amp;gt; &quot;x.x&quot;, :xmlns&lt;br /&gt;=&amp;gt; &quot;www.codewalla.com&quot;) do&lt;br /&gt;xml.channel do&lt;br /&gt;@Recipes = Recipe.find_all&lt;br /&gt;xml.title(&quot;List of Recipes  -- Total &quot;, Recipe.count,&lt;br /&gt;&quot; recipes&quot;)&lt;br /&gt;xml.link&lt;br /&gt;xml.description&lt;br /&gt;xml.RecipesAuthor(&quot;CodeWalla&quot;)&lt;br /&gt;@Recipes.each do |item|&lt;br /&gt;xml.item do&lt;br /&gt;xml.Title(item.title)&lt;br /&gt;xml.link&lt;br /&gt;xml.author(&quot;CodeWalla&quot;)&lt;br /&gt;xml.desciption(item.description)&lt;br /&gt;xml.date(item.date)&lt;br /&gt;xml.category(item.category.name)&lt;br /&gt;end&lt;br /&gt;end&lt;br /&gt;end&lt;br /&gt;end&lt;/pre&gt;The above code is made to generate a rss feed of a particular table from a database. Here, Recipe is a table name and item is the variable in m used to store one recipe temporarily, to display its contents. This code needs to be stored in .rxml file.&lt;br /&gt;Eg: D:/Copy of rails/cookbook/app/views/actor/index.rxml&lt;br /&gt;&lt;br /&gt;It can be invoked by:&lt;br /&gt;http://localhost:3000/actor/index.rxml&lt;br /&gt;&lt;br /&gt;The output of the code is:&lt;pre class=&quot;javacode&quot;&gt;&amp;lt;rss xmlns=&quot;www.codewalla.com&quot; version=&quot;x.x&quot; class=&quot;Recipe&quot;&amp;gt;&lt;br /&gt;  &amp;lt;channel&amp;gt;&lt;br /&gt;    &amp;lt;title&amp;gt;List of Recipes  -- Total 4 recipes&amp;lt;/title&amp;gt;&lt;br /&gt;    &amp;lt;link/&amp;gt;&lt;br /&gt;    &amp;lt;description/&amp;gt;&lt;br /&gt;    &amp;lt;RecipesAuthor&amp;gt;CodeWalla&amp;lt;/RecipesAuthor&amp;gt;&lt;br /&gt;    &amp;lt;item&amp;gt;&lt;br /&gt;      &amp;lt;Title&amp;gt;codewal;l&amp;lt;/Title&amp;gt;&lt;br /&gt;      &amp;lt;link/&amp;gt;&lt;br /&gt;      &amp;lt;author&amp;gt;CodeWalla&amp;lt;/author&amp;gt;&lt;br /&gt;      &amp;lt;desciption&amp;gt;&amp;lt;/desciption&amp;gt;&lt;br /&gt;      &amp;lt;date&amp;gt;&amp;lt;/date&amp;gt;&lt;br /&gt;      &amp;lt;category&amp;gt;Dessert&amp;lt;/category&amp;gt;&lt;br /&gt;    &amp;lt;/item&amp;gt;&lt;br /&gt;    &amp;lt;item&amp;gt;&lt;br /&gt;      &amp;lt;Title&amp;gt;bbbbbbbbbbbbbb&amp;lt;/Title&amp;gt;&lt;br /&gt;      &amp;lt;link/&amp;gt;&lt;br /&gt;      &amp;lt;author&amp;gt;CodeWalla&amp;lt;/author&amp;gt;&lt;br /&gt;      &amp;lt;desciption&amp;gt;bbbbbbbbbbbbbb&amp;lt;/desciption&amp;gt;&lt;br /&gt;      &amp;lt;date&amp;gt;2006-05-04&amp;lt;/date&amp;gt;&lt;br /&gt;      &amp;lt;category&amp;gt;Starters&amp;lt;/category&amp;gt;&lt;br /&gt;    &amp;lt;/item&amp;gt;&lt;br /&gt;    &amp;lt;item&amp;gt;&lt;br /&gt;      &amp;lt;Title&amp;gt;dsfhsjdflk&amp;lt;/Title&amp;gt;&lt;br /&gt;      &amp;lt;link/&amp;gt;&lt;br /&gt;      &amp;lt;author&amp;gt;CodeWalla&amp;lt;/author&amp;gt;&lt;br /&gt;      &amp;lt;desciption&amp;gt;;kkb;k&amp;lt;/desciption&amp;gt;&lt;br /&gt;      &amp;lt;date&amp;gt;2006-05-04&amp;lt;/date&amp;gt;&lt;br /&gt;      &amp;lt;category&amp;gt;Starters&amp;lt;/category&amp;gt;&lt;br /&gt;    &amp;lt;/item&amp;gt;&lt;br /&gt;    &amp;lt;item&amp;gt;&lt;br /&gt;      &amp;lt;Title&amp;gt;Ice Tea&amp;lt;/Title&amp;gt;&lt;br /&gt;      &amp;lt;link/&amp;gt;&lt;br /&gt;      &amp;lt;author&amp;gt;CodeWalla&amp;lt;/author&amp;gt;&lt;br /&gt;      &amp;lt;desciption&amp;gt;Good !!!&amp;lt;/desciption&amp;gt;&lt;br /&gt;      &amp;lt;date&amp;gt;2006-05-04&amp;lt;/date&amp;gt;&lt;br /&gt;      &amp;lt;category&amp;gt;Dessert&amp;lt;/category&amp;gt;&lt;br /&gt;    &amp;lt;/item&amp;gt;&lt;br /&gt;  &amp;lt;/channel&amp;gt;&lt;br /&gt;&amp;lt;/rss&amp;gt;&lt;/pre&gt;Kindly comment on this code.&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Generate+RSS+Feed&quot; rel=&quot;tag&quot;&gt;Generate RSS Feed&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+Code+Snippet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F07%2Fgenerate-rss-feed.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115292428978638891/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115292428978638891' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115292428978638891'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115292428978638891'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/07/generate-rss-feed.html' title='Generate RSS Feed'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115285154406934769</id><published>2006-07-14T10:01:00.000+05:30</published><updated>2006-07-14T10:04:58.283+05:30</updated><title type='text'>July 2006 PuneRuby meet</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;The PuneRuby meet is fixed for this Sunday, 16th July 2006 at 17.00 hrs. The venue, as usual, is SICSR, Model Colony, Pune. The speakers are:&lt;br /&gt;&lt;br /&gt;a. &lt;b&gt;Shashank Date&lt;/b&gt; - President of Reevik Inc, Kansas, USA. Has an overall experience of 19 years in IT. A known name in the Ruby world, one of the programmers of the Ruby&#39;s one-click installer, and is one of the early adopters of Rails.&lt;br /&gt;&lt;br /&gt;b. &lt;b&gt;Dibya Prakash&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Anyone else interested in speaking kindly let me know asap, the topic and your background.&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/July+2006+PuneRuby+meet&quot; rel=&quot;tag&quot;&gt;July 2006 PuneRuby meet&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F07%2Fjuly-2006-puneruby-meet.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115285154406934769/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115285154406934769' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115285154406934769'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115285154406934769'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/07/july-2006-puneruby-meet.html' title='July 2006 PuneRuby meet'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115278402689841691</id><published>2006-07-13T15:16:00.000+05:30</published><updated>2006-07-13T15:18:17.983+05:30</updated><title type='text'>Validation in Rails</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;Let&#39;s try our hand at some validation. No participant should be allowed in the database if it has an empty text field or an invalid URL for the blog_url. So, where do we put the validation? The model layer is the gatekeeper between the world of code and the database. Nothing to do with our application comes out of the database or gets stored back into the database that doesn&#39;t first go through the model.&lt;br /&gt;&lt;br /&gt;This makes it an ideal place to put all validation; it doesn&#39;t matter whether the data comes from a form or from some programmatic manipulation in our application. If the model checks it before writing to the database, then the database will be protected from bad data.&lt;br /&gt;&lt;br /&gt;Let&#39;s look at the source code of the model class (in app/models/participant.rb).&lt;pre class=&quot;javacode&quot;&gt;class Participant &amp;lt; ActiveRecord::Base&lt;br /&gt;end&lt;/pre&gt;Not much to it, is there? All of the database mapping, creating, updating, searching, and so on is done in the parent class (ActiveRecord::Base, a part of Rails). Because of the joys of inheritance, our Participant class gets all of that functionality automatically.&lt;br /&gt;&lt;br /&gt;Let&#39;s start by validating that the text fields all contain something before a row is written to the database. We do this by adding some code to the existing model, as follows:&lt;br /&gt;&lt;pre class=&quot;javacode&quot;&gt;class Participant &amp;lt; ActiveRecord::Base&lt;br /&gt;  validates_presence_of :name, :city, :blog_url&lt;br /&gt;end&lt;/pre&gt;The &lt;code&gt;validates_presence_of( )&lt;/code&gt; method is a standard Rails validator. It checks that a given field, or set of fields, is present and its contents are not empty. The &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/doc/e14505ba-6c63-4c1c-93a1-06b3a5d69081/ScreenShot.jpg&quot;&gt;screen shot&lt;/a&gt;&lt;/b&gt;, shows what happens if we try to submit a new product with none of the fields filled in. It&#39;s pretty impressive: the fields with errors are highlighted, and the errors are summarized in a nice list at the top of the form. Not bad for one line of code. You might also have noticed that after editing the participant.rb file you didn&#39;t have to restart the application to test your changes. Rails notices that the files have been changed and reloads them into the application. This is a tremendous productivity boost when developing.&lt;br /&gt;&lt;br /&gt;We also want to make sure that each partcipant has a unique blog_url. One more line in the Participant model will do this. The uniqueness validation will perform a simple check to ensure that no other row in the participants table has the same blog_url as the row we&#39;re about to save.&lt;br /&gt;&lt;code&gt;validates_uniqueness_of :blog_url&lt;/code&gt;&lt;p&gt;&lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/learn-rubyrails-with-me.html&quot;&gt;First Post&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/07/rails-and-database-tables.html&quot;&gt;Previous&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/&quot;&gt;Next&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Validation+in+Rails&quot; rel=&quot;tag&quot;&gt;Validation in Rails&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F07%2Fvalidation-in-rails.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115278402689841691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115278402689841691' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115278402689841691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115278402689841691'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/07/validation-in-rails.html' title='Validation in Rails'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115274778939101296</id><published>2006-07-13T05:11:00.000+05:30</published><updated>2006-07-13T05:21:58.450+05:30</updated><title type='text'>Adding a Missing Column</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;Let&#39;s say we  decide that our participants table needs an additional column for storing the participant&#39;s blog URL. This means we&#39;ll need to add a column to the database table, and we&#39;ll need to make sure that the various maintenance pages are updated to add support for this new column. Let&#39;s alter the file db/create.sql, adding the blog_url column. Let&#39;s save this file as &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/doc/ab305432-aee1-4f2a-8dd6-59cfc0aa6fbf/create2.sql&quot;&gt;create2.sql&lt;/a&gt;&lt;/b&gt; as shown here:&lt;pre class=&quot;javacode&quot;&gt;drop table if exists participants;&lt;br /&gt;create table participants (&lt;br /&gt;  id int not null auto_increment,&lt;br /&gt;  name varchar(100) not null,&lt;br /&gt;  city text not null,&lt;br /&gt;  blog_url varchar(200) not null,&lt;br /&gt;  primary key (id)&lt;br /&gt;);&lt;/pre&gt;When I first created this file, I added a drop table command at the top of it. This now allows us to create a new (empty) schema instance with the command:&lt;br /&gt;c:/rails/work/student&gt;&lt;code&gt;mysql student &amp;lt;db/create2.sql&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Obviously, this approach only works if there isn&#39;t important data already in the database table (as dropping the table wipes out the data it contains). That&#39;s fine during development, but in production we&#39;d need to be careful.&lt;br /&gt;&lt;br /&gt;The schema has changed, so our scaffold code is now out-of-date. As we&#39;ve made no changes to the code, it&#39;s safe to regenerate it. Notice that the generate script prompts us when it&#39;s about to overwrite a file. We type &lt;code&gt;Y&lt;/code&gt; to indicate that it can overwrite all files. The command is:&lt;br /&gt;c:/rails/work/student&gt;&lt;code&gt;ruby script/generate scaffold Participant Admin&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;You can now enter the new data and the screen should look like &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/doc/8f7094ae-222a-4b83-bd30-011bde18415e/Screen2.jpg&quot;&gt;this&lt;/a&gt;&lt;/b&gt;.&lt;p&gt;&lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/learn-rubyrails-with-me.html&quot;&gt;First Post&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/07/configuring-application.html&quot;&gt;Previous&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/&quot;&gt;Next&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Adding+a+Missing+Column&quot; rel=&quot;tag&quot;&gt;Adding a Missing Column&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F07%2Fadding-missing-column.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115274778939101296/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115274778939101296' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115274778939101296'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115274778939101296'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/07/adding-missing-column.html' title='Adding a Missing Column'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115269076170005399</id><published>2006-07-12T13:22:00.000+05:30</published><updated>2006-07-13T05:24:33.296+05:30</updated><title type='text'>Configuring the Application</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;Rails uses a flat file located in &lt;code&gt;config/database.yml&lt;/code&gt; to store the information on how to connect to the database. This file should be edited to look like this:&lt;pre class=&quot;javacode&quot;&gt;# MySQL (default setup).  Versions 4.1 and 5.0 are recommended.&lt;br /&gt;#&lt;br /&gt;# Install the MySQL driver:&lt;br /&gt;#   gem install mysql&lt;br /&gt;# On MacOS X:&lt;br /&gt;#   gem install mysql -- --include=/usr/local/lib&lt;br /&gt;# On Windows:&lt;br /&gt;#   There is no gem for Windows.  Install mysql.so from RubyForApache.&lt;br /&gt;#   http://rubyforge.org/projects/rubyforapache&lt;br /&gt;#&lt;br /&gt;# And be sure to use new-style password hashing:&lt;br /&gt;#   http://dev.mysql.com/doc/refman/5.0/en/old-client.html&lt;br /&gt;development:&lt;br /&gt;  adapter: mysql&lt;br /&gt;  database: student&lt;br /&gt;  username:&lt;br /&gt;  password:&lt;br /&gt;  host: localhost&lt;br /&gt;&lt;br /&gt;# Warning: The database defined as &#39;test&#39; will be erased and&lt;br /&gt;# re-generated from your development database when you run &#39;rake&#39;.&lt;br /&gt;# Do not set this db to the same as development or production.&lt;br /&gt;test:&lt;br /&gt;  adapter: mysql&lt;br /&gt;  database: student_test&lt;br /&gt;  username: root&lt;br /&gt;  password:&lt;br /&gt;  host: localhost&lt;br /&gt;&lt;br /&gt;production:&lt;br /&gt;  adapter: mysql&lt;br /&gt;  database: student_production&lt;br /&gt;  username: root&lt;br /&gt;  password:&lt;br /&gt;  host: localhost&lt;/pre&gt;&lt;br /&gt;Now let us write the maintenance application. In a command window type:&lt;br /&gt;c:/rails/work/student&gt;&lt;code&gt;ruby script/generate scaffold Participant Admin&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;That single command has written a basic maintenance application. The Participant parameter told the command the name of the model we want, and the Admin parameter specifies the name of the controller. Let&#39;s try our application. First, we&#39;ll start a local WEBrick-based web server, supplied with Rails. Let&#39;s connect to it. Remember, the URL we give to our browser contains both the port number (3000) and the name of the controller in lowercase (admin) ie. http://localhost:3000/admin&lt;br /&gt;&lt;br /&gt;It&#39;s showing us a list of participants, and there aren&#39;t any participants. Let&#39;s remedy that. Click the New participant link, and a form should appear. Fill in the details and click on the Create button, you should see the new participant in the list. &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/doc/4d905b15-430f-4a2d-ab89-b1285652086d/Screen.jpg&quot;&gt;See the screenshot&lt;/a&gt;&lt;/b&gt;. The User Interface is not good, but it works. We can show this to our client for his/her approval. The client can  play with the other links (showing details, editing existing participants etc.).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Rails Scaffolds&lt;/b&gt;&lt;br /&gt;A Rails scaffold is an autogenerated framework for manipulating a model. When we run the generator, we tell it that we want a scaffold for a particular model (which it creates) and that we want to access it through a given controller (which it also creates). In Rails, a model is automatically mapped to a database table whose name is the plural form of the model&#39;s class. In our case, we asked for a model called Participant, so Rails associated it with the table called participants. And how did it find that table? We told it where to look when we set up the development entry in config/database.yml. When we started the application, the model examined the table in the database, worked out what columns it had, and created mappings between the database data and Ruby objects. We created the participant maintenance scaffolding in the Admin controller, which is why the URL that accesses it has admin at the start of its path. The scaffold is the starting point of an application, not a finished application. And we&#39;re about to make use of that fact as we move on to the next iteration in our project.&lt;p&gt;&lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/learn-rubyrails-with-me.html&quot;&gt;First Post&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/07/rails-and-database-tables.html&quot;&gt;Previous&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/07/adding-missing-column.html&quot;&gt;Next&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Configuring+the+Application&quot; rel=&quot;tag&quot;&gt;Configuring the Application&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F07%2Fconfiguring-application.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115269076170005399/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115269076170005399' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115269076170005399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115269076170005399'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/07/configuring-application.html' title='Configuring the Application'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115259657462181757</id><published>2006-07-11T11:10:00.000+05:30</published><updated>2006-07-13T05:26:35.046+05:30</updated><title type='text'>Rails and Database Tables</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;We shall now create a web interface that lets us maintain a student database - create new student records, edit existing student records, delete unwanted ones, and so on. We&#39;ll develop this application in small iterations. We&#39;ll start off by creating a new Rails application. This is where we&#39;ll be doing all our work. Next, we&#39;ll create a database to hold our information.&lt;br /&gt;&lt;br /&gt;Open a command window and navigate to our folder &#39;work&#39; where the path on my machine is c:/rails/work Switch to the work folder and use the rails command to create an application called student, as follows.&lt;br /&gt;c:/rails/work&gt;&lt;code&gt;rails student&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Create the database student&lt;/b&gt;&lt;br /&gt;In a command window type:&lt;br /&gt;c:/rails/work/student&gt;&lt;code&gt;mysql -uroot&lt;/code&gt;&lt;br /&gt;You should now get a mysql prompt. Next at the mysql prompt, type as follows:&lt;br /&gt;mysql&gt;&lt;code&gt;create database student;&lt;/code&gt;&lt;br /&gt;It will respond with:&lt;br /&gt;&lt;code&gt;Query OK, 1 row affected (0.00 sec)&lt;/code&gt;&lt;br /&gt;Next, on the mysql prompt, type:&lt;br /&gt;&lt;code&gt;mysql&gt;grant all on student.* to &#39;root&#39;@&#39;localhost&#39;;&lt;/code&gt;&lt;br /&gt;Then type:&lt;br /&gt;mysql&gt;&lt;code&gt;exit&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Let&#39;s write the Data Definition Language (DDL) for creating the student table in MySQL. Your application student has a sub folder db where we shall store this file &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/doc/1e887bfa-76e4-4b32-b6a1-fd3d1c9e5809/create.sql&quot;&gt;create.sql&lt;/a&gt;&lt;/b&gt;&lt;pre class=&quot;javacode&quot;&gt;drop table if exists participants;&lt;br /&gt;create table participants (&lt;br /&gt;  id int not null auto_increment,&lt;br /&gt;  name varchar(100) not null,&lt;br /&gt;  city text not null,&lt;br /&gt;  primary key (id)&lt;br /&gt;);&lt;/pre&gt;Rails assumes that every table it handles has as its primary key an integer column called &lt;code&gt;id&lt;/code&gt; Internally, Rails uses the value in this column to keep track of the data it has loaded from the database and to link between data in different tables.&lt;br /&gt;&lt;br /&gt;Now use the mysql client to execute the DDL and create the table in our student database. Type:&lt;br /&gt;c:/rails/work/student&gt;&lt;code&gt;mysql student &amp;lt;db/create.sql&lt;/code&gt;&lt;br /&gt;This would have created our &lt;code&gt;participants&lt;/code&gt; table.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Rails Naming Convention&lt;/b&gt;&lt;br /&gt;Rails assumes that:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;database table names, like variable names, have lowercase letters and underscores between the words.&lt;/li&gt;&lt;li&gt;table names are always plural.&lt;/li&gt;&lt;li&gt;files are named in lowercase with underscores.&lt;/li&gt;&lt;/ul&gt;Rails uses this knowledge of naming conventions to convert names automatically. For example, your application might contain a model class that handles line items. You&#39;d define the class using the Ruby naming convention, calling it LineItem. From this name, Rails would automatically deduce the following.&lt;ul&gt;&lt;li&gt;That the corresponding database table will be called line_items. That&#39;s the class name, converted to lowercase, with underscores between the words and pluralized.&lt;/li&gt;&lt;li&gt;Rails would also know to look for the class definition in a file called line_item.rb (in the app/models directory).&lt;/li&gt;&lt;/ul&gt;Rails controllers have additional naming conventions. If our application has a store controller, then the following happens.&lt;ul&gt;&lt;li&gt;Rails assumes the class is called StoreController and that it&#39;s in a file named store_controller.rb in the app/controllers directory.&lt;/li&gt;&lt;li&gt;It also assumes there&#39;s a helper module named StoreHelper in the file store_helper.rb located in the app/helpers directory.&lt;/li&gt;&lt;li&gt;It will look for view templates for this controller in the app/views/store directory.&lt;/li&gt;&lt;li&gt;It will by default take the output of these views and wrap them in the layout template contained in store.rhtml or store.rxml in the directory app/views/layouts.&lt;/li&gt;&lt;/ul&gt;Rails helps by giving you most of the configuration for free if you follow the standard conventions.&lt;p&gt;&lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/learn-rubyrails-with-me.html&quot;&gt;First Post&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/07/hello-puneruby-from-rails.html&quot;&gt;Previous&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/07/configuring-application.html&quot;&gt;Next&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Rails+and+Database+Tables&quot; rel=&quot;tag&quot;&gt;Rails and Database Tables&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F07%2Frails-and-database-tables.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115259657462181757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115259657462181757' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115259657462181757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115259657462181757'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/07/rails-and-database-tables.html' title='Rails and Database Tables'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115243548946914685</id><published>2006-07-09T14:26:00.000+05:30</published><updated>2006-07-13T05:28:22.463+05:30</updated><title type='text'>Hello, PuneRuby from Rails</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;Rails being an MVC framework, accepts incoming requests from a browser, decodes the request to find a controller, and calls an action method in that controller. The controller then invokes a particular view to display the results back to the user. Rails takes care of most of the internal plumbing that links all these things together. To write our simple Hello, PuneRuby application, we need code for a controller and a view. We don&#39;t need code for a model, as we&#39;re not dealing with any data.&lt;br /&gt;&lt;br /&gt;Let&#39;s use a generator script to create a new controller for our application. This command is called &lt;b&gt;generate&lt;/b&gt;, and it lives in the script subdirectory of the demo folder we created. Let&#39;s create a controller called &lt;i&gt;Say&lt;/i&gt; as follows:&lt;br /&gt;c:/rails/work/demo&gt;&lt;code&gt;ruby script/generate controller Say&lt;/code&gt;&lt;br /&gt;The source file we&#39;ll be interested in is the controller. You&#39;ll find the file &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/doc/3d5df717-52b4-4fe7-bcc8-5b7de784dcf3/say_controller.rb&quot;&gt;say_controller.rb&lt;/a&gt;&lt;/b&gt; in the folder:&lt;br /&gt;&lt;code&gt;app/controllers/say_controller.rb&lt;/code&gt;. Let&#39;s have a look at it.&lt;pre class=&quot;javacode&quot;&gt;class SayController &amp;lt; ApplicationController&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;SayController is an empty class that inherits from ApplicationController, so it automatically gets all the default controller behavior. We need to add some code to have our controller handle the incoming request. What does this code have to do? For now, it&#39;ll do nothing - we simply need an empty action method. Let&#39;s add an action called hello to our say controller. Adding a hello action means creating a method called hello in the class SayController. A controller&#39;s job is to set up things so that the view knows what to display. In our first application, there&#39;s nothing to set up, so an empty action will work fine. Modify say_controller.rb as follow:&lt;pre class=&quot;javacode&quot;&gt;class SayController &amp;lt; ApplicationController&lt;br /&gt; def hello&lt;br /&gt; end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;Now let&#39;s try calling it. Find a browser window, and navigate to the URL:&lt;br /&gt;http://localhost:3000/say/hello.&lt;br /&gt;You will see in your browser, a message saying - &quot;Template is Missing.&quot; This happens because we created the controller class and the action method, but we haven&#39;t told Rails what to display.&lt;br /&gt;&lt;br /&gt;By default, Rails looks for templates in a file with the same name as the action it&#39;s handling. In our case, that means we need to create a file called &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/doc/9cc521d4-9179-463a-8b24-b577234824cd/hello.rhtml&quot;&gt;hello.rhtml&lt;/a&gt;&lt;/b&gt; in the folder:&lt;br /&gt;&lt;code&gt;app/views/say/hello.rhtml&lt;/code&gt; as follow:&lt;pre class=&quot;javacode&quot;&gt;&amp;lt;html&amp;gt;&lt;br /&gt;  &amp;lt;head&amp;gt;&lt;br /&gt;    &amp;lt;title&amp;gt;Hello, PuneRuby&amp;lt;/title&amp;gt;&lt;br /&gt;  &amp;lt;/head&amp;gt;&lt;br /&gt;  &amp;lt;body&amp;gt;&lt;br /&gt;    &amp;lt;h1&amp;gt;Hello from PuneRuby!&amp;lt;/h1&amp;gt;&lt;br /&gt;  &amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/pre&gt;Save the file hello.rhtml, and refresh your browser window. You should see it display our friendly greeting. Notice that we didn&#39;t have to restart the application to see the update. During development, Rails automatically integrates changes into the running application as you save files.&lt;br /&gt;&lt;br /&gt;The .rhtml suffix tells Rails to expand the content in the file using a system called ERb (for Embedded Ruby). ERb is a filter that takes an .rhtml file and outputs a transformed version. The output file is often HTML in Rails, but it can be anything. Normal content is passed through without being changed. However, content between &amp;lt;%= and %&amp;gt; is interpreted as Ruby code and executed. The result of that execution is converted into a string, and that value is substituted into the&lt;br /&gt;file in place of the &amp;lt;%=...%&amp;gt; sequence. Here&#39;s the modified &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/doc/c36b6045-a90c-4178-adfc-c8a552d8040d/hello1.rhtml&quot;&gt;hello1.rhtml&lt;/a&gt;&lt;/b&gt; file. In addition, stuff in rhtml between &amp;lt;% and %&amp;gt; (without an equals sign) is interpreted as Ruby code that is executed with no substitution back into the output. The interesting thing about this kind of processing, though, is that it can be intermixed with non-Ruby code. Refresh your browser to see the result.&lt;br /&gt;&lt;br /&gt;Let&#39;s see how we can link two pages. Add a bye method to the file say_controller.rb as follows:&lt;pre class=&quot;javacode&quot;&gt;class SayController &amp;lt; ApplicationController&lt;br /&gt;  def hello&lt;br /&gt;  end&lt;br /&gt;  def bye&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;and create the relevant &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/doc/a31c0a9d-fa0c-449b-a001-57307f4cec42/bye.rhtml&quot;&gt;bye.rhtml&lt;/a&gt;&lt;/b&gt; file as follows:&lt;pre class=&quot;javacode&quot;&gt;&amp;lt;html&amp;gt;&lt;br /&gt;  &amp;lt;head&amp;gt;&lt;br /&gt;    &amp;lt;title&amp;gt;Bye for now&amp;lt;/title&amp;gt;&lt;br /&gt;  &amp;lt;/head&amp;gt;&lt;br /&gt;  &amp;lt;body&amp;gt;&lt;br /&gt;    &amp;lt;h1&amp;gt;Bye for now&amp;lt;/h1&amp;gt;&lt;br /&gt;  &amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Fire up your browser again, but this time point to the new view using the URL&lt;br /&gt;http://localhost:3000/say/bye.&lt;br /&gt;&lt;br /&gt;Now we need to link the two screens together. We&#39;ll put a link on the hello screen that takes us to the bye screen, and vice versa. For now we&#39;ll use hyperlinks. Rails comes with a bunch of helper methods that can be used in view templates. Here, we&#39;ll use the helper method &lt;code&gt;link_to( )&lt;/code&gt;, which creates a hyperlink to an action. The file &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/doc/54b1a2a1-b5ea-4f06-ac4d-7a54f3067184/hello2.rhtml&quot;&gt;hello2.rhtml&lt;/a&gt;&lt;/b&gt; shows this:&lt;pre class=&quot;javacode&quot;&gt;&amp;lt;html&amp;gt;&lt;br /&gt;  &amp;lt;head&amp;gt;&lt;br /&gt;    &amp;lt;title&amp;gt;Hello, PuneRuby&amp;lt;/title&amp;gt;&lt;br /&gt;  &amp;lt;/head&amp;gt;&lt;br /&gt;  &amp;lt;body&amp;gt;&lt;br /&gt;    &amp;lt;h1&amp;gt;Hello from PuneRuby&amp;lt;/h1&amp;gt;&lt;br /&gt;  &amp;lt;!-- code added for third part of tutorial --&amp;gt;&lt;br /&gt;  &amp;lt;br /&amp;gt;&lt;br /&gt;  &amp;lt;br /&amp;gt;&lt;br /&gt;  &amp;lt;%= Time.now %&amp;gt;&lt;br /&gt;  &amp;lt;br /&amp;gt;&lt;br /&gt;  &amp;lt;p&amp;gt;&lt;br /&gt;   Time to say&lt;br /&gt;   &amp;lt;%= link_to &quot;Bye&quot;, :action =&amp;gt; &quot;bye&quot; %&amp;gt;&lt;br /&gt;  &amp;lt;/p&amp;gt;&lt;br /&gt;  &amp;lt;!-- code added for third part of tutorial --&amp;gt;&lt;br /&gt;  &amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;There&#39;s a link_to( ) call within an ERb &amp;lt;%=...%&amp;gt; sequence. This creates a link to a URL that will invoke the bye( ) action. The first parameter in the call to link_to( ) is the text to be displayed in the hyperlink, and the next parameter tells Rails to generate the link to the bye action. As we don&#39;t specify a controller, the current one will be used.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Assignment&lt;/u&gt;: Create a .rhtml page that links to our page hello2.rhtml Post your solution as comment to this blog post.&lt;p&gt;&lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/learn-rubyrails-with-me.html&quot;&gt;First Post&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/07/verifying-rails-installation.html&quot;&gt;Previous&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/07/rails-and-database-tables.html&quot;&gt;Next&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Hello,+PuneRuby+from+Rails&quot; rel=&quot;tag&quot;&gt;Hello, PuneRuby from Rails&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F07%2Fhello-puneruby-from-rails.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115243548946914685/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115243548946914685' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115243548946914685'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115243548946914685'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/07/hello-puneruby-from-rails.html' title='Hello, PuneRuby from Rails'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115197449230719503</id><published>2006-07-04T06:22:00.000+05:30</published><updated>2006-07-09T14:57:52.923+05:30</updated><title type='text'>Verifying Rails Installation</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;When you install the Rails framework, you also get a new command-line tool, &lt;code&gt;rails&lt;/code&gt;, which is used to construct each new Rails application that you write. The &lt;code&gt;rails&lt;/code&gt; command creates the right directory structure for you and populates it with some standard Rails code.&lt;br /&gt;&lt;br /&gt;We shall create a very small web application to verify our Rails installation.&lt;br /&gt;&lt;br /&gt;Open a command window and navigate to a place in your filesystem where you would want to create your application&#39;s directory structure. I am creating it in a folder called &lt;code&gt;work&lt;/code&gt; and the path on my machine is &lt;code&gt;c:/rails/work&lt;/code&gt; Switch to the &lt;code&gt;work&lt;/code&gt; folder and use the &lt;code&gt;rails&lt;/code&gt; command to create an application called &lt;code&gt;demo&lt;/code&gt;, as follows.&lt;br /&gt;c:/rails/work&gt;&lt;code&gt;rails demo&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;The command has created a directory named &lt;code&gt;demo&lt;/code&gt;. Within the &lt;code&gt;demo&lt;/code&gt; folder there are many other folders and files created for you. Amongst all of this, you will find a folder called &lt;code&gt;script&lt;/code&gt;, that contains some utility scripts that we will be using as we develop our application. For now, we will use the &lt;code&gt;server&lt;/code&gt; script that starts a stand-alone web server that can run our newly created Rail application under &lt;b&gt;WEBrick&lt;/b&gt; (this is a pure-Ruby web server that comes along with Ruby). So type the command:&lt;br /&gt;c:/rails/work/demo&gt;&lt;code&gt;ruby script/server&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;We have just started a web server at port 3000. We can now access the application by pointing a browser at http://localhost:3000&lt;br /&gt;You can press control-C to stop WEBrick.&lt;br /&gt;&lt;p&gt;&lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/learn-rubyrails-with-me.html&quot;&gt;First Post&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/07/ruby-on-rails-installation.html&quot;&gt;Previous&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/07/hello-puneruby-from-rails.html&quot;&gt;Next&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Verifying+Rails+Installation&quot; rel=&quot;tag&quot;&gt;Verifying Rails Installation&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F07%2Fverifying-rails-installation.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115197449230719503/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115197449230719503' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115197449230719503'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115197449230719503'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/07/verifying-rails-installation.html' title='Verifying Rails Installation'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115182587185734049</id><published>2006-07-02T13:06:00.000+05:30</published><updated>2006-07-11T18:47:23.906+05:30</updated><title type='text'>Ruby on Rails Installation</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;Armed with the elementary knowledge of Ruby gained so far, I am now going to explore &lt;b&gt;&lt;a href=&quot;http://www.rubyonrails.org/&quot;&gt;Ruby on Rails&lt;/a&gt;&lt;/b&gt;. &lt;b&gt;Rails&lt;/b&gt; is a full-stack, open-source web framework (support structure) in &lt;b&gt;Ruby&lt;/b&gt;, that closely follows the &lt;b&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Model-view-controller&quot;&gt;Model View Controller (MVC)&lt;/a&gt;&lt;/b&gt; architecture for writing real-world applications (Rails applications are written in Ruby) with less code and no cumbersome XML configuration files. Simply put, &lt;i&gt;Rails is an open source Ruby framework for developing database-backed web applications&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;To install &lt;b&gt;Ruby on Rails&lt;/b&gt; on Windows, we need to do the following:&lt;ul&gt;&lt;li&gt;Install Ruby 1.8.2 which we have already done.&lt;/li&gt;&lt;li&gt;Check whether you have RubyGems installed by typing &lt;code&gt;gem --version&lt;/code&gt; in a command window. We should have this too.&lt;/li&gt;&lt;li&gt;Now we&#39;ll use RubyGems to install Rails and a few things that Rails needs. &lt;u&gt;Ensure that your internet connection is active&lt;/u&gt;. In a command window, type &lt;code&gt;gem install rails --include-dependencies&lt;/code&gt;&lt;br /&gt;Congratulations! You are now on Rails.&lt;/li&gt;&lt;li&gt;There&#39;s one more step you have to perform before you can start development. Rails works with DB2, MySQL, Oracle, Postgres, SQL Server and SQLite databases. For all but MySQL, you will need to install a database driver, a library that Rails can use to connect to and use your database engine. Rails come with a built-in driver (written in pure Ruby) for MySQL databases. We shall use MySQL 4.1.8 and the installation instructions are in the file &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/doc/4fb50b64-ce5b-4f2d-8622-7a31d1001c04/mysqlsetup.doc&quot;&gt;mysqlsetup.doc&lt;/a&gt;&lt;/b&gt;.&lt;/li&gt;&lt;li&gt;To update our Rails is simple. In a Command window type: &lt;code&gt;gem update rails&lt;/code&gt; RubyGems will automatically update your Rails installation.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;I would like all the 42 participants to comment on this post, after they have installed Rails.&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/learn-rubyrails-with-me.html&quot;&gt;First Post&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/07/ruby-miscellanea.html&quot;&gt;Previous&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/07/verifying-rails-installation.html&quot;&gt;Next&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails+Installation&quot; rel=&quot;tag&quot;&gt;Ruby on Rails Installation&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F07%2Fruby-on-rails-installation.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115182587185734049/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115182587185734049' title='19 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115182587185734049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115182587185734049'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/07/ruby-on-rails-installation.html' title='Ruby on Rails Installation'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>19</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115181669617947160</id><published>2006-07-02T10:34:00.000+05:30</published><updated>2006-07-08T11:19:16.920+05:30</updated><title type='text'>Ruby Miscellanea</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;This is a Work-In-Progress and will cover Ruby Miscellanea topics but relevant to Ruby on Rails.&lt;br /&gt;&lt;ol class=&quot;lalpha&quot;&gt;&lt;li&gt;&lt;b&gt;&lt;u&gt;More on Constants&lt;/u&gt;:&lt;/b&gt;&lt;ul&gt;&lt;li&gt;Constants defined within a class or module may be accessed anywhere within the class or module.&lt;/li&gt;&lt;li&gt;Outside the class or module, they may be accessed using the scope operator, &lt;code&gt;::&lt;/code&gt; prefixed by an expression that returns the appropriate class or module.&lt;/li&gt;&lt;li&gt;Constants defined outside any class or module may be accessed as it is or by using the scope operator with no prefix.&lt;/li&gt;&lt;li&gt;Constants may &lt;u&gt;not&lt;/u&gt; be defined in methods.&lt;/li&gt;&lt;li&gt;Constants may be added to existing classes and modules from the outside by using the class or module name and the scope operator before the constant name. The program &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/doc/9f8ab6b2-b8de-484b-9a30-a020ad52a90e/Const.rb&quot;&gt;Const.rb&lt;/a&gt;&lt;/b&gt; shows all of this:&lt;br /&gt;&lt;pre class=&quot;javacode&quot;&gt;OUTER_CONST = 99&lt;br /&gt;&lt;br /&gt;class Const&lt;br /&gt; def get_const&lt;br /&gt;  CONST&lt;br /&gt; end&lt;br /&gt; CONST = OUTER_CONST + 1&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;puts Const.new.get_const&lt;br /&gt;puts Const::CONST&lt;br /&gt;puts ::OUTER_CONST&lt;br /&gt;puts Const::NEW_CONST = 123&lt;/pre&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;u&gt;&lt;b&gt;Modules&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;Modules are similar to classes in that they hold a collection of methods, constants, and other module and class definitions. Unlike classes, you cannot create objects based on modules.&lt;br /&gt;&lt;br /&gt;Modules serve two purposes:&lt;ul&gt;&lt;li&gt;First they act as &lt;u&gt;namespace&lt;/u&gt;, letting you define methods whose names will not clash with those defined elsewhere. The examples &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/doc/48bee37d-468b-447d-8c12-628b7380f7a4/MyTrig.rb&quot;&gt;MyTrig.rb&lt;/a&gt;&lt;/b&gt;, &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/doc/3be7864c-8ea8-49dc-99f5-3236619f5bd2/MyMoral.rb&quot;&gt;MyMoral.rb &lt;/a&gt;&lt;/b&gt; and &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/doc/eaad4c0f-123e-4511-8404-2d880f151559/UseModule.rb&quot;&gt;UseModule.rb&lt;/a&gt;&lt;/b&gt; illustrates this.&lt;pre class=&quot;javacode&quot;&gt;# MyTrig.rb&lt;br /&gt;module Trig&lt;br /&gt;  PI = 3.1416&lt;br /&gt;  # class methods&lt;br /&gt;  def Trig.sin(x)&lt;br /&gt;    # ...&lt;br /&gt;  end&lt;br /&gt;  def Trig.cos(x)&lt;br /&gt;    # ...&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;# MyMoral.rb&lt;br /&gt;module Moral&lt;br /&gt;  VERY_BAD = 0&lt;br /&gt;  BAD      = 1&lt;br /&gt;  def Moral.sin(badness)&lt;br /&gt;    # ...&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;# UseModule.rb&lt;br /&gt;require &#39;MyTrig&#39;&lt;br /&gt;require &#39;MyMoral&#39;&lt;br /&gt;y = Trig.sin(Trig::PI/4)&lt;br /&gt;wrongdoing = Moral.sin(Moral::VERY_BAD)&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;Second, they allow you to share functionality between classes - if a class &lt;u&gt;mixes in&lt;/u&gt; a module, that module’s instance methods become available as if they had been defined in the class. They get mixed in. The program &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/doc/61731dc1-6913-4621-a223-33fc4ba0b902/Mixins.rb&quot;&gt;Mixins.rb&lt;/a&gt;&lt;/b&gt; illustrates this:&lt;pre class=&quot;javacode&quot;&gt;# Mixins.rb&lt;br /&gt;module D&lt;br /&gt; def initialize(name)&lt;br /&gt;    @name =name&lt;br /&gt; end&lt;br /&gt;  def to_s&lt;br /&gt;  @name&lt;br /&gt; end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;module Debug&lt;br /&gt;  include D&lt;br /&gt; # Methods that act as queries are often&lt;br /&gt; # named with a trailing ?&lt;br /&gt; def who_am_i?&lt;br /&gt;  &quot;#{self.class.name} (\##{self.object_id}): #{self.to_s}&quot;&lt;br /&gt; end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;class Phonograph&lt;br /&gt; # the include statement simply makes a reference to a named module&lt;br /&gt; # If that module is in a separate file, use require to drag the file in&lt;br /&gt; # before using include&lt;br /&gt; include Debug&lt;br /&gt; # ...&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;class EightTrack&lt;br /&gt; include Debug&lt;br /&gt; # ...&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;ph = Phonograph.new(&quot;West End Blues&quot;)&lt;br /&gt;et = EightTrack.new(&quot;Real Pillow&quot;)&lt;br /&gt;puts ph.who_am_i?&lt;br /&gt;puts et.who_am_i?&lt;/pre&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;u&gt;Symbols&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;A symbol looks like a variable name but it’s prefixed with a colon. Examples: :action, :line_items. You can think of symbols as string literals that are magically turned into constants. Alternatively, you can consider the colon to mean &quot;thing named&quot; so :id is &quot;the thing named id.&quot; You can also think of :id as meaning the name of the variable id, and plain id as meaning the value of the variable.&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/learn-rubyrails-with-me.html&quot;&gt;First Post&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/07/ruby-faq.html&quot;&gt;Previous&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/07/ruby-on-rails-installation.html&quot;&gt;Next&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Ruby+Miscellanea&quot; rel=&quot;tag&quot;&gt;Ruby Miscellanea&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F07%2Fruby-miscellanea.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115181669617947160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115181669617947160' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115181669617947160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115181669617947160'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/07/ruby-miscellanea.html' title='Ruby Miscellanea'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115172324101741440</id><published>2006-07-01T08:34:00.000+05:30</published><updated>2006-07-02T10:36:02.493+05:30</updated><title type='text'>Ruby FAQ</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;div style=&quot;border:1px solid gold;padding:10px;&quot;&gt;&lt;br /&gt;&lt;dl&gt;&lt;dt&gt;&lt;b&gt;What do you mean by &quot;Ruby is a Dynamic programming language&quot;.&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;In computer science, a dynamic programming language is a kind of programming language in which programs can change their structure as they run: functions may be introduced or removed, new classes of objects may be created, new modules may appear. Refer &lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_programming_language&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt; for more details.&lt;/dd&gt;&lt;dt&gt;&lt;b&gt;Can we delete an entry in the middle and shift the remaining entries, in an array?&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;The &lt;code&gt;delete&lt;/code&gt; method of an array can do that, for example:&lt;br /&gt;&lt;code&gt;a = [&quot;a&quot;, &quot;b&quot;, &quot;b&quot;, &quot;c&quot;]&lt;br /&gt;a.delete(&quot;b&quot;)&lt;/code&gt;&lt;br /&gt;The contents of array are now &quot;a&quot; and &quot;c&quot;.&lt;/dd&gt;&lt;dt&gt;&lt;b&gt;Does Ruby have associative arrays like awk?&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;Hashes (sometimes known as associative arrays, maps or dictionaries) are available in Ruby.&lt;/dd&gt;&lt;dt&gt;&lt;b&gt;How is memory managed for Strings in Ruby? Is there a separate pool for Strings?&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;Strings are objects of class String. The &lt;code&gt;String&lt;/code&gt; class has more than 75 standard methods. If you refer to &lt;a href=&quot;http://www.rubyist.net/%7Eslagell/ruby/strings.html&quot; target=&quot;_blank&quot;&gt;Ruby User&#39;s Guide&lt;/a&gt;, it says that &quot;we do not have to consider the space occupied by a string. We are free from all memory management.&quot;&lt;/dd&gt;&lt;dt&gt;&lt;b&gt;Does Ruby allow us to write functions that can accept variable number of parameters?&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;Yes. See this example:&lt;br /&gt;&lt;code&gt;def print_nums(*numbers)&lt;br /&gt;&lt;br /&gt;end&lt;/code&gt;&lt;/dd&gt;&lt;dt&gt;&lt;b&gt;Can we have an anonymous class in Ruby?&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;Yes. Refer page 382 of the second edition of the book &lt;a href=&quot;http://www.pragmaticprogrammer.com/titles/ruby/index.html&quot; target=&quot;_blank&quot;&gt;Programming Ruby&lt;/a&gt;, by Dave Thomas&lt;/dd&gt;&lt;dt&gt;&lt;b&gt;Does Ruby have Multiple Inheritance?&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;Ruby uses &lt;i&gt;modules&lt;/i&gt; to implement &lt;u&gt;mix-ins&lt;/u&gt; that simulate multiple inheritance.&lt;/dd&gt;&lt;dt&gt;&lt;b&gt;Does Ruby allow Object Serialization?&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;Java features the ability to &lt;i&gt;serialize&lt;/i&gt; objects, letting you store them somewhere and reconstitute them when needed. Ruby calls this kind of serialization &lt;i&gt;marshaling&lt;/i&gt;. Saving an object and some or all of its components is done using the method &lt;code&gt;Marshal.dump&lt;/code&gt;. Later on you can reconstitute the object using &lt;code&gt;Marshal.load&lt;/code&gt;. Ruby uses marshaling to store session data.&lt;/dd&gt;&lt;dt&gt;&lt;b&gt;Java and Ruby Similarities:&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;As with Java, in Ruby...&lt;ul&gt;&lt;li&gt;memory is managed for you via a garbage collector.&lt;/li&gt;&lt;li&gt;there&amp;#8217;s public, private, and protected methods.&lt;/li&gt;&lt;li&gt;you&amp;#8217;ve got embedded doc tools (Ruby&amp;#8217;s is called RDoc). The docs generated by rdoc look very similar to those generated by javadoc. RDoc can produce fairly good content even if the source contains no comments.&lt;/li&gt;&lt;/ul&gt;&lt;/dd&gt;&lt;dt&gt;&lt;b&gt;Java and Ruby Differences:&lt;/b&gt;&lt;/dt&gt;&lt;dd&gt;Unlike Java, in Ruby...&lt;ul&gt;&lt;li&gt;you don&amp;#8217;t need to compile your code. You just run it directly.&lt;/li&gt;&lt;li&gt;there&amp;#8217;s different &lt;span class=&quot;caps&quot;&gt;GUI&lt;/span&gt; toolkits. Ruby users can try &lt;a href=&quot;http://wxruby.rubyforge.org/wiki/wiki.pl&quot;&gt;WxRuby&lt;/a&gt;,&lt;br /&gt;&lt;a href=&quot;http://www.fxruby.org/&quot;&gt;FXRuby&lt;/a&gt;, or the bundled-in Ruby Tk for example.&lt;/li&gt;&lt;li&gt;you use the &lt;code&gt;end&lt;/code&gt; keyword after defining things like classes, instead of having to put braces around blocks of code.&lt;/li&gt;&lt;li&gt;you have &lt;code&gt;require&lt;/code&gt; instead of &lt;code&gt;import&lt;/code&gt;.&lt;/li&gt;&lt;li&gt;all member variables are private. From the outside, you access everything via methods.&lt;/li&gt;&lt;li&gt;parentheses in method calls are usually optional and often omitted.&lt;/li&gt;&lt;li&gt;everything is an object, including numbers like 2 and 3.14159. Classes are objects! For example, &lt;code&gt;Array&lt;/code&gt; is a constant name that is bound to the Array class object. To create a new object, we call &lt;code&gt;new&lt;/code&gt; on the class object as in &lt;code&gt;a = Array.new&lt;/code&gt;&lt;/li&gt;&lt;li&gt;there are no primitives or data types&lt;/li&gt;&lt;li&gt;variable names are just labels (not objects). They don&amp;#8217;t have a type associated with them.&lt;/li&gt;&lt;li&gt;there&amp;#8217;s no type declarations. You just assign to new variable names as-needed and they just &amp;#8220;spring up&amp;#8221; (i.e. &lt;code&gt;a = [1,2,3]&lt;/code&gt; rather than &lt;code&gt;int[] a = {1,2,3};&lt;/code&gt;).&lt;/li&gt;&lt;li&gt;it&amp;#8217;s &lt;code&gt;foo = Foo.new( &quot;hi&quot;)&lt;/code&gt; instead of &lt;code&gt;foo = new Foo( &quot;hi&quot; )&lt;/code&gt;.&lt;/li&gt;&lt;li&gt;the constructor is always named &amp;#8220;initialize&amp;#8221; instead of the name of the class.&lt;/li&gt;&lt;li&gt;you have &amp;#8220;mixin&amp;#8217;s&amp;#8221; instead of interfaces.&lt;/li&gt;&lt;li&gt;&lt;span class=&quot;caps&quot;&gt;YAML&lt;/span&gt; tends to be favored over &lt;span class=&quot;caps&quot;&gt;XML&lt;/span&gt;.&lt;/li&gt;&lt;li&gt;it&amp;#8217;s &lt;code&gt;nil&lt;/code&gt; instead of &lt;code&gt;null&lt;/code&gt;. Also, &lt;code&gt;nil&lt;/code&gt; is a normal object; you can never get a null pointer error!&lt;/li&gt;&lt;li&gt;there is no method overloading.&lt;/li&gt;&lt;li&gt;it&#39;s much more common to put many classes in the same file.&lt;/li&gt;&lt;/ul&gt;&lt;/dd&gt;&lt;/dl&gt;&lt;/div&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;This is a work-in-progress.&lt;/b&gt;&lt;/i&gt;&lt;p&gt;&lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/learn-rubyrails-with-me.html&quot;&gt;First Post&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/writing-our-own-class.html&quot;&gt;Previous&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/07/ruby-miscellanea.html&quot;&gt;Next&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Ruby+FAQ&quot; rel=&quot;tag&quot;&gt;Ruby FAQ&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F07%2Fruby-faq.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115172324101741440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115172324101741440' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115172324101741440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115172324101741440'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/07/ruby-faq.html' title='Ruby FAQ'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115164439439949106</id><published>2006-06-30T10:42:00.000+05:30</published><updated>2006-07-08T11:15:23.893+05:30</updated><title type='text'>Writing our own Class</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt; A class is a combination of state (for example, the quantity and the product id) and methods that use the state. &lt;br /&gt;&lt;br /&gt;The &lt;i&gt;Object&lt;/i&gt; is the parent class of all classes in Ruby. Its methods are therefore available to all objects unless explicitly overridden.&lt;br /&gt;&lt;br /&gt;Let&#39;s write our own class - &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/web/RubyPrograms&quot;&gt;MotorCycle.rb&lt;/a&gt;&lt;/b&gt;.&lt;br /&gt;&lt;pre class=&quot;javacode&quot;&gt;class MotorCycle&lt;br /&gt;  def initialize(make, color)&lt;br /&gt;    # Instance variables&lt;br /&gt;    @make = make&lt;br /&gt;    @color = color&lt;br /&gt;    end&lt;br /&gt;  def startEngine&lt;br /&gt;    if (@engineState)&lt;br /&gt;      puts &#39;Engine Running&#39;&lt;br /&gt;    else&lt;br /&gt;      @engineState = true&lt;br /&gt;      puts &#39;Engine Idle&#39;&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;  def dispAttr&lt;br /&gt;    puts &#39;Color of MotorCycle is &#39; + @color&lt;br /&gt;    puts &#39;Make  of MotorCycle is &#39; + @make&lt;br /&gt;  end&lt;br /&gt;  m = MotorCycle.new(&#39;Yamaha&#39;, &#39;red&#39;)&lt;br /&gt;  m.startEngine&lt;br /&gt;  m.dispAttr&lt;br /&gt;  m.startEngine&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;&lt;u&gt;Read this very carefully, it&#39;s a brain bender!&lt;/u&gt; Classes in Ruby are first-class objects - each is an instance of class &lt;i&gt;Class&lt;/i&gt;. When a new class is defined (typically using class &lt;i&gt;Name&lt;/i&gt; ... end), an object of type &lt;i&gt;Class&lt;/i&gt; is created and assigned to a constant (&lt;i&gt;Name&lt;/i&gt;. in this case). When &lt;i&gt;Name.new&lt;/i&gt; is called to create a new object, the new instance method in &lt;i&gt;Class&lt;/i&gt; is run by default, which in turn invokes &lt;i&gt;allocate&lt;/i&gt; to allocate memory for the object, before finally calling the new object&#39;s &lt;i&gt;initialize&lt;/i&gt; method.&lt;br /&gt;&lt;br /&gt;A class&#39;s instance methods are public by default; anyone can call them. Let&#39;s refer to the program &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/doc/9162511e-dab3-447b-9d2b-b8e7d9e4a007/ClassAccess.rb&quot;&gt;ClassAccess.rb&lt;/a&gt;&lt;/b&gt; below. The private directive is the strictest; private methods can only be called from within the same instance. Protected methods can be called in the same instance and by other instances of the same class and its subclasses.&lt;pre class=&quot;javacode&quot;&gt;class ClassAccess&lt;br /&gt; def m1   # this method is public&lt;br /&gt;  end&lt;br /&gt; protected&lt;br /&gt; def m2   # this method is protected&lt;br /&gt; end&lt;br /&gt; private&lt;br /&gt; def m3   # this method is private&lt;br /&gt; end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;Instance variables are not directly accessible outside the class. To make them available, Ruby provides accessor methods that return their values. The program &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/doc/aca8da4b-c92d-4e17-9968-f0e361b3e98c/Accessor.rb&quot;&gt;Accessor.rb&lt;/a&gt;&lt;/b&gt; illustrates the same.&lt;pre class=&quot;javacode&quot;&gt;# Accessor.rb&lt;br /&gt;# First without accessor methods&lt;br /&gt;class Song&lt;br /&gt; def initialize(name, artist)&lt;br /&gt;    @name     = name&lt;br /&gt;    @artist   = artist&lt;br /&gt; end&lt;br /&gt; def name&lt;br /&gt;  @name&lt;br /&gt; end&lt;br /&gt; def artist&lt;br /&gt;  @artist&lt;br /&gt; end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;song = Song.new(&quot;Brazil&quot;, &quot;Ricky Martin&quot;)&lt;br /&gt;puts song.name&lt;br /&gt;puts song.artist&lt;br /&gt;&lt;br /&gt;# Now, with accessor methods&lt;br /&gt;class Song&lt;br /&gt; def initialize(name, artist)&lt;br /&gt;    @name     = name&lt;br /&gt;    @artist   = artist&lt;br /&gt; end&lt;br /&gt;  # the instance variable @name and @artist will&lt;br /&gt;  # be automatically created below&lt;br /&gt;  attr_reader :name, :artist # create reader only&lt;br /&gt; # For creating reader and writer methods&lt;br /&gt; # attr_accessor :name &lt;br /&gt; # For creating writer methods&lt;br /&gt; # attr_writer :name &lt;br /&gt;&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;song = Song.new(&quot;Brazil&quot;, &quot;Ricky Martin&quot;)&lt;br /&gt;puts song.name&lt;br /&gt;puts song.artist&lt;br /&gt;&lt;/pre&gt;There are many classes and modules (more on this later) built into the standard Ruby language. They are available to every Ruby program automatically; no &lt;i&gt;require&lt;/i&gt; is required. Some built-in classes are &lt;i&gt;Array, Bignum, Class, Dir, Exception, File, Fixnum, Float, Integer, IO, Module, Numeric, Object, Range, String, Thread, Time.&lt;/i&gt; Some built-in Modules are &lt;i&gt;Comparable, Enumerable, GC, Kernel, Math.&lt;/i&gt; The following &lt;b&gt;&lt;a href=&quot;http://www.cs.mun.ca/~donald/slug/2003-10-16/presentation/img5.html&quot;&gt;Class Hierarchy&lt;/a&gt;&lt;/b&gt; is informative.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Inheritance&lt;/u&gt; allows you to create a class that is a refinement or specialization of another class. Refer program &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/web/RubyPrograms&quot;&gt;Inherit.rb&lt;/a&gt;&lt;/b&gt;. &lt;br /&gt;&lt;pre class=&quot;javacode&quot;&gt;class GF&lt;br /&gt; def initialize&lt;br /&gt;  puts &#39;In GF class&#39;&lt;br /&gt; end&lt;br /&gt; def gfmethod&lt;br /&gt;  puts &#39;GF method call&#39;&lt;br /&gt; end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;# class F sub-class of GF&lt;br /&gt;class F &lt; GF&lt;br /&gt; def initialize&lt;br /&gt;  puts &#39;In F class&#39;&lt;br /&gt; end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;# class S sub-class of F&lt;br /&gt;class S &lt; F&lt;br /&gt; def initialize&lt;br /&gt;  puts &#39;In S class&#39;&lt;br /&gt; end&lt;br /&gt;son = S.new&lt;br /&gt;son.gfmethod&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;&lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/learn-rubyrails-with-me.html&quot;&gt;First Post&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/reading-from-writing-to-text-files.html&quot;&gt;Previous&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/07/ruby-faq.html&quot;&gt;Next&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Writing+our+own+Class&quot; rel=&quot;tag&quot;&gt;Writing our own Class&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F06%2Fwriting-our-own-class.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115164439439949106/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115164439439949106' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115164439439949106'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115164439439949106'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/06/writing-our-own-class.html' title='Writing our own Class'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115154974199793003</id><published>2006-06-29T08:24:00.000+05:30</published><updated>2006-06-30T10:45:37.996+05:30</updated><title type='text'>Reading from / Writing to Text files</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;Let&#39;s look at how we can read / write to a text file with the help of a simple program &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/web/RubyPrograms&quot;&gt;ReadWrite.rb&lt;/a&gt;&lt;/b&gt;. &lt;pre class=&quot;javacode&quot;&gt;# Open and read from a text file&lt;br /&gt;File.open(&#39;Constructs.rb&#39;, &#39;r&#39;) do |f1|&lt;br /&gt; while line = f1.gets&lt;br /&gt;  puts line&lt;br /&gt; end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;# Create a new file and write to it&lt;br /&gt;File.open(&#39;Test.rb&#39;, &#39;w&#39;) do |f2|&lt;br /&gt; # use &quot;&quot; for two lines of text&lt;br /&gt; f2.puts &quot;Created by Satish\nThank God!&quot;&lt;br /&gt;end&lt;/pre&gt;The File.open method can open the file in different modes like &#39;r&#39; Read-only, starts at beginning of file (default); &#39;r+&#39; Read/Write, starts at beginning of file; &#39;w&#39; Write-only, truncates existing file to zero length or creates a new file for writing. Please check the online documentation for a full list of modes available. File.open opens a new File if there is no associated block. If the optional block is given, it will be passed &lt;i&gt;file&lt;/i&gt; as an argument, and the file will automatically be closed when the block terminates.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;b&gt;Assignment: &lt;/b&gt;&lt;/u&gt;Write a Ruby program (call it SwapContents.rb) to do the following. Take two text files say A and B. The program should swap the contents of A and B ie. after the program is executed, A should contain B&#39;s contents and B should contains A&#39;s. Post your program as a comment to this post.&lt;p&gt;&lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/learn-rubyrails-with-me.html&quot;&gt;First Post&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/own-methods-in-ruby.html&quot;&gt;Previous&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/writing-our-own-class.html&quot;&gt;Next&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Reading+from+/+Writing+to+Text+files&quot; rel=&quot;tag&quot;&gt;Reading from / Writing to Text files&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F06%2Freading-from-writing-to-text-files.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115154974199793003/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115154974199793003' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115154974199793003'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115154974199793003'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/06/reading-from-writing-to-text-files.html' title='Reading from / Writing to Text files'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115154231834994116</id><published>2006-06-29T06:16:00.000+05:30</published><updated>2006-06-29T08:30:42.623+05:30</updated><title type='text'>Own methods in Ruby</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;Let&#39;s look at &lt;b&gt;writing one&#39;s own methods in Ruby&lt;/b&gt; with the help of a simple program &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/web/RubyPrograms&quot;&gt;MyMethods.rb&lt;/a&gt;&lt;/b&gt;. &lt;pre class=&quot;javacode&quot;&gt;# A simple method&lt;br /&gt;def hello&lt;br /&gt;  puts &#39;Hello&#39;&lt;br /&gt;end&lt;br /&gt;#use the method&lt;br /&gt;hello&lt;br /&gt;&lt;br /&gt;# Method with an argument - 1&lt;br /&gt;def hello1(name)&lt;br /&gt;  puts &#39;Hello &#39; + name&lt;br /&gt;  return &#39;success&#39;&lt;br /&gt;end&lt;br /&gt;puts(hello1(&#39;satish&#39;))&lt;br /&gt;&lt;br /&gt;# Method with an argument - 2&lt;br /&gt;def hello1 name2&lt;br /&gt;  puts &#39;Hello &#39; + name2&lt;br /&gt;  return &#39;success&#39;&lt;br /&gt;end&lt;br /&gt;puts(hello1 &#39;satish&#39;)&lt;br /&gt;&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/learn-rubyrails-with-me.html&quot;&gt;First Post&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/arrays-in-ruby.html&quot;&gt;Previous&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/reading-from-writing-to-text-files.html&quot;&gt;Next&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Own+methods+in+Ruby&quot; rel=&quot;tag&quot;&gt;Own methods in Ruby&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F06%2Fown-methods-in-ruby.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115154231834994116/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115154231834994116' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115154231834994116'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115154231834994116'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/06/own-methods-in-ruby.html' title='Own methods in Ruby'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115148795147091090</id><published>2006-06-28T15:15:00.000+05:30</published><updated>2006-06-29T07:59:22.516+05:30</updated><title type='text'>Arrays in Ruby</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;An array is just a list in your computer. Every slot in the list acts like a variable: you can see what object a particular slot points to, and you can make it point to a different object. Arrays are best explained by the following example &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/web/RubyPrograms&quot;&gt;Arrays.rb&lt;/a&gt;&lt;/b&gt;.&lt;pre class=&quot;javacode&quot;&gt;# Arrays&lt;br /&gt;&lt;br /&gt;# Empty array&lt;br /&gt;var1 = []&lt;br /&gt;# Array index starts from 0&lt;br /&gt;puts var1[0]&lt;br /&gt;&lt;br /&gt;# an array holding a single number&lt;br /&gt;var2 = [5]&lt;br /&gt;puts var2[0]&lt;br /&gt;&lt;br /&gt;# an array holding two strings&lt;br /&gt;var3 = [&#39;Hello&#39;, &#39;Goodbye&#39;]&lt;br /&gt;puts var3[0]&lt;br /&gt;puts var3[2]&lt;br /&gt;&lt;br /&gt;flavour = &#39;mango&#39;&lt;br /&gt;# an array whose elements are pointing&lt;br /&gt;# to three objects - a float, a string and an array&lt;br /&gt;var4 = [80.5, flavour, [true, false]]&lt;br /&gt;puts var4[2]&lt;br /&gt;&lt;br /&gt;name = [&#39;Satish&#39;, &#39;Talim&#39;, &#39;Ruby&#39;, &#39;Java&#39;]&lt;br /&gt;puts name[0]&lt;br /&gt;puts name[1]&lt;br /&gt;puts name[2]&lt;br /&gt;puts name[3]&lt;br /&gt;# the next one outputs nil&lt;br /&gt;# nil is Ruby&#39;s way of saying nothing&lt;br /&gt;puts name[4]&lt;br /&gt;# we can add more elements too&lt;br /&gt;name[4] = &#39;Pune&#39;&lt;br /&gt;puts name[4]&lt;br /&gt;# we can add anything!&lt;br /&gt;name[5] = 4.33&lt;br /&gt;puts name[5]&lt;br /&gt;# we can add an array to an array&lt;br /&gt;name[6] = [1, 2, 3]&lt;br /&gt;puts name[6]&lt;br /&gt;&lt;br /&gt;# some methods on arrays&lt;br /&gt;newarr = [45, 23, 1, 90]&lt;br /&gt;puts newarr.sort&lt;br /&gt;puts newarr.length&lt;br /&gt;&lt;br /&gt;# method each (iterator) - extracts each element into lang&lt;br /&gt;languages = [&#39;Pune&#39;, &#39;Mumbai&#39;, &#39;Bangalore&#39;]&lt;br /&gt;&lt;br /&gt;languages.each do |lang|&lt;br /&gt;  puts &#39;I love &#39; + lang + &#39;!&#39;&lt;br /&gt;  puts &#39;Don\&#39;t you?&#39;&lt;br /&gt;end&lt;/pre&gt;The method &lt;i&gt;each&lt;/i&gt; allows us to do something (whatever we want) to each object the array points to. In the example, we are able to go through each object in the array without using any numbers.&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/learn-rubyrails-with-me.html&quot;&gt;First Post&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/some-methods-in-ruby.html&quot;&gt;Previous&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/own-methods-in-ruby.html&quot;&gt;Next&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Arrays+in+Ruby&quot; rel=&quot;tag&quot;&gt;Arrays in Ruby&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F06%2Farrays-in-ruby.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115148795147091090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115148795147091090' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115148795147091090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115148795147091090'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/06/arrays-in-ruby.html' title='Arrays in Ruby'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115146966633500628</id><published>2006-06-28T10:09:00.000+05:30</published><updated>2006-06-29T15:12:03.806+05:30</updated><title type='text'>Some Methods in Ruby</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;Let us explore some methods in &lt;b&gt;Ruby&lt;/b&gt;. So far we had seen a method like &lt;b&gt;puts&lt;/b&gt; that writes to the screen. &lt;u&gt;How does one accept user input?&lt;/u&gt; For this &lt;b&gt;gets&lt;/b&gt; and &lt;b&gt;chomp&lt;/b&gt; are useful. The example (&lt;b&gt;&lt;a href=&quot;http://www.esnips.com/web/RubyPrograms&quot;&gt;Methods.rb&lt;/a&gt;&lt;/b&gt;) below illustrates the same.&lt;pre class=&quot;javacode&quot;&gt;# gets and chomp&lt;br /&gt;puts &quot;In which city do you stay?&quot;&lt;br /&gt;STDOUT.flush&lt;br /&gt;city = gets.chomp&lt;br /&gt;puts &quot;The city is &quot; + city&lt;/pre&gt;&lt;b&gt;chomp&lt;/b&gt; is a string method and &lt;b&gt;gets&lt;/b&gt; retrieves only strings from your keyboard. You must have realised that &lt;b&gt;gets&lt;/b&gt; returns a string and a &#39;\n&#39; character, while &lt;b&gt;chomp&lt;/b&gt; removes this &#39;\n&#39;.&lt;br /&gt;&lt;br /&gt;There are many methods in the String class (you don&#39;t have to memorize them all; you can look up the documentation) like the &lt;b&gt;reverse&lt;/b&gt; that gives a backwards version of a string (reverse does not change the original string). &lt;b&gt;length&lt;/b&gt; that tells us the number of characters (including spaces) in the string. &lt;b&gt;upcase&lt;/b&gt; changes every lowercase letter to uppercase, and &lt;b&gt;downcase&lt;/b&gt; changes every uppercase letter to lowercase. &lt;b&gt;swapcase&lt;/b&gt; switches the case of every letter in the string, and finally, &lt;b&gt;capitalize&lt;/b&gt; is just like downcase, except that it switches the first character to uppercase (if it is a letter).&lt;br /&gt;&lt;br /&gt;&lt;u&gt;More on methods:&lt;/u&gt; If objects (such as strings, integers and floats) are the nouns in Ruby language, then methods are the verbs. &lt;i&gt;Every method needs an object&lt;/i&gt;. It&#39;s usually easy to tell which object is performing the method: it&#39;s what comes right before the dot. Sometimes, though, it&#39;s not quite as obvious. When we are using puts, gets - where are their objects? In Ruby, the implicit object is whatever object you happen to be in. But we don&#39;t even know how to be in an object yet; &lt;u&gt;we&#39;ve always been inside a special object Ruby has created for us that represents the whole program.&lt;/u&gt; You can see always see what object you are in by using the special variable &lt;b&gt;self&lt;/b&gt;.&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/learn-rubyrails-with-me.html&quot;&gt;First Post&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/simple-constructs-in-ruby.html&quot;&gt;Previous&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/arrays-in-ruby.html&quot;&gt;Next&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Some+Methods+in+Ruby&quot; rel=&quot;tag&quot;&gt;Some Methods in Ruby&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F06%2Fsome-methods-in-ruby.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115146966633500628/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115146966633500628' title='17 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115146966633500628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115146966633500628'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/06/some-methods-in-ruby.html' title='Some Methods in Ruby'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>17</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115145747285009517</id><published>2006-06-28T06:46:00.000+05:30</published><updated>2006-06-29T05:14:11.633+05:30</updated><title type='text'>Simple Constructs in Ruby</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;Today, we shall explore some very simple constructs available in &lt;b&gt;Ruby&lt;/b&gt;. The example below (&lt;b&gt;&lt;a href=&quot;http://www.esnips.com/web/RubyPrograms&quot;&gt;Constructs.rb&lt;/a&gt;&lt;/b&gt;) illustrates the &lt;b&gt;if else end&lt;/b&gt; construct.&lt;pre class=&quot;javacode&quot;&gt;# if else end&lt;br /&gt;var = 5&lt;br /&gt;if var &gt; 4&lt;br /&gt;  puts &quot;Variable is greater than 4&quot;&lt;br /&gt;  puts &quot;I can have multiple statements here&quot;&lt;br /&gt;  if var == 5&lt;br /&gt;      puts &quot;Nested if else possible&quot;&lt;br /&gt;  else&lt;br /&gt;      puts &quot;Too cool&quot;&lt;br /&gt;  end&lt;br /&gt;else&lt;br /&gt;    puts &quot;Variable is not greater than 5&quot;&lt;br /&gt;    puts &quot;I can have multiple statements here&quot;&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;An example of using &lt;b&gt;elsif&lt;/b&gt; is there in the program &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/web/RubyPrograms&quot;&gt;ElsIfEx.rb&lt;/a&gt;&lt;/b&gt; &lt;br /&gt;&lt;br /&gt;Some common conditional operators are: ==, != &amp;gt;=, &amp;lt;=, &amp;gt;, &amp;lt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Loops&lt;/b&gt; like the &lt;b&gt;while&lt;/b&gt; are available. Again, the example below illustrates the same.&lt;pre class=&quot;javacode&quot;&gt;# Loops&lt;br /&gt;var = 0&lt;br /&gt;while var &lt; 10&lt;br /&gt;    puts var.to_s&lt;br /&gt;  var += 1&lt;br /&gt;end&lt;/pre&gt;&lt;br /&gt;I shall talk about another construct the &lt;b&gt;do end&lt;/b&gt; when we discuss arrays.&lt;br /&gt;&lt;p&gt;&lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/learn-rubyrails-with-me.html&quot;&gt;First Post&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/strings-in-ruby.html&quot;&gt;Previous&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/some-methods-in-ruby.html&quot;&gt;Next&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Simple+Constructs+in+Ruby&quot; rel=&quot;tag&quot;&gt;Simple Constructs in Ruby&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F06%2Fsimple-constructs-in-ruby.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115145747285009517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115145747285009517' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115145747285009517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115145747285009517'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/06/simple-constructs-in-ruby.html' title='Simple Constructs in Ruby'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115138481047766992</id><published>2006-06-27T10:35:00.000+05:30</published><updated>2006-06-28T07:32:52.816+05:30</updated><title type='text'>Strings in Ruby</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;Let us explore Strings in &lt;b&gt;Ruby&lt;/b&gt;. We refer to a group of letters in a program as &lt;i&gt;strings&lt;/i&gt;. Strings can have punctuation, digits, symbols, and spaces in them...more than just letters. &#39;&#39; does not have anything in it at all; we call that an empty string. Here&#39;s the program &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/web/RubyPrograms&quot;&gt;RubyStrings.rb&lt;/a&gt;&lt;/b&gt;&lt;pre class=&quot;javacode&quot;&gt;=begin&lt;br /&gt; Ruby Strings&lt;br /&gt;=end&lt;br /&gt;&lt;br /&gt;puts &quot;Hello World&quot;&lt;br /&gt;# Can use &quot; or &#39; for Strings, but &#39; is more efficient&lt;br /&gt;puts &#39;Hello World&#39;&lt;br /&gt;# String concatenation&lt;br /&gt;puts &#39;I like&#39; + &#39; Ruby&#39;&lt;br /&gt;# Escape sequence&lt;br /&gt;puts &#39;It\&#39;s my Ruby&#39;&lt;br /&gt;# New here, displays the string three times&lt;br /&gt;puts &#39;Hello&#39; * 3&lt;br /&gt;# Defining a constant&lt;br /&gt;PI = 3.1416&lt;br /&gt;puts PI&lt;br /&gt;# Defining a local variable&lt;br /&gt;myString = &#39;I love my city, Pune&#39;&lt;br /&gt;puts myString&lt;br /&gt;=begin&lt;br /&gt; Conversions&lt;br /&gt; .to_i, .to_f, .to_s&lt;br /&gt;=end&lt;br /&gt;var1 = 5;&lt;br /&gt;var2 = &#39;2&#39;&lt;br /&gt;puts var1 + var2.to_i&lt;br /&gt;&lt;/pre&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Questions asked by the participants:&lt;/span&gt;&lt;br /&gt;1. &lt;b&gt;Sharif Kazi&lt;/b&gt; - &lt;i&gt;Please explain how memory is managed for Strings in Ruby? Is there a separate pool for Strings?&lt;/i&gt;&lt;br /&gt;&lt;u&gt;Answer:&lt;/u&gt; Strings are objects of class String. The String class has more than 75 standard methods. If you refer to &lt;b&gt;&lt;a href=&quot;http://www.rubyist.net/~slagell/ruby/strings.html&quot;&gt;Ruby User&#39;s Guide&lt;/a&gt;&lt;/b&gt;, it says that &quot;we do not have to consider the space occupied by a string. We are free from all memory management.&quot;&lt;br /&gt;&lt;br /&gt;2. &lt;b&gt;Anish&lt;/b&gt; - &lt;i&gt;It&#39;s to be noted that any given variable can at different times hold references to objects of many different types. - Does that mean a variable of type x can hold reference to the variable of type b without direct relation (inheritance) between them?&lt;/i&gt;&lt;br /&gt;&lt;u&gt;Answer:&lt;/u&gt; Please go thro&#39; the code in the program &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/web/RubyPrograms&quot;&gt;DiffObjects.rb&lt;/a&gt;&lt;/b&gt; We can assign an object to a variable. Also, we can reassign a different object to that variable. In fact, variables can point to just about anything...except other variables. So in the program, when we tried var2 = var1, it really pointed to 8 instead. Then with var1 = &#39;eight&#39;, we had var1 point to the string &#39;eight&#39;, but since var2 was never really pointing at var1, it stays pointing at the number 8.&lt;br /&gt;&lt;br /&gt;3. &lt;b&gt;Deepali&lt;/b&gt; - &lt;i&gt;Do we have something like print of Java?&lt;/i&gt;&lt;br /&gt;&lt;u&gt;Answer:&lt;/u&gt; Yes, we do have that in Ruby. Write a Ruby program that has this statement and check the output.&lt;br /&gt;STDOUT.print(&quot;This is a string&quot;)&lt;p&gt;&lt;br /&gt;&lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/learn-rubyrails-with-me.html&quot;&gt;First Post&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/numbers-in-ruby.html&quot;&gt;Previous&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/simple-constructs-in-ruby.html&quot;&gt;Next&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Strings+in+Ruby&quot; rel=&quot;tag&quot;&gt;Strings in Ruby&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F06%2Fstrings-in-ruby.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115138481047766992/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115138481047766992' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115138481047766992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115138481047766992'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/06/strings-in-ruby.html' title='Strings in Ruby'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-20338611.post-115138200485451675</id><published>2006-06-27T09:49:00.000+05:30</published><updated>2006-06-28T13:15:20.943+05:30</updated><title type='text'>Numbers in Ruby</title><content type='html'>&lt;div style=&quot;font-family: verdana, arial, sans-serif; line-height:12px; font-size: 11px; text-align: justify;&quot;&gt;Let&#39;s play with Numbers. In &lt;b&gt;Ruby&lt;/b&gt;, numbers without decimal points are called &lt;i&gt;integers&lt;/i&gt;, and numbers with decimal points are usually called floating-point numbers or, more simply, &lt;i&gt;floats&lt;/i&gt;. Here&#39;s the program &lt;b&gt;&lt;a href=&quot;http://www.esnips.com/web/RubyPrograms&quot;&gt;RubyNumbers.rb&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;pre class=&quot;javacode&quot;&gt;=begin&lt;br /&gt; Ruby Numbers&lt;br /&gt; Usual operators:&lt;br /&gt; + addition&lt;br /&gt; - subtraction&lt;br /&gt; * multiplication&lt;br /&gt; / division&lt;br /&gt;=end&lt;br /&gt;&lt;br /&gt;puts 1 + 2&lt;br /&gt;puts 2 * 3&lt;br /&gt;# Integer division&lt;br /&gt;# When you do arithmetic with integers, you&#39;ll get integer answers&lt;br /&gt;puts 3 / 2&lt;br /&gt;puts 10 - 11&lt;br /&gt;puts 1.5 / 2.6&lt;br /&gt;&lt;/pre&gt;&lt;span style=&quot;background-color: yellow;&quot;&gt;Questions asked by the participants:&lt;/span&gt;&lt;br /&gt;1. &lt;b&gt;Jatinder Singh&lt;/b&gt; - &lt;i&gt;How do I get the integer result for the following operation (the desired output is 2) - puts 5.5/2&lt;/i&gt;&lt;br /&gt;&lt;u&gt;Answer:&lt;/u&gt; Try this -&lt;br /&gt;num = 5.5 /2 &lt;br /&gt;puts num&lt;br /&gt;puts num.to_int&lt;p&gt;&lt;br /&gt;&lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/learn-rubyrails-with-me.html&quot;&gt;First Post&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/names-in-ruby.html&quot;&gt;Previous&lt;/a&gt;&lt;/b&gt;  |  &lt;b&gt;&lt;a href=&quot;http://punerb.blogspot.com/2006/06/strings-in-ruby.html&quot;&gt;Next&lt;/a&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;hr style=&quot;color:silver;&quot; /&gt;&lt;span class=&quot;technoratitag&quot;&gt;&lt;b&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tag/Numbers+in+Ruby&quot; rel=&quot;tag&quot;&gt;Numbers in Ruby&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Instant+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Quick+Ruby+Guide&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Programming+Languages&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Ruby+on+Rails&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/QuickRuby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBloggers&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/PuneBlogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogosphere&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Digg&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Media&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tip&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/RSS&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Marketing&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/News&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/IndianGuru&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blogging&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Internet&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Blog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Technical+Support&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Software&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Help&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Pune&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/SatishTalim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Satish+Talim&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblog&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Weblogs&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Free+Training&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Tutorial&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Education&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Teacher&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;a href=&quot;http://technorati.com/tag/Learning+Ruby&quot; rel=&quot;tag&quot;&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href=&quot;http://technorati.com/search/punerb.blogspot.com%2F2006%2F06%2Fnumbers-in-ruby.html&quot;&gt;Blogs linking to this article&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://punerb.blogspot.com/feeds/115138200485451675/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/20338611/115138200485451675' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115138200485451675'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/20338611/posts/default/115138200485451675'/><link rel='alternate' type='text/html' href='http://punerb.blogspot.com/2006/06/numbers-in-ruby.html' title='Numbers in Ruby'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11893078648375764557</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry></feed>