Blog posts tagged "rails"

Boston.rb, Next Tuesday (Feb 7th)

February 2nd, 2006

After a rather long hiatus, Boston.rb is reasonably likely to meet Feb. 7th. Website seems to experiencing the dreaded 502 Bad Gateway error (umm, yeah, secrets out, Rails hosting is non-trivial), but jump on the list for more info. (or at least join in the confusion)

Tagged: Uncategorized , ,

Session “Flash” in PHP

December 7th, 2005

Doing some PHP hacking tonight, I was missing Rails’ “flash”. So I coded up a quick and dirty implementation of the read-once session status notification pattern. The code

Tagged: Uncategorized , , , ,

Flushing Rails Database (MySQL) Sessions

December 7th, 2005

I use Rails’ database session backend for LM. (for login, as well as “flash”) Without any sort of built in garbage collection the sessions table gets very large, very quickly. Beyond aesthetic issues, this can also cause MySQL’s key buffer to fill up. (which on Debian is by default set quite low)

So I wrote up a quick flush method, and saved it in a file models/session.rb.

class CGI::Session::ActiveRecordStore::Session
  def self.flush_old_empty_sessions
     self.delete_all "DATE_SUB(NOW(),INTERVAL 6 HOUR) > 
     updated_at and BIT_LENGTH(data) <= 688"

This says nuke all sessions which are over 6 hours old, and which are empty. (688 is the length of the serialized session with an empty flash)

MySQL specific, and susceptible to changes in either session structure or its serialization. But it was quick and easy and worked for me.

Then you simply need a cron job like: ruby script/runner 'CGI::Session::ActiveRecordStore::Session.flush_old_empty_sessions'

Tagged: Uncategorized , , , , ,

MeasureMap Alpha: Review

November 22nd, 2005

I’ve been running the alpha of MeasureMap for a few weeks now, and I thought I’d do a quick brain dump.

First thing you notice? It’s pretty, just ridiculously, gratuitously whizbangy. And that can make it find of fun to play with, in and of itself. Still that Flash can be slow (though not apparently compared to Google Analytics), but really if I was getting the questions I had answered, I don’t think I’d notice.

And as a domain specific (blogs) stats package, they’ve done some nice work breaking up the reports into appropriate discrete units. (I love the daily overview screen you get when you click thru from the timeline and you’ve posted multiple blog posts in a single day)

The Wrong Questions

Maybe LaughingMeme is abnormal, but I have about 10 posts that Google loves so much that (according to MMap) they account for 47% of all my traffic. (and its a power law distribution) In general they aren’t posts I’m all that excited about: year old speculation on Google IMAP brings in hundreds of visitors a day, while Beklin Sucks! has been a perennial favorite, and daily traffic to I’m feeling lucky often exceeds 1000 visitors.

The fact that people are visiting these pages is boring. And the fact that Google is sending them there, day in and day out? Boring.

Show Me the Novel

What’s new? What’s different today then yesterday, this week then last week? Freak outliers, and emerging trends please.

55 Posts About Coffee And Still They Come

Help me out with audience. What brings the readers? What brings the links? What brings the comments? I’ve got my posts marked up with microformat tags, Yahoo has the term extraction API, lets use some of that domain specificity to do something new. (and while rel=”tag” is the only widely deployed microformats currently, more will follow)

Gurchin has got Gads integration, MMaps needs to distinguish by exploiting its specialty.

And Speaking of “conversions”

Any chance of hooking up with Feedburner to allow me to plot subscriber spikes to blog posts? No idea if the data would be compelling, but I know that most of the people in my subscription list got there by writing one really good post. (staying there is harder)

Sources and Fans

You’re tracking links in, and links out, I’d love to see that information compiled into its social mesh.

Quirky Stats Muching AI

Okay, what I really want is an AI that gets a kick out of pouring over the logs all day, and finding the quirky and sublime.

Imagine logging in to be told that “the query ‘bush in freefall’ was your 22nd most popular search yesterday, but your 1st most popular on searches coming from .mil” (true), or “the spike in ‘weather rss’ this weekend corresponded to freak hail storms across the country” (actually I have no idea why that query spiked). But I’m willing to settle for a bit less.

Rails and ProxyPass

October 28th, 2005

One of my key goals when moving Laughing Meme over to Typo was not to break the nearly 4 years of accumulated URLs. This involved some tweaking of Typo’s importer script to maintain my old ids1, and some routes tweaking. So far so good.

But what about the pieces of the site not maintained by MT, pieces that expect to be handled by Apache, not dispatch.fcgi? For that ProxyPass if you friend. It isn’t a sweeping solution, but as I bring pieces of the site online that use PHP, server side includes, or just DirectoryIndex, I’m using ProxyPass to re-route the URLs before they fall into the Rails’ event horizon. Works great.

1. Actually, was a bit more complicated them that, as I combined several MT blogs (LM, MLPs, Work, etc) into one, so I let the importer create a id, but also hang onto the MT id in a new column imported_id

Tagged: Uncategorized , ,

TZInfo – Ruby Timezone Library

September 19th, 2005

TZInfo is a Ruby library that uses the standard tz (Olson) database to provide daylight-savings aware transformations between times in different timezones. The tz database is compiled into Ruby classes which are packaged in the release. No external zoneinfo files are required at runtime.

Sweet! Another item off the todo list I don’t have to do. And Scott has written an article about how to use it as a replacement for Rail’s “so-broken-its-negligent” TimeZone implementation.

As a hacker (is it a universal feeling?) its always an ambiguous feeling to see someone else cross an item off your todo list, a little sense of a loss (I was looking forward to solving that problem) with a bit of glee (Now I get to solve more interesting problems!)