Saturday, December 8, 2007

Rails to the rescue

It's good to keep the tools in your box sharp, I'm happy I've been messing with Rails on my own, because I need to knock out a prototype for work really quickly, Rails to the rescue!

A couple notes, NetBeans 6.0 is out, and I highly recommend it as your Rails development environment. I took a few minutes to switch to the new IDE, and it's very smooth. Alas, when I switched, I was having a very hard time getting plug-ins, and getting Rails to upgrade via Gems. I was receiving weird buffer errors. Google to the rescue, there was a simple fix that involved upgrading gems..just run this command:

gem update --system

and you should be in business...thanks to the DRY blog for the heads up! I'm also incorporating the WillPaginate plug-in in this round, and I've got to mash-up with Google maps. I did find a gem for Google maps, we'll see how far I get, but I'll post any findings..


Updates:

Apparently, will_paginate returns nil if your collection is smaller than the per-page. I was having a problem where I was returning an array of results for my 'position log', and it would not show up in the form where I had used

<%=will_paginate @obs_log %>

I'm not sure why, but here's the code for will_paginate..

# Renders Digg-style pagination. (We know you wanna!)
# Returns nil if there is only one page in total (can't paginate that).
#

def will_paginate(entries = @entries, options = {})
#total_pages =

if entries.page_count > 1
renderer = WillPaginate::LinkRenderer.new entries, options, self
links = renderer.items

content_tag :div, links, renderer.html_options
end
end

So this really does me no good, I'm sure I'm missing something obvious, but it should at least render the collection without the paging cruft. I'm just in too much of a hurry, but this was frustrating. I punted and just showed the last 30 or so with a :limit in my find_all.

I want to present a REST-ful interface for my app to accept data from a mobile with a GPS, I ran across this RailsCast on REST, which seems useful...

Monday, December 3, 2007

will paginate

I've been working on a Rails app as a sort of hobby, it's for a site that I'm prototyping for fun, and we'll see where it goes. I've been off and on, depending on the home schedule, but having a concrete goal helps in my effort to keep my chops up. My areas of focus right now are Ruby, Rails, AJAX, JavaScript (with the Dojo toolkit), as well as CSS and design (never my strong suit). The things I work on lately are quite fun and challenging, but have taken me away from heads-down web app coding for quite a while.

Anyhow, working with the project, pagination turns out to be deprecated in Rails. I grabbed the new plug-in, classic_pagination, but the first thing I got is a notice that it's dead code, and I should move to WillPaginate. I love working with Rails, but the capricious nature of open source does have its drawbacks! Anyhow, I'm working with it, it looks nice. I found a quick jump-start on a RailsCast episode dedicated to pagination, linked here. RailsCast is a fine resource, and I highly recommend it.

One thing I would point out, and something that I'm still working to change, is to wake up to the fact that Rails and Ruby let you pop open a console and work with your code while you code. Try things out, see what responses you get, and if it looks good, copy it into your codebase. As a Java monkey, this is still a foreign mode of operation. The point is, if you're used to coding Java like I am, get used to having that console open, and monkey with your code! Check out the RailsCast, and give WillPaginate a try.


Taking the Social Web into the virtual world

Here's an interesting article on IBM's efforts to blend social software, identity, and the virtual world through Lotus.

IBM Lotus programmers and engineers from IBM's research groups are currently working on ways to employ virtual reality technologies with Lotus Connections social computing software, said Jeff Schick, vice president of social computing for IBM.


I heard someone describe the 3D web by saying 'people are back', and I think this is the true strength of environments like Second Life. It's not about the graphics or a particular virtual space, it's about the people and experiences that are available. Maintaining and monitoring a social network is Web2.0, the 3D web is about being present with friends and peers in meaningful ways, through virtual experiences.