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

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: return super… Continue reading Why Doesn’t My Rails App Use memcached with cached_model?

Get Apache Serving Static Files With Prefixed Mongrel

I decided to run AltLaw.org under a “/v1” URL prefix. It’s still beta, and the URL structure will likely change in the future. I don’t want to break 160,000 links when that day comes. Fortunately, Mongrel makes this pretty easy with the –prefix option to mongrel_rails. I added –prefix ‘/v1’ to my mongrel_rails command line.… Continue reading Get Apache Serving Static Files With Prefixed Mongrel

Darcs with Capistrano for Rails

I’ve used Darcs as my only version-control system for a while now. When I got into Rails, I naturally wanted to use Capistrano. Unfortunately, Darcs and Capistrano don’t get along too well. Darcs’ file-based repositories don’t mesh well with Capistrano’s assumption that the repository is accessed through a server, a la Subversion. I ran into… Continue reading Darcs with Capistrano for Rails

The Price of Fame

After the New York Times’ premature announcement of AltLaw.org — I don’t mind, publicity is good — I discovered the downside of getting linked, even indirectly, from a major site. I woke this morning to find 632 bounced spam messages in my inbox sent from spoofed “@stuartsierra.com” addresses. Gotta update my catch-all email settings.

Published
Categorized as Uncategorized Tagged

Apache Proxy for Rails Returns 403 Forbidden

Trying to set up Apache2 as a proxy for mongrel on my new Ruby on Rails server, following the instructions on the mongrel site. I kept getting “403 Forbidden” errors on every request. I found a comment that seemed to describe the same situation. Sure enough, editing /etc/apache2/mods-enabled/proxy.conf to change “Deny” to “Allow” fixed the… Continue reading Apache Proxy for Rails Returns 403 Forbidden

Stretching LaTeX

I recently picked up The LaTeX Companion, 2nd Edition. It’s… dense. It shows a lot of amazing things LaTeX can do, but also highlights its weaknesses. Most of these weaknesses have to do with the legacy of TeX itself. For example, it’s difficult to flow text around objects, because TeX determines line widths before it… Continue reading Stretching LaTeX

Beyond Syntax

From a 1995 paper on intentional programming: “Present day syntax had [sic] been predicated on a character stream that could have been input from punch cards, or teletypes.” Exactly! Why are we still working in a punch-card manner on million-pixel displays? Why are we still arguing about curly brackets versus parentheses when Unicode has millions… Continue reading Beyond Syntax

Ruby vs. Lisp

I’m certainly not the first to do this, but I felt like writing it. Comparing Ruby and Common Lisp: Syntax: Advantage, Common Lisp. No contest here. Ruby’s syntax is ugly, with all those ends hanging around and the { |var| … } block syntax. The one thing Ruby has going for it is conciseness. The… Continue reading Ruby vs. Lisp

The Virtues of Static Typing

When I first discovered dynamically-typed languages like Perl and Ruby, I was convinced of their superiority to statically-typed languages like C++. No longer did I have to waste hours typing redundant type declarations or adding casts just to make the compiler happy. Dynamic typing allowed me to work quickly and unencumbered in what felt like… Continue reading The Virtues of Static Typing