Bot::BasicBot 0.5
01 December 2004
in blog
tagged with
[irc]
[perl]
[release]
Bot::BasicBot 0.50 is released. The big thing in this one is nick tracking - the bot will keep track of what nicks are in a given channel, and if they’re opped or not - this is mostly so I can re-write slavorg on top of Bot::BasicBot, and bin slavorg2…
flickr
07 December 2004
in blog
tagged with
[flickr]
[photos]
flickr is annoyingly slick. I messed around for a few hours trying to learn enough php to parse the RSS feed or use their API or something to get a list of recent photos on the page here, then I realised that there’s a page that just does all the work for you. You need to mess with javascript, but I can cope with that. Don’t I look silly now?
Also, I can get (atom? rssd+? Who cares?) feeds of anyone’s photostream, I can upload from my mobile via email from anywhere (leading to silly photos), I can just link to anything without having to explicitly share it… As has been said to me, these aren’t necessarily very clever features from a technical point of view, but it’s all about the workflow, innit? It’s so easy to use.
safari and password fields
09 December 2004
in blog
tagged with
[browser]
[macos]
[unicode]
Today I discovered that safari ‘magically’ downgrades latin-1 input in form password fields to their nearest ascii equivalents - typing ‘pásswörd’ into a password box actually submits ‘password’. But you can cut and paste non-ascii in and it works fine. I’m very confused.
Class::Persist 0.30
10 December 2004
in blog
tagged with
[perl]
[release]
I’ve done something I’ve wanted to do for ages - get another release of Class::Persist out. This one I consider massively improved over the last one - it’s dropped some of the nastier dependancies, doesn’t require it’s own magic database tables to be created, can properly put objects into more than one database, and, my personal favourite new feature, all objects are maintained properly as ‘singletons’ - you can only have one copy of any given object around at any one time.
The release should be here: Class::Persist 0.30.
London Perl Workshop talk
11 December 2004
in blog
tagged with
[cocoa]
[perl]
I gave a talk today at the London Perl Workshop, brilliantly organised by a shadowy cabal of mysterious figures. Every talk I saw was great, to the point that the inevitable clashes with other talks that I wanted to see were really annoying, but fortunately everything was filmed, so presumably there’ll be video of the talks I missed available at some point. Likewise, all the slides will be around at some point, but until then, my slides are here. Powerpoint, I’m afraid, it’s what the work laptop has, and 1.5 megs, because it’s full of pictures…
UTF8 Openguides
13 December 2004
in blog
tagged with
[perl]
[unicode]
[utf8]
[wiki]
I foolishly offered to make OpenGuides UTF-8 safe. Because I don’t do that enough at work, or something. Anyway, it’s going quite well - because I did all the grunt work in CGI::Wiki a while ago, it’s just a matter of finding all the inputs and outputs and making sure they’re encoded properly. So far, the page contents and names are utf-8 safe, along with the cookie preferences, so your username is good. The search stuff looks scary, and there are various broken plugins, etc, etc, so there’s still stuff to do. I should also do the hooks properly - CGI::Wiki should offer nice functions for this stuff.
Anyway, there’s a demo site here in case you feel like trying to break it. The patch against OG is here, out of my svn repository, of course.
Writing recursive closures
15 December 2004
in blog
tagged with
[perl]
I discovered the other day that you can do quite horrifying things with perl. A closure in perl is a nice concept - it’s a block that can reference things in the scope that it’s declared in, but that can be passed around and used in quite different scopes. For instance, suppose I wanted a function that, say, converted a string to utf8 bytes (yes, I’m obsessed with utf8). I can do this like this:
my $closure;
$closure = sub {
my $val = shift;
return Encode::encode("utf8", $val);
};
And call it later as:
print $closure->("héllo");
This is dead nifty. But because a closure can reference things in it’s scope, and $closure is in it’s scope, it can call itself, or at least, it can call the function pointed at by $closure. So we can make this function recursive:
$closure = sub {
my $val = shift;
if (ref $val eq "ARRAY") {
return [ map { $closure->($_) } @$val ];
} elsif (ref $val eq "HASH") {
return { map { $_ => $closure->($_) } keys(%$val) };
} else {
return Encode::encode("utf8", $val);
}
};
Until the assignment is complete, the inside of the closure won’t work, because $closure is undefined. But by the time we call it later..
return $closure->( [ "héllo", { foo =>"bår" } ] );
..everything works.
Crazy, I tell you.
More UTF8 pain
15 December 2004
in blog
tagged with
[browser]
[unicode]
[utf8]
Does no-one in the world care about non-ASCII characters? It’s pathetic. I’m trying to make HTML form uploads work for files with non-ASCII characters in their names, and I’m hitting the stupidest problems.
The main bugbear is mozilla - you can’t upload files with wide characters in their names. At all. Piece of shit. Safari seems to be encoding the upload filenames with some made-up encoding that I can’t figure out, so that’s out of luck. At least safari sends the actual contents of the files.
The one browser I’ve tried that works flawlessly is Internet Explorer. Microsoft, at least, seem to care about the non-US market.