P'unk Avenue Window

GTFS feeds: you can get there from here (and a free lunch)

June 30th, 2009 by Tom 1 Comment

As any Mainer will tell you, you can’t get there from here. And as any Heinlein fan will tell you, you there ain’t no such thing as a free lunch.

Much to the consternation of both, SEPTA has taken a bold step into the 21st century by not only signing on to Google Transit, but also releasing freely available GTFS (Google Transit Feed Specification) feeds of their transit data.

Free feeds for getting there from here… get it?

Anyway, as a fella who has dabbled in creating transit-related software in the past, I’m thrilled that doing so in the Philadelphia area won’t be an exercise in screen-scraping for too much longer, even though it worked out well for my own septime.org site as well as iSepta (neither of which are affiliated with SEPTA).

iSepta in particular should now be able to quickly move to the official feeds and add subway and trolley stops, since those are included in the new GTFS feeds.

SEPTA is also releasing a somewhat iSepta-like service of their own, to be called Next to Arrive. That service will include realtime information about the actual locations of trains, which is a step up from simply knowing where they are supposed to be.

SEPTA has not yet released feeds for bus routes, so septime will continue to screen-scrape for the time being. Although I expect I’ll soon get around to using the official GTFS feeds for regional rail, subway and trolley information. That way I’ll be ready to rock when the bus feeds arrive.

When SEPTA finally releases feeds for bus routes, it should be practical to plan a trip via Google Transit that involves both sides of the Ben Franklin Bridge… much like the lives of so many PhilaJerseyDelphians. Hoo rah.

Everyone who is encouraged by this news should take a moment to thank SEPTA for doing the right thing via their official comment form. I am assured that these are read by real live human beings, so be nice. And ask politely how soon bus data can be added to Google Transit and the public feeds.

Google Transit is a game-changing social tool because it makes transit accessible to people who don’t have time to make a second job of mastering the transit system in their new city. And it makes the planning of spontaneous trips to unfamiliar destinations practical even for those of us who do know the system well enough for our usual trips. This is especially important in a city like Philadelphia with six different modes of transit (*), counting SEPTA services alone.

GTFS feeds, incidentally, couldn’t be simpler. You might be expecting some sort of whizzy high-concept XML. Nope, it’s just a collection of CSV files any Excel power-user would know what to do with. There’s a .csv for the stops, a .csv for the routes, and so on and so forth. And they include GPS coordinates! Whee.

This is all very handsome stuff, but it makes me nostalgic for an analog transit trip planner I once encountered in a subway system many moons ago: every station had a little lightbulb next to its name. You pressed “from” and “to” buttons located next to the two stations you wished to travel between. Boom, the shortest path between them lit up.

The principle behind it? As simple as they come: electricity takes the path of least resistance.

Of course, that trip planner wouldn’t tell you what time to expect the train, or whether that particular train was even running on Tuesdays after 10pm. For that, I’d suggest Google Transit. Or if all else fails… a printed schedule [shudder].

(*) Regional rail, subway, trolley, El, bus and light rail.

How to add ON DELETE CASCADE to an existing MySQL table without dropping any existing data

May 27th, 2009 by Tom No Comments

You created a MySQL table with a foreign key reference… for instance, a user_id field that refers to a separate table of users.

Then you realized you should have specified “ON DELETE CASCADE” when creating the table. Now, when you try to delete a user, you can’t because objects in the other table are still referencing that user object. Ouch.

What to do, what to do!

Do this (substitute your table and column names, of course):

SHOW CREATE TABLE pk_context_cms_access;

Note the name of the foreign key constraint, which is usually automatically generated, and looks like this:

CONSTRAINT `pk_context_cms_access_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `sf_guard_user` (`id`)…

Now drop the foreign key constraint. Relax! You’re not dropping the column involved, so you’re not losing any data. You’re just giving up the integrity check that makes sure foreign IDs refer to stuff that really exists and prevents you from deleting records unless you have set ON DELETE CASCADE… which is probably why you are reading this. (This will temporarily relax referential integrity requirements. In English, that means you should probably temporarily disable the site while blasting through these steps, if it serves billyuns of people every micro-moment.)

alter table pk_context_cms_access drop foreign key pk_context_cms_access_ibfk_1;

Now add the foreign key constraint back again, this time with ON DELETE CASCADE:

alter table pk_context_cms_access add foreign key(user_id) references sf_guard_user(id) on delete cascade;

Boom. Check “show create table pk_context_cms_access” again to see that it worked:

CONSTRAINT `pk_context_cms_access_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `sf_guard_user` (`id`) ON DELETE CASCADE…

Now buy me a beer.

How to open Google Calendar (or any URL) on your Mac at scheduled times of day

May 14th, 2009 by Tom No Comments

We make heavy use of Google Calendar here at work. Unfortunately I rarely remember to look at it unless an alert has specifically been set up to get my attention.

This morning I set up my Mac to open Google Calendar in my web browser every day at 10:15am.

How do you do that? Turns out it’s not hard.

You can open a URL at the terminal command line—

“Whoa! Did you just say ‘terminal command line?’ I thought you said this wasn’t hard?”

Well, it isn’t! All you really need to know about the terminal application is this:

1. It’s not hard.
2. Go to the Finder, click “Applications” (at lower left), open up “Utilities” in the pane at right, and then double-click “Terminal.” Now you have a terminal window to type commands in.
3. After each terminal command, one generally presses the Enter (return) key. So if I say nothing to the contrary, assume you’re meant to do that after each command.

You can open a URL in your web browser from the terminal command line by typing a command like this. Just copy and paste your Google Calendar’s URL from the address bar:


open 'https://www.google.com/calendar/hosted/punkave.com/render?tab=mc'

(Note that if your URL actually contains the ' character you’ll need to escape it with a \ in front.)

OK, you’ve opened a web page from the command line. Now, how do you schedule that to happen every day?

Luckily the Mac, like any good Unix box, offers a utility called cron which does things for you at scheduled times. To set that up, all you have to do is edit your cron jobs with the crontab command…

But this part is a little bit of a PITA: by default, the crontab command opens your cron jobs file with vi, an old-school Unix text editor. I’m happy with it, but you don’t need to be. So I’m going to first walk you through how to switch things around so that crontab opens things in good old TextEdit.

I’ll also show you how to set up a convenient command you can use in the terminal window to edit any file with TextEdit from the command line.

We’ll start by editing your ~/.profile file. This file contains commands that the terminal window runs when you first start it up.

First, use the touch command to ensure the file exists. TextEdit doesn’t like being asked to edit files that don’t yet exist:


touch ~/.profile

Now try this command (hint: don’t suffer, copy and paste it into terminal):


/Applications/TextEdit.app/Contents/MacOS/TextEdit ~/.profile

Your .profile file is open in TextEdit. This file contains Unix shell commands that should be run every time a new shell window opens for you. At first it will probably be empty.

Add these lines at the end of the file (which might be empty to start):


# Use TextEdit for crontab and similar commands
# that want to use your default editor
export VISUAL=/Applications/TextEdit.app/Contents/MacOS/TextEdit
# Use TextEdit when you type: edit filename
alias edit='/Applications/TextEdit.app/Contents/MacOS/TextEdit'

The lines that begin with # are comments and the command shell will ignore them. I provide them so you can remember why you did this stuff later.

A word of warning: when launched this way, TextEdit tends to open behind the terminal window. You might have to apple-tab around a bit to find it.

Finally, close your terminal window and open a new one. This ensures that the commands in ~/.profile have been run. Alternatively you can use this command to run the commands in ~/.profile in your current terminal window:


source ~/.profile

Now we’re ready to edit your cron jobs… in TextEdit, not vi. At the terminal prompt, type:


crontab -e

And paste in this line (but substitute your Google Calendar URL of course, copied and pasted from your browser):


15 10 * * * open 'http://your.url.here/'

Then save your work and quit TextEdit. The crontab command can’t continue until you quit TextEdit.

Now the URL you’ve pasted in will open every day at 10:15am. If Firefox is your default browser, it will open in a new tab. I haven’t tried this with Safari as the default browser. Freel free to enlighten me as to how that works out.

What are those numbers and stars about? They represent minutes, hours, days of the month, months, and days of the week. We are only concerned with the first two: we want the job to run at 10:15am. If you want to run the job in the afternoon, be sure to use 24-hour time (for instance, set the second number to 13 for 1pm).

cron can do quite a bit more. If you want to know more about scheduling cron jobs, try this command:


man 5 crontab

Freedom Press

May 9th, 2009 by Rick 3 Comments

picture-7

Non-fiction writers love to incorporate snippets of French in their prose. These petits fours provide emphasis, adding cachet to otherwise dry sentences. They are often italicized to avoid confusion and help the reader with pronunciation. After all, their purpose is to create an inclusive fraternité between author and audience, not alienate and embarrass.

Editorial writing offers opinion supported by facts. It contains a certain bourgeois entitlement, a privilege not afforded to provençal journalism, technical writing, and other blasé publication. It is that haute entitlement that elevates writing to an international level. The French language accoutrements of which I’m speaking can be employed to conjure lavish images the Belle Époch or tempestuous ones from the subsequent Fin de siécle.

With the newspaper industry’s raison d’etre waning, perhaps editors are taking a more laissez-faire approach to pretension. Widening the aperture of journalistic creativity might be the saving grace of our Quatrième État. We must grant impunity to our newspapermen from stylistic judgement. We only stand to benefit from expanded proverbial exercise in the print oeuvre.

Latin might be the eternal language of scholarship, but French is the language of culture… c’est la vie.

You Will Be Visited By Three Ghosts

May 1st, 2009 by Rick 1 Comment

timemachine

The present is experienced through the senses, mostly realtime, with some delay/buffering. The past and the future are experienced nonlinearly in the mind, via memory and extension/projection. The computer doesn’t do much for the present. It, and our interaction with it, allows us to store memory—photos, diaries, videos, lectures, history texts—and make plans for the future—talk to friends, buy tickets, research vacations, find a new job. The present happens when we close the laptop.

As intelligence increased we (westerners) became more and more literate. That literacy extended humanity and translated to an increased proficiency in experiencing the nonlinear. To transport ourselves to far away places, to become abstract, to escape ourselves and the captivity of the present. It seems we have accomplished that goal and then some. Memory is being outsourced by the petabyte. Every scientist’s goal is to predict the future so that he or she can alter it.

I’m guilty of treating the present as a passthrough that occurs between here and there. It’s that blurry part of our peripheral vision to the left and right of the thing we’re pursuing. I eat too fast. I ride my bike breathlessly. Technology is not to blame, we have developed it in order to extend ourselves. There isn’t really even any need for blame. I’m just curious, with all of this extension and breadth, what emphasis have I placed on my depth? I’m jealous of professional athletes, not for the lifestyle, but their precognitive ability. To catch a pass you have to be so in the present you’re really in the future.

Live in the now!

Internet Explorer 6 to be ghetto-virtualized into oblivion

April 25th, 2009 by Tom No Comments

Microsoft will allow bass-ackwards XP-only applications, such as IE 6-only web apps, to run in emulation via Virtual PC as part of the regular Windows 7 desktop. That feature will apparently be standard in enterprise-class versions of Windows.

I appreciate that Microsoft has found a way to do what they have been unable to do for years: push a modern web browser onto the desktops of the most stubborn corporate and institutional clients. The people who make the lives of web designers pure hell by insisting on IE 6 compatibility because they once allowed someone to sell them a web application that can never, ever be upgraded to work with anything else. This is good. Frustrating as all hell, but good.

But Microsoft, if you do this the wrong way… where “the wrong way” is allowing admins to enforce a policy like “everybody gets virtualized IE6 all the time and may not have IE8 as their default browser…” then you’re going to hear the screaming, the wailing and the gnashing all over again.

Criticism, journalism: things are tough/awesome all over

April 24th, 2009 by Tom 2 Comments

I enjoyed last night’s Junto discussion on art criticism in Philadelphia but I’m puzzling over some fundamentals. The larger context went mostly unspoken.

All journalism everywhere is in deep sheep dip right now because print newspapers are dying.

At the same time, everybody’s a critic (ahem) thanks to the Interwebs.

Which means we have an overwhelming supply of armchair critique of everything— art, politics, sports, everything— but our supply of profoundly well-informed criticism is perhaps in danger.

But that last is far more an issue for politics (if you can’t afford to send stringers to Pakistan, your information is limited) than for art (there are people who choose to invest 20 hours a week in art, on their own dime).

Also, why is this discussion so centered on Philly? Who cares about locality? Okay, it’s an important color in the palette, but it’s not everything. And other media have already gotten the message that it doesn’t matter so much anymore.

Craft artists have moved en masse to Etsy. They can sell their work, they can get discovered. And criticism and commentary happen everywhere people care enough about the work. Geography is mostly irrelevant, except insofar as it informs the style of the work itself.

And I’m talking about craft artists who produce functional objects. The need to be in the same room with it before you buy it should be greater, not less, than the need to stand in a gallery with a painting. So why must fine art sales, and fine art criticism, be local? And dependent on the expense of galleries and print publication?

Local artist Katie Henry produces both sewn paintings and bags. To my knowledge her sewn paintings have sold only on a local basis, while it is completely impossible for her to keep a handmade bag in stock for more than eight seconds. But I suspect this is mostly because her paintings haven’t been listed on Etsy (hey, the lady’s busy enough as it is).

So why hasn’t fine art really arrived on Etsy yet? It could be as simple as a marketing decision on Etsy’s part. Perhaps a wise one. But that’s just an opportunity for someone else.

The Art Criticism Junto

April 16th, 2009 by Rick 3 Comments

The Art Criticism Junto

Thursday April 23, 2009

The discussion which will begin at 7pm. Food and drink at 6pm.

Please join us next Thursday, April 23rd at 6pm for the Junto. This month we will be discussing the past, present, and future of art criticism in Philadelphia. We are pleased to host an all-star panel representing the many sides of the art world.

Sid Sachs: Director of Rosenwald-Wolf Gallery, UArts faculty, author, curator, with a long history in the Philadelphia art world.

Roberta Fallon and Libby Rosof: the ever-present writers/critics responsible for the Philadelphia Art Blog. Roberta and Libby founded the Zero .1% for Art Commission to bridge the gap between ordinary people and art. Artblog, established in 2003, is an outgrowth of that mission.

Katie Murken: Philadelphia artist and educator. Since receiving her MFA in Printmaking & Book Arts from the University of the Arts Katie has been an instructor at the Tyler School of Art and practicing artist. In 2007, she worked with P’unk Avenue on the multimedia installation Debtor’s Inheritance at the Schuylkill Center. In 2008, she received an Independence Foundation Fellowship for the Public Author Project, a long-term interactive project that will use text messaging to explore the phenomenon of books and libraries in today’s digital climate. Katie is currently collaborating with three Philadelphia artists as part of the Little Berlin gallery’s upcoming exhibition Offerings.

Andrew Suggs: (from the Vox Populi website) “Recent exhibition venues include The Galleries at Moore (Philadelphia, PA), Fleisher-Ollman Gallery (Philadelphia, PA), ThreeWalls (Chicago, IL), Publico Gallery (Cincinnati, OH), The Carpenter Center for the Visual Arts (Cambridge, MA), and Vox Populi (Philadelphia, PA). Andrew currently lives and works in Philadephia, where he is the Executive Director of Vox Populi. He earned an AB cum laude from Harvard University.”

As always, we provide the cold Newcastle Brown and Philadelphia’s best tomato pie. You bring something to share, if it is not too much trouble.

Hope to see you there!

When:

Thursday April 23, 2009 at 6pm

The discussion which will begin at 7pm. Food and drink at 6pm.

Where:

P’unk Avenue
1168 E. Passyunk Avenue
Philadelphia, PA 19147

Sometimes, blogging is timeless

April 15th, 2009 by Tom No Comments

Sometimes Google doesn’t exactly rush pell-mell to index your blog. And when Google does index your blog, sometimes they don’t do it in a way that really helps your readers.

To my mind, blogs have two kinds of readers:

1. People who read it regularly, via RSS or similar
2. People who find individual articles via a search.

Category #1 isn’t really Google’s department. Fair enough.

Category #2, of course, is what Google Search is all about. Sure, 99% of queries are about “country matters” and every search engine has them down to a tee, but the queries you really care about are always in that 1% that’s obscure and weird and only mentioned in passing on one site ever. And Google’s capacity to actually find that stuff is the reason they took over the search world in the first place.

But for a while there, this really wasn’t working for the P’unk Avenue Window blog.

Searches like these (with the quotes, making them exact):

“Designing while intoxicated”
“svncampfire”

Were turning up other people linking to or talking about our articles, but they were not turning up the articles themselves. Results on our actual blog always turned out to be category pages or the home page… which, more often than not, didn’t feature that content anymore due to the addition of new blog posts.

This poses a problem because people don’t know they are interested in something like svncampfire until they need it.

I did quite a bit of research looking for an explanation for Google’s dislike of our individual article pages. I considered blaming our robots.txt file, the presence of dates in our article page URLs, and of course sunspots.

But in the process I finally got around to learning about Google Sitemaps. And more importantly, the Google Sitemap Generator plugin for WordPress, which is beautiful. There’s really no other word for it.

A sitemap is a simple file that spells out what pages are on your site and what their relative importance is. You can’t use it to increase your overall rank with Google, but you can use it to promote your individual articles at the expense of things that might otherwise seem more important to Google, like your category pages. Where before Google might only rarely bother to crawl back through your calendar archive links, now Google clearly understands that your posts are special and unique snowflakes that do not wither with age and should be taken equally seriously. And unless you’re giving out stock tips or weather reports, this is of the good.

The sitemap plugin will not only generate sitemaps for you, it will automatically update them whenever you post to your blog. Tweak the weightings using the handy control panel and you’re good to go.

There is, however, one catch that meant an extra week of waiting before Google finally caught on: the very first time you write a sitemap, you must submit it to Google manually via the Google Webmaster Tools. The plugin cheerfully informed me that it had already “submitted the sitemap to Google” without mentioning this little fact. So take care to follow through on that detail. You should be using the webmaster tools anyway!

The results are not perfect. Some searches that ought to bring up our individual articles still mysteriously bring up only category pages. And tweets consisting almost entirely of links to our articles (often using the hated URL shorteners, which Google doesn’t seem to translate) still often outrank the articles themselves. But hey, it’s progress. Most of the time we’re on the first page in appropriately narrow searches. It’s a big improvement, and I have a much warmer, fuzzier feeling about the usefulness of blogging on topics of lasting interest.

Why People [I Know] Photograph

April 13th, 2009 by Rick No Comments

I talked with Isaac Schell after his recent opening about the motivation and inspiration for his pictures. At first he frame photography as a compulsion. A way to get an image out of his head. He later conceded that Garry Winogrand got it right by saying, “I photograph to see what the world looks like in photographs.”

A picture I took, New York City

A picture I took, New York City

Photography is the invention of an impatient world. Insofar as It is a way to render a scene timeless, it varies little from the early functions of painting. However, the quickness with which photography can snapshot such a scene is where it has set itself apart. Photography is an enabler of faster-paced living. We augment and extend our memories by time shifting scenes. We can mediate a vacation through the lens, flatten an overwhelmingly deep scene, vignette a busy one, and most significantly grant ourselves a continuance to process and reprocess the witnessed event at later times. We mostly ignore the present, storing the past on SD cards, and fantasize about photographs we’d like to take in the future.

Beyond the documentary function of photography there are a number of post-structural functions, those that rely on the interpretation of the viewer. They fit nicely into three categories of design outlined by Donald Norman in his not so recent TED talk—the visceral, the behavioral, and the reflective.

The visceral function speaks to the content of a photograph. A pretty girl, a sunset, a landmark, violence, action, and so forth. These are the pictures in our albums and shoeboxes, gathering dust and yellowing as they attempt to preserve spent time.

The behavioral layer of a photograph contains its composition, the juxtaposition of objects, counterpoint, light and shadow, the mechanics of the scene. It is informed by and understood through the a knowledge of the operation of the camera/lens/film. These are the clever pictures we took in our first black and white photography class.

Lastly, the reflective function is that post-modern one, entirely reliant on the social context of a picture, entirely ignoring the visceral and behavioral. These pictures concern the backstory rather than the scene. They are new topographic photos of small town storefronts, street snapshots, Stephen Shore’s steak dinner, the mundane, photographs of nothing. They don’t have inherent meaning. The burden understanding their relevance falls entirely on the viewer, one with some knowledge of the history of photography and of the culture reflected by the mirror of these photographs.

When I take (I can’t bring myself to say “make a picture,” I’m just not that good at it) a picture I fixate on those functions of photography. I flex my eyes and brain too hard, it always seems to look like I tripped right before releasing the shutter. I end up a little too close, let some rogue element in the corner of the frame, or find perfectly dull flat light. By thinking about too many things, I accomplish very little in my picture-taking.

I get overly excited when I see that someone has unconsciously arranged their overflow recycling to look like a still-life—how quaint and lofty all at once, and Yes! it’s six PM with light hitting it at a wonderfully oblique angle. If I crouch just so, and take a step back, and stop down, and Click. Somehow I have managed to take nothing more and nothing less than a picture of garbage. It’s that other function of photography, the elusive and unteachable one, that contains a photograph’s aura.