Thursday, September 23, 2010

Eclipse: escape strings when pasting - off by default?

After a couple of years of occasionally having to paste a large multi-line string into Java source code and escape the hell out of it, I eventually searched for some kind of online tool to automatically do the job and quickly discovered that Eclipse automatically does this for you if a certain menu option is enabled (prefs->Java->Editor->Typing->"Escape text when pasting into a string literal").

So why on earth is this feature not enabled in Eclipse by default?

Tuesday, September 21, 2010

Integrity in snooker: empty pandering or meaningful measures?

When the John Higgins scandal erupted some months ago, I tried to keep an open mind and honestly hoped it was all a misunderstanding until I watched the video and heard some of the details of the case. It was very disturbing evidence, but even then I hoped for everything to turn out alright in the end, even if there was a good chance that he truly intended to carry out the promised match-fixing.

Flash forward a few months and Higgins' manager is banned from the sport for life (even though he had already resigned from his position on the WPBSA board) and Higgins gets a backdated six month ban and a £75,000 fine.
Then Barry Hearn, the recently-appointed chairman of World Snooker, appears on BBC2 today talking about the new anti-corruption unit being set up as a preventative - rather than curative - measure against betting fraud and match-fixing.

He was asked what role Higgins will have in this new light, and responded by basically saying that he would serve as an example to other players of how dangerous it is to give in to that temptation and appear to agree to dodgy deals without reporting them, especially now that there'll be some official, private channels for doing so. He also stated that Higgins made a silly mistake, by trusting people he shouldn't have, and was heavily punished and that £75,000 isn't pocket change.

That was a mistake, I think. For someone like Higgins, a backdated six-month ban and a £75,000 fine is chump change, especially when Hearn followed up those comments to assure of the seriousness of the new regime by saying "we're talking about lifetime bans here".
If we're talking about lifetime bans, Higgins got away very lightly and you should really acknowledge that. Why not just say something like "the case with Higgins could easily have ended up differently and he might have received a very lengthy or indefinite ban. But now we're drawing a line and making it very clear what you can and can't do, and specifying the penalties for breaking those rules"?

Another player, Quinten Hann, was handed an 8 year ban a while back, for agreeing to lose a match in the China Open. However, he resigned before the ban was decided, and never had a squeaky clean image to begin with. Also, his highest ranking was #14, where John Higgins has been #1 for a while and is one of the most consistent players in the game.
What if Higgins was a much lower-ranked player of less fame? Would he have been banned for longer (or even forever) and fined less?

What worries me is that much of the assurances about "hard measures" might be concerned more with convincing the public with tough-talking "draconian" plans than with actually stamping out corruption - that Higgins' real mistake was to get caught. But I'm still glad to see Higgins back in the game - it'd be such a shame for a master craftsman to be officially banned from his craft forever. I just hope that Hearn and the rest truly care about sport and its integrity rather than simply protecting the bottom line by telling the optimal story to the punters.

Oh and on a side note, I'm glad to read Hearn's comments on Ronnie O'Sullivan's odd attitude towards completing a 147 today: “I really don’t like to hear multi-millionaires talking about a few extra pounds for a 147 when that’s the game that’s given them their livelihood”.
Spot on, and a big "WTF Ronnie". Walking away from the table on a 140 break with the black on, or missing on purpose (which he very nearly did - the black nearly bounced off the table) would actually hurt the audience - remember Ken Doherty's missed black on a maximum attempt and the groans from the crowd, and try to imagine what it would be like if O'Sullivan missed one on purpose. I'd hate to be the guy giving post-match interviews with him - it seems like 15% of the time he enjoyed playing, 70% of the time he felt nothing, 80% of the time he says something really sad that makes you wonder if he hates the whole thing, himself, fans, other players etc.

But on the other hand, a 147 is still an amazing feat, even if it's slightly more common. The commentators seemed to only consider the case where there's no maximum break prize versus a £147,000 prize. Why not have a token but still half decent prize for a maximum - let's say £14,700 - which a) would not be sniffed at and b) would be separate from the high break prize, so that getting a 147 gets you a tangible reward. The amount isn't really important, as long as a maximum is distinguished from a high break of 145 or whatever.

Sunday, September 12, 2010

Screen magnifier and Orca screenreader stuck on at login screen (Ubuntu)

Although Linux has improved immensely in many respects over the years, there's still a chance of running into bizarre problems, either during install or in normal use.

A while ago I wiped the old Mandriva 2008 partition on my Acer Aspire 1705SMi, a 7 year old juggernaut of a laptop which was sitting in a drawer for a year or so.
The first problem was that the Ubuntu Live CD could not even boot properly, since as soon as it loaded the splash screen the video adapter (a NVidia GeForce FX Go5600) went slightly insane and produced a screen which looked like a garbled moire interference pattern. Rough shapes (maybe that's a dialog box...?) were visible but it was basically unusable.

Getting past that required editing the boot command line for the kernel at the GRUB prompt (hitting 'e', IIRC) and adding the "nomodeset" parameter. I also removed the "splash" parameter but this probably wasn't necessary. If something like this can happen, why not offer a nomodeset boot option on the boot menu, rather than forcing the user to edit the boot command line?
This got as far as a failed start of X and dropped back to the shell, where I was able to edit /etc/xorg.conf and start the installer.

So that was okay. The install worked nicely, although both suspend to RAM (sleep) and suspend to disk (hibernate) completely fail to resume, requiring a hard reboot. No change from ~2004 when I had to download a fixed version of the buggy Acer DSDT and install it at boot, as well as tinker with the kernel source (maybe, not sure if it was necessary). Surely those problems could have been fixed in the mainline kernel though - if it was fixable by a layman like myself before, why does it still not work out of the box?

Then a 2 year old demon managed to somehow enable Orca (a screenreader), a screen magnifier and dreadfully annoying "slow keys" by randomly clicking around (from her own user account), and things got really weird on the next reboot: the left half of the screen is normal, while the right half shows a magnified cursor and a load of garbage (maybe due to the old NVidia card being a pile of arse). Trying to type in a password to login seemed impossible at first, until I realised that I had to hold each key for about half a second before it would register. Ugh.

Anyway, after logging in I made sure that all of the accessibility tools were switched off in every preference menu on the GNOME desktop. Unfortunately this didn't really switch them off, even though the gconftool-2 program declared that they were successfully disabled.

After much googling (for once, not very helpful except to confirm that other people in similar situations have solved the problem by reformatting and re-installing Ubuntu, WHAT!) and grepping, I found another set of gconf XML configuration files in /var/lib/gdm/.gconf, even though you need to be root to access them.

Anyway, these global settings could be unset as follows:
$ sudo su
# cd /var/lib/gdm/.gconf
# gconftool-2 --direct --config-source xml:readwrite:. -s --type boolean /desktop/gnome/accessibility/keyboard/stickykeys_enable false
# gconftool-2 --direct --config-source xml:readwrite:. -s --type boolean /desktop/gnome/accessibility/keyboard/bouncekeys_enable false
# gconftool-2 --direct --config-source xml:readwrite:. -s --type boolean /desktop/gnome/accessibility/keyboard/slowkeys_enable false
# gconftool-2 --direct --config-source xml:readwrite:. -s --type boolean /desktop/gnome/applications/at/screen_magnifier_enabled false

Some of these problems may be due to the laptop having a poorly-designed BIOS/DSDT, so this post may sound like sour grapes. But a natural response from anyone who uses such a machine would be "but it works in Windows?" - and if it does, why shouldn't it work in Linux?