<?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 Learning Journey</title>
	<atom:link href="http://tamersalama.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://tamersalama.com</link>
	<description>of Tamer Salama</description>
	<lastBuildDate>Tue, 16 Apr 2013 05:15:26 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<item>
		<title>RubyMotion &#8211; PullToRefresh</title>
		<link>http://tamersalama.com/2013/04/15/rubymotion-pulltorefresh/</link>
		<comments>http://tamersalama.com/2013/04/15/rubymotion-pulltorefresh/#comments</comments>
		<pubDate>Tue, 16 Apr 2013 04:58:22 +0000</pubDate>
		<dc:creator>Tamer</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[RubyMotion]]></category>

		<guid isPermaLink="false">http://tamersalama.com/?p=1035</guid>
		<description><![CDATA[To add Sam Vermette&#8217;s SVPullToRefresh to your RubyMotion project: Add the SVPullToRefresh pod Add the Quartz Framework [crayon-519ead2716692/] Then &#8211; in your controller [crayon-519ead2717635/]]]></description>
			<content:encoded><![CDATA[To add Sam Vermette&#8217;s <a href="https://github.com/samvermette/SVPullToRefresh" title="SVPullToRefresh" target="_blank">SVPullToRefresh</a> to your RubyMotion project:

<ol>
<li>Add the SVPullToRefresh pod</li>
<li>Add the Quartz Framework</li>
</ol>

 
<pre class="crayon-plain-tag"># In your Rakefile
Motion::Project::App.setup do |app|
  # ...
  app.frameworks += ['QuartzCore']

  app.pods do
    pod 'SVPullToRefresh'
    # ...
  end

end</pre> 

Then &#8211; in your controller
 
<pre class="crayon-plain-tag">def viewDidLoad
   # ....
    tableView.addPullToRefreshWithActionHandler Proc.new {
      loadMagicalData(tableView)
     # do some other magic
     # then don't forget to:
      tableView.pullToRefreshView.stopAnimating
    }

  # ...

end</pre> 

]]></content:encoded>
			<wfw:commentRss>http://tamersalama.com/2013/04/15/rubymotion-pulltorefresh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using NUI with RubyMotion</title>
		<link>http://tamersalama.com/2013/03/18/using-nui-with-rubymotion/</link>
		<comments>http://tamersalama.com/2013/03/18/using-nui-with-rubymotion/#comments</comments>
		<pubDate>Tue, 19 Mar 2013 03:01:45 +0000</pubDate>
		<dc:creator>Tamer</dc:creator>
				<category><![CDATA[iOS]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[RubyMotion]]></category>

		<guid isPermaLink="false">http://tamersalama.com/?p=1026</guid>
		<description><![CDATA[NUI is an open-source library that allows you to style your iOS applications using CSS-like files and syntax. In my opinion, NUI carries few benefits over its commercial, KickStart backed, competitor Pixate. First; NUI allows you to style your application on the fly while it&#8217;s running in the simulator. And Second; NUI styled-elements are not [...]]]></description>
			<content:encoded><![CDATA[<a href="https://github.com/tombenner/nui" target="_blank">NUI</a> is an open-source library that allows you to style your iOS applications using CSS-like files and syntax. In my opinion, NUI carries few benefits over its commercial, KickStart backed, competitor <a href="http://www.pixate.com/" target="_blank">Pixate</a>. First; NUI allows you to style your application on the fly while it&#8217;s running in the simulator. And Second; NUI styled-elements are not masked/wrapped in their special classes (like those PX* classes with pixate), rather, they remain as their original iOS declarations. The second point makes debugging the simulated application and tracking ons-creen objects (using cmd-hover) much easier.

<br/><br/>
<b>Installation:</b>
<br/>
In your RubyMotion application&#8217;s Rakefile:
 
<pre class="crayon-plain-tag">Motion::Project::App.setup do |app|
  #...
  app.pods do
    # ...
    pod 'NUI'
  end
end</pre>


Then run <code><pre class="crayon-plain-tag">rake clean & rake</pre></code>


<br/><br/>
<b>Usage:</b>
<br/>


Create a theme.nss file (which will include your application&#8217;s stylesheet). Then in your <pre class="crayon-plain-tag">app_delegate.rb</pre> 
 
<pre class="crayon-plain-tag">class AppDelegate

  @@nui_settings = NUISettings.init
  @@nui_settings.setAutoUpdatePath("/absolute/path/to/project/and/theme.nss")

  def application(application, didFinishLaunchingWithOptions:launchOptions)

    @nui = NUIAppearance.init
    # ...
  end

end</pre> 


<br/>
Run <code> <pre class="crayon-plain-tag">rake</pre> </code> and check your application in the simulator. Now, any changes to the <pre class="crayon-plain-tag">theme.nss</pre>  file will be reflected right away to the running application in the simulator.

Happy styling
]]></content:encoded>
			<wfw:commentRss>http://tamersalama.com/2013/03/18/using-nui-with-rubymotion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Consultancy Masterclass</title>
		<link>http://tamersalama.com/2013/03/18/consultancy-masterclass/</link>
		<comments>http://tamersalama.com/2013/03/18/consultancy-masterclass/#comments</comments>
		<pubDate>Mon, 18 Mar 2013 16:29:02 +0000</pubDate>
		<dc:creator>Tamer</dc:creator>
				<category><![CDATA[Professional]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://tamersalama.com/?p=1023</guid>
		<description><![CDATA[Last weekend, I sat through the two-day Consultancy Masterlcass by Brennan Dunn &#038; Obie Fernandez. Both Brennan and Obie have extensive experience building their own successful consultancy firms. The class was insightful and full of those &#8216;from the trenches&#8217; experiences. What was of significant value is the knowledge transparently shared by students and alumni. All [...]]]></description>
			<content:encoded><![CDATA[Last weekend, I sat through the two-day <a href="http://doubleyourfreelancingrate.com/build-a-consultancy" target="_blank">Consultancy Masterlcass</a> by <a href="http://doubleyourfreelancingrate.com/" target="_blank">Brennan Dunn</a> &#038; <a href="http://obiefernandez.com/" target="_blank">Obie Fernandez</a>. Both Brennan and Obie have extensive experience building their own successful consultancy firms. 

The class was insightful and full of those &#8216;from the trenches&#8217; experiences. What was of significant value is the knowledge transparently shared by students and alumni. All of whom are of similar mindsets and are taking their steps in establishing their own names in the consultancy world. I look forward to being part of a great community.

]]></content:encoded>
			<wfw:commentRss>http://tamersalama.com/2013/03/18/consultancy-masterclass/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thoughts on building vs growing</title>
		<link>http://tamersalama.com/2012/11/09/thoughts-on-building-vs-growing/</link>
		<comments>http://tamersalama.com/2012/11/09/thoughts-on-building-vs-growing/#comments</comments>
		<pubDate>Sat, 10 Nov 2012 06:40:41 +0000</pubDate>
		<dc:creator>Tamer</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Professional]]></category>

		<guid isPermaLink="false">http://tamersalama.com/?p=1014</guid>
		<description><![CDATA[Many times I&#8217;ve heard professionals talk and plan out building software applications. Great ideas they&#8217;d like seen implemented, and how it could make things better. Though might not seem obvious &#8211; software applications, at least the good, are never built.Applications are grown.[1]There&#8217;s quite the range of differences between building an application and growing one, but [...]]]></description>
			<content:encoded><![CDATA[<p>Many times I&#8217;ve heard professionals talk and plan out building software applications. Great ideas they&#8217;d like seen implemented, and how it could make things better. Though might not seem obvious &#8211; software applications, at least the good, are never built.</p><p>Applications are grown.[1]</p><p>There&#8217;s quite the range of differences between building an application and growing one, but I&#8217;ll focus here on few main ones.</p><p>Building something is associated with a resulting rigid structure and components. It takes effort to put together, but once build &#8211; it&#8217;s static. All what&#8217;s left is usage, admiration &amp; maintenance.</p><p>On the other hand, growing something is an organic process. It rarely stops. It requires a continuous labour of love. You can reap benefits but as you do, you always have to give back, care and nurture.</p><p>Growing is more appropriate to the act of developing software. Applications doesn&#8217;t (or shouldn&#8217;t) reach a static rigid state, they always benefit from continuous assessment, reevaluation and changes. They adjust to surroundings. They evolve, transform and get bigger (but not necessarily more complex).<br /> <br />So &#8211; next time you&#8217;re discussing new applications &#8211; try to see how close the word &#8216;growing&#8217; is to everyone.</p><p>[1] I wish I could remember where first I heard that or who said it.</p>]]></content:encoded>
			<wfw:commentRss>http://tamersalama.com/2012/11/09/thoughts-on-building-vs-growing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Rails and inner query choices</title>
		<link>http://tamersalama.com/2012/11/08/rails-and-inner-query-choice/</link>
		<comments>http://tamersalama.com/2012/11/08/rails-and-inner-query-choice/#comments</comments>
		<pubDate>Fri, 09 Nov 2012 03:13:51 +0000</pubDate>
		<dc:creator>Tamer</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://tamersalama.com/?p=1005</guid>
		<description><![CDATA[Consider that we have two models; [crayon-519ead273050f-i/] and [crayon-519ead27314a8-i/] . A Well represent an oil/gas/water well, each with multiple SurveyPoints. A SurveyPoint represent the well&#8217;s coordinate at a certain depth. [crayon-519ead2732b01/] Say, we&#8217;d like to implement a filtration mechanism that allows us to query the wells &#8211; and for those set of wells we&#8217;d like [...]]]></description>
			<content:encoded><![CDATA[<p>
Consider that we have two models;  <pre class="crayon-plain-tag">Well</pre> and  <pre class="crayon-plain-tag">SurveyPoint</pre> . A Well represent an oil/gas/water well, each with multiple SurveyPoints. A SurveyPoint represent the well&#8217;s coordinate at a certain depth.
</p>
 
<p>
 
</p><pre class="crayon-plain-tag">class Well &lt; ActiveRecord::Base
  has_many :survey_points
end

class SurveyPoint &lt; ActiveRecord::Base
  belongs_to :well
end</pre><p> 

</p>


<p>
Say, we&#8217;d like to implement a filtration mechanism that allows us to query the wells &#8211; and for those set of wells we&#8217;d like to conditionally present the set of survey_points for those set of filtered wells.
</p>

<p>
A method &#8216;<pre class="crayon-plain-tag">Well.search</pre>&#8216; would returns the set of wells we&#8217;re interested in ( <pre class="crayon-plain-tag">@wells</pre> )
</p>

<p>
Using the power of AREL chaining, we could then conditionally extract the SurveyPoints using the following:
</p>

<p>
 
</p><pre class="crayon-plain-tag">def SurveyPoint.find_for_wells(wells)
 scope.where(:well_id => wells.select(:id))
end</pre><p> 
</p>

<p>
This roughly translates into the query:
</p>
 
<pre class="crayon-plain-tag">SELECT * FROM SURVEY_POINTS WHERE WELL_ID IN (SELECT ID FROM WELLS WHERE ....)</pre> 

<p>
The challenge here is that if both results is large, depending on the cardinality &#8211; the database engine might not be able to make use of defined indexes and the outer query might not be optimizable.
</p>
<p>
Instead &#8211; if we use pluck instead of select:
</p> 
<p>
</p><pre class="crayon-plain-tag">def self.find_for_wells(wells)
 scope.where(:well_id =&gt; wells.pluck(:id))
end</pre><p> 
</p>
<p>
Rails would fire two queries instead of an inner one. Pluck would first extract the list of ids (val_1, val_2, &#8230;) in an array before passing it to the main query. This roughly translates into:
</p>
<p>
 
</p><pre class="crayon-plain-tag">SELECT * FROM SURVEY_POINTS WHERE WELL_ID IN (val_1, val_2, val_3, ....)</pre><p> 

</p>

<p>
No inner query is used in that case and the main one is easy to optimize.
</p>]]></content:encoded>
			<wfw:commentRss>http://tamersalama.com/2012/11/08/rails-and-inner-query-choice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JRuby &#8211; can&#8217;t convert Hash into String</title>
		<link>http://tamersalama.com/2012/11/08/jruby-cant-convert-hash-into-string/</link>
		<comments>http://tamersalama.com/2012/11/08/jruby-cant-convert-hash-into-string/#comments</comments>
		<pubDate>Thu, 08 Nov 2012 20:43:16 +0000</pubDate>
		<dc:creator>Tamer</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://tamersalama.com/?p=1001</guid>
		<description><![CDATA[I&#8217;ve recently upgraded a JRuby/Rails application from JRuby 1.6.3 (1.8 compatibility mode) to 1.6.8 (1.9 mode). Everything was working out fine except for actions relying on internal CSV library (FasterCSV in 1.8 mode). The error [crayon-519ead273c099-i/] was thrown as CSV tries to generate the csv string. This had the hallmarks that the application was still [...]]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;ve recently upgraded a JRuby/Rails application from JRuby 1.6.3 (1.8 compatibility mode) to 1.6.8 (1.9 mode). Everything was working out fine except for actions relying on internal CSV library (FasterCSV in 1.8 mode). The error  <pre class="crayon-plain-tag">can't convert Hash into String</pre> was thrown as CSV tries to generate the csv string.
</p>

<p>
This had the hallmarks that the application was still under the 1.8 mode (after a deploy to tomcat). The following XML entry in web.xml was essential to enforce the 1.9 mode:
</p><pre class="crayon-plain-tag">&lt;context-param&gt;
    &lt;param-name&gt;jruby.compat.version&lt;/param-name&gt;
    &lt;param-value&gt;1.9&lt;/param-value&gt;
  &lt;/context-param&gt;</pre><p> 
</p>
]]></content:encoded>
			<wfw:commentRss>http://tamersalama.com/2012/11/08/jruby-cant-convert-hash-into-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>newrelic &#8211; undefined method `-&#8217; for nil:NilClass</title>
		<link>http://tamersalama.com/2012/10/30/newrelic-undefined-method-for-nilnilclass/</link>
		<comments>http://tamersalama.com/2012/10/30/newrelic-undefined-method-for-nilnilclass/#comments</comments>
		<pubDate>Tue, 30 Oct 2012 23:02:37 +0000</pubDate>
		<dc:creator>Tamer</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://tamersalama.com/?p=985</guid>
		<description><![CDATA[Using JRuby with trinidad (developer mode) &#8211; I was intermittently getting this error. Apparently thrown as estimated_time for the transaction was returning nil. I was also having all sorts of other issues (undefined method `metric_name&#8217; for nil:NilClass) with all newrelics action summaries. To resolve (following suggestions on the trinidad google group): [crayon-519ead27426dc/] According to Nick [...]]]></description>
			<content:encoded><![CDATA[<p>
Using JRuby with trinidad (developer mode) &#8211; I was intermittently getting this error. Apparently thrown as <code>estimated_time</code> for the transaction was returning <code>nil</code>. I was also having all sorts of other issues (undefined method `metric_name&#8217; for nil:NilClass) with all newrelics action summaries.
</p>
<p>
To resolve (following suggestions on the <a href="https://groups.google.com/forum/#!topic/rails-trinidad/a6uNdguEEwY" target="_blank">trinidad google group</a>):
</p>
 
<pre class="crayon-plain-tag"># config/initializers/newrelic.rb
if defined?(JRUBY_VERSION) &amp;&amp; Rails.env == "development"
  require 'newrelic_rpm'
  NewRelic::Agent.manual_start({:dispatcher =&gt; :trinidad, :agent_enabled =&gt; true})
end

# Gemfile
group :development do
  gem 'newrelic_rpm', '3.3.0', :require =&gt; false
end</pre> 

<p>
According to Nick Sieger&#8217;s <a href="https://github.com/nicksieger/redmine/blob/master/config/initializers/newrelic.rb" target="_blank">gist</a> &#8211; &#8220;NewRelic isn&#8217;t detecting Trinidad at the moment&#8221; &#8211; Although I could see trinidad&#8217;s detection mechanism implemented in newrelic&#8217;s most recent (3.5.0.1)
</p>
<p>
I&#8217;ve tried it with more recent versions of newrelic &#8211; but it seems 3.3.0 is the most stable.<br/>
JRuby 1.6.8 (1.9 mode)<br/>
trinidad 1.4.4<br/>
newrelic_rpm 3.3.0<br/>
</p>

<strong>UPDATE:</strong><br/>
<p>
Getting another error of  <pre class="crayon-plain-tag">undefined method `first' for true:TrueClass</pre>. The error is apparently thrown if the &#8220;EXPLAIN&#8221; query has failed against the DB engine. Although &#8211; I got the transaction_tracing disabled with explain_enabled set to false &#8211; yet this release still attempts to fire the &#8220;EXPLAIN&#8221; against the DB.
</p>
<br/>
<p>
Since I&#8217;m using the oracle_enhanced_adapter, the current newrelic &#8220;EXPLAIN&#8221; query wouldn&#8217;t work &#8211; hence an error is thrown. However, the error consumption by newrelic returns true rather than nil.
</p>
<p>
Changing <pre class="crayon-plain-tag">handle_exception_in_explain</pre> to return nil instead of the true fixes it.
</p>
 
 
<pre class="crayon-plain-tag">def handle_exception_in_explain
        yield
      rescue Exception =&gt; e
        begin
          # guarantees no throw from explain_sql
          NewRelic::Control.instance.log.error("Error getting query plan: #{e.message}")
          NewRelic::Control.instance.log.debug(e.backtrace.join("\n"))
          # UPDATE: Added to prevent issues when drilling down deep into SQL (explain not working)
          nil
        rescue Exception
          # double exception. throw up your hands
        end
      end</pre> 

]]></content:encoded>
			<wfw:commentRss>http://tamersalama.com/2012/10/30/newrelic-undefined-method-for-nilnilclass/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JRuby/Rails Streaming in development environment (and beyond)</title>
		<link>http://tamersalama.com/2012/10/23/jrubyrails-streaming-in-development-environment-and-beyond/</link>
		<comments>http://tamersalama.com/2012/10/23/jrubyrails-streaming-in-development-environment-and-beyond/#comments</comments>
		<pubDate>Tue, 23 Oct 2012 12:39:00 +0000</pubDate>
		<dc:creator>Tamer</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://tamersalama.com/?p=968</guid>
		<description><![CDATA[Rails streaming is a great feature that allows you to optimize on server resources when dealing with large generated content. However &#8211; it might be a bit tricky to validate and test in local development. First off &#8211; a local server that supports streaming is required. The only one I could find was trinidad which [...]]]></description>
			<content:encoded><![CDATA[<p>
Rails streaming is a great feature that allows you to optimize on server resources when dealing with large generated content. However &#8211; it might be a bit tricky to validate and test in local development.
</p>
<p>
First off &#8211; a local server that supports streaming is required. The only one I could find was <a title="trinidad" href="https://github.com/trinidad/trinidad" target="_blank">trinidad</a> which is moving to the likely defacto for JRuby/Rails projects. Trinidad uses tomcat-core as it&#8217;s servlet container and server.
</p>
<p>
Then make sure you grab the latest <a title="jruby-rack" href="http://rubygems.org/gems/jruby-rack" target="_blank">jruby-rack</a> resolving most recent issues (1.1.10 at the time of writing).
</p>
<p>
This <a title="stackoverflow" href="http://stackoverflow.com/a/4320399/7693" target="_blank">StackOverflow answer</a>, along with <a href="http://robotmay.com/post/24054884390/forgotten-rails-features-http-streaming" target="_blank">this guide</a> offer a comprehensive support as to what options work with Rails version as well as some gotchas (newrelic, caching, haml, &#8230;).
</p>
<p>
For Rails 3.2.x &#8211; It boils down to assigning an object that responds to an each method call to the <code>response_body</code> of a controller&#8217;s action. However &#8211; this doesn&#8217;t allow you to set a <code>:stream =&gt;true</code> where it explicitly tells Rails to stream the respons. To resolve that I opted to use a render call, with a passed option hash as follows:
</p>
<pre class="crayon-plain-tag"># Controller
def streaming_action
  @objs = MyObj.where(:foo =&gt; 'bar')
  render :nothing =&gt; true, :stream =&gt; true #setting the response to stream while rendering nothing
  self.response_body = Streamer.new(@objs) # the object responding to 'each' call
end

#models/streamer.rb
class Streamer
  attr_accssor :objs

  def initialize(objs)
    @objs = objs
  end

  # all the magic
  def each
    yield &quot;Some initial output for header&quot;
    @objs.each do |obj|
      yield &quot;#{obj.attr}\n&quot;
    end
  end
end</pre>
<p>
This works with the following releases:
JRuby 1.6.8
Rails 3.2.8
jruby-rack 1.1.10
trinidad 1.4.4
</p>]]></content:encoded>
			<wfw:commentRss>http://tamersalama.com/2012/10/23/jrubyrails-streaming-in-development-environment-and-beyond/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JQuery Autocomplete updating a document element (not the dropdown)</title>
		<link>http://tamersalama.com/2011/12/06/jquery-autocomplete-updating-a-document-element-element-not-a-dropdown/</link>
		<comments>http://tamersalama.com/2011/12/06/jquery-autocomplete-updating-a-document-element-element-not-a-dropdown/#comments</comments>
		<pubDate>Wed, 07 Dec 2011 00:38:51 +0000</pubDate>
		<dc:creator>Tamer</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://tamersalama.com/?p=960</guid>
		<description><![CDATA[I came across the requirement of updating a page element from the result of an Autocomplete. The server results were to be placed in a select element as set of option items. I had to overwrite some JQuery UI Autocomplete private methods as apparently there was no easy way of generating HTML and embedding it [...]]]></description>
			<content:encoded><![CDATA[I came across the requirement of updating a page element from the result of an Autocomplete. The server results were to be placed in a select element as set of option items.

I had to overwrite some <a href="https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.autocomplete.js" title="JQuery UI Autocomplete">JQuery UI Autocomplete</a> private methods as apparently there was no easy way of generating HTML and embedding it in the right spot on the page:

The JSON server response:
<pre class="crayon-plain-tag">[{&quot;id&quot;:&quot;aaa&quot;,&quot;id_and_ba_name&quot;:&quot;bbb&quot;}, ...]</pre>
<pre class="crayon-plain-tag">var auto = $(&quot;#lc&quot;).autocomplete({
      minLength: 3,
      delay: 600,
      dataType: 'json',
      source: '/remote/action',
      open: function() {
         $(&quot;ul.ui-autocomplete&quot;).remove(); //removes the ul styling for dropdown
      }
    })
    auto.data(&quot;autocomplete&quot;)._renderMenu= function(element, items) {
      //treats the DOM element as the menu where items are to be placed
      var self = this;
      $('#the_select_element').show().html('');
      $.each( items, function( index, item ) {
        self._renderItem($('#the_select_element'), item );
      });
    }
    auto.data(&quot;autocomplete&quot;)._renderItem= function(element, item) {
       // generate options elements and adds them to menu
       return $(&quot;&amp;lt;option&gt;&amp;lt;/option&gt;&quot;)
        .data(&quot;item.autocomplete&quot;,item)
        .attr(&quot;value&quot;,item.id)
        .append(item.id_and_ba_name)
        .appendTo(element);
    }</pre>

JQuery 1.8.16
Rails 3.1]]></content:encoded>
			<wfw:commentRss>http://tamersalama.com/2011/12/06/jquery-autocomplete-updating-a-document-element-element-not-a-dropdown/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JRuby and Polyglot</title>
		<link>http://tamersalama.com/2011/11/17/jruby-and-polyglot/</link>
		<comments>http://tamersalama.com/2011/11/17/jruby-and-polyglot/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 03:02:24 +0000</pubDate>
		<dc:creator>Tamer</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://tamersalama.com/?p=954</guid>
		<description><![CDATA[JRuby 1.5.6 (I know. Old) Rails 3.0.1 Polyglot 0.3.3 UPDATE: see easier fix below Getting the following error when bundling: [crayon-519ead275282e/] JRuby YAML parser is erring with this version of Polyglot (don&#8217;t you love JRuby!!). &#8216;gem dependency -R polyglot&#8217; will get you the reverse dependencies on the library. In this case it&#8217;s &#8216;treetop&#8217; Had to [...]]]></description>
			<content:encoded><![CDATA[JRuby 1.5.6 (I know. Old)
Rails 3.0.1
Polyglot 0.3.3

UPDATE: see easier fix below

Getting the following error when bundling:

<pre class="crayon-plain-tag">Java::JavaLang::ArrayIndexOutOfBoundsException: An error occured while installing polyglot (0.3.3), and Bundler cannot continue.
Make sure that `gem install polyglot -v '0.3.3'` succeeds before bundling.</pre>

JRuby YAML parser is erring with this version of Polyglot (don&#8217;t you love JRuby!!).

&#8216;gem dependency -R polyglot&#8217; will get you the reverse dependencies on the library. In this case it&#8217;s &#8216;treetop&#8217;

Had to edit the &#8216;gemspec&#8217; files and restrict the version of polyglot to &#8216;< 0.3.3'

Example - From
s.add_runtime_dependency(%q<polyglot>, [">= 0"])
To
s.add_runtime_dependency(%q<polyglot>, [">= 0", "< 0.3.3"])

Yak shaving!!!

UPDATE: EASIER FIX:
just use <code>gem 'polyglot', '0.3.2'</code> in your Gemfile, it might just do the trick.]]></content:encoded>
			<wfw:commentRss>http://tamersalama.com/2011/11/17/jruby-and-polyglot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
