peteg's blog - noise - blogging now at HCoop.

/noise/blogging | Link

After comprehensively wasting André's server (thanks André!), leading to a downtime of about three weeks (and counting), I decided to move to HCoop. Apart from opening me up to the U.S. legal system [*], it seems like a nice arrangement for hackers with small budgets and low-bandwidth (popularity) websites.

I have also ditched the comment system as no-one ever used it for anything like what it's meant for. Just email me. There's a link on the right sidebar. Use it.

[*] I'm not altogether sure this makes any difference though; through Australia's multifarious agreements with the U.S. I would probably be open to litigation no matter where it was hosted.

img update.

/noise/blogging/img | Link

A massive port of some of my old PLog entries led me to update the img plugin. Now it does some fancier CSS stuff. Enjoy.

CSS brokenness: The CSS gunk from some W3 style examples which works fine... if you don't mind your images flush left or right. Why is there no simple way to centre arbitrary objects?


/noise/blogging/writeback | Link

I got a few doses of blog clap, and being bored and idle I put some effort into tidying up Blosxom's venerable writeback plugin and adding Captcha support. (I don't believe in the centralised blacklisting epitomised by akismet, it's too readily abused.) I get the impression that somebody in ee land is manually spamming, so I might need a plan B. My other concern is that the Captcha times out, meaning that if you take longer than a day to go from page load to post-comment it will bugger you up. Also the interaction with the back button is less than ideal.

You'll need to instruct CPAN to install Authen::Captcha (or use your package manager to do it for you, or remove those bits of code). It should be easy to adapt it to use another Captcha library. I'm thinking about constructing a logic-puzzle one.

Part way through I realised just how fragile Blosxom is (no non-word characters in directory names? — and I was going to call this writeback++!) and how badly coded most plugins are (let's do everything ourselves! date functions, interpolation, file-backed databases, ...). If my perl was more fluent I'd have a shot at linting it all.

Hacking the RSS feed into shape.

/noise/blogging | Link

Blosxom's stitch-the-template-and-content-together code is pretty nasty. Well, it's simple up to the point when one tries to use a fancy interpolation (substitution) engine to, say, implement a schmick img tag. RSS's not-invented-here-edness purportedly disallows HTML in the feed, but in practice it appears that's fine provided all the tags are suitably HTML armoured, which was the hoop that Blosxom was dutifully leaping through. I just tweaked the main script so that some interpolation occurs before the escaping, and the same again and some more after. Voila, with ugliness comes images. Yes, this sort of thing makes one yearn for a mainstream blogging engine.

While I'm ranting I've gotta say perl's approach of making everything magical wears thin fast. I want predictability, and while I accept that API docs are written to be read I don't appreciate having to read perlsyn and perlop (and perlre) manpages while doing simple imperative programming. How about: small language, verdant libraries instead of here's fifteen ways to write an enumerator? The great ideas in the language and fantastic libraries are heavily obfuscated by noise, and I don't believe it's possible to write robust perl applications — aspect-oriented programming has nothing on this for spaghetti. Any sane person looking at the perlsec manpage must surely agree with me — tainting supposedly works provided one doesn't defeat it, by omission or commission. Mutter, mutter.

Is it just my Safari that struggles with RSS feeds? Those bugs have been there for years now.

Blosxom plugin: img

/noise/blogging/img | Link

(or: reinventing PLog, one piece at a time.)

I wanted to add images to the blog, and as I'm fed up with ImageMagick I was relieved to find that someone has written a more usable replacement for perl called Imager. You'll need to install that first, and it should be as easy as politely asking CPAN to do it for you. Also you'll need interpolate_fancy so you can invoke the method in your stories. Here's the code:

The instructions are in the script. It's still quite rough, and I'll be updating it as I go along. Take a good look at your error logs if things don't work.

img file read error: Could not open /Users/peteg/Sites/static//IMG_1667.JPG: No such file or directory

The existing Blosxom image plugins are a lot fancier than this; I just wanted something that generates thumbnails and automatically adds the requisite attributes to the img tag. This photo is from my trip up to Berilee last month — if you squint you can see the car ferry at Berowra Waters. The markup is:

<@img.img src="IMG_1667.JPG"
 style="border-style: none; margin: 0 0 10px 10px; float: right; clear: right;" />

which, when run on my iBook, results in the XHTML:

<a href="http://localhost/~peteg/images/IMG_1667.JPG"><
 img src="http://localhost/~peteg/images/cache/tn_IMG_1667.JPG"
 style="border-style: none; margin: 0 0 10px 10px; float: right; clear: right;"
 alt="" /><

I get the impression that the interpolate_fancy plugin doesn't like having newlines in the arguments.

...and yes, I am vaguely aware that those suckling on the RSS nipple are not getting the full technicolour experience. Bear with me.

Shifting to

/noise/blogging | Link

Finally got around to buying a domain: $AU33 for three years from the nondescript Website Domains registrar. So far, so unimaginatively kosher. I availed myself of the freebie DNS provided by EveryDNS; they're somewhat limited in the kind of records they'll serve up, but more importantly are apparently reputable.

At the moment I've got Apache running on Debian on my dear old P120 at home, so it's all terribly slow. I feared the 64kbits uplink would sour the deal but Blosxom blindsided me by taking several tens of seconds to render the index pages. perl, gotta love it.

DNS Report has proven useful for linting all that stuff.

Root canal work on Blosxom.

/noise/blogging | Link

I thought I'd try to tidy up a few things in Blosxom, such as the timestamps in comments, get the cookie memory-device going, that sort of thing. While the core and some plugins may be as-tidy-as-perl-can-be, the writeback (comments) one is pretty nasty.

I also tried to fix the formatting of the sidebar. Once again the lack of compositionality of HTML bit me on the arse: some things one can fix by twiddling some CSS in the flavour files, and others require a sift through the perl. To some extent it's a matter of code quality, but also there's the issue of what HTML objects are allowed with what combining forms. For example, the find plugin needs to return a form, so that'll be a div and not a span, thanks.

I guess my next trick will be some kind of functionalisation of my abbreviations plugin, so I can have some default text and also override it as needs be. Next Christmas, for sure.

The Joys of XHTML.

/noise/blogging | Link

The theme I pinched for Blosxom claimed to use an XHTML DTD, and so idly I thought I'd try to make it conform. Yep, a complete waste of time. I naively imagined that XHTML has twenty-first-century tech but in fact everyone's been ignoring it since 1999.

Both Safari and Mozilla seem to deal with it OK. I have no idea if any of this works in Internet Explorer, sorry.

There's a semi-usable packaging of the W3's validator available here. For dynamic content I use curl to grab the page then feed it through as a file. Not very convenient but the less lazy can script it.

I find it ironic that the motivation for XHTML in the Wikipedia article is to make things more anal, purportedly for an efficiency payoff. To my eye it's just XML buzzword compliance, an opportunity to clean up the semantics of the beast squandered on syntactic busy-work.

My pet peeve is that the layout rules are so damn complex when something as semantically simple as a bunch of markup combinators could fix this mess. This tradition in CS goes back at least as far as Henderson's 1982 paper on functional geometry and continues with Lava and pretty printing and many other works. Then, instead of spending an hour finding out that one should lay out a line right-to-left (perhaps, maybe, this week at least), I could just say "title beside search box" and get exactly that!

Heck, this would even be better than CSS: define a bunch of named objects and some way to lay them out explicitly. Completely separate content and presentation, perhaps even a "declarative" layout! Somehow the fundamental notion of compositionality has been MIA here.

Andy's On-line Self-Help Call-for-Help.

/noise/blogging | Link
The problem with a public blog is that is has to be interesting, or it languishes, as this one does, reader-less, apart from the odd Google misfire that sends people looking for the best seat in some Ticketek venue this way. At the end of the night it's hard not to verb the noun, not to non-sequitur. Others are voluble so that I may be taciturn. Andy, who apparently runs a plethora (or perhaps a cliché) of blogs, appears to be outsourcing the authorship of his self-help book.

Yes, I'm giving Blosxom a go.

/noise/blogging | Link

Venerable NTK had a link to Blosxom back in ... well, let's just say it was many years ago. I remember being horrified by such a masochistic use of perl and instead tried to do something nice in Haskell, a project which has become too time-consuming to maintain. The models are very similar, entry-per-file, but Blosxom uses the file change date to decide where it belongs in the index.

(That last point is resolved by the entries_index plugin that caches the date when the CGI script first sees the entry... necessarily stepping away from the pure filesystem-as-database model.)

I must admit I didn't think perl could be written this readably.

Somewhat annoyingly there are several conflicts in worldview between CSE and Blosxom, the main one being blosxom's view that plugins should not be in URL-able webspace, versus CSE's wisdom of forcing all CGI-accessible things to live in public_html land... but not to worry.

Somewhat surprisingly for such an ancient instance of the blogging program genre there's an active user group. The plugins are groovy and I'm sure they're as insecure as all get-out. How long will it take to get a healthy dose of the blog-clap?

Things to fix:

  • Archives, get rid of list bullets.
  • Categories font.
  • Get images working.
  • Trackback / comments.

Hacks for the shift.

/noise/blogging | Link

Showing how rusty my 37337 sh skills are, here's some things that help to migrate PLog entries to Blosxom:

  • Make PLog entries into Blosxom ones:
    for file in *; do mv $file $file.txt; done
  • ... but before that, get blosxom's idea of the date for an entry to match PLog's:
    for file in *; do echo $file |
       touch -t `sed -n "1s/\(....\).\(..\).\(..\)/\1\2\30000/p;"` $file;