Main menu:

Site search

Categories

February 2010
S M T W T F S
« Jan    
 123456
78910111213
14151617181920
21222324252627
28  

Archive

View Steven Ng's profile on LinkedIn

Stupid Smilies!

It was a good idea to start blogging lessons learned as I code, but it took almost as long to post a correctly formatted entry when I ran into one problem. WordPress creates emoticons automagically. Even if the text is embedded in a <code> or <pre> block. My last posting contained a :order symbol, which WordPress converted into a laughing smiley. Thinking it was in my code, I manually retyped in the text, tried a code tag, and removed extraneous tags to no avail. WordPress has a setting that takes care of this. Emoticon conversion is turned on by default, a bad thing for Ruby bloggers. Problem fixed, after wasting too much time doing the right thing.

Ordering on a Field in a Linked Table

I attempted to order my runners based on their assigned stage number. The stage number is linked by the stage_id in the schema and the class shows that it belongs to a stage:

class Runner > ActiveRecord::Base
  belongs_to :stage
end

At first glance, I figure I would simply order on the stage number:

  def self.find_all_runners
    find ( :all, :order => "stage.number" )
  end

But this resulted in a “no such column” error:

SQLite3::SQLException: no such column: stages.number: SELECT * FROM “runners” ORDER BY stages.number

I found the solution in Ryan Daigle’s blog. In order for this to work you need a :joins to the linked table so Active Record knows the origin of stage.number. In my application, the find should be:

  def self.find_all_runners
    find ( :all, :joins => :stage, :order => "stages.number" )
  end

Test shots of the CES video page

Merry Christmas

I love the way Schulz drew Snoopy’s face.

Peanuts

Apple Loosens The Reins A Bit, Sends Handslaps Rather Than Rejections

Apple is moving in the right direction. With this and the new app to report quality of service problems, Apple and AT&T are making moves that will make me reconsider moving away to Verizon:

It looks like Apple might be making moves to loosen up their restrictions, if only ever so slightly. Earlier this week, Apple finally let a live video broadcasting app through the gates, after apps of that genre sat on the review backburner for months. Today, they’ve willingly approved another application that calls upon one of Apple’s private (and generally blacklisted) APIs.

 

Posted via web from nomadicoder’s posterous

Nomadic Money Saving Tip

Wear your shirts till they’re thread bare. When you wear out your shirts, save the buttons (don’t forget the spares) and collar stays before you throw it out. Use the buttons to repair shirts that don’t carry spare buttons and use the collar stays to replace the ones you lost in the laundry.

Adam Savage’s Obsession

What’s in the mind behind one of the hosts of Mythbusters

Kindle for iPhone

The New York Times reported that Amazon just released an Kindle Reader for the iPhone

I downloaded it an hour ago and had a chance to briefly use it. It gives me access to all of the books I’ve already purchased. I don’t see my newspaper subscriptions, but I suspect that will come in a future release.

The interface more book-like than the Stanza Reader. Where the Stanza reader uses touch regions to turn pages, on the Kindle reader, you use the page change gesture of sliding your finger from right to left across the screen as if you were flipping pages. Page changes are fast without the refresh flash you get on the Kindle device.

The iPhone is just about my mobile all-in-one device.

Kindle 1.2 Update

Amazon recently updated the Kindle firmware to version 1.2. The update has been taking place over the past week or so. My Kindle updated last night. So far i see a new “Sync & Check Items” which I gather from on line discussions synchronizes purchased items and synchronize bookmarks between devices. This will probably make it easy for folks who purchase the soon to be released Kindle 2.Opening a book purchased from Amazon, there is also a “Sync to Furthest Page Read”. I think this lets you return to where you left off in a book, if you have not read your purchased book in some time or if you go back to an earlier location in a book.You can also delete books from the main menu. Now, you don’t have to open content management and manually search for books to delete.Lastly, while I don’t recommend the device for browsing the web, I’ve found the browsing and updating to run somewhat faster.Overall, Kindle 1.2 feels as if it has improved performance. Better content management is a definite plus. This upgrade seems to ease the way for Kindle 1 owners who transition to the Kindle 2. [Update March 4, 2009: It appears the page changes are faster.  Also, I've noticed that every other page does not flash, but immediately transitions to the next page.] 

Keri Mullis on Scientists

Nobel Prize winning biochemist, Keri Mullis, talks about doing science and what we can learn about climate data and global warming.