/customers/iconara.net/iconara.net/httpd.www/blog/wp-content/plugins/wp-super-cache/wp-cache-phase1.php Iconara » Ruby

Archive for the 'Ruby' Category

Stability tip for running Sequel in Rails on Passenger

If you use Sequel in a web app running in Apache, here’s a stability tip: make sure you reconnect to the database when Passenger forks.

Read the rest of this entry →

Ruby 1.9 and encodings, lament â„– 1

Yehuda Katz, has done an excellent writeup on Ruby and encodings, but under the heading “Why this is, in practice, a rare problem”, I think he’s explained exactly why, in practice, there is a common problem:

In practice, most sources of data, without any further work, are already encoded as UTF-8. For instance, the default Rails MySQL connection specifies a UTF-8 client encoding, so even an ISO-8859-1 database will return UTF-8 data.

Many other data sources, such as MongoDB, only support UTF-8 data internally, so their Ruby 1.9-compatible drivers already return UTF-8 encoded data.

Your text editor (TextMate) likely defaults to saving your templates as UTF-8, so the characters in the templates are already encoded in UTF-8.

And then Ruby 1.9, unless you explicitly tells it otherwise, defaults to interpreting the file, and all strings defined in it, as ASCII and all that is for nothing.

Installing the MySQL gem in Snow Leopard

Installing the native MySQL gem (simply called mysql) isn’t as easy as it may seem — unless you’ve installed both MySQL and Ruby using MacPorts, in which case it is.

There are a few problems that crop up when installing the mysql gem: the build process may not find the MySQL libraries, they may build them for the wrong architecture and you may not have gotten all the required files when you installed MySQL.

Read the rest of this entry →