Firefox hack to display "accesskey" keyboard shortcuts

I'm a big fan of using accesskeys in Firefox as I just love keyboard shortcuts! One problem is that most websites don't advertise the fact that they have accesskeys and what those shortcuts are.

After a little searching I found this forum post from back in 2004 with a hack to Firefox's UserContent.css file. I changed it slightly to show a nice purple "[shortcut key]" when it finds a keyboard shortcut. This is what it looks like when viewing the Wikipedia site:



To install this hack create a file in your profile's chrome directory called 'userContent.css' and add the following:

/* Display [] by the item with the accesskey */
a[accesskey]:after,
button[accesskey]:after,
input[accesskey]:after,
label[accesskey]:after,
legend[accesskey]:after,
textarea[accesskey]:after {
margin-left: 0.3em;
color: Plum;
content: "[" attr(accesskey) "]";
}

One other thing to remember is the accesskey enabler changed from Alt to Alt-Shift in Firefox2 (release notes):
Access key definitions provided by web pages can now be triggered using Alt+Shift+key on Windows, Ctrl+key on Mac OS X, and Ctrl+Shift+key on Unix.

Technorati Tags: , , , ,

Some useful Ruby & Rails firefox search plugins

I've found the following two Firefox search plugins useful and thought
I'd pass then on:

RubyInside

This plugin searches a massive list of sites (scroll to the comments for more details) maintained by Peter Cooper, a UK Rails developer who runs the excellent RailsInside website.

RailsHelp

This plugin was developed by Nick Cody to search the RailsHelp.com website.
Update - railshelp.com seems to be down at the moment...

Getting the Right Alt key (Alt GR) to work in Ubuntu Linux

I've been bothered for a while now that my right alt key labelled 'Alt GR' doesn't work in Ubuntu. It was clear that things weren't right when I ran 'xev' and pressed the two Alt keys - here is the output:

KeyPress event, serial 29, synthetic NO, window 0x3200001,
state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,

KeyPress event, serial 29, synthetic NO, window 0x3200001,
state 0x10, keycode 113 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,

ISO_Level3_Shift? Not really the Alt_R I was looking for!
After reading this Ubuntu bug report I change my keyboard preferences to be "Alt and Meta are on the Alt keys" (found under System -> Preferences -> Keyboard)



Now when I run xev this is what I get:

KeyPress event, serial 30, synthetic NO, window 0x3200001,
state 0x10, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,

KeyPress event, serial 30, synthetic NO, window 0x3200001,
state 0x10, keycode 113 (keysym 0xffea, Alt_R), same_screen YES,

At last, a working Alt-R key!

Technorati Tags: , , , , ,

How to change your Rails database adapter from OCI to Oracle

I've started to use Rails migrations recently connecting to an Oracle database.

After reading many examples of how to configure the database.yml file on the Rails wiki (as well as ones from Oracle's own website), I ended up with something like:

development:
adapter: oci
host: database.com/mySID
username: schema_name
password: schema_name
This worked fine, but after researching other migration-related topics I read that oci was the 'old' way to connect to Oracle, the 'new' adapter to use is oracle.

A tutorial from Oracle showing usage of the new 'oracle' adapter (scroll down to the section entitled "Part 1: Of configuration, Cursors, and Rows") suggested that your config should look like this:
development:
adapter: oracle
host: DEBIAN
username: rails
password: rails
Note: DEBIAN was the name of their TNS entry specified in their local tnsadmin.ora file.

I didn't want to use a reference to a local tnsadmin.ora file on my machine, I wanted to specify the host and SID explicitly. After many failed attempts at specifying this in different formats I happened across this Rails patch ticket regarding the change from 'oci' to 'oracle' - the winning clue was:

To use the adapter with it's new name, simply change your database.yml file to include:
adapter: oracle
database: <your db name here>

Note that database is now used instead of host.

So the problem was that I was entering the database server details in the host field (like all the examples said to) but for a non-TNS named server you need to use the database field.

My fully working Oracle database.yml config entry now looks like this:
development:
adapter: oracle
database: database.com/mySID
username: schema_name
password: schema_name
Technorati Tags: , , , , ,