reCAPTCHA becoming unusable – decent alternatives?

I use reCAPTCHA to help prevent spam comments. It used to be very good, and had the added bonus that it’s helping to digitise books at at same time, rather than wasting effort.

However, it seems to be giving worse and worse CAPTCHAs lately, providing words that are almost impossible to read, and often words that are clearly not even English.

For instance:

What’s that?

I don’t want to put off real visitors from leaving comments by making them decipher things that are too close to nonsense, so I think I’m going to have to replace reCAPTCHA with something more suitable. Suggestions welcome.

HTML::Table::FromDatabase 1.00 released with row_callbacks feature

I just released version 1.00 of HTML::Table::FromDatabase, with a new row_callbacks feature.

You could already declare callbacks on a cell-level basis, so you could say, format monetary values appropriately, round numeric columns, turn URLs into clickable links etc. Now, you can also declare a callback which receives an entire row as a hashref, which it can modify as needed.

An (admittedly somewhat contrived) example from the documentation:

my $table = HTML::Table::FromDatabase->new(
    -sth => $sth,
    -row_callbacks => [
        sub {
            my $row = shift;                                                                                 
            if ($row->{name} eq 'Bob') {
                # Hide this row
                $row = undef;
            } elsif ($row->{name} eq 'John') {
                # John likes to be called Jean these days:
                $row->{name} = 'Jean';
            }
        },   
    ],       
);

I decided to bump the version to 1.00 for the sake of anyone who considers 0.x versions to be unready for production use; this module has been about since 2008 and is working well in production use for me.

The Dancer release that will get you hooked!

Sawyer X wrote up a good post on version 1.3050 of the Dancer Perl web framework being released – "The Dancer release that will get you hooked!".

The addition of extra hooks, along with support for plugins to create hooks, heralds additional flexibility and power for your Dancer apps.

Dancer itself now provides various new hooks you can use to customise its behaviour, including before_deserializer, before_file_render, before_error_render, before_template_render, before_layout_render, before_serialization
– see the Dancer::hook() documentation for the full list. Plugins can register their own hooks, which your code can then make use of.

Props go to Franck Cuny for the implementation, and JT Smith of Plain Black for pushing for this feature and working with the Dancer team in designing the implementation.

Dancer 1.3050 also includes various bug fixes and improvements – see the CHANGES file for a full list.

Dancer::Plugin::TimeRequests

Today I knocked up a quick plugin for the Dancer Perl web framework to log the time taken by requests to help look for bottlenecks – enter Dancer::Plugin::TimeRequests.

At the moment it’s very simple, and simply logs the time taken to execute every request; in the future, I may extend it to support capturing statistics and adding a route handler to display stats (e.g. average request time, which routes take the longest to execute, etc.)

Suggestions / patches welcome – the code is on GitHub as usual.

Increasing loop devices on Xen host

Trying to start another Xen guest domain, and getting an error indicating that there are no loop devices left, like the following? :


Error: Device 51714 (vbd) could not be connected. Failed to find an unused loop device

Increase the number of loop devices that the loop kernel module will create, by editing/creating /etc/modprobe.d/local-loop containing something like:

Continue reading Increasing loop devices on Xen host

Back in the (bicycle) saddle

Last week, I picked up a used mountain bike off eBay, so I could get out cycling again. I used to enjoy cycling, but the chain on my old bike (which I was actually borrowing from my father) snapped, and I never got round to replacing it, so I hadn’t cycled for a couple of years.

I decided it was time to get back out there cycling for some good enjoyable exercise, so I picked up a 22″ frame Apollo mountain bike from eBay for £40, and got out there riding (click to embigulate):

I took a 3.4 mile cycle over the weekend, but just got back tonight from riding across town to my parents and back – 3.48 miles in 20:56 on the way out (avg 9.96 mph, max 24mph) and 4.38 miles in 26 mins (avg 9.9 mph, max 21 mph) on the way back (different route). Altogether, ~7.7 miles in ~45 mins cycling, I’m happy enough with that!

If you’re wondering about the level of geekyness required to get stats like that, I’m using Google’s “My Tracks” on my phone to record the route via GPS, mostly for motivation so I can work to slowly increase my average speed and cover longer distances. It’s also amusing to be able to see your route on the map.

I’m considering uploading maps of my rides, but I’m not entirely sure whether I want to, since one end of the ride will pinpoint where I live. (On the other hand, it wouldn’t be too hard to find that out anyway, and I don’t have a policy of making enemies, so it oughtn’t be that big a deal.)

Ubuntu 11.04 – X freezing after screensaver active / laptop lid closed

I recently upgraded my laptop (a Dell 17R / N7010) to Ubuntu 11.04 (Natty), and since then, it has been randomly freezing when I come back to it after leaving it for a while.

I see my X session exactly as I left it, and can move the mouse around, but nothing seems to respond to mouse/keyboard events. The system is still alive, I can SSH to it from another box, or switch to a different virtual terminal (e.g. Ctrl + Alt + F1), and I can kill Xorg (sudo pkill X) at which point gdm immediately gets restarted, and I can log back in.

It seems to only strike when the laptop has been left unattended for some time. I can close the lid, wait ten seconds and re-open it, and everything is fine. I can also trigger the screensaver by locking the screen with Ctrl + Alt + L, then unlock, and all is also fine.

I’ve done some Googling, and I’m certainly not the only person experiencing this:

Bug 772925 – Screen freezes after laptop lid closed for more than 1 minute
Bug 781402 – Ubuntu 11.04 / Unity freezing when screen is ‘woken up’
a discussion of bug 781402 on fossplanet.com
Bug 740126 – Disabling an output can cause vblank events to be missed

I’m using ‘Ubuntu Classic’, i.e. using GNOME rather than Unity, but the reports of the problem I’ve seen are split between both.

I’ve found a suggestion of a possible fix – installing compizconfig-settings-manager then disabling Sync to vblankon ubuntuforums.org.

I’ve just tried that out; I’ll update this post when I know whether it has worked or not.

EDIT: I’ve checked logs for anything illuminating and found little, but I did just spot the following in /var/log/Xorg.0.log.old:


[437515.524] (EE) intel(0): [DRI2] DRI2SwapComplete: bad drawable

I’ve no idea if it’s related to the problem or not.

EDIT 2: So far, it would seem that disabling “Sync to vblank” as mentioned above has fixed the problem, for me. (It’s also possible that it was fixed in one of the updates since, but I haven’t spotted any package updates that looked relevant.)

If you’re having the same problem, feel free to comment here on whether the “Sync to vblank” change stopped the freezes for you.