Skip to content

Home

Blog API and blogging tools

After reading George's solicitation, I decided to take a look around for win32 offline blogging apps. The two I looked at this morning (w.bloggar and SharpMT) didn't work with my old 'zlog, which is a bit annoying. From what I could see, w.bloggar uses methods not supported by s9y and SharpMT is broken (the correct responses were being sent, it just kept thinking that there was an HTTP violation).

Is there good, bloat-free (or at least, not over bloated) app for win32? Is there one for linux ?

Shoddy software

sacred_cover_gb.jpg.t ... and I'm not talking about my own this time.

I just sat down with Juliette to play a two-player game of Sacred, a game that I got a little while back, but never found the time to finish.

Sacred looks lovely and is a fun game, when it's not crashing out. It's one of the least stable games I've laid eyes upon (even with the latest patches) since I had the misfortune to install the first Star Trek: Armada game.

None of the above

I caught the tail end of the BBC news earlier tonight (I don't normally watch it) and one of the reports was concerning the "Presidential Debate". The report was rounded off with the news that "Kerry has been attending debating camp, learning to use shorter sentences" and that "Bush has been practicing staying up later than 9.30pm (his usual bedtime) in order to appear alert later in the evening".

Now, I couldn't help but laugh at this news, particularly when there is no clear leader in the polls. I'm, once again, reminded of the "Vote for None of the Above" campaign from the film Brewsters Millions. Brewster has to spend $30 million in the space of 30 days in order to qualify for his inheritance, and decides that one good way to get rid of the cash is to enter the presidential campaign. However, he isn't in it to win it, he is merely there to point out that none of the candidates is worth voting for, especially himself.

I Am Legend

I Am Legend

The other day I received a couple of goodies from my wishlist (thanks to David Costa) in return for fixing an SQLite bug. One of the items was I Am Legend.

If you are a fan of vampire stories, or even if you're not, this is an excellent short story (just shy of 160 pages of very readable type). It was so good that it only took me a few hours to read, and as I approached the end of the book I got the "oh no! the story is almost over" feeling that accompanies books of this calibre.

I thoroughly enjoyed the book. If you're not a vampire fan, don't be put off by the frightening cover artwork--the story is not particularly violent or explicit, making excellent use of mood and tension instead.

It's like 5 bucks, right?

Well, I'm finally back from php|works, feeling pretty good about how well the conference went for everyone, and pretty jet-lagged and travel tired.

If there is one thing I'll always remember from the conference, it will be the slur on Canadian currency value from the title of this post; it got a lot of mileage (all in good spirits though!).

The conference seemed to go very well; I didn't see (m)?any attendees playing truant, and that suggests the there was enough going on to satisfy them all. After hours there was plenty to do in and around Toronto (even if it meant going to Best Buy first) and that made a welcome change compared to the venues for some of the other conferences I have been to--they have a tendency to be somewhat isolated, and that can lead to a kind of cabin fever.

I was one of the unfortunate speakers to be harasmussed, but I didn't mind; it was kinda funny to see people walk in, hang around for a bit, and then sneak out carrying the vacant chairs from the room.

Thumbs up to Marco and php|a for another great conference! :-)

PDO semi-toy example

Here's a little script I just cooked up for my crontab. It watches the sites listed in the URLs array for changes in the "plain text"; when a change is detected, it outputs the URL.

Although the task is somewhat trivial, this script does a good job of demonstrating how convenient bound parameters can be. To make the update, I simply need to call $upd->execute(). No need to manipulate or massage the variables in the script, and no need to generate the SQL statement on each iteration.

<?php   
   $URLS = array(
      'http://www.nvidia.com/object/linux.html',
      'http://ipw2200.sourceforge.net/news.php',
   );
   if (!extension_loaded('pdo_sqlite')) {
      dl('pdo.so');
      dl('pdo_sqlite.so');
   }
   $db = new PDO('sqlite:' . getenv('HOME') . "/.web-watch.sql3");
   $db->query('create table hash(url primary key, hash)');
   $db->setAttribute(PDO_ATTR_ERRMODE, PDO_ERRMODE_EXCEPTION);
   $cached_hash = null;
   $stmt = $db->prepare('select hash from hash where url = :url');
   $stmt->bindParam(':url', $url);
   $stmt->bindColumn('hash', $cached_hash);
   $upd = $db->prepare('replace into hash (url, hash) values (:url, :hash)');
   $upd->bindParam(':url', $url);
   $upd->bindParam(':hash', $hash);
   foreach ($URLS as $url) {
      $body = file_get_contents($url);
      $hash = md5(strip_tags($body));
      $cached_hash = null;
      if ($stmt->execute()) {
         $stmt->fetch(PDO_FETCH_BOUND);
      }
      if ($cached_hash != $hash) {
         $upd->execute();
         echo "Changed web:\\n$url\\n";
      }
   }
?>

Gmail accounts up for grabs

I've got a few invites going spare; if you'd like to try it out, you (should!) know how to contact me.

Update: I'm back up to the full complement of 6 available invites again; seems like you can't give the damned things away.... please take them off my hands...

Update2: Another morning, another full complement of 6 invites...

Update3: still got the full complement. They're obviously not as sexy as they once were.

PHP 5 Extension Dependencies - we need your help

update (in response to a recent comment): this patch is already in the 5.1 tree; please test that instead; thanks!

[patch updated again: if you have a BSD-ish system that complained about "making too many open files", please try it again]

[patch updated: please try it again. Note that if you only have "mawk" you should install GNU awk instead, as mawk is broken]

I've created this patch to force extensions with dependencies on other extensions to be initialized in the correct order when they are compiled statically into the core of PHP.

It's known to work on Linux (and Tru64--thanks Magnus), but we'd really like to know if it works on other systems too--we don't have access to them, and we really want to get this into PHP 5.0 (due in July!).

So, please test it if you have SunOS, Solaris, BSD, HP UX, AIX, IRIX or any other "weird" unix systems.

Instructions:

Checkout PHP 5 (or download a snapshot from snaps.php.net)

Apply the patch:

   cd php5
   curl http://www.php.net/~wez/configure-deps.diff | patch -p0
   ./configure

Now look in main/internal_functions.c and/or main/internal_functions_cli.c

You should see something like this in the file. Each line corresponds to the extensions you enabled through configure; your list may be longer or shorter depending on how much stuff you compile into PHP.

   zend_module_entry *php_builtin_extensions[] = {
    phpext_libxml_ptr,
    phpext_xml_ptr,
    phpext_tokenizer_ptr,
    phpext_sysvshm_ptr,
    phpext_sysvsem_ptr,
    phpext_sysvmsg_ptr,
    phpext_standard_ptr,
    phpext_sqlite_ptr,
    phpext_simplexml_ptr,
    phpext_spl_ptr,
    phpext_session_ptr,
    phpext_posix_ptr,
    phpext_pcre_ptr,
    phpext_pcntl_ptr,
    phpext_gd_ptr,
    phpext_ftp_ptr,
    phpext_exif_ptr,
    phpext_ctype_ptr,
    phpext_calendar_ptr,
    phpext_bz2_ptr,
    phpext_bcmath_ptr,
    phpext_zlib_ptr,
};

If you see libxml before xml, it's worked. If you see repeated entries, it broke.

Please try building it now too.

If it all works, please either comment here, or send an email to internals@lists.php.net indicating which platform you used.

If it breaks while compiling main/internal_functions.c and/or main/internal_functions_cli.c, please let me know by email to wez@php.net.

Prefix the subject with [DEPS-PATCH], and include the name of your platform and the internal_functions.c file.

Thanks for helping to make PHP 5 better :-)

PDO Slides from php|works

You can find them here.

Update: I realized this morning that I didn't mention meta-data (as in column types and sizes) as one of the things on the horizon in the slides (nor in the talk; doh!).