articles in 2010

Apple Keyboard for sale!

no comments yet, post one now

,----------------------------------------------------,
| [][][][][]  [][][][][]  [][][][]  [][__]  [][][][] |
|                                                    |
|  [][][][][][][][][][][][][][_]    [][][]  [][][][] |
|  [_][][][][][][][][][][][][][ |   [][][]  [][][][] |
| [][_][][][][][][][][][][][][]||     []    [][][][] |
| [__][][][][][][][][][][][][__]    [][][]  [][][]|| |
|   [__][________________][__]              [__][]|| |
`----------------------------------------------------'

I’m selling one of these, Get it while its hot!

March 15, 2010 10:45 by

Dr. Seuss

no comments yet, post one now

Be who you are and say what you feel, because those who mind don’t matter and those who matter don’t mind.Dr. Seuss
February 28, 2010 19:14 by

Book Book

no comments yet, post one now

The Book Book from TwelveSouth

Just got the new Book Book from TwelveSouth in the post today, its awesome (if a little pricey with P&P from the USA). TwelveSouth also make some excellent mac gear.

February 16, 2010 22:29 by

The Temper Trap - Sweet Disposition

no comments yet, post one now

Also appeared live in studio at KEXP a few days ago.

February 04, 2010 15:17 by

Fake it till you make it!

2 comments

I’d like to share another handy little rake task that helps you fill up your Rails application with realistic ‘fake’ data. Here it is

Using the very excellent Faker gem by Benjamin Curtis this task can be configured to populate your models with random amounts of fake information. This can a be a real time-saver for load testing, preparing demos/screencasts, or just filling up your pages with realistic data so you can get to work on your views.

The classic 'comb-over', a traditional fake.

The classic 'comb-over', a traditional fake.

The task includes the following features;

  • Assign relationships between models with a random object picker
  • A random tag picker, for populating tag lists
  • Fake out your app at different different sizes; tiny, small, medium and large
  • Clean task, to clear stuff out before you start your faking
  • Disables mail sending before faking out, since before/after and other code hooks in your app might trigger sending mails
  • Helper to fake out a randomly picked time object within the last year
  • Prompts to ask before deleting any data on cleaning task.
  • Summary report after faking out, explaining exactly how many objects were created

Simply configure it (see code comments for help on this), drop it into your Rails lib/tasks folder and run like so;

sudo gem install faker # if you haven't got the gem already OR 
sudo gem install ffaker # use the faster faker gem from Emmanuel Oga 
rake fakeout:small # or tiny / medium / large

Cleaning all ...
Faking it ... (small)
  * Users: 53
  * Questions: 53
  * Answers: 38
  * Tags: 38
  * Taggings: 160
Done, I Faked it!

Along with this subdomain script from last month, I have pushed this code to github as a gist, so you can track it and grab updates to it whenever. The example there shows the task configured for a small Question & Answer app I’ve been working on.

And yes, I have started drawing a bit again, maybe it’ll make these posts more interesting to look at until I properly build this blog out.

Update – I have amended the task definitions to take a single argument; no_prompt. This turns off the confirm prompt and is useful for non-interactive running, e.g. with heroku rake commands for instance.

Update – This rake task is also fully compatible with the faster ffaker gem by Emmanuel Oga

February 07, 2010 15:31 by

Farnsworth House by Peter Guthrie

no comments yet, post one now

The 1951 Mies van der Rohe designed Farnsworth House, an icon of 20th century modern architecture in Plano, Illinois.

January 30, 2010 15:38 by

We Were Promised Jetpacks - Quiet Little Voices

no comments yet, post one now

January 30, 2010 15:32 by

Cyclemeter & Other Stats

no comments yet, post one now

If you follow my tweets, you might have noticed I occasionally use the excellent Cyclemeter (iPhone app) for collecting stats. What you might not have noticed is that you can actually shout support (or more likely abuse) at me while I’m cycling in and out of work!

The app uses text-to-speech to convert your @hiddenloop replies (pushed to the iphone through the app) and plays them over whatever music I’m listening to. Clever stuff! So next time you see a tweet like this holla back!

If you’re big into tracking exercise stats, I would recommend Cyclemeter over the other apps out there right now. I’ve tried MapMyRide, MapMyRun (and some others) and none work as well or are as simple to use. CycleMeter can also be used for running, but I prefer to use a Nike+ kit with an iPod nano (rather than lugging the iPhone around with me)

I’m working on a new feed & push importer service (with web-hooks) for Bugle that will allow any valid feed data to be displayed/updated within your site or blog. First examples of this will probably be put to use here, with my tweets, run data, cycle stats etc.

Cleaning your Rails routes

no comments yet, post one now

After watching the excellent Rails Best Practices presentation by Wen-Tien Chang, I took the opportunity to perform this optimization on my apps. Basically removing the default Rails route mappings from routes.rb. If your Rails app is RESTful then you should have all your resource endpoints defined in routes; and be using the Rails url/path view helpers in your templates. If this is the case you can remove these default mappings at the base of your routes file;

# these can go!
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'

Doing this on my smaller Rails apps caused no problems, but in Bugle (a bigger app) I came across the following gotchas;

Look for urls or paths in your code that are defined with { :controller => :foo, :action => :bar } options, these should be replaced for the equivalent Rails helper for the controller – rake routes is your friend in figuring out what to use; eg.

url_for(:controller => 'blogs', :action => 'show' :id => @blog.id}
# should simply change to
blog_url(@blog) 
# or
blog_path(@blog)

Calls to link_to should again use the same urls/path helpers as above – but in some instances this became a “Route not found problem”;

link_to 'comment website', @comment.website
# where @comment.website is a String e.g. http://hallo.com
# instead ditch link_to and use simple HTML tags

Happily I was able to delete a large amount of unnecessary routing specs, that were essentially testing the behavior of the 7 standard RESTFul Rails routes. Rails 3 has a completely revamped routing system (see here for details), so making optimizations and cleaning up routes.rb prior to it’s release is advisable.

Related Links

January 21, 2010 12:18 by

Imperial Corn Market

no comments yet, post one now

Imperial Storm Troopers in Corn Market, Belfast

"These aren't the broadband mobile offers we are looking for"

← (k) prev | next (j) →