no order too small…

Posted on October 2nd, 2009 by whinger. Filed under Tech.

I’ve used the components supplier farnell before and found them to be excellent. Up until recently I’ve been able to get around their minimum order value for free delivery because work has an account with them; however work has changed their policy so I can’t order stuff through them any more (grrr).

So anyway, I needed to repair the PSU on a Topfield I got off ebay and the 6 capacitors I need came to £2.69 inc VAT; I figured I’d have to bite the bullet and pay a fiver or so for delivery (although I wasn’t too happy about it). Imagine my surprise, therefore, when the checkout came out at “free same-day-dispatch”.

It turns out that farnell abolished the minimum order requirement for website cash orders at the beginning of the year. So hurrah for them!

Edit: they arrived next-day too. Brilliant!

Reedit: no-minimum-order policy has now been reversed. Booooo!

Tags: .

someone needs a boot somewhere…

Posted on September 28th, 2009 by whinger. Filed under Whinges.

So I placed an order for collection at my local store with boots online on the 16th September (yes, boys and girls, that’s 12 days ago). They told me at the time it would be available to collect by the 23rd, which I thought was a bit slothlike, but hey!, how urgently can you need toothpaste, right?

The despatch note came on the 18th, which gave me hope that I might be experiencing shiny clean teeth and that fresh breath that 3 cups of coffee and a mustard-filled sandwich does its best to destroy (and I’m sorry but the Colgate I can get from everywhere – actually that’s another rant, but I’ll leave that for another day – just doesn’t compete) within a reasonable amount of time; however it’s now the 28th and I’ve still not had the nod from Boots to tell me that I can collect.

I sent them a polite email on Friday and have heard nothing. So today I tried a different tack – this is the text of the email I sent this morning.

Order status is despatched and has been for nearly a week. I dropped into the store on Friday and they suggested that the next delivery date would be Saturday but your status still says “despatched”. Now given that I could probably have attached the package to a tortoise and it could have travelled the 20 miles or so from Nottingham to Alvaston by now, unless you’re shipping from the Outer Hebrides using the pony express I’d say it has either not been despatched at all or it’s been lost on the way.

Can you investigate and let me know when you expect to be able to fulfil my order?

So I guess either I’ll now never receive it or I’ll give them a laugh and they might actually do something. We’ll see 🙂

Edit – the automated bounce email I got back states (about their 0845 number):
You will pay at the local rate and calls may be recorded for training purposes
I thought they weren’t allowed to call 0845 “local” rate any more?

Update (2009-10-01) I received a phone call from a very helpful boots rep today: their courier has admitted mislaying my parcel. Oh well, at least they’re dealing with it!

Tags: , , , , .

vici ergo sum optimus

Posted on September 24th, 2009 by whinger. Filed under Poker, Whinges.

I love to see people look back on hands and think “I played that really well” whereas in actual fact they played like a weak donkey.

Nick Schulman’s post on full-tilt is the perfect example. He raises with a middling hand, gets reraised and decides to call anyway. He then misses the flop – there’s an overcard to his middling hand – but calls the bet on the flop. He then proceeds to give his opponent two opportunities to hit a card that beats him, assuming that he wasn’t beaten by the queen on the flop or indeed before the flop.

In almost every situation this is just rubbish. He’s then giving himself kudos because he won the pot but that’s just results-orientated thinking. If he’d reraised all-in he’d have won much more, was that a better play?

IMO he played the hand badly from start to finish. Thoughts?

Tags: .

MySQL’s design team triumphs again!

Posted on August 24th, 2009 by whinger. Filed under Tech, Web Development, Whinges.

From this upgrade note for MySQL 5.1

As of MySQL 5.1.15, InnoDB rolls back only the last statement on a transaction timeout.

Oh, what a fantastic design decision.

I love that there’s no explanation, no reasoning. Just “we’ve fucked over transactions”.

It’s almost like they decided that MySQL was getting far too close to being a usable enterprise solution so they did this to make sure it stayed where they know it really should be – website backend city.

Edit: MAD points out that the old behaviour can be turned back on with an option, but most people new to a database will install it with the default options and really, implementing this option at all just displays complete disregard for the ACID ideals

Tags: .

Paul Robichaux considered harmful

Posted on August 10th, 2009 by whinger. Filed under Tech.

Paul Robichaux is (I’m sure) a well-respected MVP. I’ve no issue with either MVPs, him in particular or indeed Microsoft. I use a number of MS products, I’ve been (in days when I wasn’t a php-whore) an MSDN-subscribing developer and I’ve made my living in no small way thanks to a number of their products; as such I’d like to make clear that I’m neither a raving loony free-software fanatic nor a MS hater.

However Paul’s rant against z-push seemed so inflammatory and given that the existing comments displayed the most moronic and ignorant attitudes of the free-software community, I felt obliged to post a more measured comment to his site myself for some balance.

It’s been a good few days now and the comment hasn’t appeared. I’m not drawing any conclusions from that yet; however I thought I’d post the essence of what I said here (I don’t have the original text because I submitted it to Paul’s site, which probably makes it his copyright anyway!)

The problem I have with Paul’s position is that it’s disingenuous. No-one really wants to “steal” (as he puts it) MS’ synch protococol, because being able to synch my contacts (which probably change once a week if that) or even my calendar (admittedly slightly more useful) in real time without plugging my phone into my laptop (ooh what a hardship) isn’t a big sell. What they do want is to get their phones to pick up email quickly and cheaply (preferably at approaching zero-cost) without using a huge amount of battery power. There are a number of ways to do this – the cheapest and simplest being IMAP IDLE, which holds a connection open to the IMAP server and waits until the server says “here, I’ve got a new email” (pretty much the same as MS’ “innovative” product does, in fact 🙂 ).

The problem with this is that MS’ phones don’t support IMAP IDLE, despite the openness of the protocol, the wide support for it across almost all IMAP servers and the fact that their own users have been crying out for it for years. Why don’t they? Perhaps because (up until recently) the only way to get instant email on an MS phone (apart from the exorbitant blackberry) was to pay for Exchange. That sounds remarkably like abuse of their market position to me.

I also find it intriguing that Apple decided not to support IDLE either, when they licensed the Activesync protocol. Coincidence?

So here’s a deal Paul. Get MS to support IMAP IDLE natively in their phone’s email client and I’ll stop using z-push in a heartbeat. And if you can get Apple to do it I bet a fair few more of its users would too.

Tags: , , .

Another decent full-tilt read

Posted on August 5th, 2009 by whinger. Filed under Poker.

The gist of this full-tilt post from Jay Greenspan is fairly simple: if you can’t decide whether to fold or raise, calling should not be the default action.

Simple, but very well put.

In these cases, the call isn’t a strategic choice; it’s a sort of compromise between raise and fold that has none of the advantages

It’s something I’ve found in my own game is a great way of leaking chips – calling on the flop when I’m not sure where I am – because (unless the turn hits me in a big way) I still won’t know where I am.

Tags: .

uudecode implemented entirely in bash

Posted on July 31st, 2009 by whinger. Filed under Tech.

With the internet being full of silly but interesting things I would have thought this would be an easy find but I couldn’t find it anywhere – a couple of people asking about it with some vague bits of code here and there but most of the time people would say something dumb like “use (awk|perl|uudecode)”

Not because I think it’s particularly useful or sensible (it certainly isn’t that, since it takes around 200 times as long as the C version!) but just to see if it were possible, here’s my bash uudecode implementation.

while read -rs t ; do
  if [ $bs -eq 1 ] ; then
    if [ "a$t" = "aend" ] ; then
      i=($(printf "%d " "'${t:0:1}" "'${t:1:1}" "'${t:2:1}" "'${t:3:1}" "'${t:4:1}" "'${t:5:1}" "'${t:6:1}" "'${t:7:1}" "'${t:8:1}" "'${t:9:1}" "'${t:10:1}" "'${t:11:1}" "'${t:12:1}" "'${t:13:1}" "'${t:14:1}" "'${t:15:1}" "'${t:16:1}" "'${t:17:1}" "'${t:18:1}" "'${t:19:1}" "'${t:20:1}" "'${t:21:1}" "'${t:22:1}" "'${t:23:1}" "'${t:24:1}" "'${t:25:1}" "'${t:26:1}" "'${t:27:1}" "'${t:28:1}" "'${t:29:1}" "'${t:30:1}" "'${t:31:1}" "'${t:32:1}" "'${t:33:1}" "'${t:34:1}" "'${t:35:1}" "'${t:36:1}" "'${t:37:1}" "'${t:38:1}" "'${t:39:1}" "'${t:40:1}" "'${t:41:1}" "'${t:42:1}" "'${t:43:1}" "'${t:44:1}" "'${t:45:1}" "'${t:46:1}" "'${t:47:1}" "'${t:48:1}" "'${t:49:1}" "'${t:50:1}" "'${t:51:1}" "'${t:52:1}" "'${t:53:1}" "'${t:54:1}" "'${t:55:1}" "'${t:56:1}" "'${t:57:1}" "'${t:58:1}" "'${t:59:1}" "'${t:60:1}"))
      l=$[${i[0]} -32 & 63 ]
      while [ $l -gt 0 ] ; do
        i0=$[${i[$[x++]]} -32 & 63]
        i1=$[${i[$[x++]]} -32 & 63]
        i2=$[${i[$[x++]]} -32 & 63]
        i3=$[${i[$[x++]]} -32 & 63]
        if [ $l -gt 2 ] ; then
          echo -ne "\0$[$i0 >> 4]$[$i0 >> 1 & 7]$[$i0 << 2 & 4 | $i1 >> 4]\0$[$i1 >> 2 & 3]$[$i1 << 1 & 6 | $i2 >> 5]$[$i2 >> 2 & 7]\0$[$i2 & 3]$[$i3 >> 3 & 7]$[$i3 & 7]"
        elif [ $l -eq 2 ] ; then
          echo -ne "\0$[$i0 >> 4]$[$i0 >> 1 & 7]$[$i0 << 2 & 4 | $i1 >> 4]\0$[$i1 >> 2 & 3]$[$i1 << 1 & 6 | $i2 >> 5]$[$i2 >> 2 & 7]"
          echo -ne "\0$[$i0 >> 4]$[$i0 >> 1 & 7]$[$i0 << 2 & 4 | $i1 >> 4]"
  elif [ "${t:0:5}" = "begin" ]; then

Note that I’ve used as few subprocesses as possible – I’ve got it down to one per line of input (the stupidly long “printf” line – more about that later) because the thing that bash does really badly is spawn off a subprocess: you can do a huge amount of fairly complex string and number manipulation in bash in place of a single subprocess spawn and it will still cut the time used massively. So for example I was using (as recommended across the web)

h=$(printf "%X" $d)

to convert decimal-to-hex: it’s about 10 times quicker (and actually not much less obvious) to create an array (0 1 2 3 4 5 6 7 8 9 a b c d e f) and build the hex string yourself using ${arr[d>>4]}${arr[d&15]} (I suppose using a 256 entry array would actually be quicker still but I gave up on the hex thing anyway to use octal)

The most interesting thing (fairly obvious, when you think about it) is the speed increase when you change from dripping through converting character by character

c = `printf "%d" "'$c"`

to the massive and horrible one-line-at-a-time printf above. You’re talking about a 15x speedup for the entire operation just by doing that.

Anyway, I found it all very challenging; I hope you find it useful/interesting :-).

Feel free to tell me what an idiot I am or (if you’re feeling more constructive) suggesting optimisations. If you can figure out a way of getting a character into a charcode integer without using a subprocess then obviously that would be really useful…

Edit: this awk-based implementation is probably more useful (it’s smaller and lots faster!) if you want to include a backup in your script for when uudecode isn’t installed

Tags: , , .

Mixed WPA/WPA2 mode on ZyXEL Prestige 660HW-T1

Posted on June 28th, 2009 by whinger. Filed under Tech.

Problem: Broadcom wifi adaptor in HP 6735s running Vista won’t connect to internet via Zyxel Prestige 660HW-T1 running WPA mixed mode

Issue: WPA1 support on Vista with the Broadcom drivers doesn’t seem to work, but turning on Mixed Mode WPA2/WPA1 on the Zyxel stops internet access; meanwhile we have some WPA1-only devices (Belkin print server) so we can’t use WPA2-only

Solution: updating the Broadcom drivers didn’t help, and neither did getting the latest firmware for the Zyxel. Eventually I realised that some sites (mainly google) worked while others didn’t and (after a few tests) figured out that the MTU size needed to be lowered to 1482.

Whinge: Why on earth would WPA mixed mode alter the maximum MTU? That’s just crazy.

FWIW, changing the MTU on the Zyxel is a fairly complicated thing: this page describes how to do it temporarily and permanently. I’d also recommend changing the MTU on Windows because otherwise the router will have to split up your traffic into chunks, and you can actually get away with just changing the Windows MTU if you don’t want to change router settings; download the excellent TCPOptimizer from and set the MTU with that.

Tags: , , , , .

Dude, you’re so, like, negative (zero)

Posted on April 23rd, 2009 by whinger. Filed under Tech, Web Development, Whinges.

Edit: this is fixed in 5.1.30, so I’m guessing it was fixed a while back – I’m working on a legacy system using 5.0.15.


So MySQL thinks that


should return -0

(Whatever -0 is)…

Clearly I’ve simplified my code and there are ways around this, but… WTF?


For what it’s worth,

SELECT -COALESCE(null, 0) + 0;

results in the expected “0” value.


I was disappointed that


doesn’t work though – if you’re going to believe that -0 is a valid number, you should be able to get +0 out of it.

Tags: , , , , , .

Internet Explorer: this page contains both secure and nonsecure items

Posted on April 23rd, 2009 by whinger. Filed under Tech, Web Development.

So the web is full of people asking about this symptom and I hit it myself. Seemingly randomly (but consistently) IE will complain about nonsecure items in the page, with this warning message:


This page contains both secure and nonsecure items. \n\nDo you want to display the nonsecure items?

The error message from IE7

The usual response to this is that you’re loading images (or other media) from a non-SSL connection (hence “non-secure” items); there are also some mentions of IE not being happy about IFRAMEs without SRC= attributes (the browser assigns “about:blank” as a default SRC, which – being non-secure – flips the error); however none of these things applied in my case.


I discovered that if I turned off javascript the error disappeared, which suggested my script was problematic, but I still couldn’t find anything in the scripts which was loading any non-secure items.


In the end after much messing around it turns out that the offending script was setting to a relative path, eg”url(/images/mybackground.gif)”;

Even though this will correctly resolve to an https:// address (assuming the root of the document is https://) IE can’t figure this out and moans.


Simply adding the full path to the background solved my problem.


This doesn’t apply to CSS files setting backgrounds – you can happily have relative paths in these and all will be well. 


Of course I then wondered why I hadn’t found that on the web and figured you might be looking for it too – so here it is 🙂

Tags: , , , , .