The Wayback Machine - https://web.archive.org/web/20170701044802/http://www.advogato.org/person/oubiwann/diary.html?start=159

Older blog entries for oubiwann (starting at number 159)

twitter

Yeah, so I'm late to the game.

In fact, twitter's not really a game I was ever interested in. I only started using it today because of the work we're doing at Divmod. The reason I was never enthusiastic was I just couldn't see myself using yet another application or having yet another web page open all the time.

But it hit me this morning at 3:00am when I couldn't sleep that with tying a single script's name at the command line, I could push whatever command I had just issued to my twitter. That script uses bash's history command as well as python-twitter. I wrote another simple script that I can use to push arbitrary text too. That coupled with the fact that 1) twitter supports an IM service and 2) I'm now using BitlBee, I can now use twitter without context switching (since I spend 80-90% of my computer time in the terminal and my IRC client).

I'll probably be using twitter mostly as an open-ended replacement for setting IM/IRC status. Interesting commits or revealing bash activity will make their way, too. And, of course, I will be using it for the as yet unannounced Divmod app we will be releasing :-)

Technorati Tags: divmod, internet, python, social networking, software

Syndicated 2007-11-01 15:52:00 (Updated 2007-11-01 15:57:22) from Duncan McGreggor

29 Oct 2007 (updated 30 Oct 2007 at 01:04 UTC) »

trac Stats Gathering with Storm

One of the things we've wanted to do recently at Divmod is track development status of milestones as well as gain some perspective on repository history/trends in activity. The first thing I did? Looked at SQL for about 2 and a half minutes. The second thing I did? Fired up a python instance and imported storm.locals :-)

With a few minutes of typing and looking stuff up (e.g., how to define compound keys for an already extant schema/db), I was up and running and was able to concentrate fully on the problem at hand (reports) and how to represent data visually (matplotlib). Now that's how an ORM is supposed to work :-)

Here are the schemas I defined in python:

class Revision(object):
"""
A storm ORM object representing a row in the trac 'revsion' SQLite table.
"""
__storm_table__ = 'revision'
rev = Unicode(primary=True)
time = Int()
author = Unicode()
message = Unicode()

def getDateTime(self):
try:
self.dt
except AttributeError:
self.dt = convertEpoch2DT(self.time)
return self.dt

class NodeChange(object):
"""
A storm ORM object representing a row in the trac 'node_change' SQLite
table.
"""
__storm_table__ = 'node_change'
__storm_primary__ = ('rev', 'path', 'change_type')
rev = Unicode()
path = Unicode()
node_type = Unicode()
change_type = Unicode()
base_path = Unicode()
base_rev = Unicode()

Revision.nodeChanges = ReferenceSet(Revision.rev, NodeChange.rev)

class TicketChange(object):
"""
A storm ORM object representing a row in the trac 'ticket_change' SQLite
table.
"""
__storm_table__ = 'ticket_change'
__storm_primary__ = ('ticket', 'time', 'field')
ticket = Unicode()
time = Int()
author = Unicode()
field = Unicode()
oldvalue = Unicode()
newvalue = Unicode()
Note the 1-to-m relationship of revision to nodes changed -- so easy :-)

This is exactly what a (good) tool is supposed to let you do: focus on and solve the larger problem at hand, not get lost fixing tools. With the schemas defined, the queries took literal seconds to write, I had my data, and was able to start generating textual summaries as well as processing the queries for graphs.

Wanna see some graphs? Below is a slide show of some graphs (just a few of the hundreds that are generated) representing the work of the Divmod dev team over various points in time on a secondary trac instance (not our main, Divmod trac instance). Though I haven't included them in the slide show, the code also generates graphs per-user, per-time-period.