Archives for March 2012

Back to Archives

Taking Radio Beyond the Play Button

KPCC StreamMachine Listen Live Demo KPCC

Back in January I mentioned my explorations with Node.JS and the process of getting over the hump with a new framework. After a couple months of false starts, I had finally gotten a little streaming audio relay up and running.

Turns out, that may have been the start of something interesting.

Over the last few months I've become a bit obsessed with the idea of where radio goes in this new Internet world, and particularly with the idea that the experience of listening to a digital stream has the potential to be worlds better than that offered by your radio. Your radio, after all, only offers you a play button. — Continue Reading...

Making Django and Rails Play Nice, Part 3: Caching

This is the third section of a multi-part look at some of the issues that we faced in developing KPCC's new beta website, which is written in Ruby on Rails but runs side-by-side with the existing Django site. Part one looked at mapping generic relationships with MySQL views, while part two talked about adapting sessions to allow them to wander from one site to the other.

There are plenty of ways to do caching. Page caches, partial caches, timestamp-based caches, versioned caches... they've all got some place in valid place in the caching arsenal. In Rails, the convention is to build sweepers that get fired when model objects are saved, giving a spot to handle expiration or rebuilding of caches. But what do you do when Django needs to be the one to expire your Rails caches? — Continue Reading...

Making Django and Rails Play Nice, Part 2: Sharing Sessions

Yesterday I introduced some of the challenges faced in development of KPCC's new beta web site, which is running Django and Ruby on Rails side-by-side during a slow transition from one framework to the other. Part one focused on using MySQL views to allow Django's generic relationships and Rails' polymorphic relations to use the same data.

Today's topic is sessions, specifically how to allow a session to seamlessly pass from one backend to the other. — Continue Reading...

Making Rails and Django Play Nice with the Same Data

Friday afternoon, KPCC opened up a public beta for our new web site, which finally gives me license to talk about some of what I've been working on over the past few months.

Accept the cookie on that beta page and you'll get a fresh new view of the KPCC site. In the process, you'll get handed off from our old Django site to a new Ruby on Rails application. Share a link with a friend? If they're not opted-in to the beta, they'll see the old site at the same URL.

That back-and-forth happens via some nifty conditional logic in nginx, a handful of carefully-applied MySQL views and custom session and caching backends that allow us to pass data and trigger actions between Django and Rails.

I'll explore those different pieces over a handful of posts, starting today with the MySQL views that enable polymorphic association and generic relations to play nice. — Continue Reading...

Apologies for the mess

It's a bit messy around here at the moment as I take big swings at some of the architectures underneath this little site.

This afternoon I moved the site from a pair of Amazon EC2 t1.micro instances to one of the new 64-bit m1.small instances, getting away from the nasty CPU limits that kill performance after a couple page loads. I also rolled in the newly-engined AssetHost, finding and squashing plenty of instances where I hadn't yet namespaced bits of code in there along the way.

Starting tomorrow I'll be doing some write-ups on things that I've been working on for KPCC, so my silent February should transition into a relatively-wordy March.