Posts

Showing posts from November, 2007

links for 2007-11-30

Scientific American: The Secret to Raising Smart Kids (tags: kids education ) Reinspire :: CSS Vertical Stretch span or stretch a div all the way to the bottom of the page (tags: css )

links for 2007-11-29

Ultra High Security Password Generator (tags: passwords security )

links for 2007-11-28

Prototype checklist (tags: javascript ) Javascript Closures (tags: javascript )

links for 2007-11-27

Tango Icon Library - Tango Desktop Project (tags: icons )

links for 2007-11-23

Chart Chooser (tags: charts ) A MapQuest for Our Money - New York Times (tags: money budget )

links for 2007-11-21

Backbase Ajax Portal Demo (tags: ajax portal ) Mootools Ajax Portal Demo (tags: ajax portal ) Drag/Drop Portal Interface With Scriptaculous And Drupal | Ayman Hourieh's Blog (tags: ajax portal ) JIRA - Feature Tour - Report example of jira's portal, or customizable dashboard (tags: portal ) Xilinus : Prototype Portal Class (tags: ajax portal )

links for 2007-11-17

DBAzine.com: Trees in SQL: Nested Sets and Materialized Path (tags: database ) Representing Trees in a relational DB (tags: database )

links for 2007-11-16

subtlety : a remote subversion excursion This is just too useful. I'm using it to monitor Rails. (tags: subversion rss )

Functional Programming Meets Web Application Development

If you're checking out functional programming, but are firming stuck in object oriented programming, then give Scala a try. Scala merges aspects of OOP and FP together into a cohesive and flexible language. If you're a web application developer interested in functional programming, then you'll want to check out David Pollak's presentation on lift to the Bay Area Functional Programmers . lift is a web framework written in Scala, using both functional programming and Scala's Actors, which enable heavily concurrent applications via lightweight (threadless) processes.

links for 2007-11-09

rfacebook - facebook api for ruby and rails (tags: rubyonrails facebook )

Rails Bug With Has Many Collections Empty? and Build

After my long rant about problems in Ruby on Rails has_many collections and empty? calls , we spent some more time and really condensed the problem. I can explain this problem much more clearly now. Let's take the following code: f = Foo.new f.bars.build f.bars.empty? pp f.bars What do you think will be printed out when we pp f.bars ? Well, if you're like me, you'd think it would return an array with one Bar in it. And, if you were like me, you'd be wrong. Turns out that the call to f.bars.empty? doesn't realize you've ever added a new Bar to the collection of bars. Therefore, it will go into the database and do a select count(*) to determine the size of the collection. It will return zero, because at this point you haven't saved anything into the database. Not only is going to the database to determine the size of the collection wrong (in the line above, I've added a Bar though build so empty? should know there's at least one), but empty?

links for 2007-11-07

A clean slate, Edge Rails recipe (tags: rubyonrails )

When Empty Isn’t Empty With Rails Active Record Collections

So I'm writing some Rails code, just playing around, and I run into a very strange situation. I've found a situation where Rails' Active Record code is calculating the results to empty? incorrectly, even if I add elements to the collection . So I had a has_many collection with elements inside of it, but calls to length or empty were returning 0 and true . Here's my simple models: class Query < ActiveRecord::Base has_many :measures validates_presence_of :cube_name def measure_attributes=(attrs) attrs.each {|a| measures.build(a)} end end and class Measure :query has_one :condition, :as => :conditionable end Notice that in Query, I've added a measure_attributes method which automatically handles the construction of new Measure instances from the form parameters. Here's the simple nested form. From the models, a Query has many Measures: <% form_for :query, :url => {:action => :new} do |f| %> Cube Name: <%= f.text_field :

links for 2007-11-03

Kimball Group: Data Warehouse Training: Articles (tags: database datawarehouse )