CPAN v DTD (spoiler: CPAN loses)

June 1st, 2007

I need to parse a DTD. Specifically I need to parse this DTD:

http://www.w3.org/TR/html4/strict.dtd

It’s quite a well known one. Certainly there’ll be a module on CPAN that can parse it. Let’s have a look.

XML::DTD

Looks promising, comprehensive. Unfortunately it fails with an error which is eventually tracked to a misspelled method name. So much for test coverage. Fix that and it throws a bunch of warnings that cause a rapid loss of confidence. No matter, let’s try…

XML::DTDParser

It’s a “quick and dirty DTD parser”. Hmm. “I’m too lazy to document
the structure”. Nice.

“Since version 1.6 this module supports my “extensions” to DTDs. If the DTD contains a comment in form…”

Maybe I’ll come back to XML::DTDParser…

SGML::DTDParse

SGML? That’s got to be good, right? SGML is the daddy. Every fule no that. Unfortunately it doesn’t really seem to have much of a Perl interface. It’s all about translating DTDs to XML. I might be able to use that. I’m getting desperate.

I’ll take a quick look at the test suite for a confidence boost. Here’s one:

    # Before `make install' is performed this script should be
    # `make test'. After `make install' it should work as `perl

    #########################                                  

    # change 'tests => 1' to 'tests => last_test_to_print';    

    use Test::More tests => 1;
    BEGIN { use_ok('SGML::DTDParse') };                        

    #########################                                  

    # Insert your test code below, the Test::More module is use
    # its man page ( perldoc Test::More ) for help writing this

(I’ve cut the right hand side of the test off so it fits my stupid page layout. Don’t worry - you’re not missing anything good)

The other test is pretty similar. I’m not that confident now.

XML::ParseDTD

Running out of options. Let’s look at XML::ParseDTD. From the documentation it appears to rock. The test results say “2 PASS, 2 FAIL”. 50/50. So at least it’s got some tests, right? Damn right! Here they are in their entirety:

    #!/usr/bin/env perl -w

    use strict;
    use Test::Simple tests => 2;
    use XML::ParseDTD;

    my $dtd = new XML::ParseDTD('http://www.w3.org/TR/xhtml1/D
    ok( defined $dtd, 'new() returned something' );
    ok( $dtd->isa('XML::ParseDTD'), 'it\'s the right class' );

(Again I’ve cut the right hand side of the test off. Again you’re not missing anything good)

I’m momentarily impressed that it managed to score two failures with that. I’m about to find out how.

Never mind, the DTD URI in the test looks a lot like the DTD I need to parse. I’m getting close. I can feel it.

Unfortunately it has a dependency on Cache::SharedMemoryCache (why?) which in turn depends on IPC::ShareLite - which doesn’t install on my PowerBook. So now I need to fix / avoid IPC::ShareLite.

See kids: the great thing about CPAN is how much time it saves!

iTunes 9006 error?

June 1st, 2007

Is anyone else experiencing stalled iTunes Pro downloads? I’ve got a bunch of files stuck in the download queue. Every time I reschedule them - either pause / un-pause or restart iTunes - it tries for a few minutes to download them and then fails with a 9006 error.

iTunes 9006 errors

iTunes Plus

May 30th, 2007

iTunes 7.2 is out. iTunes Plus (DRM free downloads) is available. So I’ve made a purchase: Placebo: Covers.

Wow, it’s easy isn’t it? So nice to be able to enjoy the integrated iTunes experience without worrying about infesting my computer with DRM crippled media.

As Kirk McElhearn points out the files do contain identifying information that can be traced (trivially) back to you. That’s fine by me.

Captcha::reCAPTCHA

May 28th, 2007

I’ve just released a Perl interface to reCAPTCHA. You should be able to find it here:

http://search.cpan.org/dist/Captcha-reCAPTCHA

At the time of writing the US mirror of search.cpan.org doesn’t seem to have updated for a few days so if you need it in a hurry you can also get it here:

http://cpan.hexten.net/modules/by-authors/id/A/AN/ANDYA/

reCAPTCHA

Citizen Journalism

May 25th, 2007

I’d like to make it possible for local people to set up blog space on the Nenthead community site. They’d post local news stories and interesting ones would be promoted to a unified news front page. Kind of like Advogato but for non-geeks.

Is anyone doing this kind of community focused citizen journalism? I see Wikinews but that’s more top down than what I have in mind.

Drugs house shut after complaints

May 24th, 2007

Drug House

Blimey, the complaints must have been annoying if they had to resort to drugs.

HEDFUK

May 17th, 2007

Magic:

IKEA

By Christian Heilmann via Tobie Langel.

Bastard Linux Patent FUD

May 16th, 2007

And then this:

“The point of the study was actually to eliminate the FUD about Linux’s alleged legal problems by attaching a quantifiable measure versus the speculation,” he said. “And the number we found, to anyone familiar with this issue, is so average as to be boring; almost any piece of software potentially infringes at least that many patents.”

Who said that? Dan Ravicher of OSRM - also known as the guy who wrote the report Balmer is quoting.

Via The Inquirer

Update: This dates from November 2004 (eWeek). As far as I know Ballmer’s still quoting the same report.

Robber Barons

May 14th, 2007

James Turner is pissed off about Microsoft’s patent sabre rattling - as we all should be.

At the end, there’s only one thing left to say. For shame Microsoft, for shame. You’ve twisted competition into a thuggish debacle that ranks right up there with the worst of the great robber barons. How ironic that Bill Gates is trying to reinvent himself as the great philanthropist. Andrew Carnegie took much the same route late in his life, as if it could wash away his sins. We can only hope that in a few years, Steve Ballmer will look as much a fool as Daryl McBride does today.

More here.

Death Threat

May 8th, 2007

This is fun: an assassination threat and - presumably - extortion attempt. It appears to have been sent from the web server of a reputable company using PHP mail header injection.

Date: Mon, 7 May 2007 23:49:26 -0700
To: andy@hexten.net
Subject:

Hello,

I wish to let you know that i have been paid by a client
to assasinate you at convenience,and i have signed a
contract of $650,000 yesterday for this.I have never met
you before,but they gave me the full description of your
identity and contact,together with your photograph which
my boys have used to trace you.

The reason why they want you Dead is not disclosed to me
as i was not allowed to know,but you are now not better
that the dead ok.

My BOYS are now contantly watching you,they are
following you- home,office,everywhere.....,you go and
they are waiting for my instruction to terminate you.And
they will strike at convenience.

THIS IS MY MESSAGE-

LISTEN VERY WELL !!!!,the Police cannot do much to help
you out in this right now because you are being
watched,any such attempt is very risky cause you will
push us to terminate your life without option. Your
calls are not safe also.In fact you are traced.

I have no business with you but at least i have cleared
the way as a pro- ,but you may have one chance to live
again if you can contact me not latter that 24 hours
after this mssage.

GOODLUCK!!!

Copyright Andy Armstrong, 2005. Entries (RSS) and Comments (RSS).