Google Chrome bug in onchange on select dropdown

Posted on September 12th, 2008 by whinger. Filed under Web Development.


So a classic web developer trick is to use the onchange event of a dropdown to change another field in the form. Yes, there are accessibility issues with this (keyboard+screenreader users could trigger the onchange event while scrolling through the options) but FF3 and WebKit both seem to have realised this and if you change the value keyboard-wise they only trigger onchange when you blur. Of course IE7 is behind the curve on this (surprise) but with luck IE8 might catch up.

Anyway, Chrome seems to have a problem with setting focus() to another object from within the onchange event – while the focus works fine and the new field is focussed correctly, it fails to update the existing selectbox to the new value.

There is a workaround (of course) and it’s fairly straightforward: replace

linkedField.focus();

with

setTimeout(function (){linkedField.focus()}, 5);

and all is fine.

Safari doesn’t exhibit this so I don’t know if it’s something google has done or if it’s just Safari’s more recent webkit version. Let’s hope that it’s fixed before the beta period ends!

.



w00t! My 1337 5k111z in online tournament shocker

Posted on September 12th, 2008 by whinger. Filed under Poker.


So I’ve been trying to win through the Pokerstars FPP satellite structure to the London EPT every couple of days for the last couple of weeks and not done too well; however last night I finally got a couple of breaks (winning with AT against AK by spiking a T on the river being most notable) and managed to concentrate and make a few disciplined folds and made it through to Sunday’s weekly final. So that’s about a 1 in 500 chance of me playing in the London EPT. w00t!

Anyway, the stats surprised me a bit

  122 hands played and saw flop:

   - 8 times out of 15 while in small blind (53%)
   - 8 times out of 14 while in big blind (57%)
   - 26 times out of 93 in other positions (28%)
   - a total of 42 times out of 122 (34%)

  Pots won at showdown - 12 out of 20 (60%)
  Pots won without showdown - 27

Don’t really know what to make of that. The “pots won at showdown” %age is lower than I’d like. The “while in blind” values were a product of the competition, it was _really_ tight (I guess because of the structure). I suppose in that environment playing lots of pots is valid (especially given the “pots won without showdown” amount), but I should have been prepared to fold more when I didn’t have much post-flop (improve that 60%).

These tourneys are fantastic value though, because with the number of people taking part 1/10 players have a 1/500 (or so) shot at a (nearly) $11k prize, which means the implied value (even without taking into account the secondary cash prizes) is around $2.22 for 10FPP. With the cash prizes (an extra $5000) the EV per FPP is 32c. Considering a pokerstars Tshirt is 500FPP I think that’s probably a valuation about 10-20x the usual.

Anyway, keep your fingers crossed this Sunday evening. I’ll let you know how it goes.

.



If Cyrus won’t run two imapd processes on different IPs, What’s In A Name?

Posted on September 9th, 2008 by whinger. Filed under Tech, Web Development.


I couldn’t find a solution to this for the first few web searches I ran, so hopefully this will provide answers to anyone also searching for the same problem!

I run Cyrus because it seems like the best solution for a) supporting folders containing subfolders and emails, b) providing email accounts to many users without needing system logins and c) NTLM support.

Due to reasons I won’t go into now I had to restrict the imap process only to run on one of the server’s IPs; however I also need to access it from localhost for some of the server processes.

Now the recommended way to run the cyrus daemon on multiple specific IPs appears to be to tell the master process to run two different daemons, one on each IP.

So I had in cyrus.conf

imap              cmd="imapd -U 30" listen="myhostname:imap" prefork=1 maxchild=100

imap-lh           cmd="imapd -U 30" listen="localhost:imap" prefork=1 maxchild=100

The problem was, as soon as I enabled this second line, cyrus went into complete meltdown – connecting on one of the IPs just hung and eventually timed out (and it seemed to be randomly chosen at restart whether it’s the local or public IP which fails).

I finally found a posting in the cyrus mailing list (lists.andrew.cmu.edu), which has had no responses (typical) and explains it: there’s a bug in the cyrus code which figures out the lockfile name – for some reason (probably to stop people using invalid characters) it just stops at the first alphanumeric character so both daemons were using the same lock file.

So the “random” element was just whichever one connected second: renaming the second daemon to “imaplh” solves the problem.

Hope this helps someone!

Tags: , , , , , , .



I’m so lazy…

Posted on July 29th, 2008 by whinger. Filed under Web Development.


So I haven’t blogged for months. Not that I’m exactly inundated with people emailing me every day asking when the next entry will arrive, but even so I feel bad. Why is that? Perhaps because I spent time and effort (albeit not very much) figuring out how to get this to work and setting it up. Maybe because in my heart of hearts I truly believe if I were just to write more, people would understand how urbane and witty my thoughts are and I would be lauded as the next Wilde. Only without the prison bit, obviously.

Anyway, I’ve added a new category – web development – which should a) make my blog more relevant to all you internet geeks (nothing like whoring myself out to the mass market) but b) (and more importantly) really give me something to whinge about.

Currently most of my paid-for development is php and javascript, so you should find some random whinges in here fairly regularly since (as you’ll know if you’ve ever tried them) they’re both highly whinge-worthy. I’ll also probably be whinging about browsers if I’m having a bad day, and there may be the odd post about shellscripts or other Linux/Unix stuff, but the majority of this category will probably fit “web development” best.

I suppose I should have a “meta” category for this type of blog entry, since it’s a blog about the blog. How postmodern.

.



PHP: long variable names

Posted on July 29th, 2008 by whinger. Filed under Web Development.


edit: as Chris points out in the comments, this doesn’t hold true for php 5.2. Yah, boo. 🙁

So using long variable names in php makes a difference to the speed of your code.

It’s true: try this…

<?
$s=time();
for ($c=0; $c < 100000000; $c++) {
$verylongvariablename++;
}
print time()-$s . "\n";

$s=time();
for ($c=0; $c < 100000000; $c++) {
$a++;
}
print time()-$s . "\n";

?>

This gives me a difference of around 20%.

Of course in the real world you won’t just be incrementing variables in a tight loop so the difference is essentially irrelevant and I wouldn’t recommend anyone starts sacrificing readability by shortening variable names, but I thought it was interesting.

Who knows, you might too 🙂

Tags: .



Terrible terrible joke

Posted on December 6th, 2007 by whinger. Filed under Uncategorized.


So I hear that Gillian Gibbons is to sell her teddy bear on ebay; unfortunately she’s got into even more trouble after she said she would be happy if it makes a profit….

Tags: .



You Lucky Bastard….

Posted on July 3rd, 2007 by whinger. Filed under Poker, TV, Whinges.


So I was watching Premier League Poker last night and, while commentating, Roland “WPT champion y’know” De Wolfe was having a whinge worthy of yours truly about how lucky Phil Hellmuth had got throughout the whole tournament (Phil won this heat, giving him 4 out of 5 for the series so far).

Yeah, Phil’s been running hot for 18 years, Roland. I guess your WSOP bracelets are just weighing down your wrists.

Isn’t it amazing how the best players in the world always seem to get lucky?

.



Firefox “Smart Keywords”

Posted on June 13th, 2007 by whinger. Filed under Tech.


Until today, I had no idea you could set up these in firefox. I’d used similar functionality in konqueror and been suitably impressed, but no-one had ever mentioned it as a firefox feature, as far as I could tell.

It now turns out that you can set up something very similar in IE 5+. Years of my life wasted… Kinda.

.



Sopranos? Bah…

Posted on June 11th, 2007 by whinger. Filed under TV.


So I’m reading all the hoo-hah about the arty ending to The Sopranos and it occurs to me that this is yet another cult American TV series which I don’t get, along with Six Feet Under and The West Wing (off the top of my head).

I don’t know why but everyone goes on about them as if they’re just amazing but when I rented the whole first series of The West Wing I ended up watching about three episodes and going “what?”…

Lost, err, lost itself in the second series (about episode 208 it completely disintegrated into rubbish-ness), Prison Break became a completely different show after they broke out of prison (well, yeah, I guess that was to be expected :)) and ground to a halt for me when they all started digging holes looking for buried treasure.

OK, 24 is still great and Kiefer is still the God of Sunday nights, but even that has become a little tired since season 4. This last season was stuffed with new people who we don’t really care about and ended on such a complete nothing that I had to check that, yes, that was 24 hours and there wasn’t another one to come.

Yes, we used to watch a load of stuff – Frasier has some of the funniest moments of TV ever and Friends was mandatory Friday night viewing, while Sex and the City kept us laughing for all six series – but they’ve ended (in Friends’ case, thankfully, it has to be said)

So the only other American TV we still watch and enjoy in our household is Desperate Housewives, heaven help us.

Maybe the only thing the Americans can do well any more for more than one season is torture and violence or sitcoms about what are essentially gay people played for the camera by heterosexuals…

I’ve kind-of forgotten what I was going to write about here, but, err, I think I got my point across 😉

.



Did we quote you happy?

Posted on June 5th, 2007 by whinger. Filed under Whinges.


My better half was driving along in her Clio about 2 months ago when some stupid bitch in a Jeep Cherokee decided it would be fun to pull out from a driveway into the side of her.

Although it was a fairly low-speed crash (about 25mph) the damage to the car was significant – the central column was bashed in, the driver’s side window smashed (all over Chris, you can imagine she was shaken up!). Anyway, Norwich Union arranged to have it picked up by a specialist repair centre (I won’t name names… yet…) who spent nearly two months doing a solid professional repair, not just sticky-plastering over the cracks, oh no.

Anyway, we got it back on Friday and I immediately noticed that the driver’s door is on slightly higher than the near-side which, were I to find it on a second-hand vehicle I was considering for purchase, would be a clear sign to steer well clear. So, not being a trained mechanic I figured I ought to get one to look it over.

Den is a great mechanic who I trust implicitly and he managed to look over the car last night. The look on his face when I came to pick up the car was enough to tell me that I’d done the right thing in getting it checked out.

I won’t bore you with the exact details but suffice it to say they left sections of the underneath of the car unsealed, forgot to put some of the cabling in its mountings (so eg the rear brake hose – it’s discs all round – is hanging loose and rubbing against a bracket), and left the central locking faulty.

As you can imagine the car is going back today. The thing that really annoys me, though, is that they continue to carry out repairs even though the cost must be far beyond the write-off value (the car’s 5 years old).

Norwich Union, of course, refuse to discuss the issue: their Indian call-centre is staffed with aggressive and unhelpful script-monkeys who fail to attempt to understand our questions and flatly refuse to ask the assessor to contact us. One fax to their head office has produced no response and a second – sent today with a copy of Den’s assessment – is likely to do the same.

We’ve now had the courtesy car (a Ford C-Max, which is surprisingly nice, by the way) for two months: that must have cost a grand or so. On top of the £3.5k they’ve spent on the actual repair (now set to increase further) the write-off value is now just a dot in the distance. A more cynical observer might wonder whether the garage is giving some sort of kick-back to the Norwich Union assessor to let them carry out the work.

Tags: .



Blogroll

Categories