Flushing the DNS cache on OS X

I often find that OS X refuses to obey my /etc/hosts file for some time after I change it. It seems that often you have to manually flush the DNS cache by hand to force host file changes to take effect. Under pre-leopard systems, use lookupd : > sudo lookupd -flushcache Starting with Leopard, lookupd has been replaced with dscacheutil : > sudo dscacheutil -flushcache

August 5, 2009 · 1 min · Dave Perrett

HTTPSHandler error using python 2.5 and GAE on OS X

If you are getting an error complaining that ‘module’ object has no attribute ‘HTTPSHandler’ running python 2.5 on OS X : ...

June 6, 2009 · 1 min · Dave Perrett

'spec/rake/spectask' errors doing rake db:migrate

If you get an error similar to the following while running rake db:migrate : error no such file to load -- spec/rake/spectask … you need to install the rspec gem : > sudo gem install rspec

April 29, 2009 · 1 min · Dave Perrett

'Can't find Magick-config' error installing rmagick gem

If you are getting the error ‘Can’t find Magick-config’ when installing the RMagick gem, chances are you’re missing the libmagick9-dev library. /opt/ruby-enterprise-1.8.6-20090201/bin/ruby extconf.rb install rmagick checking for Ruby version >= 1.8.2... yes checking for gcc... yes checking for Magick-config... no Can't install RMagick 2.9.1. Can't find Magick-config in ..... To fix this on ubuntu, simply install libmagick : apt-get install libmagick9-dev

April 26, 2009 · 1 min · Dave Perrett

undefined method assert_valid_keys in Rails

If you are getting an error about ‘undefined method assert_valid_keys’ in Rails : undefined method `assert_valid_keys' for :time_entry_product:Symbol … it may be because you have two relationships specified on the same line in your model : ...

February 24, 2009 · 1 min · Dave Perrett

Styling Apache directory listings with mod_autoindex

Index-Style is a set of html, css and image files designed to work together with the mod_autoindex module to make the default Apache file listings look a little nicer. The UI design is based almost entirely on the great work done by the guys at Repos-Style, although the code itself is largely done from scratch (as mod_autoindex doesn’t support XSLT). ...

December 29, 2008 · 2 min · Dave Perrett

Nginx adds strange characters using rails/memcached_pass

After upgrading a few gems recently, I found that the content returned from the nginx memcached_pass directive always had a few strange characters prepended. After some investigation it seems that this is caused by rails ‘marshalling’ the data. If you’re using a memcached set command such as Cache.set(key, content, time_to_live) You need to add an extra argument to force rails to cache the raw data instead of marshalling it : ...

December 23, 2008 · 1 min · Dave Perrett

Phusion Passenger PassengerMaxPoolSize is ignored

I’ve been wondering for a while why Phusion Passenger seems to completely ignore the PassengerMaxPoolSize, PassengerMaxInstancesPerApp and PassengerPoolIdleTime directives. I recently discovered that they don’t work inside VirtualHost blocks in apache config. The old (non-working) config was something like : ...

December 22, 2008 · 1 min · Dave Perrett

Pylons - LookupError: Entry point 'main' not found in egg

If you are getting a LookupError in Pylons similar to the following : ...

December 21, 2008 · 1 min · Dave Perrett

memcaches_page plugin for Rails

This plugin is very similar to the built-in Rails ‘caches_page’ functionality, except it caches to memcached rather than a file. It relies on the ‘memcached_pass’ nginx directive to serve pages directly from memory if possible, and only passes to rails if necessary. On my server I’ve seen a 75% reduction in Ruby memory usage using this technique. ...

December 3, 2008 · 3 min · Dave Perrett