NPR and PHP

May 10th, 2009 by Andrew Plemmons Pratt

NPR TechnologyEvery so often, I’m on a road trip, driving around the great southern states, and I’m overtaken with a very strong need for some public radio. Unfortunately, I don’t have one of the handy NPR Station Locator Maps. I also don’t have an iPhone, for which I could get the free NPR Station Locator app. What I have is a work-detail Blackberry and soft sport for dabbling in scripting languages. So I took the opportunity to learn some PHP and build a rudimentary station finder using the NPR API.

NPR of course offers a spiffy web-based station finder map for scoring your closest Wait Wait Don’t Tell Me! or All Things Considered fix. But it’s a little too full-featured to work on a dinky mobile browser. But let’s also not kid ourselves about functionality here; this was an excuse to learn some super-basic PHP:

http://appratt.com/npr/

We’ll call this version 1.0 because it lacks anything resembling a design; it doesn’t verify that you’re feeding it ZIP codes or return appropriate error messages if nothing is in range; and it doesn’t indicate station strength (though station strength is something you can figure out pretty quickly with your tuner).

What is does do is query the NPR API and return a list of the closest stations with city and call number, ranked in order of proximity. Which is all you need when you know you’re missing Michelle Norris and all you can find is Delilah.

Processing

December 2nd, 2008 by Andrew Plemmons Pratt

Conceived by a couple of grad students working with John Maeda at the MIT Media Lab, Processing is an open source programming language and environment for designers. Built on top of Java, the platform is a simplified way of allowing digital artists (who might have no familiarity with coding), information designers (who might have some), or even skilled animators (who might have plenty) to construct programs that allow for dancing typography and iterative motion. Seven years in the making (hat tip to Design Observer), creators Ben Fry and Casey Reas released version 1.0 over the holiday weekend.

In an attempt to learn how to make information graphics dance around on the screen, I’ve learned the basics of ActionScript and have attempted (with little success) to learn the rudiments of Ruby On Rails. I’m dubious about the utility of a language built on top of another somewhat defunct language, but the ability to manipulate typography within a web browser without having to muck around with a timeline is intriguing.

This example from the Processing site’s “Exhibition” section is well within the realm of what’s possible in Flash, but it has a pleasant polish to it:

Iceland population graphic

Venture outside the world of information graphics and into digital art and you get Processing applications like this, a music video for Radiohead’s “Bodysnatchers” generated by a reactive program that responds to audio input:


Bodysnatchers – Zeno Music Visualiser from Glenn Marshall on Vimeo.

And finally, here’s an applet I pulled directly from the examples that come with the v1.0.1 package, exported, and then uploaded to my server. The code is 17 lines long:


void setup()
{
size(200, 200);
noStroke();
colorMode(RGB, 255, 255, 255, 100);
rectMode(CENTER);
}


void draw()
{
background(51);
fill(255, 80);
rect(mouseX, height/2, mouseY/2+10, mouseY/2+10);
fill(255, 80);
int inverseX = width-mouseX;
int inverseY = height-mouseY;
rect(inverseX, height/2, (inverseY/2)+10, (inverseY/2)+10);
}

This could be worth playing around with.

Federally Financed R&D Expenditures at Doctorate-granting Institutions by State, FY 1993-2006

March 28th, 2008 by Andrew Plemmons Pratt

Here we’re going to experiment with a Google gadget displaying Federal expenditures on state R & D over a period of 14 years:

Source: SSTI

Incipit

March 8th, 2008 by Andrew Plemmons Pratt

I figured that the best way to encourage myself to revamp appratt.com would be to just delete everything on the site and install WordPress. Here we are. Now on to step two, putting my own stuff back on.