Update January 2010, What I've Been Up To

I've been working on a Ruby on Rails program for my work for quite a while now, and it's getting near time to ship. There have been a couple of by-products that have come out from my work on that program that I've released to my Github account.

track_changes was created to allow me to audit changes made to models in a rails application. When I first looked for auditing solutions for rails, it didn't appear that there were any that were thread-safe, and they all seemed to be quite complex for my needs. After a recent refactor, the bulk of work done is in the file http://github.com/mhaley/track_changes/blob/master/lib/track_changes/audit_filter.rb which is about 60 lines of code. About a week ago I also added the ability to configure the filter if your audit model isn't called Audit and a couple of other items.

Links for track_changes:
unfuddle_my_email is a simple command-line tool written in Ruby that will download email from a POP3 mailbox and post it to your Unfuddle account as a new ticket. It's usage is simple, you copy the included configuration-sample.yml, edit it to point to your POP3 mailbox and Unfuddle project, and then simply run unfuddle_my_email configuration.yml. This will create tickets in your project.

I do plan on added a few more features to unfuddle_my_email, such as keeping track of already downloaded messages, but for now it works well enough.

Links for unfuddle_my_email:

Why Registering a Domain Through Microsoft Office Live is a Terrible Idea

tl;dr If you ever transfer a domain registered through Office Live to another registrar, you will experience 5 days of complete downtime on your website and email.

Here's the scenario, you see that Microsoft will offer to host a small business web site and email for for free. When signing up you don't already own a domain, so you register one through Microsoft. Microsoft will register the domain on behalf of you through Melbourne IT. You now own the domain in question.

Fast forward some time into the future. You've decided that Microsoft's Office Live service isn't adequate any longer for your needs and you want to move on to real web hosting. This is not unusual in the least, however, remember back when you registered your domain through Microsoft, which registered the domain for you via Melbourne IT?

In order to gain complete control of your domain, you have to cancel your Office Live account, rendering your website and email useless, upon which Microsoft will provide you the domain registry key which you can use to create an account at Melbourne IT. From there, you can initiate a transfer of the domain to another registrar, but, and it's a biggie, Melbourne IT will not do a transfer on demand.  If you start a transfer request, Melbourne IT will do absolutely nothing for 5 days until the chance to abort the transfer expires before transferring the domain.

Now, what does all this mean?

A minimum of 5 days of downtime for your website and email.

As far as I can see, this scenario is unavoidable.

Moving to New Domain

I've finally wrestled control of smajnr.net from Microsoft's Office Live service. So I will be transferring blog.smajn.net to blog.smajnr.net. Currently, I'm not entirely sure how things are going to go. After the transition, I will at least setup a DNS redirect from the old domain to the new domain.

I do plan on posting an article on why you shouldn't use Microsoft Office Live. After I get things done.

Update:

Looks like the DNS is updated, at least on my end. I've setup a permanent 301 redirect from any blog.smajn.net URL to blog.smajnr.net. Things are looking good.

Ruby 1.8: NoMethodError: undefined method `ord' for "":String

Missing String#ord in Ruby 1.8? Here's a simple monkey-patch that will add it to Ruby.

unless "".respond_to?(:ord)
class String
def ord
self[0].ord
end
end
end

http://gist.github.com/251465

Update to "How To Disable an Observer in Rails"

I've posted an update to How To Disable an Observer in Rails.

Note to self: Randomize a list in Scheme

Using PLT Scheme, I wanted to randomize a list. Here is what I came up with:
(define (random-sort l)
(sort l
(lambda (x y)
(equal? 0 (random 2)))))

Installing Ruby 1.9.1, Rails 2.3.2 and PostgreSQL on Windows Vista

This is a short write up on how I installed my Rails development environment on Windows Vista. If you have any trouble, consult the notes section at the bottom.

Update: I missed the part about installing the devkit, thanks to Roger Pack on the Rubyinstaller-devel mailing list. I also added a section for references.

Downloads

You’ll need to download the following:

Installing PostgreSQL 8.4

Installing PostgreSQL is rather simple, just follow the wizard.

PostgreSQL 8.4 Installer Welcome Choose your installation directory

Choose your data directory Configure service account password Configure listen port Setup default locale Installing PostgreSQL 8.4 Initializing the database cluster Installation success

Installing Ruby 1.9.1

Ruby 1.9.1 preview installer welcome GPL License Installation directory Installing Ruby 1.9.1 installation success

Installing the devkit

Extract “devkit041109.7z” to your ruby path, “C:\Ruby19”, after which you should have the following directory:

  • C:\Ruby19\devkit

Also, edit the file “C:\Ruby19\devkit\msys\1.0.11\etc\fstab” to contain the following:

C:/Ruby19/devkit/gcc/3.4.5 /mingw
C:/Ruby19/devkit/msys/1.0.11/usr/local /usr/local

Installing Rails and the pg gem.

The Ruby installer added a “Start Command Prompt with Ruby” to the Start Menu, go ahead and run that now.

  1. Add the PostgreSQL bin directory to your path.
  2. Install rails.
  3. Install the pg gem.
set Path=%Path%;C:\Program Files\PostgreSQL\8.4\bin
gem install --no-ri --no-rdoc rails
gem install --no-ri --no-rdoc pg

rails_pg_step01_to_step03


That’s it, go develop that killer twitter client, its what all the cool kids are doing.

Notes

  • If you had previously installed PostgreSQL, remove the service account user with “net user postgres /delete”.
  • Copy “C:\Program Files\PostgreSQL\8.4\bin\libeay32.dll” to “C:\Ruby19\bin” if you encounter an error when Rails attempts to connect to your database.

References