Archive for December, 2008

How to generate an SQL script from a MySQL database

Tuesday, December 9th, 2008

You can generate an SQL script from a mySQL database by using the mysqldump tool. The mysqldump tool will dump your mySQL database to a file (for example).

How to use DISTINCT on a single column of a multi-column select statement

Saturday, December 6th, 2008

I recently came across this problem today of how to perform a SELECT DISTINCT but on a single column of a multi-column select statement. Imagine a database with a COUNTRIES table. The table contains a list of countries and there is also a "Nationality" column (eg. Australia is the country, ...

Understanding blocks in Ruby on Rails

Saturday, December 6th, 2008

Understanding how to use blocks in Ruby is crucial to leveraging the full power of this language. A block, known as a closure in programming theory, is basically just a method without a name, or an anonymous method. All methods in Ruby have the special ability to accept a block as ...

MySQL : how to run an SQL script from the command line

Friday, December 5th, 2008

If you have an SQL script file you wish to run from the MySQL command line, you can use the source command at the MySQL command prompt as follows.

Deploy a rails application on Bluehost

Thursday, December 4th, 2008

Deploying a rails application on Bluehost for the first time is not a fun task, especially if you are fairly new to rails development. I hope the following details may save someone some of the hair-loss inducing troubles I experienced. Having said that I'm happy with Bluehost thus far. I ...