Archive for the ‘Whinges’ Category

* curses!

Posted on December 18th, 2008 by whinger. Filed under Web Development, Whinges.


Say you want to step through a bunch of records in order using a MySQL cursor. That’s normally not a problem: you create a stored procedure so:
CREATE PROCEDURE doit()
BEGIN
DECLARE whichi INT(11) DEFAULT 0;
DECLARE mycur CURSOR FOR SELECT IF(i=1, f1, f2) AS whichi ORDER BY whichi;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET cursorExpired=true;
open mycur;
curnext: loop
FETCH mycur INTO whichi;
IF cursorExpired THEN
LEAVE curnext;
END IF;
select whichi;
END LOOP curnext;
close mycur;
END;

Obviously that’s an incredibly inefficient way to list records, but you get the idea.

The point of the query is that the SELECT must be ordered by the result of IF(i=1, f1, f2); however calling doit() will not output what you expect (unless, of course, you’ve come across this problem before, in which case you’ll be expecting it :))

What you get is no ordering of the data at all – the ORDER BY part of the statement is effectively ignored. Why? Because we’ve called the field in the SELECT query the same as the variable we declared above. So you end up with (essentially)

SELECT IF(i=1, f1, f2) AS whichi ORDER BY 0;

I guess you can imagine how long it took me to figure that one out.

Tags: .



* MySQL – USING() considered harmful

Posted on October 30th, 2008 by whinger. Filed under Tech, Web Development, Whinges.


I’m not a great fan of making use of non-ANSI SQL: not only does it make it harder for new coders to pick up but it means any chance of changing databases becomes completely financially unviable.

The MySQL USING() clause is the worst type of example: not only is its requirements for brackets confusing and unnatural, it provides no advantage except to the incredibly lazy – being purely syntactic sugar.

For those who don’t know, it replaces

FROM a INNER JOIN b ON a.fieldname=b.fieldname

with

FROM a INNER JOIN b USING(fieldname)

Up until today I’ve been mildly irritated by it, until I came across a bizarre piece of behaviour. Given two tables, “pubs” and “beers”, with a joining field “brewery” and both with named fields “name”, running

SELECT strength FROM beers INNER JOIN pubs USING(brewery) WHERE name="the white horse"

utterly fails to warn me that “name” is ambiguous and returns no results (unless there’s a beer called “the white horse”, of course). On the other hand,

SELECT strength FROM beers INNER JOIN pubs ON beers.brewery=pubs.brewery WHERE name="the white horse"

immediately produces the “Column ‘name’ in where clause is ambiguous” error you expect.

Do I need to go into detail why this makes USING() harmful?

This is admittedly fixed in more recent versions (bugs.mysql.com) since October last year but how many installations out there (like mine) will still exhibit the bug? I’d guess at a fair few.

Tags: , , , .



* pneu-moania

Posted on October 6th, 2008 by whinger. Filed under Whinges.


I need a new tyre (I think mine has a slow puncture) and I found these guys – tyre fit direct – who seemed to be offering the best deal for an on-site fitting (actually the best price at all – even cheaper than the remarkable black circles) for the Conti I wanted.

So I go through the order process, which seems all well and good: I get an email back telling me that most orders will, if placed before 10:30 (mine was around 9:33), be fulfilled the same working day.

I sit back and wait but, when lunchtime arrives and I’ve heard nothing I figure I should check to make sure that the order hasn’t just disappeared into the internet ether. One phone call to tyrefitdirect and “they’re trying to find a fitter nearby as their normal fitter’s van is broken”. Hmm.

At 13:57 I get a short phone message telling me that they’re cancelling the order; they’re not sure what’s wrong with the van and they don’t know when it will be fixed. I get the distinct impression that the van doesn’t actually exist.

There are two things wrong with this. First, their tagline is “Mobile Tyres Fitted Nationally”, not “Mobile Tyres Fitted Nationally (as long as you’re in one of our three delivery areas)”. Second, can it really take four and a half hours to figure out they won’t be able to fulfill the order?

For future reference, Mr TyreFitDirect, if you’re serious about “fitted nationally” the right thing to do is to send a non-local van to fit my tyre. It may cost you a bit more but it will pay in the long run because you won’t get bad publicity like, erm, this blog post.

Failing that, tell the customer up-front and don’t wait for him to call you.

You see, the problem is that the impression I now have is that tyrefitdirect.co.uk are just a bunch of cowboys who probably have a couple of fitters signed up and (if you’re lucky enough to live in the right area) will turn up with the wrong tyre and expect you to accept it because you’ve waited all day and you need the tyre to get home. So next time I shan’t even bother and I recommend that others don’t either.

So I’ve gone with the excellent e-tyres instead, who are a little more expensive (actually 10% more) but who have delivered on their promises and done an excellent job the last three times I’ve used them. I suppose “you get what you pay for” applies here as anywhere else.

Edit on 7th October: I spoke too soon – etyres have just called to say their systems were down overnight so now I have to wait another day. They are at least apologetic enough to send me a £10 voucher though, which is more than our friends at “Mobile Tyres Fitted Nationally” ever did, and at least they’re coming tomorrow (touch wood…).

Tags: , .



* and that is why kings are tyrants

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


So those of you who read regularly (or indeed have the presence of mind to be able to read down a couple of entries) will know that today’s Pokerstars EPT London satellite weekly final was graced by yours truly.

Things started slowly: I couldn’t pick up a hand and when I picked up marginal holdings (A8, A6, 55) someone behind me would reraise wildly. I made a marginal call on the river in a pot from the cutoff with second pair against a straight (oops) but managed to maintain enough of a reputation (I think they thought I was a bit of a donkey) to get a few small pots, I got lucky a couple of times to stay in (second pair calling short-stack’s all-in improved to aces-up on the river, two pair against a made straight improved to a full house on the river) but I wasn’t making any great inroads, just staying still.  I chased a couple of big draws and missed and ended up at about 9BB, then hung on until I found a hand worth playing. It turned out to be AA(!) against a player who – with 3x the stack of anyone at the table – had been raising most things. I limped with the AA expecting him to raise and he joyously raised 2/3 my stack, meaning he had to call my all-in. The AA held up (for once!) and I went into the break comfortable at 21xBB.

Nothing happened for a while and I played 44 in the BB against a 4xBB all-in – I felt pretty sure it was a coinflip and it was, but his AJ hit two pair and I couldn’t magic the third 4. That left me back at 11BB and not really enough to speculate with any more.

Then came 88 and facing a bet and a raise all-in I figured the chances of winning looked slim but with the blinds increasing rapidly I crossed my fingers and called. One of the better possible scenarios looked back at me: an AJ and AK; the K came on the turn but I was saved by a river 8 and suddenly I had a playable stack – about 13th in a field of 200 or so.

The next few hands played out: I used my relative stack to win a couple of pots uncontested, then made a questionable call on the flop with Q7 – I’d hit third pair and something felt wrong about the bet – and thought better of it on the turn.

I still wasn’t sure about the fold though and when, 5 or so hands later, I picked up KK and faced a reraise to my standard raise from the same player I pushed and proceeded to cry like a baby when he virtually flipped the AA.

Aces held and (apart from a glimmer of hope with my remaining 1.7BB with A8 which went nowhere) that was that.

Oh well, there’s always next week 🙂

.



* 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?

.



* 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: .



* Who gives you eXtra???

Posted on May 31st, 2007 by whinger. Filed under Whinges.


Last time I went into The Halifax I had to queue because they were dealing with some stupid idiot who had lost his paying in book or something… and when I got to the counter she said “you can pay it in at the machine – you don’t need to have deposit envelopes already, it will give you one”

So this time, when I went in and there’s only one cashier and two people waiting I thought “I’ll give it a try”…

So I went to the machine, pressed “deposit” and “cash”, and the amount, upon which it spat out an envelope and said “this deposit will not be available until 5/6/07” (that’s 5th June to any American cousins)

Now that’s not good enough – it’s a cash deposit, FFS!, so I figured “I’ll go inside and put it in there”, except now the machine is waiting for me to put the envelope in the slot…

So I press “cancel”… nothing happens

I press “clear”… nothing happens

So now there’s a queue of people behind me thinking “what’s this tosser doing”… and I can’t just put the empty envelope in because the bank might think I’m trying to defraud them or something…

So I have to wait 90 seconds while the machine just sits there beeping at me… I can’t even walk away cos it still has my card.

Eventually I get my card back and I go back inside and there’s no queue, so I walk straight up up and she says “sorry, would you mind waiting, I’m just in the middle of a transaction”, and I’m like “can’t someone else help me” and she’s “I’m just finishing this transaction, I’ll only be two minutes”, and I’m “oh, only two minutes, well that’s F*CKING FINE then, after all my time isn’t worth ANYTHING, I’m just the F*CKING CUSTOMER, I’ll just STAND AROUND LIKE A C*NT waiting for you F*CKING DO YOUR JOB PROPERLY you STUPID B*TCH.”

Of course I didn’t say any of that, I just pouted like a spoilt child and mumbled “Like I have a choice”.

So the whole thing from start to finish took about 10 minutes for a transaction which actually takes about 30 seconds.

The only “Extra” I’m getting there is a few points on my blood pressure.

Bah.

Tags: .



Blogroll

Categories