Archives for May 2005
RailsDay registration is open!
Rails Day is a competition which gives teams of developers 24 hours to build the best web app that they can using Ruby on Rails.
The competition is this weekend. I’m looking forward to it. There are some great prizes as well…
Agile Web Development With Ruby on Rails
by Dave Thomas and David Heinemeier. It’s not out until August or so, but you can get a beta book in PDF form now. My copy has been ordered...
nine inch nails
Just got back from seeing Nine Inch Nails at Stubb’s BBQ in Austin. Great show. However, it was odd seeing nin play such a small venue tonight. No big video screens or anything like the Fragility tour.
Anyways, you can view my crappy cell phone pictures, or just look for ‘nin’ photos at Flickr.
comic addiction
You know what? I can quit anytime I feel like it.
Oh crap, did I actually link to a 3 year old article? I think I did. I just stumbled upon it looking through my referrals somehow.
Adventures in Rails Debugging
I had the greatest rails debugging session ever, tonight. And by greatest I mean incredibly frustrating.
I have a controller that updates an amount value for an Item model. In the unit tests, everything works great. In a rendered partial, however, it was showing an old value. First, let’s take a look at the controller code:
logger.info ">> BEFORE! @item.amount=#{@item.amount}"
@item.add_bid @session[:user], @params[:bid_amount]
logger.info ">> AFTER! @item.amount=#{@item.amount}"
render_partial('info', @item) if @request.xhr?
logger.info ">> AFTER PARTIAL! @item.amount=#{@item.amount}"
redirect_to :action => :show
Notice the extensive use of logging… Now’s the view:
<% RAILS_DEFAULT_LOGGER.info ">> INSIDE VIEW! info.amount=#{info.amount}" %>
<strong><%=info.amount.format%></strong>
Straight forward, right? Well, it turns out it puts the value of @item.amount before the bid is added! Here’s the log output:
>> BEFORE! @item.amount=$85.00 USD
SQL (0.000310) BEGIN
SQL STUFF
SQL (0.000271) COMMIT
>> AFTER! @item.amount=$100.00 USD
>> INSIDE VIEW! @item.amount=$100.00 USD
>> AFTER PARTIAL! @item.amount=$100.00 USD
Notice that the value is updated after the item is saved, before the partial, inside the partial, and after it. So why was it printing the old value? Well, Scott Barron gave the first hint to the solution: Multiple render calls are ignored. I restructured the code so that the render methods are only called once whether it’s an Ajax request or a normal POST. Still no dice.
Then, I put a breakpoint inside the view, and noticed it was getting called twice! The first time was before the update, which is why the old value was showing. I took another look at the controller, and noticed I was calling the show action also. The show action just loads an item using @params[:id], so I was using it in multiple actions, rather than repeating that bit of code. Well, I just recently added another line that renders that same exact partial for ajax requests.
That is why the rendered data was showing old data. By using a call to another action, I was duplicating the call to the partial, and Rails was probably caching it somewhere.
Comiclog is out
comiclog is my little comic book database I’ve been working on for about a month in my spare time. It’s invite-only for now, mostly to keep curious travelers out of it. It’s still pretty rough right now.
This is an idea I’ve been toying with for some time. If I need information on movies or anything, there are great resources. But, there’s nothing for comics. Comic publishers just don’t get the web. It’s not just a forum for a bunch of fanboys to get together and bitch about your latest summer blockbuster. I’m just trying to explore what else the web can do for comics.
Ideas are welcome. Bug reports are also welcome. My current source code is available. comiclog is powered by Ruby on Rails / TextDrive / lighttpd / FastCGI.
darcs / subversion gateway
So far, I’ve been a happy Subversion user. I migrated my firm’s VSS repositories, and everything’s been (mostly) smooth.
Darcs worked out pretty well for what little I used it. The interesting thing though, is that each client is its own repository. This allows you to work offline with a revisioned history of your changes. I wonder if I could set up Tailor to mirror my darcs changes to the central svn server?
FeedTagger
Looks like Bloglines has some competition. FeedTagger has a lot of catchup to do in terms of features. The tagging stuff is very interesting.
Hey, a useful widget!
So far, I haven’t been all that impressed with the Dashboard widgets in Tiger. More eye candy than functionality (and the sweet ripple effects don’t even work on my Mini).
Enter Flidget, the Flickr uploading widget by Anatoly and Rob. Cool stuff. The fact that you can drag files from the desktop to the dashboard is very handy.
Okay, I know there are lots of other useful widgets, but none that I really need at the moment. Flidget rocks though.
Synergy
Synergy lets you easily share a single mouse and keyboard between multiple computers with different operating systems, each with its own display, without special hardware. It’s intended for users with multiple computers on their desk since each system uses its own monitor(s).
I’ve posted on this before, but Synergy rocks. I’ve noticed some issues with the back/forward mouse buttons (buttons 4 and 5), and the windows key on the client machine. I feel helpless without the windows key.
Ruby on Rails ported to Javascript
TrimPath Junction is a clone or port of the terrific Ruby on Rails web MVC framework into JavaScript. TrimPath Junction is also sometimes referred to as TrimJunction, or as just Junction. Or, in honor of its heritage, it’s also sometimes called JavaScript on Junction (JoJ).
There’s even a Ruby-Javascript code comparison, and a little demo app.
