From the amusing PHP Manual Masterpieces, we have a function that combines my two favourite pastimes – date operations and using PHP!
int frenchtojd ( int $month , int $day , int $year )
Converts a date from the French Republican Calendar to a Julian Day Count. These routines only convert dates in years 1 through 14 (Gregorian dates 22 September 1792 through 22 September 1806). This more than covers the period when the calendar was in use.
I like the entry on
frenchtojd particularly because of the virtually glossed-over:
Notice, however, that the documentation does not say what happens if you pass in invalid data [..] I’d try to find out empirically, but my online PHP shell has actually disabled this function for vague “security reasons.”
He’s ranting about the core library, but practically takes it as read that random subsets of PHP may or may not be available on whatever hosting provider you happen to be using? Is this problem just minor background noise compared to everything else?
(Has anyone tried to make a sane (and necessarily slightly incompatible) fork of PHP that actually has a “parser” and a “grammar” and other incredibly advanced compsci concepts? Something that would let people write a subset of the language that would actually be understandable?)
On the bright side, maybe the rise of nginx will lead to the downfall of PHP. Right now it occupies a privileged position as the unofficial Apache scripting language, but using nginx you can only call PHP through fastcgi, where it has the same overhead as everything else, and has to compete on features.
Unread Count Tracking
I wrote up my unread count sparkline generator code. It watches my various online services and tracks how many unread items I have in each. For instance, you can see that today I suddenly got a lot of unread items in my RSS reader. I blame the Economist.
Having these graphs has had 2 interesting effects. Firstly, I’ve found it lots easier to keep my unread counts down. For instance, immediately after building it I realised I had far too many things in Instapaper, reminding me to actually read them.
The other effect it has had is that I’m slightly more inclined to read things just before I know the hourly monitoring script triggers. I know I’m being observed now. Maybe I want to deal with this email now, so the graph moves down a notch. I know this is silly and irrational. I assume it’ll fade once the novelty of the tracking has worn off. But I felt it was worth mentioning.
Finally, the 2lmc spool is live with the new improved php version of the code, as opposed to the mod-perl thing it was running on before. Not that I have anything against mod-perl, I use the thing professionally, but it does lead to somewhat large processes, and on the (very) shared box that the spool is hosted on, being able to get rid of it would be a benefit. Thus the successive deaths of Hayfever and the old Spool code. Soon it will be a bright, clean, apache2-driven future.
All I want, and I don’t feel that this is a lot, is to be able to put photos on my web page from iPhoto. Because writing iPhoto plugins is a pain, this requires me to use either Flickr, which I don’t want to (because I’d like to control my own photos, please, and not pay money for it), or php gallery, which has it’s own issues for me, mostly that it’s written in php.
As a perl (most of the time) programmer, I resent the fact that my web page is increasingly powered by php, but alas that’s where all these little toys come from nowadays. I’ve dabbled in php myself a little now, and it seems like a bearable language, although not one I’d actually want to write serious code in. Of course, with my colo going through.. pain recently, it’s tempting to restrict myself to a very simple subset of things, specifically, a subset of the stuff that the main box admin uses, because I know that it works and I don’t have to think about it. No more compiling weird perl/C modules on solaris as root with bizarre things tacked onto the end of my library path for me. The other colo has debian on it, which I like, but only 64 megs of memory, which I don’t. Hardware (even virtual hardware) sucks.
Of course, having got a gallery, I want to do things like have ‘5 most recent’ pictures on the front page of the site, and this is where things fall down a little. Noone else seems to want to do this stuff – I may end up subscribing to my own RSS feed, syndicating from one bit of my site to another, which seems disgustingly wasteful.