phptidy

Long, long ago, Steve Hancock gave us PerlTidy, which allowed me to quickly and reliably convert raw Perl code into code that abided by all of my coding standards, whatever they might be for a particular project. This was much goodness.

I even have a vim macro that allows me to select a block of text, type a key sequence, and have that code reformatted so that it is more easily readable, evenly indented, and just prettier.

For many years, I've looked for a similar tool for PHP. I've seen references to something that Coogle did, but I can't actually find it, and it doesn't completely sound like what I'm looking for anyways.

Apparently the problem is that the intermixing of form and function (html and php) that happens in php code, makes this a more difficult problem than just parsing and reassembling source code. I naively think that there must be a simple way to treat HTML as comments and ignore it, but seeing as I have not the vaguest idea of how to go about this, it's kinda of condescending of me to make such claims. What do I know?

This morning I discovered that PerlTidy works, some of the time, to tidy up PHP code. And, of course, sometimes it doesn't, because part of what PerlTidy does is inspect the Perl code itself, in order to determine how to format things, and PHP code doesn't generally parse as valid Perl, except when it does.

When I was learning PHP, I observed repeatedly that it was almost exactly the same as Perl, in most respects, most of the time. This gained me many dirty looks from the "Perl is evil" PHP programmers I encountered, but, since language bigotry has never struck me as a survival strategy, I continue to maintain this belief. Indeed, this belief allowed me to uncover features of PHP that I don't frequently see used, and aren't very well documented, but I discovered blindly by assuming that PHP should behave the same as Perl if I need it to. And most of the time it does.

Ahem. Back to the point.

I find numerous postings on various blogs and mailing lists, where people are bemoaning the lack of a usable PHPTidy tool. I'm really curious why it's a hard problem. I don't understand what's involved in doing this, in the least, either in PHP or Perl, so I have no real notion of whether it is hard or not. What gives?

Conference TShirts

The great conference TShirt is one that, if you have to explain what it means to someone who wasn't there, takes 30 minutes, and leaves both of you feeling like it wasn't worth the effort.

My canonical example of this is the shirt from the first YAPC I attended. It proclaims:

YAPC 19100
Laziness, Impatience, Hubris
Pick Any Three

This has embedded in it at least 5 inside jokes/references. Or 6, depending on how you count.

Most conferences I go to try to make shirts that live up to this level of cleverness.

A good bar is like good software: Open
Trillions and Trillions Served

But I don't think folks often live up to the YAPC shirt.

I was thinking about this while doing laundry and I came across the "hAPI hAPI joy joy" shirt from the Yahoo booth at OSCon.

Perl stuff in svn

For many years, I worked on Perl date/time modules. Calendars - non-Gregorian ones, that is - held a great deal of fascination for me, and I wrote Perl modules for many of them. They're all on CPAN, along with assorted other stuff.

Then, due to a variety of factors, mostly involving Apache, I gradually lost interest in writing Perl calendar modules, and those modules languished. At the same time, the great Perl DateTime module project started (at least in part because of my work, but mostly due to Dave Rolsky) and most of my modules became obsolete, and replaced with the better implementations that came out of that project.

I just rediscovered all my Perl date/time modules in cvs, as I was moving all CVS stuff over to svn. here they are, if anyone cares.

There's some other stuff in there too, if anyone wants to poke around. If you want to submit patches, please feel free to do so. If you want to fork any of these projects and do something else with them, please feel free to do that, too, although I'd kinda like to know about it if they amount to anything useful.

Everything that you can get to in the public/ directory should be considered to be under ASL2 (Apache Software License version 2.0) unless explicitly stated otherwise.

Perl lightning talks

The Perl lightning talks have been a staple of the Perl Conference, and, later, the O'Reilly Open Source Convention, for as long as I've been attending it. And YAPC, too, although I haven't been to YAPC in many moons. They were somewhat different this year. Not hugely, but subtly.

MJD observed that, when he started them, the purpose was to get folks who would otherwise not give talks to give brief presentations in a low-stress environment. 5 minutes is enough to get a taste of public presenting, but not long enough to get too terribly intimidated.

Over the years, it became a bit of a sideshow, with elaborate presentations, complete with slides and sound effects. And of course MJD as the MC, complete with funny hat and gong. And so folks who wanted to give a five minute "here's what I'm working on" or "here's my cool idea" talk were overshadowed by the brilliant presentations by Audrey Tang and Andy Lester and the like. Also, talks lean towards the comic routine rather than the technical talk. Indeed, technical lightning talks tend to get heckled on IRC, and yawned through, waiting for the *real* lightning talks.

We started doing Lightning Talks at ApacheCon a few years back, and they have become part of our conference culture. We, too, tend to favor the entertainment talks rather than the technical talks. That's fine, in that it draws a crowd, and folks hear interesting ideas, and it's a great community event. But we need to remember what the initial purpose of lightning talks really is - to give folks a shot at the mic, if only for a few minutes.

Of course, I don't run the lightning talks, so feel free to ignore me. :-)

Delicious library on your website, sort of

I've hacked together a few dozen lines of Perl that transform your Delicious Library XML file to HTML pages. It is by no means complete, but if you care, then it will give you a starting point. It uses XML::Simple, which has prerequisites of XML::SAX and XML::NameSpaceSupport.

Put this in "/Users/username/Library/Application Support/Delicious Library", mkdir HTML, and then run it. It will generate files in that HTML directory, one called index.html, and then one per book.

Patches welcome. I'll be doing more useful things with it when I have more time to hack on it. Apparently I just spent 2 hours on this. Sheesh.

delicious2www.pl

HJTI license. Will eventually have templates, so that I don't have to listen to people complaining about how ugly my HTML is. It doesn't handle the case where you don't have cover images. And it currently only does books. No particular reason for that.

Example output

---------------------------------------

Update: Version 1.4 does movies and music, orders the output by title, and has at least a nod at documentation.

 1 2 Next →

About

Here dies another day during which I have had eyes, ears, hands and the great world round me; And with tomorrow begins another. Why am I allowed two? (Evening, by Chesterton)

User