Fixing the Poignant Guide

There’s a problem here in the Poignant Guide to Ruby, where a variable appears to go missing when loaded in a separate code file (using the ‘require’ command). In short, it’s because local variables always go out of scope when a file is loaded or required, and the best solution I can see is to Capitalize the variable, making it a constant, as suggested here. Note also that the author’s suggestion that the Poignant Guide has been corrected in the ‘final’ version does not seem to be true, since the version he points to still has the same error.

Not rolling with Ruby on Rails (yet)

Ahhhh, problems problems. I rashly installed Rails 2.0 thinking such an excitable dev community would have produced a raft of useful tutorials in the three months since its release… alas, no. The ‘standard’ tutorials all still seem to be about 1.2.x, and various incompatibilities mean they just fall over when you try them out in 2.0. The collective wisdom of the web at the moment seems to be to learn in 1.2.x, then upgrade to 2.0 when you know what you’re doing! So I’ll shortly be doing that, and probably will return here to give it a go.

In the meantime, there are a few intros to Rails 2.0, but even they seem to suffer from minor differences between 2.0.1 and 2.0.2. I’m working my way through this one, and have learned one thing so far, that the default database is now SQLite, when previous versions used mySql. To force a new rails app (say, ‘exchange’) to set itself up for mySql, instead of doing this:

rails exchange

Do this instead:

rails -d mysql exchange

Your <appname>\config\database.yml will now be set up for mySql.

Update: this mysql setup is actually mentioned at the start of Part 2, very handy but a little too late for my liking!

Another point to note, if you’re using Instant Rails on Windows, is that the apps are best tested using the ruby script/server command suggested by the tutorial not the ‘Start with Mongrel’ button in Instant Rails. Trying the latter will throw a few ‘missing library’ errors when you try to run the app.

Also nice…

OK, my fifth sign-up of the day… set up a new Yahoo! ID just so I can join Upcoming groups and keep tabs on geekup events. Very elegant AJAXy validation on the sign-up form. Neat and unobtrusive… at least until I tried to submit without a postcode (scrolled off the screen to get the submit button), and it wasn’t clear where the source of the error was without scrolling back up again by hand.

Getting started with Ruby on Rails

So I want to get playing around with RoR as quickly as possible. I chose the web host Textdrive some time ago just for their ruby support. Alas when I finally got the time to give this a go (more than a year later!) it’s not as simple as just plug in and play… oh no; you have to raise a support ticket to get them to configure lighttpd[1] on a certain port. So for now I’m going down the localhost route: get it up and running on my dev laptop ASAP so I can get a feel for the language and framework without involving a remote server. According to the mothership, that’s Instant Rails.

Naturally, it’s not as simple as that: the Instant Rails download archive will break if you try to unzip it with Windows’ built-in decompression. Aaaargh! So first a trip to their recommended decompressor, 7-zip, then go and grab the Instant Rails archive itself. However, that’s ‘instant’, as in ’70MB download’…

“Instant” Rails my arse… ho hum!

[1] it’s a webserver that’s not apache. see http://www.lighttpd.net/

Good and Bad experiences

Four new signups today, made me think about the ups and downs of the (already passé) “Web 2.0” thing. Quick verdict?

  • Highrise and WordPress = goooood!
  • Joyent Connector and iProfile = baaaad!

More detailed analysis to come, but first thinking on the latter is that shiny design and big type is not enough. Both seemed overly complex, slow to respond (Joyent) and ask you to make decisions without being sure of the consequences. Then logging in confronts you with many unexplained options. Highrise and WordPress both got me signed up and doing useful work within two minutes.

Hello world!

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

Follow

Get every new post delivered to your Inbox.