Archive for October, 2007

Parsing Complex Comparisons

Tuesday, October 16th, 2007

An interesting tidbit: can your programming language parse a < b < c? Perl can’t. Ruby can, but returns an error “undefined method `>’ for false:FalseClass.” Interestingly, Python accepts it, and even gives the correct result. Something clever must be going on in the parser to make that work.
Update October 17: Although Lisp can’t [...]

code.nytimes.com

Tuesday, October 16th, 2007

A cool new site, with the best possible slogan, “All the code that’s fit to printf().” Nice to see a giant media company getting into this.

Why Doesn’t My Rails App Use memcached with cached_model?

Thursday, October 4th, 2007

Answer: you’re using the latest version of Rails (1.2.3), which slightly changes the syntax of its SQL statements. cached_model relies on a regular expression to match that SQL statement.
To fix: Dive into the source of the cached_model gem, find the file lib/cached_model.rb, and change the first line after def self.find_by_sql to this:

[...]