June 10, 2008

Braindump

Just offloading some things and ideas that have been rattling around.

  • CNN ran a story last week entitled, "Nine cool jobs that pay well." (Paying "well" is relative in their article, I guess.) Top of the list? Brewmaster ($42,430).
  • And good news if you want to take advantage of how cool it would be to be a brewmaster: Beer is recession proof.
  • Where are the open source MySpace/Facebook clones? Are there any? In particular, I'm wondering if there is an open source social networking application written in PHP. There didn't seem to be any last time I checked, so I was half thinking of writing one myself.

    ...not with the intent of competing with MyFaceSpaceBook or anything like that; for that matter, anyone can create a free social network on Ning. I was more thinking in terms of, what if I wanted to create a separate, private social network site that didn't rely on the Ning shared hosting paradigm? Or plop that software down on an intranet somewhere, behind a firewall? Any PHP apps out there I can just download and install for that?

    Hence my thinking on writing one. Mostly just because.
  • "Digital nostalgia." Not sure where I'm going with that yet, but it's sparked by William Gibson's comments about eBay in this interview.

Posted by jon at 11:51 PM


August 9, 2007

Housecleaning

My goodness, I've certainly been neglecting this site. Most of my blogging energy has focused on The Brew Site and Hack Bend, but I've also been neglecting other areas of this site—the projects page in particular needed cleaning up, and I needed to catch up on PHP code fixes for my HTML2Text class and Word Stemmer class that people had sent me over the past year or so.

So I spent some time yesterday doing just that. There's really not much to see if you're simply here for the blogging portion of the site, but in case you were here looking for my PHP code or were one of the people who were nice enough to email me fixes for the bugs, I've gotten that stuff updated (and thanks to the suggesters).

In the meantime I'll see what I can do about the writing portion of the site—ie, the blog. I certainly have no intention of retiring it but that's sure what appears to be happening... so no no, not gonna happen, I shall start making more effort to write regularly here again. And perhaps tweak the site design around a bit. I mean, it's only been...

...holy hell, it's been five years? How on earth did I let that anniversary pass by without comment or celebration or something? Back on April 22nd, this was...

Whoa.

Posted by jon at 11:45 PM


April 13, 2006

Bad PHP! Bad!

If you're familiar with web programming and AJAX and PHP, check out this item about Client-side PHP on The Daily WTF. Go ahead, take a look. I'll wait.

Done? Good. Now, if you're familiar with what's happening in that code, I'll wait while you convulse in horror. :)

Holy expletive, that code makes me angry and want to laugh at the same time. I'll just reiterate Deane's headline: Someone please fire the person who wrote that.

Posted by jon at 2:00 PM


February 8, 2006

What about a local PHP user group?

Last week I met with a local businessman who was interested in finding a local PHP expert/consultant for a project that he's expanding. He already has a long-distance PHP guy doing work for him, but also wanted someone local. This got me to thinking; aside from myself and a few isolated individuals, and Alpine, who are the PHP people for Central Oregon? Are there any PHP-specific shops or consultants who are available for this kind of thing? If not, why not? And how would anyone find out about them?

My next thought, invariably, was We need a local PHP user group for exactly this kind of thing. A local organization where any and all of the PHP programmers/users can get together, and perhaps build a directory of services and maybe even host events.

Would this be of interest to anyone? I'm actually pretty ignorant about the user group thing (it's probably been close to a decade since I've been anywhere near a user group type of function), so I may not actually know of which I speak. For instance, is there already a Central Oregon PHP user group that I'm totally unaware of?

I'd be interested in getting involved one way or another. What says the community-at-large?

Posted by jon at 1:13 PM


February 1, 2006

PHP contest: Texas Holdem

I thought this sounded interesting considering how popular poker is these days (you know who you are): PHP Editors is holding a PHP programming contest for a Texas Holdem game. I might try it out. It wouldn't be anything like most commercial poker sites out there, but it would be an interesting programming project.

...Not unlike being back in school, writing a program for whatever computer course I'd be in. Those were the days; they were still teaching Pascal at the time. I remember writing a Hangman game (it mostly sucked), and an algorithm for storing shuffling a deck of cards (which might have been a precursor for a poker program).

Of course, handling and "shuffling" a deck of cards that only exists in a computer program is trivial. You simply need to have a structure representing the cards, and draw them randomly. (And a method for keeping track of what's been drawn.) Each subsequent "shuffle" is simply a different random number set selecting the cards.

Posted by jon at 11:45 PM


November 2, 2005

I'm no longer cutting edge on PHP

I just realized this; I haven't used PHP 5 at all since it came out, so I'm terribly illiterate about this latest version of PHP. I still use PHP 4. That means I'm no longer cutting edge on PHP! Or maybe that just means I'm no longer bleeding edge, since PHP 5 adoption has been terribly slow.

Posted by jon at 11:39 PM


October 6, 2005

Ning

By now the geeky part of the blogosphere and, er, web-o-sphere has been rocked by the announcement of Ning two days ago. Check it out. Their one-line description reads "Ning is a free online service (or, as we like to call it, a Playground) for building and using social applications."

What this means is they're hosting a service/platform that allows people to build their own social software applications... things like online voting/polls, dating services, bookmarks, review sites. In theory the level of complexity in creating these ranges from point-and-click Clone-N-Theme all the way up to Advanced PHP Developer.

Yup, PHP. It looks like they're opening the doors to the system and letting you code the apps directly. "Uh-oh," I thought. "I hope they have PHP sandboxed." And sure enough, it says in the FAQ that they do. Sounds iffy to me (let's just say I'm glad I'm not responsible for running this service!), though I'll give them points for innovation and guts here.

Looks like they offer up an API for their developer environment, all running under PHP 5. And from what I've been seeing, they've assembled a team of some of the top PHP people out there to put this together, so that's impressive.

It's all very Web 2.0, especially with tags (and the annoying/clever convention of showing the relative popularity of various tags with different font sizes). I don't know, it looks interesting, and it'll be hot for awhile, but I gotta wonder just how valuable it is to have hundreds of crappy variations of "Which is cuter," most of which were created as throwaway examples and abandoned by idly curious people (like me)...

Posted by jon at 4:58 PM


June 15, 2005

BittyWiki

Just for grins, and to flex my PHP chops, I decided to write a simple wiki system. The catch, though, is to see how short I can make the actual program; I was inspired by this Shortest Wiki Contest, though I can't profess to be quite as fanatic as those guys (I prefer readable code—squishing it all into a minimal number of obfuscated lines just seems like cheating), I think I did pretty well so far. Read through if you're interested; it's pretty technical and I include the PHP source.

More...

Posted by jon at 12:29 AM


June 8, 2005

10 years of PHP

The PHP programming language is 10 years old today. A large part of what I do these days is PHP development—I've got it running web sites, parsing web server log files, running command-line batch processes, and more. Thanks to Rasmus and the PHP community for making it all possible!

For a good roundup of the 10 year coverage, go here and here.

Posted by jon at 11:36 AM


March 16, 2005

PHP on .NET

Jeff Sandquist has a pointer to a video interview with two programmers that are writing a PHP compiler for Microsoft's .NET Framework. The name of their project is Phalanger.

That's cool, I guess, if you don't mind working in .NET. I've been thinking for awhile that I wouldn't mind a PHP compiler that would create standalone executables (though cross-platform, not just tied to Windows), so this is kind of a step in that direction.

Of course, there's already PHP-GTK which is cross-platform. And hmmm, I notice in their February news, there's a pointer to a project called bcompiler which lets you create an exe file from a PHP-GTK app... very interesting.

Oops, and I notice the Roadsend PHP compiler does just what I was rhapsodizing about. It appears I'm behind the times. Though the "Professional" edition (compiles to Windows, Linux and FreeBSD) costs $399 ("Personal"—Windows only—is $89).

Posted by jon at 11:33 PM


February 3, 2005

php|tropics

A bit over a year ago I blogged about the PHP Cruise. Well, this year there's another PHP conference organized by the folks at php|architect, though it's not a cruise this time: php|tropics!

It's in Cancun, Mexico, from May 11 through 15. Now, if I only had a few grand lying around and could convince work that it's a business trip...

Posted by jon at 11:21 PM


December 28, 2004

PHP Suggest

Over on php.net, they announced a full implementation of a search field suggestion box:

The function list suggestions we started to test a year ago seemed to be working better as some bugs were found and fixed, so it was time to make the result available on all php.net pages.

Whenever you type something into the search field, while having the function list search option selected, you will get a list of suggested functions starting with the letters you typed in. You can browse the list with the up/down keys, and you will be able to autocomplete the function name with the spacebar.

Couple things I find interesting about this. First, it predates Google Suggest by a year (prior art that everyone heralding Google Suggest seemed not to notice); did Google get the idea from the PHP site, or is this more common?

The second point is a bit more trivial, but I noticed when I was trying it out by typing in "date" that there are two additional PHP date functions that appeared in the list: date_sunrise() and date_sunset(). These are new to PHP 5. They take a timestamp, latitude, and longitude and return the respective time of day for sunrise or sunset. What's interesting is that they are remarkably similar to two functions I had written well before PHP 5 came out. ("Written" is subjective, more like "adapted," probably from a Java function somewhere.) However, from the looks of the manual, these new built-in functions only take a Unix timestamp, which limits the results to dates between 1970 and 2038, while my functions take any combination of month, day and year. The point? I just like to toot my own horn sometimes. :)

Posted by jon at 10:38 PM


October 8, 2004

PHP code rant

This is a mini-rant on PHP that can be safely avoided by non geek types.

This post over on PHP Everywhere caught my attention, vis-a-vis programming semantics and practice. Basically, inside a switch statement, someone placed the default block before the case blocks and was surprised when that default condition executed, and the "expected" case did not.

Some are calling this a bug; I do not. This is the exact behavior I expect switch and default to display, and I always place any default blocks last in the statement, because that makes the most sense semantically and logically. I expect this because that's how I learned it when learning C years ago; it's the way the switch construct works and why it's so fast.

Relevant snippage from the PHP manual:

The switch statement executes line by line (actually, statement by statement). In the beginning, no code is executed. Only when a case statement is found with a value that matches the value of the switch expression does PHP begin to execute the statements. PHP continues to execute the statements until the end of the switch block, or the first time it sees a break statement. If you don't write a break statement at the end of a case's statement list, PHP will go on executing the statements of the following case....

A special case is the default case. This case matches anything that wasn't matched by the other cases, and should be the last case statement.

Seems pretty clear to me. I would expect PHP to immediately execute the default block as soon as it encounters it, even if this "cuts off" remaining case blocks below it. So quit complaining and write cleaner code.

Okay, done ranting.

Posted by jon at 4:37 PM


June 30, 2004

Friendster goes PHP

An item I saw yesterday but forgot to blog about: Friendster goes PHP. Pretty cool.

Finally on Friday we launched a platform rearchitecture based on loose-coupling, web standards, and a move from JSP (via Tomcat) to PHP. The website doesn't look much different, but hopefully we can now stop being a byword for unacceptably poky site performance.

I haven't had much of a chance yet to use Friendster to see if it truly is faster, so I can't personally comment on that aspect. And predictably, this is going to bring all sorts of people out of the woodwork arguing over the relative merits of Java/JSP (which was old Friendster) versus PHP... just look at the comments on the link above to see it already happening. And while debate and disagreement can be healthy and productive, how about a quick reality check to everyone:

PHP is good. Java is good. Both have their merits and disadvantages. Loudly complaining that [Java|PHP] is the only true way and the other is crap is boring and uninformed.

Posted by jon at 11:41 AM


March 16, 2004

PHP Development Hint

Here's a general hint for PHP development: A quick and easy way to check for syntax or compile errors without uploading the PHP script to the Web server and testing online through a browser is via the command line. It's obvious, and I don't know why I didn't think of this sooner, but I've been doing more and more of it lately.

I develop primarily under Windows (with PHP installed) and upload to a Unix-variant server, and this what I've been doing to run a PHP script on the command line on my Windows system:

php-cli -l filename.php

You could omit the -l option (it's a syntax check option only) to parse and run the code, if you like. Either way, it's an easy way to check your code without uploading it and potentially breaking your site.

Posted by jon at 3:35 PM


March 4, 2004

Rasmus is the Man

... Rasmus Lerdorf, that is, the creator and godfather of PHP. He's got an article on the Oracle Technology Network titled "Do You PHP?" that's definitely worth a read. Here's a sample:

What it all boils down to is that PHP was never meant to win any beauty contests. It wasn't designed to introduce any new revolutionary programming paradigms. It was designed to solve a single problem: the Web problem. That problem can get quite ugly, and sometimes you need an ugly tool to solve your ugly problem. Although a pretty tool may, in fact, be able to solve the problem as well, chances are that an ugly PHP solution can be implemented much quicker and with many fewer resources. That generally sums up PHP's stubborn function-over-form approach throughout the years....

Despite what the future may hold for PHP, one thing will remain constant. We will continue to fight the complexity to which so many people seem to be addicted. The most complex solution is rarely the right one. Our single-minded direct approach to solving the Web problem is what has set PHP apart from the start, and while other solutions around us seem to get bigger and more complex, we are striving to simplify and streamline PHP and its approach to solving the Web problem.

The guy just oozes common sense. Here's another bit about PHP that he wrote on the PHP-DEV mailing list about two years ago, one of my favorites that just sums up beautifully the philosophy of PHP:

The golden rules of PHP are to keep the WTF(*) factor low and the POTFP(**) factor high.

(*) What The Fuck
(**) Piss Off The Fewest People

No two ways about it: he's one of my heroes.

Posted by jon at 12:01 AM


March 1, 2004

Advanced PHP Programming

The book Advanced PHP Programming is out, by George Schlossnagle. Looks like it might be pretty interesting; there's certainly a scarcity of good PHP books that cover advanced topics—most of them are targeted at the beginner and the basics, and don't have anything to offer me.

(Quick disclaimer: some of the Wrox books actually look like they might be decent, but I haven't had my hands on a Wrox PHP book since the first couple they published.)

There was a time when I wanted to write a PHP book. It was going to be an advanced book, called "PHP Secrets" and cover all sorts of topics. I never really pursued it, though, largely because of a general disillusionment in the computer book industry: you spend a year or more writing a book on a subject, and by the time it gets published it's obsolete.

Thinking about it now, though, maybe a better venue for such a thing would be online, like what Mark Pilgrim did with his Dive Into Python book. That might be kind of cool; a live work-in-progress that I could (theoretically) keep up-to-date. Hmmm.

Posted by jon at 11:49 PM


February 23, 2004

CMS Ranting

Gadgetopia has a good rant on content management that I'm just getting around to posting about. (CMS's Should Manage Content, Not Display It)

My solution was to write a function library to make raw database calls to get everything out in a nice, big, nested PHP array. I essentially built an API for the CMS to make pulling content easy, but I do all the HTML processing in PHP, abandoning completely the display side of this CMS. I still use it for administration, workflow, etc. (which it excels at), but when PHP is such a fantastic, mature language, why reinvent the wheel?

I really don't have anything to add to this, other than that this is largely why I favor developing my own PHP software rather than using pre-built systems—I have absolute control over the way the software works and I don't have to rely on clunky, awkward front-end architecture and programming that I disagree with. Give me the data, and let me decide what to do with it.

Posted by jon at 10:42 PM