Blah Blah Woof Woof

Archived content 2005-2007

Your next computer will be a big ass table

Posted by Tim Riley Fri, 22 Jun 2007 00:04:00 GMT

Very funny fake commercial mocking the $10,000 Microsoft Surface. (Via Daring Fireball.)

Posted in Geek, Tumble | 1 comment

Rails form helpers should not require an instance variable

Posted by Tim Riley Fri, 04 May 2007 07:24:00 GMT

From ticket #2726 in the Rails Trac:

The form helpers assume the object you want them to reference is an instance variable, ie: they require an ’@’. This makes them completely useless in a partial unless I explicitly include something like ”@user = user” at the top of each partial.

I came across this limitation today when I was using partials to contain forms to edit a collection of objects.

Right now the only way I can see to work around this is to add that additional line at the top of the partials in question. Seems that the form helpers were really only designed to work best in the view that receives instance variables directly from the controller.

Posted in Geek | no comments

Hackety Hack!

Posted by Tim Riley Thu, 03 May 2007 05:53:00 GMT

My first brush with programming was writing Beatles songs in QBasic. It was a fun and simple experience that and was inspiration for me to learn more.

This sort of accessible introductory experience has disappeared for a while now, but thanks to why the lucky stiff, Hackety Hack is poised to bring it… backety back. Best of all, it wraps everything up in current concepts:

How can you find fault in a programming tutorial that teaches you how to make a blog before it teaches you how to do arithmetic? -aparrish

Further, _why is fostering a community around the system, which looks like it will culminate with all budding hackers being able to share their programs with each other. Having been involved in “grown up” open source projects, I can certainly say that their sense of community is a big part of their appeal, and this should work in the same way here.

Anyway, read the manifesto and check it out!

Posted in Geek | 1 comment

Evenly dividing array elements in bash

Posted by Tim Riley Tue, 27 Mar 2007 20:08:00 GMT

Writing in bash is fun because of the constraints it offers, but I’m never sure if I am choosing the most straightforward way to do things.

A few weeks ago I had to write a script to vacuum a bunch of databases once per week. Instead of doing them all at once, I wanted to evenly spread the load across the seven days.

I wrote something that works pretty well, I think, but it does seem a little hackish, and I’d love to hear if there is a better way to achieve this.

Here’s what I did, check it out:

 # 11 elements in this example
 # Should be processed 2 per day for the first 4 days, then 1 per day for the reamining 3 days
 items=("mario" "luigi" "toad" "peach" "yoshi" "wario" "koopa" "bowser" "lakitu" "birdo" "fryguy")


 # number of the current day, starting from 0
 let "today = `date +%u` - 1" 

 # number of whole that can be processed per day
 let "per_day = ${#items[*]} / ${days}" 

 # remainder of items that must also be processed
 let "remainder = ${#items[*]} % ${days}" 

 # index of array element to start iterating from for the current day
 if [ $today -gt $remainder ]; then
   let "start = (${per_day} * ${today}) + ${remainder}" 
   let "start = (${per_day} * ${today}) + ${today}" 

 # number of elements to iterate over for the current day
 if [ $today -ge $remainder ]; then
   let "count = ${per_day} + 1" 

 # Do it!
 echo "Processing ${count} items." 

 for ((i=$start; i < ($start+$count); i++)); do
   do_something_with_item ${items[$i]}

If you can offer any tips or suggestions, please comment on this entry!

Posted in Geek | 1 comment

Highrise is out

Posted by Tim Riley Tue, 20 Mar 2007 04:53:00 GMT

Check it out. I think this service could be a great leads tracker for our office.

Posted in Tumble, Geek | no comments and copying mixed audio/data CDs

Posted by Tim Riley Tue, 21 Nov 2006 12:29:00 GMT

Here is my first Max OS X tip!

I have noticed some strange behaviour when using to copy a couple of my audio CDs. When it is storing the disc to be duplicated, the progress bar begins to grow steadily, but after a few percent is done, it skips straight to 100% and asks you to insert the blank disc.

This seems to happen when the disc in question is a mixed data/audio CD. Disco seems to only recognise the data session and ignores the audio one (which is the part I want).

To work around this, open up the OS X Disk Utility program (in /Applications/Utilities), and you will see two different mounted entries for your CD. Select the one that represents the data session and choose to unmount (not eject) it. Restrt Disco and then it will be able to properly copy your audio CD. You will lose the data session, but at least you can get your tunes!

Posted in Geek, Music | no comments | no trackbacks

Rails, AJAX requests and flash

Posted by Tim Riley Wed, 18 Oct 2006 04:37:00 GMT

My lesson from today: If you are loading Rails actions using AJAX, and your controller is using flash to pass messages to, for example, an RJS view, make sure you use to assign them. This way, they will only stay around for the one action instead of persisting for the next AJAX request or full page load.

Posted in Geek | no comments | no trackbacks

Don't trip up on the first log

Posted by Tim Riley Mon, 09 Oct 2006 13:59:00 GMT

Quick note for anyone moving from Rails to write a little Camping app: It pays to read the instructions! Particularly this part:

NOTE: Camping auto-prefixes table names. If your class is named Blog::Models::Post, your table will be called blog_posts. Since many Camping apps can be attached to a database at once, this helps prevent name clash.

What I would give to get that extra hour and a half back… sigh

Posted in Geek | 1 comment | no trackbacks

Password generation

Posted by Tim Riley Mon, 17 Jul 2006 07:57:00 GMT

Automatic password suggestion for your Rails app, with some good discussion in the comments.

Posted in Tumble, Geek | no comments | no trackbacks

I want to tag everything

Posted by Tim Riley Thu, 13 Jul 2006 04:09:00 GMT

Desktop apps that would be much cooler and more useful for me if they came with tagging abilities:

  • iTunes (genres are so Interface 1.0)
  • Thunderbird/Evolution
  • Nautilus (though this looks like it is already in the works)

For this reason, I’m really looking forward to seeing more of Leaftag in GNOME.

Tagging has already made its way into desktop photo management apps, such as f-spot and iPhoto, I suppose thanks to the influence of sites like flickr. I wonder why this has so far not moved far out of this realm?

Posted in Geek | 5 comments | no trackbacks

Older posts: 1 2 3 4