Well, a PHP example, anyway

Once I dove in and started messing around, I only had to fix two typos as the example I was working on seems to work correctly, at least to the extent that I’ve tested it. I now have what appears to be a working example of Geostring parsing in PHP. In this case, the example reads my feed from the Twitter website, sifts out any geostring tags it finds, then generates Google Maps links for each one found. As I write this, there are two geostring tags on that page, representing places (and times)
that I have actually been, and it seems to work.

You can take a look at the source code for the example here, or see it in action here.

Feel free to grab a copy to play with if you’d like (or write one yourself that isn’t so messy – hey, as someone who doesn’t consider himself a professional “coder”, I’m just happy that it did exactly what I wanted it to do on the first try…). You should only need to worry about two things – changing the $text_to_read, and whether or not your web server (or CLI) has fopen wrappers turned on so the script can read another web page if you use a web page as your text to parse rather than a local file.

Since generating a geostring tag is trivial, I didn’t bother trying to incorporate that into this example. If you want one, then here:

<?php
//generate a geostr tag with the most typical information only
//point not part of a track nor including heading or angle
$lat=44.027168;
$lon=-111.297892;
$elev=”1711.9m”; //could leave off the “m” and treat as float, since it defaults to “meters”
$timestamp=”20071125T123438-06″; //6 hours behind UTC

print(“geostr:$lat,$lon,$elev:$timestamp:geostr”);
//”full” version: print(“geostr:$lat,$lon,$elev:$timestamp,:,:geostr”);
//completely unnecessary, but legal
?>

As always, comments and suggestions are welcome.

Off-Topic and Back Again: “Framing”, Cluetrain Manifesto, and Twitter

“Framing” came up briefly on one of the other small independent blogs I follow. I’d link
to the post but it’s gone now. I sincerely hope its disappearance wasn’t related to the
comment I posted there, unless it was just because of the “don’t feed the trolls” part
of it – (in which case excuse me for a moment while I tell myself what an amazing fountain of useful advice I am and feel self-important for about 15 seconds before I return to reality…). I’m guessing the poster just decided he didn’t want to keep the post, but I won’t let that spoil my brief ego-feeding fantasy.

For those lucky enough to have missed it so far, here’s my flippant and extremely brief explanation
of my understanding of how the “framing” thing goes. An assistant professor of communications popped up among the science blogs one day with what seemed to begin as a couple of reminders of the obvious (mainly because it occasionally seems that people have forgotten). Namely, that if you want someone to understand what you are trying to communicate (particularly scientific matters) and agree with you, you are more likely to succeed if you can connect what you are discussing to something that your audience already cares about, and you are less likely to succeed if you are, shall we say, unfriendly to them as you present your subject.

From there, “framing” seems to have grown into something resembling the brand-name of some kind of mass-market “self-help” product line. Its primary proponent, from the distant vantage point
whence I occasionally catch a glimpse of the fight, starts to seem like the angry Vice President
of Communications for Science, Incorporated, whose office issues angry memos denouncing the insubordinate “screechy monkeys” who insist on deviating from the approved language when discussing Science, inc.’s Mission Statement. The fact that science is a conversation among people rather than a corporation probably explains why so much of the response has been not “Oh, crap, we’d better behave ourselves or we’ll get in trouble” but “Who the heck are you, and why are you telling me what I can say and how I can say it?” And that, I think, is all that needs to be said. (Anyone who stumbles upon my little blog and disagrees is welcome to say so in the comments.)

Book: The Cluetrain ManifestoActually, it’s probably more than needs to be said, and I wouldn’t have even mentioned it except that the problem of trying to apply this sort of approved “Command and Control” approach towards information in the Internet age reminded me of something else. The Cluetrain Manifesto was published so long ago that AOL was still considered a successful and valuable operation at the time, but it still seems to be relevant. (It’s free to read online – follow the link if you want to do so). At its core, its central thesis seems to be that the “Command and Control” approach to information management favored by corporate and political entities is effectively broken now because of the two-way communication made possible by a ubiquitous internet. In essence, “the market” is no longer made of isolated individuals passively sitting on the couch “consuming” the approved messages coming through the television, but a “conversation” of people who can easily tell the difference between a corporate “message” and authentic human conversation. Here’s a relevant passage:

“Imagine for a moment: millions of people sitting in their shuttered homes at night, bathed in that ghostly blue television aura. They’re passive, yeah, but more than that: they’re isolated from each other.

Now imagine another magic wire strung from house to house, hooking all these poor bastards up. They’re still watching the same old crap. Then, during the touching love scene, some joker lobs an off-color aside — and everybody hears it. Whoa! What was that? People are rolling on the floor laughing. And it begins to happen so often, it gets abbreviated: ROTFL. The audience is suddenly connected to itself.

What was once The Show, the hypnotic focus and tee-vee advertising carrier wave, becomes in the context of the Internet a sort of reverse new-media McGuffin — an excuse to get together rather than an excuse not to. Think of Joel and the ‘bots on Mystery Science Theater 3000. The point is not to watch the film, but to outdo each other making fun of it.”

Twitter logoAnd now we take one more step towards on-topicness: One current set of the metaphorical wires described in that passage is Twitter. Twitter is kind of like a gigantic lobby at a convention center where some huge conference is going on. The lobby is filled with little groups of people, collectively discussing with each other all kinds of little thoughts, observations, and events that each person there has encountered. You can easily wander through the lobby for hours, listening for snippets of conversation that relate to your own interests. Sure, being a raw, natural, human group of discussions, Sturgeon’s Law (“90% of Everything is Crap”) is in full effect. Sometimes literally: On Twitter I’m tracking the term “brewing” which seems to pick up more metaphorical uses of the word than literal, and a recent “Tweet” that popped up was somebody commenting that someone didn’t flush the toilet (“someone’s been brewing up a 1.6 gallon pot of turd stew.”)

So why bother? Because I think the remaining 10% has enough potential value to make a little mental effort to sift through the stream of messages worthwhile. I’d say a majority of the messages that come through are related to events happening at that moment. Twitter seems to get a lot of use as a back-channel for commenting on things that are happening, and for organizing impromptu gatherings. In most of these cases I think location information would be a valuable addition…and now I’m finally back to “on-topic”.

I think it’d be exceedingly nifty to be able to map Twitter messages in real-time. If I can convince anyone else that my “geostrings” idea is worth using, and then if one were to track “geostr”, any “tweet” with parseable location information would automatically show up. A small tag containing precise location information would make it possible for your computer automatically alert you if a post was describing something anywhere near where you are. Imagine the case of posts like “I just saw a tornado touch down, I’m going down to the basement now”. Or, say, “Who wants to try the homebrew I’m about to bottle?”

Example code in Javascript and PHP for picking out and parsing geostrings to follow soon. I’ll get back to yeast again shortly thereafter, though.