Tuesday, February 1, 2011

Simple Rails app

All you want to do is to get up & running

on OSX Snowleopard (Ruby 1.8.7 - included with the OS & Gem 1.4.2 - after runnning gem update --system) , the sequence of steps to get a simple Rails application up & running:

> rails new app_path/app_name

cd into the  app directory & add anything special  to the Gemfile - which specifies Ruby gems to add to the apps library

> bundle install

>rails server

you should see the WEBrick test server start up

This post is necessary as using this built-in server seems to be really out of favour in Ruby-land (the Mongrel webserver is suggested) & what docs there are about it - well some paths & commands have changed...

gnu screen keyboard commands

tipsheet

I don't know what I did before I discovered Screen but I sure forget the keyboard commands all the time:

OSX SnowLeopard: switch audio


someone just told me: if you have the volume icon in your menubar (ie. this can be turned on/off in the audio preference panel) option-click the speaker icon & it will show you a menu to change input/output on all your audio devices.



this is something I've always wanted. Someone even created a little menubar app to do the same thing (well, it does a bit more really) - so I imagine it's a recent Mac addition. Apple have a long history of additions to the UI like this, stretching basic into System 7 days & it often makes 3rd-party accessories no longer relevant or necessary. I guess it's a risky market - adding functionality that is sort of 'obvious' (but is missing) - your app might suddenly become obselete.

Centos 4: install Ruby, gem & mechanize

what's out there 'in the field' is rarely the latest & greatest version of anything. Given the necessarily arcane ways that software is packaged for varieties of linux (wtf is irb a separate package?) - having 'the latest' version of your OS distro usually only means that you can actually get packages for it:

anyway -  you want to install Ruby & gem on an older centos box.

1. Use the instructions here to get ruby & gem. These are GOOD instructions - as they seem to work across several Centos versions.

2. update gem: 'gem update --system'

you want to install the 'mechanize' gem for some web-scraping, first install libxslt using yum - this should pull in all the dependencies like libxml2 etc.

There's a set of discussions about installing mechanize on ubuntu here.