Blah Blah Woof Woof

Archived content 2005-2007

It's official

Posted by Tim Riley Tue, 11 Apr 2006 04:10:23 GMT

No one at Boxen Systems likes aloe vera juice.

Posted in Life | 4 comments | no trackbacks

observe_field for fields modified by javascript

Posted by Tim Riley Mon, 03 Apr 2006 09:17:00 GMT

The Rails PrototypeHelper observe_field is useful for calling JavaScript functions or sending XmlHttpRequests whenever a form field is modified.

For fields like checkboxes or radio buttons that have a limited number of states, it is fine for the observe_field callback to be triggered whenever a mouse click or keyboard event changes this state. On the other hand, for fields like text boxes, it makes more sense to provide a :frequency option to the helper, in which case it will check the field for a changed state at set intervals (a text box that triggered the callback with every letter typed would cause performance issues).

However, you can safely throw this rule out the window if you are using JavaScript to change the state of form fields. In this case, you definitely need to specify a :frequency option:

 <%= observe_field "field_id",
   :url => { :action => "foo" },
   :frequency => 0.25,
   :with => "'value='+ escape(value)" %>

The callback isn’t triggered when a state change is made with a script, but when the observer checks periodically, then the change will in the end be picked up and your callback request or function invoked.

Posted in Geek | 1 comment | no trackbacks

The History and Use of the Bold "heh"

Posted by Tim Riley Fri, 31 Mar 2006 04:20:00 GMT

In #openbox, not only do we use and support a killer WM, but we are also breaking important new linguistic ground. heh.

Posted in General | 2 comments | no trackbacks

Installing Ruby Gems locally on a shared host

Posted by Tim Riley Tue, 28 Mar 2006 14:06:00 GMT

This took a little bit of fiddling around. On the Dreamhost servers which host my sites, there are many Ruby gems installed, but I wanted to install a couple of extra ones locally that were required by a few specific apps.

You can set $GEM_HOME and $GEM_PATH environment variables in order to customise where the gem command looks for gems. $GEM_HOME is the gem installation directory, where new gems will be installed, and $GEM_PATH is a colon-separated list of places on the system to look for already installed gems.

To install the extra gems locally, I needed to set $GEM_HOME to point to some place within my home directory. However, the gem command expects a sources gem to be installed (which provides a list of remote gem download sources), and it will refuse to find it outside of $GEM_HOME, even if it is installed somewhere in your $GEM_PATH. So, you need to install it locally as well, before installing your extra remote gems.

Here is how I did it:

  • mkdir -p ~/apps/lib/gems/1.8/cache
  • export GEM_HOME=$HOME/apps/lib/gems/1.8
  • export GEM_PATH=/usr/lib/ruby/gems/1.8
  • cp /usr/lib/ruby/gems/1.8/cache/sources-0.0.1.gem ~/apps/lib/gems/1.8/cache
  • gem install sources --local
  • gem install my_new_gem

Next, I need to figure out if there are any tricks required in order for Ruby apps to see and use these additional gems. However, that is for another night!

In other news, Rails 1.1 is out! Check out this post for a good rundown of what is new.

Posted in Geek | 1 comment | no trackbacks

First rain

Posted by Tim Riley Mon, 27 Mar 2006 10:47:00 GMT

Tonight was the first rain since the end of summer. It was almost magical to see the glistening roads and the glimmer of the city lights through the fine mist of the raindrops. It was as if I were in any film set in New York.

Posted in Life | 3 comments | no trackbacks

A different kind of instant

Posted by Tim Riley Sun, 26 Mar 2006 12:00:00 GMT

I have decided to stop connecting to the MSN and ICQ instant messaging networks. On ICQ I have been getting too much spam lately, and the M in MSN is something that I have been avoiding everywhere else anyway.

I will still be connecting to the Google Talk (Jabber) and AIM services, so please use these if you would like to contact me. If you would like my account details, do send me an email or leave a comment.

Posted in General | 5 comments | no trackbacks

Life imitates web

Posted by Tim Riley Mon, 20 Mar 2006 07:31:00 GMT

UI elements that make a good web experience are not necessarily exclusive to that medium. For example, I think that, just like when you add a comment to a weblog, you should be able to preview any voice message that you leave on someone’s phone before it gets saved permanently.

While it might be perfectly adequate to blunder around in a voice message in the same manner as the one character Hugh Grant has played in all of his films, some of us just don’t have the English accent to pull it off.

Posted in Geek | 4 comments | no trackbacks

Sortable objects in

Posted by Tim Riley Fri, 17 Mar 2006 05:18:00 GMT

There are some really good pieces of Rails documentation popping up around the place these days, but as helpful as they are, it doesn’t mean you aren’t ever without enough rope to shoot yourself in the foot.

The sortable_element JavaScript helper makes it really simple to use’ Sortable object to make lists of items that are sortable using drag and drop. However, despite the presence of the Rails helper method, it still pays to take careful note of the’ API documentation.

In this case, I was wondering why the callback for my sortable list was not being invoked after a drop was completed. I referred to some examples in the above-mentioned Rails books and I didn’t seem to be doing anything different at all. In the end I discovered that a certain format for the id attributes of your sortable elements is necessary for the list to operate properly and the callback to be invoked:

 <ul id="sortable-list">
   <li id="item_1">First Item</li>
   <li id="item_2">Second Item</li>

The id attributes for the list items must contain a string, followed by an underscore, followed by an integer. I had been using an additional underscore in my string, which caused the list to break. This wasn’t mentioned explicitly in any of the books. So, extra research can never hurt you in the end!

Posted in Geek | no comments | no trackbacks

Adelaide GNOME 2.14 Release Party

Posted by Tim Riley Thu, 16 Mar 2006 04:22:00 GMT

Next Monday night some of us will be meeting to drink in the greatest and speediest GNOME release yet! All are welcome; here are the details:

WHEN: Mon 20th March, from 7:00pm

WHERE: Belgian Beer Cafe, off Rundle St

WHO: Adelaide lovers of Free Desktops

See you then!

Posted in Life, Geek | 2 comments | no trackbacks

Sometimes it's not right to get nude

Posted by Tim Riley Wed, 15 Mar 2006 05:54:00 GMT

Now I would certainly call myself a great enthusiast of Nudie juices, but I cannot honestly recommend the Orange, Carrot & Ginger juicie. Maybe I just don’t like liquified vegetables, or as Daniel describes it, the taste of metamucil. I think in future I will leave this almost phosphorescent orange coloured juice alone and stick to the many other quality juices in the Nudie lineup.

Posted in General, Life | no comments | no trackbacks

Older posts: 1 ... 3 4 5 6 7 ... 10