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

<channel>
	<title>The Incandescent Bulb</title>
	<atom:link href="http://www.theincandescentbulb.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.theincandescentbulb.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 17 Dec 2009 12:37:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Netbeans, first impressions</title>
		<link>http://www.theincandescentbulb.com/?p=81</link>
		<comments>http://www.theincandescentbulb.com/?p=81#comments</comments>
		<pubDate>Thu, 17 Dec 2009 12:37:23 +0000</pubDate>
		<dc:creator>railsinsomniac</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[netbeans]]></category>

		<guid isPermaLink="false">http://theincandescentbulb.com/?p=81</guid>
		<description><![CDATA[I&#8217;ve always been a textmate user since I started web development with rails and OSX ( 2 years give or take ). Textmate is in my opinion a great text editor. Notably the best that I&#8217;ve ever used. with the recent release of Netbeans 6.8. I thought, why not give it a try, see what ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always been a <a href="http://www.macromates.com">textmate</a> user since I started web development with rails and OSX ( 2 years give or take ). Textmate is in my opinion a great text editor. Notably the best that I&#8217;ve ever used. with the recent release of <a href="http://netbeans.org/">Netbeans 6.8</a>. I thought, why not give it a try, see what an IDE can offer that a text editor  can&#8217;t.</p>
<p>Here&#8217;s what I think:</p>
<p><strong>Pros:</strong></p>
<ul>
<li>Search is pretty fast when project indexing is complete. ( faster than textmate&#8217;s project search )</li>
<li>Its not very slow after startup ,its near textmate fast ( although textmate is one of the slowest text editors I&#8217;ve used especially if working on a big project )</li>
<li>A <a href="http://mediacast.sun.com/users/tnorbye/media/org-netbeans-modules-ruby-themes.nbm">dark theme</a> can be installed.</li>
<li>Most of the textmate code templates are available.</li>
<li>Code folding works as it should.</li>
<li>There are plugins to put in more features.</li>
<li>Code is analyzed for errors in realtime.</li>
<li>Code auto completion that works.</li>
<li>Its Free.</li>
</ul>
<p><strong>Cons:</strong></p>
<ul>
<li>tremendously slow when starting up.</li>
<li>eats up a lot of ram, and cpu.</li>
<li>doesn&#8217;t have a built in dark theme.</li>
</ul>
<p>In addition, I changed some shortcut keys since I&#8217;m already used to textmate&#8217;s keybindings.</p>
<p>To conclude, I think I&#8217;m falling in love with netbeans. Especially with the search and autocomplete feature. Although its too early to really say that I&#8217;d stick to using it permanently. But I really like using it as my main editor.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.theincandescentbulb.com/?feed=rss2&amp;p=81</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Proper use of remote_function :with</title>
		<link>http://www.theincandescentbulb.com/?p=73</link>
		<comments>http://www.theincandescentbulb.com/?p=73#comments</comments>
		<pubDate>Thu, 17 Dec 2009 10:05:10 +0000</pubDate>
		<dc:creator>railsinsomniac</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://theincandescentbulb.com/?p=73</guid>
		<description><![CDATA[This article is based on this blog post


&#60;%= select_tag &#34;content_type&#34;,  options_for_select(content_type_options),
 {  nchange =&#62;
    remote_function(
         :url =&#62; {:action =&#62; &#039;filter_by_content&#039;},
         :with =&#62; &#039;Form.Element.serialize(this)&#039;)  } %&#62;

This code will pass all the values from the ]]></description>
			<content:encoded><![CDATA[<p>This article is based on this blog <a href="http://onrails.org/articles/2006/05/01/remote_function-with">post</a></p>
<pre class="brush: ruby; ">

&lt;%= select_tag &quot;content_type&quot;,  options_for_select(content_type_options),
 { <img src='http://www.theincandescentbulb.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> nchange =&gt;
    remote_function(
         :url =&gt; {:action =&gt; &#039;filter_by_content&#039;},
         :with =&gt; &#039;Form.Element.serialize(this)&#039;)  } %&gt;
</pre>
<p>This code will pass all the values from the serialized form. But I needed to define specific fields to pass along with the request and this wouldn&#8217;t work. I came up with.</p>
<pre class="brush: ruby; ">
&lt;%= select_tag &quot;content_type&quot;,  options_for_select(content_type_options),
 { <img src='http://www.theincandescentbulb.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> nchange =&gt;
    remote_function(
         :url =&gt; {:action =&gt; &#039;filter_by_content&#039;},
         :with =&gt; &quot;&#039;key=&#039; + Field.getValue(&#039;input_id&#039;)&quot;)  } %&gt;
</pre>
<p>If you read thru the comments on the blog post mentioned above. this was already mentioned but the syntax was incorrect. it should be &#8220;&#8216;key=&#8217; + Field.getValue(&#8216;input_id&#8217;)&#8221; not &#8220;{key : Field.getValue(&#8216;input_id&#8217;)}&#8221;</p>
<p>I&#8217;m not entirely sure if the above syntax difference is due to the rails version I&#8217;m currently using ( 2.3.4 ) since its a 3 year old blog post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.theincandescentbulb.com/?feed=rss2&amp;p=73</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails Caching Note : expiring cache when running your app with multiple slices</title>
		<link>http://www.theincandescentbulb.com/?p=54</link>
		<comments>http://www.theincandescentbulb.com/?p=54#comments</comments>
		<pubDate>Tue, 09 Dec 2008 07:21:22 +0000</pubDate>
		<dc:creator>railsinsomniac</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://incandescentbulb.wordpress.com/?p=54</guid>
		<description><![CDATA[Note to self :
If you&#8217;re using fragment caching and you&#8217;re application is deployed to a hosting provider with multiple slices. don&#8217;t forget to define the location of the cache and store your cache in a location that all slices have access to. by default rails stores the cache in /tmp/cache , normally I would point ]]></description>
			<content:encoded><![CDATA[<p>Note to self :</p>
<p>If you&#8217;re using fragment caching and you&#8217;re application is deployed to a hosting provider with multiple slices. don&#8217;t forget to define the location of the cache and store your cache in a location that all slices have access to. by default rails stores the cache in /tmp/cache , normally I would point it to RAILS_ROOT + tmp/cache</p>
<p>Here&#8217;s how to explicitly define the location of your cache:</p>
<p>Just need to define this in your environment.rb or create a file in the initializers directory.</p>
<pre class="brush: ruby; ">

ActionController::Base.fragment_cache_store = :file_store, &quot;/path/to/cache/directory&quot;
</pre>
<p>Some links about caching that I find very useful:</p>
<p>http://www.railsenvy.com/2007/2/28/rails-caching-tutorial</p>
<p>http://www.railsenvy.com/2007/3/20/ruby-on-rails-caching-tutorial-part-2</p>
]]></content:encoded>
			<wfw:commentRss>http://www.theincandescentbulb.com/?feed=rss2&amp;p=54</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using datetime_select together with a virtual field</title>
		<link>http://www.theincandescentbulb.com/?p=31</link>
		<comments>http://www.theincandescentbulb.com/?p=31#comments</comments>
		<pubDate>Mon, 27 Oct 2008 18:14:27 +0000</pubDate>
		<dc:creator>railsinsomniac</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://incandescentbulb.wordpress.com/2008/10/28/using-datetime_select-together-with-a-virtual-field-2/</guid>
		<description><![CDATA[I came across this problem just today, it cost me about 30 minutes to 1 hour just figuring out what I did wrong not to mention the time I spent trying to look for the solution. Luckily I stumbled upon this ticket. here Apparently this problem has already been reported and a patch has already ]]></description>
			<content:encoded><![CDATA[<p>I came across this problem just today, it cost me about 30 minutes to 1 hour just figuring out what I did wrong not to mention the time I spent trying to look for the solution. Luckily I stumbled upon this ticket. <a href="http://dev.rubyonrails.org/ticket/8983">here</a> Apparently this problem has already been reported and a patch has already been submitted over a year ago. But it hasn&#8217;t been pushed to rails core yet. Anyways to summarize the situation, heres how one can stumble into this problem:</p>
<p>Lets say you have a view which uses the date helper datetime_select like so:</p>
<p></p>
<pre class="brush: ruby; ">

&lt;% form_for(:ticket, :url =&gt; tickets_path) do |f| %&gt;
  	 &lt;%= f.text_field :title -%&gt;
  	 &lt;%= f.text_field :description -%&gt;
  	 &lt;%= f.datetime_select :date_this_ticket_might_get_resolved -%&gt;
&lt;% end %&gt;
</pre>
<p>And here&#8217;s a sample controller:</p>
<pre class="brush: ruby; ">

class TicketsController &lt; ApplicationController

	def	create
		@ticket = Ticket.new(params[:ticket])
		@ticket.save
	end

end
</pre>
<p>And lastly the model:</p>
<pre class="brush: ruby; ">

class Ticket &lt; ActiveRecord::Base

  	 def date_this_ticket_might_get_resolved=(val)
    	 	self.date_of_submission = Time.mktime( val[:year], val[:month], val[:day],
                                            val[:hour], val[:minute]) + 1.year
  	 end

  	 def date_this_ticket_might_get_resolved
    	 	self.date_of_submission + 1.year # add another year just to be sure
  	 end

end
</pre>
<p>You will get something like this error:</p>
<pre class="brush: plain; ">

NoMethodError (You have a nil object when you didn&#039;t expect it!The error occurred while evaluating nil.klass):
	/vendor/rails/activerecord/lib/active_record/base.rb:2645:in `execute_callstack_for_multiparameter_attributes&#039;
	/vendor/rails/activerecord/lib/active_record/base.rb:2644:in `each&#039;
	/vendor/rails/activerecord/lib/active_record/base.rb:2644:in `execute_callstack_for_multiparameter_attributes&#039;
	/vendor/rails/activerecord/lib/active_record/base.rb:2630:in `assign_multiparameter_attributes&#039;
	/vendor/rails/activerecord/lib/active_record/base.rb:2375:in `attributes=&#039;
</pre>
<p>I was using Rails 2.1 with Ruby 1.8.6 , The patch can be found on this <a href="http://dev.rubyonrails.org/ticket/8983">link</a>, Just follow the instructions its just a one liner change on ActiveRecord::Base. </p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.theincandescentbulb.com/?feed=rss2&amp;p=31</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
