<?xml version="1.0" encoding="UTF-8"?><!-- generator="WordPress/2.5.1" -->
<rss version="0.92">
<channel>
	<title>ahabman</title>
	<link>http://www.ahabman.com/blog</link>
	<description></description>
	<lastBuildDate>Thu, 16 Oct 2008 13:01:26 +0000</lastBuildDate>
	<docs>http://backend.userland.com/rss092</docs>
	<language>en</language>
	
	<item>
		<title>ruby on rails - has and belongs to many view plugin</title>
		<description>So I'll never have to write another has_and_belongs_to_many view again, here's a plugin that dynamically makes 2 &#60;ul&#62; lists which you drag and drop both ways to manage the association.

http://svn.ahabman.com/public/many_to_many_view/

From the readme:

Assumming you have an @project var and you want to associate people with it.
&#60;div id="m2m_container"&#62;
&#60;%= render :partial =&#62; "shared/m2m", ...</description>
		<link>http://www.ahabman.com/blog/2008/10/ruby-on-rails-has-and-belongs-to-many-view-plugin/</link>
			</item>
	<item>
		<title>You can&#8217;t use class variables in rails.</title>
		<description>You can't use class variables in rails.  Unless you'd like to develop in production mode (specifically with config.cache_classes = true).  In development mode all classes are reloaded on each request, which clears all class variables.

I had the perfect place to use them - while running a mass synchronization, and needing ...</description>
		<link>http://www.ahabman.com/blog/2008/10/you-cant-use-class-variables-in-rails/</link>
			</item>
	<item>
		<title>ruby csv to structured hash</title>
		<description>I had a csv like this:



object
color
flavor
shape


apple
red
sweet
round


banana
yellow
sweet
long


lemon
yellow
sour
round


and I wanted a ruby hash structured like this:
{
'apple'=&#62; { 'color'=&#62;'red',  'flavor'=&#62;'sweet', 'shape'=&#62;'round'},
'banana'=&#62; {  'color'=&#62;'yellow',  'flavor'=&#62;'sweet', 'shape'=&#62;'long'},
'lemon'=&#62; {   'color'=&#62;'yellow',  'flavor'=&#62;'sour', 'shape'=&#62;'round'}
}

So I wrote this, which does the job:
require "faster_csv"

def csv_to_structured_hash
	arr_of_arrs = FasterCSV.read( 'your.csv' )
	stuff = {}
	header = arr_of_arrs.shift
		arr_of_arrs.each_with_index do &#124;row, i&#124;
		thing = { row[0] =&#62; ...</description>
		<link>http://www.ahabman.com/blog/2008/09/ruby-csv-to-structured-hash/</link>
			</item>
	<item>
		<title>Django Tango</title>
		<description>A Django Reinhardt and David Grisman fusion.

multitrack mandolins, nylon guitars,  and percusion. </description>
		<link>http://www.ahabman.com/blog/2008/07/django-tango/</link>
			</item>
	<item>
		<title>Ruby conversion module</title>
		<description>This is a ruby module useful for conversions dealing with length, weight, torque.
module Convert

  def Convert.number_with_precision(number, precision=2)
    "%01.#{precision}f" % number
  rescue
    number
  end

  def Convert.mm_to_in(mm, precision=2)
    number_with_precision(mm * 0.03937, precision)
  end

  def Convert.in_to_mm(inches, precision=2)
    number_with_precision(inches / 0.03937 , precision)
  end


  def Convert.feet_to_meters(f, precision=2)
    number_with_precision( f * 0.3048, precision)
  end

  def ...</description>
		<link>http://www.ahabman.com/blog/2008/07/ruby-conversion-module/</link>
			</item>
	<item>
		<title>Rails redirect_to :back in Internet Explorer</title>
		<description>Today I realized that the rails command   redirect_to :back  does not work in Internet Explorer because  redirect_to :back  depends on HTTP_REFERER, which IE does not do.  I was capturing an onclick event with jQuery and was able to sending along the  current URL as a query string, which provided ...</description>
		<link>http://www.ahabman.com/blog/2008/06/rails-redirect_to-back-in-internet-explorer/</link>
			</item>
	<item>
		<title>Rails background process - simple, fast, easy.</title>
		<description>My situation was this -

	Rails 2.0 app running on slicehost (ubuntu 8.04) in passenger mod_rails
	The goal was Dynamic PDF generation for a product catalog ( &#62; 100 pages)
	This event had to be triggered from within the rails request / response cycle, but run outside of it
	I needed the simplest, fastest, ...</description>
		<link>http://www.ahabman.com/blog/2008/05/rails-background-process-simple-fast-easy/</link>
			</item>
	<item>
		<title>Point</title>
		<description> </description>
		<link>http://www.ahabman.com/blog/2008/05/point/</link>
			</item>
	<item>
		<title>mod_rails set RAILS_ENV variable to QA, Staging, or Production</title>
		<description>I'm using mod_rails with capistrano and multi-stage (qa, staging, production), and wrote this workaround so that the RAILS_ENV could be set correctly in each stage.  Mod_rails sets RAILS_ENV once in the global server conf file, but I needed it set once for each environment: qa, staging, and production.  I tried ...</description>
		<link>http://www.ahabman.com/blog/2008/05/mod_rails-set-rails_env-variable-to-qa-staging-or-production/</link>
			</item>
	<item>
		<title>jQuery validation with Prototype</title>
		<description>Here is the jQuery validation plugin fixed up so that it works if you have prototype installed along side jQuery.  I just replaced references to $() with jQuery() in the jQuery.validations.js file.
jquery.validate.js with prototype </description>
		<link>http://www.ahabman.com/blog/2008/05/jquery-validation-with-prototype/</link>
			</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 4.583 seconds -->
