Blog Posts

Planet PHP

I recently had an email exchange with chregu of Planet PHP regarding Planet PHP's blog selection. I've been subscribing to its RSS feed for over a year now, but was uncertain how blogs were selected — was it based on popularity of the developer, projects the developer works on (for instance, PEAR), etc. I felt that it was time for this information to be made public; it helps inform the readership why they're reading what they're reading.

And my exchange with him resulted in his Planet PHP FAQ blog entry, which hopefully someday will become a static page on the site. Additionally, I found out how new blogs get added, and am proud to announce I'm now in the lineup!

(Of course, the timing could not really be worse, come to think of it. I'm moving my family in to town this weekend (from our house in the Green Mountains of Vermont), and I need to make arrangements for hosting weierophinney.net in the interim while we wait for phone and DSL service — which won't be up for at least another week :-( I'm sure I'll figure out something… stay tuned!)

Update: corrected link to Planet PHP FAQ.

Continue reading...

PEAR and DocBook documentation

Sean Coates has posted a rant and a blog entry regarding DocBook and the various proposals on PEAR related to using a wiki for package documentation.

A little background is probably in order. Many PEAR developers feel that DocBook is needlessly difficult and provides a barrier to writing good documentation for PEAR projects; this is actually the most often-cited reason for lack of documentation for a PEAR package. Many actually create wikis that they then link to in a minimal DocBook tutorial as "full documentation".

One proposed remedy is to create a PEAR wiki for each PEAR package. A scheduled process would then transform the wiki markup to DocBook, HTML, PDF, whatever.

What Sean rants about is simply this: wiki markup is meant to be simple, and much code documentation would require specialized wiki markup. Additionally, DocBook is already meant to do the transformations required; it is a structured language that is meant to be processed into a variety of output formats.

While I agree with Sean's ideas in essence, I still feel that DocBook is a real pain to work with. PhpDocumentor offers some real convenience when documenting code: doc blocks can contain HTML, some simple inline elements like {@link} — and they make documenting a snap. But I just fail to understand why, when providing tutorials, a switch to DocBook is necessary. Whenever I use it, I find that I have to retool a set of tutorials I have, or somebody else has, already written in order to get formatting correct, and that I have to switch my thinking altogether to accomodate a new set of rules and logic.

Yes, DocBook is simply XML with a documented schema. However, I've never enjoyed XML. I find it too pedantic, I don't like having to escape out CDATA sequences in order to render HTML (and code, and XML, etc.), I don't like having to learn new DTDs for every project, and more. I feel for configuration, unless you have nested elements, there's no reason to use XML whatsoever. And when it comes to documentation, why use anything other than HTML? Since HTML is a subset of SGML (as is XML), there's no reason it can't be transformed to other formats itself — and for the majority of PHP developers, HTML is a known, while XML/DocBook may or may not be.

Whether or not DocBook is hard can be debated from here to eternity. The fact of the matter is that it is perceived as being hard to learn, and thus many PEAR developers are simply choosing not to bother. Why not give them a tool they can use easily? Maybe then the amount and quality of documentation on PEAR will improve.

Continue reading...

Cgiapp 1.7.0 released

I'm getting ready to move in another week, and thought it was time to push a new release out the door… before life descends into utter chaos.

Cgiapp 1.7.0 adds a plugin architecture (which has been present in the perl version since last autumn). Plugins register with the class, and, once registered, their methods may be called from your Cgiapp-based class as if they were part of it through the magic of overloading. This allows for a standard library of utilities to be written — such as form validation (a sample class for this has been provided utilizing HTML_QuickForm), authentication, error logging, etc.

Additionally, I created a Cgiapp5 class that inherits from and extends Cgiapp. Along with it is a CgiappErrorException class that can handle PHP errors and rethrow them as exceptions. Combined, the two create some very elegant run mode error handling that simply isn't possible in PHP4.

Visit the Cgiapp website for more information on Cgiapp; if you want to try it, download it.

Continue reading...

php|Tropics recap

php|Tropics last week was excellent, and I'm not even sure where to begin for a recap. I started journaling while there, but found I simply did not have enough time (or bandwidth — my one complaint about the conference) to keep up.

The trip down was hellish. I'd lost my birth certificate, and was turned away at the ticket counter due to improper documentation. I was able to reschedule for several hours later, and had just enough time to go home, look futilely for my birth certificate, and then run down to the town clerk office in Bolton to get a certified and notarized letter proving my voter registration. Which got me on the plane, but I still ended up having to sign a notarized affidavit of citizenship before my final flight from Houston could take off.

The resort where the conference was held is called Moon Palace Resort, and is one of a string of five or more 'Palace' resorts on the Mexican Riviera below Cancun. The place is huge — there are two lobby areas, and each serves what looks like a couple thousand rooms. You can't help but get exercise while there, because there's simply so much ground to cover.

Marco Tabini gave the keynote, and kept it short and sweet. To my mind, he covered one primary point: the PHP job market sucks for pay. As he put it, why does an assembly line worker at Ford get paid $35/hour, while the average PHP developer is paid $15/hour? This is not to belittle the assembly line worker, but more to ask the question of whether or not a PHP developer is inherently less skilled. Marco feels that the way to boost PHP wages is to produce a standard educational corpus and licensing program — and educate employers as to why someone who has taken them deserves to be paid more. (I'm still not sure how I feel about his conclusions, but they're certainly food for thought — as I'm not being paid much more than the PHP average.)

Rob and I skipped out on the first two sessions. To our mind, we weren't as interested in them as other sessions, and we weren't going to have much free time while there. We put on the swim trunks and took a stroll through the pool. Yes, a stroll. I wish I could find a map that shows just how long and serpentine the pool there is; you can easily get a good workout just going for a stroll in the pool.

And strolling is thirsty business, so we strolled over to a swim-up bar. Now, one excellent thing about the location is that the resort is an "all-inclusive" resort — meaning that all food and drink is included in the price. So, we ordered margaritas, since it was noon where we live. They were okay, a little weak… and Rob noted that the bartender wasn't using anything off the top shelf. "What do you think we need to do to get him to use the Sauza?" asked Rob, to which I replied, "I think you just ask for it." So, next round, "Margaritas con Sauza, por favor."

And so it goes.

Strolling also included the beach, a wonderful expanse of white sand overlooking the azure water of the Caribbean. I spent a lot of time just sitting under coconut trees staring out over the sea; I can see how tempting it would be to retire on the Caribbean.

We started attending sessions that afternoon, and only missed one more over the course of the conference. I did get some excellent information from a number of sessions — but one thing in particular I got out of the conference as a whole is how far advanced is the setup Rob and I have put together at NGA. Our web cluster is almost as good as it gets without pouring money into commercial databases and support (though Ilia Alshanetsky's web acceleration session gave me a ton of information on tuning the relations between php, apache, and the OS); we've standardized on PEAR and are using it well; we're filtering data reasonably well (though we can always do better); etc. I often feel like I'm behind the curve when it comes to our technology, so the conference was a welcome boost to the ego.

On day 2, I ran into Paul Jones, with whom I've emailed once or twice, and on whose blog I've commented several times. We immediately started hanging out, and talking shop. Which began the other important aspect of the conference: the social networking.

In day-to-day practice, I really only get to talk code and program with one other person, Rob. This is fine, but it leads to a narrow exposure. Going to the conference gave me a chance to go over code and coding philosophy with a larger variety of people — my peer group, if you will. I got to see that, if you're not working for a large corporation, you do the same shit I do every day — programming, installing and tuning servers, help desk issues, everything; coding in PHP is only one aspect of your busy life. It was actually refreshing to see that I'm not alone.

A group of six of us got together that second evening, and ate out at one of the 'restaurants' (there are several eateries at the resort; not really restaurants, 'cause you don't have to pay, and they're all buffets) overlooking the Caribbean. As we were talking, we commented on how the networking amongst each other was probably the best part of the conference — and how it would be nice if the speakers would deign to join us.

Ask and ye shall receive. Later that evening, as we stood around the 'swing bar' (a little tiki bar with swings instead of bar stools, out on an island of the large, serpentine pool), we were gradually joined by speakers, including Marcus Boerger, Wez Furlong, Derick Rethans, and Lukas Smith. We had some great discussions that started devolving in indirect proportion to the amount we drank (well, not really devolving, but certainly migrating to other non-coding topics…)

Unfortunately, Rob and I had to cut out around 11:30, as we were taking the Zend Certification Exam at 8 the following morning. I quit drinking between 9:30 and 10… Rob had not, so he got to do the exam with a hangover. All in all, I found the exam less difficult than the study guide, but certainly full of tricks meant to foil you.

The final evening had a similar conclusion to the night before, only with even more participants, including Jason Sweat and Ilia. This time there were no exams to follow, and we stayed up until 1:30 (and later for some people).

Looking back, I see I wrote very little about the actual conference — which seems odd, as it was the central event. There were certainly some excellent presentations, and a lot of great material — much of it I have not been able to find elsewhere. Hopefully I'll find some time to blog about it in the coming weeks.

I didn't take many pictures, and I need to get a gallery going anyways. Rob, however, took a ton of pictures and put them up on his site each day. You can view them at his gallery; I'll put direct links to the individual galleries later.

So, if you get a chance, attend the next PHP conference you can possibly afford, and spend as much time as possible getting to know your fellow PHP code monkeys; the benefits are, to use an oft-used marketing phrase, priceless.

Continue reading...

HTML_QuickForm with Smarty Quickstart

I've been wanting to play with HTML_QuickForm for quite some time, but the documentation has looked rather sparse and scary regarding the use of HTML_QuickForm with Smarty. Since I've been busy at work, and I haven't wanted to take the time to learn a new library, I've simply been putting it off.

Last night, I browsed through the package documentation, and noticed a link to an HTML_QuickForm Getting Started Guide by Keith Edmunds. I was pleased to discover that he also has a guide to using Smarty with HTML_QuickForm. I got started with these tutorials, and found them excellent. I found myself wanting a little more meat afterwards, and found that I could now turn to the PEAR docs and actually make sense of it all.

While I think Mr. Edmunds tutorials are great for starters, I found that there were a few pointers I could have used right off the bat. I present them here for you.

Continue reading...

Cgiapp - 2 Releases

I've made two releases of Cgiapp this week, 1.6.2 and 1.6.3.

1.6.2 was tested in a PHP 4.3.4 environment, and features several bugfixes that give PHP4 compatibility. 1.6.3 fixes a change in load_tmpl() that broke backwards compatibility.

As usual, Cgiapp is available on the SourceForge website, as is a complete Changelog and documentation.

Continue reading...

Cgiapp Plugin Development

I've been working on the Cgiapp roadmap, and particularly on the plugin architecture. I'd been operating under the assumption that I'd have to make a PHP5-specific release (Cgiapp2) to allow this feature. However, it turns out I'm wrong.

Continue reading...

Cgiapp 1.6.1 released

A user noted in a comment to my blog on the 1.6.0 release that I'd included a public keyword in the s_param() method declaration… which caused compilation to fail in PHP4. So, quick on the heels of that release, I've released 1.6.1 to correct this issue. Downloads are available at the Cgiapp website.

Continue reading...

We're having a baby!

I can't believe I haven't announced this to the world yet, but Jen and I are expecting another baby! The due date is mid-September. And… we decided at the ultrasound this past week we would go ahead and find out the gender… and….

Continue reading...

Cgiapp 1.6.0 Released

Cgiapp 1.6.0, "Wart Removal", has been released!

This release does not add any new methods, but adds quite a lot in terms of functionality:

  • phpt tests. I finished writing a suite of unit tests using the phpt framework popularized by the PHP-QA project and PEAR. This process helped me find some obscure bugs in the class, as well as some… well, downright ugly code, and to fix these areas. (To be honest, most of the 'ugly' code was a result of being too literal when porting from perl and not using more standard PHP functionality.) Among the bugs fixed:
    • s_delete() now works properly. param() and s_param() now behave gracefully when given bad data (as do a number of other methods)
    • _send_headers() and the header_*() suite now function as documented.
    • All methods now react gracefully to bad input.
  • Error handling. carp() and croak() no longer echo directly to the output stream (and, in the case of croak(), die); they use trigger_error(). This will allow developers to use carp() and croak() as part of their regular arsenal of PHP errors — including allowing PHP error handling. Additionally, most croak() calls in the class were changed to carp() as they were not truly fatal errors.
  • PEAR packaging. Cgiapp can now be installed using PEAR's installer. Simply download the package and type pear install Cgiapp-1.6.0.tgz to get Cgiapp installed sitewide on your system!

As usual, Cgiapp is available at the Cgiapp website.

Continue reading...