Skip to main content

Posts

Showing posts from June, 2007

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 (re…

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),…

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…