Hi! Thanks for visiting my blog. If you've received any value from my content would you mind supporting my new startup by downloading our browser add-on? It's called PriceBlink and makes online shopping a breeze. You can watch it in action here and download it for Chrome, Firefox, IE, or Safari by going to PriceBlink.com. Thank you and I hope you enjoy!

Problems with MySQL Gem and Rake on Snow Leopard

Sep 22

I recently got a new MacBook Pro and had problems creating a new database for my Rails app on Snow Leopard. Running rake db:create left me with the following useless error:

Couldn’t create database for {“username”=>”root”, “adapter”=>”mysql”, “database”=>”delete_me”, “password”=>nil, “socket”=>”/tmp/mysql.sock”}, charset: utf8, collation: utf8_unicode_ci (if you set the charset manually, make sure you have a matching collation)

Although I could manually access MySQL via command line and create the necessary databases, rake continually failed. It turns out that the MySQL gem needed to be compiled for a 64-bit OS as mentioned in this post:

http://weblog.rubyonrails.org/2009/8/30/upgrading-to-snow-leopard

The key command to run is:

sudo env ARCHFLAGS=”-arch x86_64″ gem install mysql — –with-mysql-config=/usr/local/mysql/bin/mysql_config

Then you should be able to run your rake tasks and ultimately get Rails talking to your MySQL database.

Read More

Magento Unexpectedly Prompts to Download index.php

Sep 11

This was a new one for me. I was installing Magento today on Ubuntu Hardy (8.04.3 LTS to be exact) and ran into a problem where accessing the base Magento install URL would prompt to download the index.php file. The odd thing was that I could access the index.php directly and it would work just fine. This was running under Apache 2.2. It turns out that Apache needed my DirectoryIndex to be specified, which is strange because this hasn’t been a problem with other installations. At any rate, I updated my default config file located in /etc/apache2/sites-available with the following lines just before the closing VirtualHost tag:


<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>

I then restarted apache (sudo /etc/init.d/apache2 restart) and was good to go.

Read More