Problem installing Rubygems on Ubuntu

September 15th, 2008 | Uncategorized | No Comments »

I was installing Rubygems 1.2.0 on Ubuntu 7.04 on Friday, something I’ve done many times but for the first time I saw this error when I ran sudo ruby setup.rb

./lib/rubygems/spec_fetcher.rb:1:in `require': no such file to load -- zlib (LoadError)
	from ./lib/rubygems/spec_fetcher.rb:1
	from ./lib/rubygems/source_index.rb:10:in `require'
	from ./lib/rubygems/source_index.rb:10
	from ./lib/rubygems.rb:767:in `require'
	from ./lib/rubygems.rb:767
	from setup.rb:22:in `require'
	from setup.rb:22

Having a look around the web yielded several approaches to solve the problem but no solution so I decided to build Zlib from source, then rebuild Ruby and then install Rubygems. That worked.
Read on »

Mysql gem on OSX Leopard

September 8th, 2008 | Uncategorized | No Comments »

Just a quick note on a problem I ran into this morning.

I needed the mysql gem so I ran gem install mysql only to find I got the following error:

*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.

The solution was to use the following:
gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

It should work as long as the path to mysql_config is correct, you may need to change the path for your own system. You can check the path to mysql_config with: which mysql_config

Disable active record in Rails 2.1.0

August 25th, 2008 | Uncategorized | No Comments »

I've had a bit of trouble trying to disable active record in my rails app today.  I set the following in environment.rb as I had done before in rails 2.0.2:

RUBY:
  1. config.frameworks -= [ :active_record ]

However it resulted in the following error:

RUBY:
  1. vendor/rails/activesupport/lib/active_support/dependencies.rb:278:in `load_missing_constant': uninitialized constant ActiveRecord (NameError)

The problem is that [your app]/config/initializers/new_rails_defaults.rb should check to see if ActiveRecord is enabled before it references it. A patch for this has already been checked into the rails codebase but if you don't want to wait for the next release you can get the patch from the link below and apply it yourself:

http://github.com/rails/rails/tree/4b4aa8f6e08ba2aa2ddce56f1d5b631a78eeef6c/railties/configs/initializers/new_rails_defaults.rb

Note:
I made the mistake of applying this patch directly to rails/railties/configs/initializers/new_rails_defaults.rb as the patch does and wondered then why the fix didn't work. It would work for any new rails apps that you create but you'll need to apply it to config/initializers/new_rails_defaults.rb in your rails app in order for this to work.

Michael Fix - Message in a Bottle (cover)

July 15th, 2008 | Uncategorized | 1 Comment »

I've finally got around to taking guitar lessons which I started about a month ago. The lessons have been giving me an even greater appreciation for finger-style playing. Actually if anyone is thinking about taking lessons I highly recommend my teacher, check out http://www.flyingfingers.ie for more information.

I stumbled across this great great YouTube find this morning and wanted to highlight it. I love The Police and 'Message in a Bottle' is one of my all-time favourite songs. This cover is just brilliant.

Internal Server Error on post.php after upgrading Wordpress

June 16th, 2008 | Uncategorized | 1 Comment »

I recently upgraded my copy of wordpress to 2.5.1. All apparently went smoothly until I tried to write a new post. When I pressed 'publish' the page would hang for a while and then return an Internal Server Error.

For those of you experiencing the same trouble. The problem was with the database. I uploaded my mysqldump of the wordpress db via phpMyAdmin on GoDaddy, I had enough grief as it was trying to get the script to go through properly, the problem was that it neglected to assign the AUTO_INCREMENT property to ID fields on all my wordpress tables. So effectively I could not create new rows.

Thanks to Ken for pointing me in the right direction.