Deep Thought

2008-11-04 19:00:00 -0500

We’re turning into jQuery nerds.

Rocketboom & TwitterVoteReport

2008-10-29 20:00:00 -0400

Rocketboom came by the Williamsburg Coworking space last Friday during the code-jam to do some interviews of the various folks working on the "TwitterVoteReport" project (from designers to press folks to coders), and ended up including Yours Truly among the interviewed. The resultant episode on their site provides a great introduction to what’s going on with TwitterVoteReport and how it works, so check it out:

Worth pointing out again and again, since the name might be a bit misleading, that it’s not just for Twitter. You’ll be able to send in SMS reportsn, report by telephone call, use an iPhone app (if Apple deigns to allow it in the app store on time), and a Google Android app is up in the Android Market.

Another Monday and All's Well

2008-10-26 20:00:00 -0400

We’ve been really busy lately here at Zetetic, which is why you haven’t heard from us in a bit. We’ve got a new design for our website on the way, we’re running a beta program of the next version of Tempo while developing another major release in the background, we’re working on an iPhone app (actually two), we’ve donated some time to helping out the folks over at the Twitter Vote Report project, and we’ll be doing yet more work with them as the crunch to the election day gets closer, and we’re still hiring.

And we’re still working hard for our clients. So, not so much time for blogging this last month.

Just to expand on a couple of these things:

Tempo Beta

If you’d like to participate, send an e-mail to and we’ll give you the details. We’re particularly interested in feedback our users have during the end-of-month billing period, as this next version should make reporting a lot faster and easier.

Twitter Vote Report

Twitter Vote Report is a project we became aware of through the folks at the Williamsburg Coworking space where I work in Brooklyn, NY. Basically, it’s a project that will allow users to text or call-in reports from polling places to build a database of activity and problem reports. Hopefully this will help to monitor the election, problems at voting places, and identify any hotspots early on the 4th of November. So far we’ve done a bit of coding and contributed a bit to the architecture and security discussion, and we’ll be contributing more work to help them get over the finish line as we get closer to the election.

The basic gist of it is that a user can tweet a problem or send an SMS message to short-code 66937 to report a problem, along with their location, like so:

#votereport long lines here l:11211
#votereport #wait:20 they won't let grandma vote l:courthouse, va

More information will be available on the TVR site soon. Lots of smart folks are putting a lot of time into making this happen and it’s been awesome to watch it come together. If you think you could help out in some way, even if it’s just spreading the word, do get in touch with them. In particular we’ll need folks who can volunteer to be “sweepers”, folks who help comb through the incoming data looking for mistakes.

Coudal's 3 Questions

2008-09-29 20:00:00 -0400

Stephen forwarded me one of the Coudal Partners newsletters the other day, and it had this rather interesting bit where they describe the three questions they ask themselves when determining whether or not to pursue a new idea:

  1. Will we be able to make money? We’re a business. We have mortgages and tuitions to pay. Plus, if we don’t make some cash once in a while, how will we feed our habit of continually screwing around?
  2. When we’re done, will we be proud of the work we’ve done? Slaving for months on a project only to not want to show it to anyone when you’re finished just plain sucks. No amount of money can make that feel better.
  3. Can we learn a little something new along the way? Executing the project has to make us smarter and help satisfy our curiosity, which we think is our greatest asset.

The article then goes on to show how they applied it to their Field Notes Brand. Just figured I’d pass that along, you should be able to access the whole thing over here, at least for a little while.

Rolling your own pagination with will_paginate

2008-09-16 20:00:00 -0400

So I’ve been working on some decent paging of time entries for Tempo’s reporting interface. I would have loved to have just ran with the fantastic will_paginate plugin, but we don’t generate what you see on the reporting screen in Tempo via a simple Rails find call on the Entry model. Instead we have a class that builds the appropriate SQL according to the various report specs and then runs it via find_by_sql. Actually, it does quite a bit more than that, but I don’t want to get off topic.

Anyway, this meant we couldn’t simply expect will_paginate to know what kind of SQL it should generate, because the standard options on find wouldn’t be enough. But the plugin was really quite well-designed for extensibility, and that made it a snap to get our own paging going on:

class ReportContext
# the list of entries to display based on context
def entries
self.prepare # make sure the SQL for this report is already built and sanitized

@offset = DEFAULT_OFFSET if @offset.blank? or @offset < 1
@limit = DEFAULT_LIMIT if @limit.blank? or @limit < 1

@entries = WillPaginate::Collection.create(@offset, @limit) do |pager|
# must use a duplicate or original sql is modified (this can get pretty vexing)
sql = Entry.send(:add_limit!, @sql.dup, :limit => pager.per_page, :offset => pager.offset)
result = Entry.find_by_sql([sql])

unless pager.total_entries
# the pager didn't manage to guess the total count, do it manually
pager.total_entries = self.count # run the count sql for this report

Now that our @context.entries method is returning a will_paginate collection, we can pass it to the view helpers, and voila:

- paginated_section @context.entries, :params => { :action => :index } do
%th{:style => "text-align: center;"}= sortable_column('Hours', 'hours')
%th= sortable_column('Date', 'occurred_on')
%th= sortable_column('Person', 'user_name')
%th= sortable_column('Project', 'project_name')
%th Tags
%th Description
%th= sortable_column('Created', 'created_at')
%th= sortable_column('Updated', 'updated_at')
- @context.entries.each_with_index do |entry, i|
= render :partial => 'entries/entry_tr', :locals => {:entry => entry}

Note how we’re passing the :action parameter into the :params option of the helper. This gets passed to the link generators that create the actual pagination links. Because this view is generated in a partial, any number of methods could have displayed it from differing XHR calls to different REST urls (entries/filter, entries/data, etc), and we have to make sure that any pagination links would bounce off the index action. By default the pagination will link to the URL of the current request.

Oh, right, so that sortable_column business? We’re finally adding this oft-requested feature into an upcoming update to Tempo.