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!

Firefox Extension Development and XPath Replace Function

May 22

If you’re doing Firefox extension development you may be surprised by the lack of the XPath replace function. I definitely was. After looking through the list of supported Firefox XPath functions I found that the translate function did the trick. Here’s a list of supported Firefox Xpath functions for future reference:

https://developer.mozilla.org/en/XPath/Functions

Read More

Merging a Single Subversion Commit from Trunk to Branch

Jan 26

I’m posting way too much about SVN these days, but these are mainly for my personal recollection. Hopefully you’ll find them useful too. Here’s the scenario: you’re working on a branch and you want to merge a single commit from trunk into the branch. The first thing you need to do is find the revision number that you want to merge. Let’s say it’s 11259. Your SVN merge command will look like this:

svn merge -r 11258:11259 –dry-run https://myrepo.com/trunk

Notice the “–dry-run” parameter. This will display a list of files impacted, but won’t actually make the change. When you’re ready for primetime just remove the –dry-run param:

svn merge -r 11258:11259 https://myrepo.com/trunk

Read More

Running a Single Test File in Rails

Nov 11

There are cases where you don’t want to run your entire Rails test suite. From your Rails application directory run the following command:

ruby -I lib:test test/integration/dealer_admin_test.rb

A small but useful tidbit.

Read More

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