Install MySQL on Snow Leopard including Rails Gem

{ Posted on 8:21 AM by Ben }
After much pain, I've finally got MySQL installed on Snow Leopard including the MySQL 2.8.1 gem:

1) I installed the x86_64 package from:
http://dev.mysql.com/downloads/mysql/5.1.html#macosx-dmg

2) Then ran:

sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include

This was to fix the following problems I was continually having:

Rails:
uninitialized constant MysqlCompat::MysqlRes

Delete all .svn folders within a directory

{ Posted on 6:18 PM by Ben }
find . -name ".svn" -type d -exec rm -rf {} \;

Expire cache from rake task in Rails

{ Posted on 7:43 PM by Ben }
This will remove all fragment cache files from the cache directory:

task :expire_cache => :environment do
ActionController::Base.new.expire_fragment(%r{/})
end

Inspiration for my home reno

{ Posted on 9:52 AM by Ben }
I'm planning on raising my house by about 8 metres, then turning the hose on and flooding the neighbourhood. It shouldn't take too long before I achieve the desired waterfront views shown here:

Log slow queries in MySQL

{ Posted on 7:45 AM by Ben }
sudo nano /etc/mysql/my.cnf

log_slow_queries = /path/to/mysql-slow.log
long_query_time = 4


http://dev.mysql.com/doc/refman/5.0/en/slow-query-log.html