<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: Raj2569's Code Snippets</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Wed, 23 Jul 2008 11:30:40 GMT</pubDate>
    <description>DZone Snippets: Raj2569's Code Snippets</description>
    <item>
      <title>Install DateBocks</title>
      <link>http://snippets.dzone.com/posts/show/3175</link>
      <description>Install engines plugin&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;./script/plugin source http://svn.rails-engines.org/plugins/&lt;br /&gt;./script/plugin install engines&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Install datebocks&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;./script/plugin source http://svn.toolbocks.com/plugins&lt;br /&gt;./script/plugin install datebocks_engine&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 19 Dec 2006 18:37:43 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3175</guid>
      <author>raj2569 (Rajkumar S)</author>
    </item>
    <item>
      <title>Select field from database with option selected</title>
      <link>http://snippets.dzone.com/posts/show/3173</link>
      <description>to post sess[callcenter_client_id]&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;select("sess", "callcenter_client_id", CallcenterClient.find_all.collect {|p| [ p.name, p.id ] }, { :selected =&gt; @sess.callcenter_client_id.to_i })&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;make sure that the :selected entry is an integer.</description>
      <pubDate>Tue, 19 Dec 2006 17:57:12 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3173</guid>
      <author>raj2569 (Rajkumar S)</author>
    </item>
    <item>
      <title>Render partial</title>
      <link>http://snippets.dzone.com/posts/show/3166</link>
      <description>&lt;code&gt;&lt;br /&gt;&lt;%= render(:partial         =&gt; "animal" ,&lt;br /&gt;           :collection      =&gt; %w{ ant bee cat dog elk },&lt;br /&gt;           :spacer_template =&gt; "spacer" )&lt;br /&gt;%&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;animal is the name of template and local variable holding each element of collection inside the partial. animal_counter holds the index of current element in the collection. spacer_template is rendered between each elements in the collection. </description>
      <pubDate>Tue, 19 Dec 2006 11:31:33 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3166</guid>
      <author>raj2569 (Rajkumar S)</author>
    </item>
    <item>
      <title>if clause</title>
      <link>http://snippets.dzone.com/posts/show/3165</link>
      <description>// description of your code here&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;((counter % 2) == 0) ? 'light' : 'dark' &lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 19 Dec 2006 10:44:13 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3165</guid>
      <author>raj2569 (Rajkumar S)</author>
    </item>
    <item>
      <title>Create a date 4 weeks ago from the current date</title>
      <link>http://snippets.dzone.com/posts/show/3164</link>
      <description>// description of your code here&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;t = 4.weeks.ago&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 19 Dec 2006 10:16:10 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3164</guid>
      <author>raj2569 (Rajkumar S)</author>
    </item>
    <item>
      <title>Assign a variable a value if it's nil</title>
      <link>http://snippets.dzone.com/posts/show/3161</link>
      <description>There is a nifty way to give a variable a value if it's nil &lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;a[i] ||=0&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;This is useful when you want to assign a value to an array and it's not yet initialized. </description>
      <pubDate>Mon, 18 Dec 2006 18:16:49 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3161</guid>
      <author>raj2569 (Rajkumar S)</author>
    </item>
  </channel>
</rss>
