I am so screwed… I ran the portupgrade utility on one of our FreeBSD servers at work. This was a production system that we used for printing certificates for our students, preparing address labels for USPS shipments, and several other small (but crucial!) database applications. When I realized that the upgrade had roached all these business-critical apps, I tried to restore the system and found that my backups weren’t usable. ARRRRGH! From now on, I’m going to verify my backups by generating a “table of contents” from the backup media after the backup is complete.
for ($i=1; $i<=100; $i++) {
print "$i. I will *never* run portupgrade(1) again without making sure I have a *known good* backup!\n";
}
While working on an earlier post, I needed to find a way to display a PHP module on a web page without having it executed. I knew this was fairly simple and involved the .phps file extension, but I hadn’t done it before. A quick search of the PHP site pointed me to the highlight_file function. About halfway down the page there is a blurb about the MIME type that I needed. It turns out that my web hosting service already has this enabled, so all I needed to do was get a .phps extension on my file. I did it the easy way, with a softlink:
ln -s myfile.php myfile.phps
For those who don’t know Unix, this effectively creates another name for the same file, which is exactly what I want. This leaves the original .php alone, so that it can be run by the web server. But is also allows me to post the code on the web, using the .phps “file” which the web server will display instead of executing. The elegance of this solution is that if/when I modify the original code, I won’t have to make any changes to the displayable code because there is really only one file (with two distinct names).
Joseph found a bunch of handy reference sheets on Dave Child’s blog, I love Jack Daniels.
The most useful (for WordPress developers, anyway) will probably be the PHP and CSS pages. Dave has also provided web-safe colors, mod_rewrite, and MySQL reference sheets. Thanks, Dave!
I stumbled across this post from almost exactly one year ago. Joseph, I salute your effort, and the fact that you made this work is very cool, but I think this approach (relatively low-level network programming) may be the wrong track to pursue. I think a more appropriate method would be network API’s for new or existing applications, or at least higher-level libraries.
Network overhead is obviously vastly more “expensive” than local function calls, so you should probably reserve network functions for heavyweight applications. You mentioned databases–I think this is actually a good use of network programming! I have in mind something like the USPS’s ZIP code lookup. There is obviously a database backend on this web app. Granted, one cannot make arbitrary database queries (nor inserts, updates, deletes), but it does serve up the data quickly and competently. The database sits on the same machine (or topologically “close”) to the API server. Google is another example, and smarter people than I will come up with many more already-existing web services with DB backends. I think this is where Internet programming can really shine!