php

HTML and regular expressions

I sort of dislike regular expressions. They're usually annoying to read and not infrequently incomprehensible without reading a book (or two) first. Still, they're useful.

I wanted to apply some regex magic to HTML content, to change words that are not part of the HTML markup. However, anecdotally, regular expressions don't play well with HTML. Still, I wasn't interested in the tags, only what is between them, so it struck me as a not impossible task.

BackUPS with Nagios

In order to rule out a crap power infrastructure as the cause for some naughty server behaviour on a client site, it was suggested I should stick a UPS on said server, to make sure that at least the input power would be clean.

In a confusion of Andys I found a recommendation for the APC BackUPS CS 500, so that is what I got and installed.

With apcupsd installed on Debian Etch, the UPS is immediately detected and it "just works".

scrapies

For some time now Yarra Trams have had a little form on their website that allows you to get the arrival times for the next three trams for a specific tram service at a specific stop.

Unfortunately their site renders extremely badly on Firefox 3 and they don't provide a documented API, so the only way to get this data is to scrape it by submitting the form on their site and parsing the results.

a spot of php tweaking

Well, as it turns out there is a ready-made fix to some of the horrid inser-input-filtering problems I - and probably any PHP coder - encounter.

This morning was the first time I saw Rasmus Lerdorf speak and, although his views on web security want me to give up coding in general and become a potato farmer more specifically, he did point out some tools to make it a lot harder for a macilious user to abuse any web app you write.