Archive for May, 2006

More Ruby links

Sunday, May 14th, 2006

It took me a few evenings to read through the links I posted before. Now that I know more about Ruby, it’s time to move on to Rails. These links helped me get started:

  1. Exploring Active Record
  2. Domain-specific languages in Active Record and Java programming
  3. What’s the secret sauce in Ruby on Rails?

Make sure to check out the “Resources” section at the bottom of those articles. There’s a large number of good links there like Ruby Quiz. Also see the relevant /. article.

Learning Ruby

Saturday, May 13th, 2006

I’ve never seen people make it so easy to learn a programming language:

  1. Try Ruby
  2. Why’s (Poignant) Guide to Ruby
  3. Programming Ruby: The Pragmatic Programmer’s Guide

First, spend the 15 minutes it takes to go through the Try Ruby tutorial. Really. Just 15 minutes. It will introduce you to all the things you need to know in the beginnning. The syntax isn’t quite as simple as LISP, but…

Next, read Why’s (Poignant) Guide to Ruby. It’ll go over most of the same stuff. If you dislike the back story you can skip the paragraphs without any code in them. If you like absurd humor, you’ll love this tutorial.

Lastly, you can read the Programming Ruby book. It’s a bit dry, but it covers more ground. It is, however, a bit outdated, so I’m not sure if the second half is worth reading right now.

Web 2.0 again

Friday, May 12th, 2006

I found two more apps:

Installing Ruby on Rails on Ubuntu Dapper

Thursday, May 11th, 2006

Dapper is a few weeks behind in integrating the RoR v1.1 Debian package. Only 1.o is available at the moment, but 1.1 should be available in the final relase of Dapper, so in a few weeks you’ll only need to ‘apt-get install rails’.

For now, I’ll use rubygems to install RoR. First, you need to have Ruby installed:

sudo apt-get install ruby

Next, following the download instructions on rubyonrails.org: wget the rubygems software, install it, use it to install rails.

wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
tar -zxvf rubygems-0.8.11.tgz
cd rubygems-0.8.11.tgz
sudo ruby setup.rb
sudo gem install rails --include-dependencies
rails path/to/your/new/application
cd path/to/your/new/application
ruby script/server

I put my app in ~/src/app1 for now. Next, open the provided url in your browser and follow the instructions there. I want to use PostgreSQL as my database backend. I also want to use subversion for revision control. Each one requires a bit of extra setup.

sudo apt-get install postgresql-8.1 subversion
sudo gem install postgres-pr

Instructions for setting up PostgreSQL can be found in /usr/share/doc/postgresql-8.1/README.Debian.gz. I will create a PSQL user with the same username as my account, and make the dbs for the app1. It might be a good idea to also set a password for the databases, but I won’t do it. Lastly, modify the database.yml file with the appropriate adapter: postgresql and user: alex.

sudo -u postgres sh
createuser -DRS alex
createdb -O alex app1_development
createdb -O alex app1_test
createdb -O alex app1_production
exit
vi ~/src/app1/config/database.yml

I’ll make the subversion repository in my home directory with instructions from /usr/share/doc/subversion/README.gz. We blow away the original code after import, which isn’t very safe. It’s ok in this case because our app can be regenerated with a couple of commands.

less /usr/share/doc/subversion/README.gz
svnadmin create ~/app1svnrepo
cd ~/src/
mv app1 trunk
mkdir app1
mv trunk/* app1/trunk
mkdir app1/branches
mkdir app1/tags
cd
svn import ~/src/app1 file:///home/alex/app1svnrepo -m "Initial import"
rm -r ~/src/app1
cd src
svn checkout file:///home/alex/app1svnrepo/ app1

Now you can work on creating your app.

VMWare Server Beta on Ubuntu Dapper

Monday, May 1st, 2006

Today I installed the VMWare Server Beta on my Ubuntu Dapper Beta machine.

You need to have the following packages installed: gcc, make, xinetd and linux-headers for your system. For me, the header package is linux-headers-2.6.15-21-686, but it depends on your architechture and your kernel version.

Run through the install script, and don’t worry about making mistakes, you can always re-run it. I selected all the default options except the networking (I chose only bridged) and typed in the appropriate location for the kernel headers. You can type “dpkg -L linux-headers-2.6.15-21-686″ to find where the package puts the header files.

The last step in the installer is the registration code you got from VMware via e-mail. Once you put that in, you’re done. You can run the VMware Server through Applications->System Tools->VMware Server.

I created a new virtual machine for WinXP, popped in the install disk, and had a WinXP install within the hour. Don’t forget to install the Windows Updates and the anti-virus software! :)

Here’s the post that got me started.