Exclude tables from mysqldump

Recently I was in a position where i wanted to exclude 2 large tables from mysqldump, without specifying every single table I wanted to back up. After a bit of searching, it seems you can easily exclude tables from mysqldump using the –ignore-table option : > mysqldump -u dave -ppassword -h localhost --ignore-table=my_db_name.my_table_name my_db_name …obviously substituting your own username, password, db name and table name etc . As far as i can tell you can use this option multiple times to exclude multiple tables

June 2, 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

Rename authors in a git repository

I recently imported the old Clutch code into git , but for some reason it ignored the authors.txt file I provided, and used the original svn user names. This info is based largely on this stack overflow post . First, clone your repository locally : ...

April 29, 2009 · 2 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