Kurt Stephens

Nerd Up!

rails

Ruby on Rails Caching

Kurt on Sun, 2007-10-07 02:38.

Links about Caching in Rails.

  • “Expanded Caching Scope” – http://ryandaigle.com/articles/2007/2/21/what-s-new-in-edge-rails-expanded-caching-scope

Ruby: Date / Rational / Fixnum#gcd hack increased app performance by 15%

Kurt on Wed, 2007-03-28 22:23.

Ruby Date uses Rational heavily, which calls Integer#gcd for every new Rational. The Integer#gcd method is generic to handle Bignums, but performs terribly for Fixnum#gcd(Fixnum), which is probably the most often case.

This RubyInline hack saved 15% execution time in a large Rails application:


UserQuery: Ruby Package Simplifies General Searching in Rails

Kurt on Thu, 2006-10-26 18:53.

See: http://rubyforge.org/projects/userquery/

The RubyForge package userquery allows users to do general queries on SQL database table columns using a simple query language. The package parses tokens from the user’s query and generates SQL WHERE clauses immune to SQL injection attacks.

For example, if a user wants to search for all entries records on a DATETIME field named date, the user can enter: “11/1/2006“ into a text field associated with searching on the date column.

UserQuery will intuitively convert this query into an SQL WHERE clause fragment:

(
 (entries.date >= '2006-11-01 00:00:00') 
AND 
 (entries.date <  '2006-11-02 00:00:00')
)

The user query syntax includes “NOT“, “OR“, “AND“ operators, grouping with parentheses, well as relational operators like “LESS THAN 5“ or “>= $500“. Keyword searching, like “foo AND NOT ‘bar baz’“ using SQL LIKE operators is configurable.


Syndicate content