Birthdays, bad news, and buying furniture

On Friday I found out that JonP’s dad Peter had died the previous day. It’s really sad news and I can’t believe it happened. It was so completely unexpected as far as I knew. Dave, Len, and I went over to see JonP, Emma, and family over at Peter’s house and we stayed there until the early hours of the morning. I learned that you have to say your glass is half full no matter how much liquid is in it unless you want someone else to drink it for you.

Carly came to see everyone at one point. When it reached midnight it was her birthday, and also Peter’s brother-in-law George’s. We wished them all a happy birthday, which was quite strange considering the circumstances of the gathering. We left Peter’s house at 5am and went to McDonalds to get breakfast just as they opened. It was pretty nice at that time. Len caught a taxi back to Nottingham and Dave and I caught a taxi back to our houses.

I slept until about mid-day on Saturday and woke up feeling really hot even though it was overcast outside. Lizz was planning to go to Ikea, so I went along. We had all the usual arguments as we went around and eventually settled on a pair of wardrobes that are 236cm tall. That’s pretty much all the way to the ceiling in our bedroom. After we’d collected everything we began to wonder if it would all fit in the car or not. I called Dave to see if it would be possible to get his help if it wouldn’t fit in our car. He said there’s no way it would fit in his. It’s a good job we managed to get it all in our car. 🙂 The drive home was not a comfortable one for me as I had to sit on a folded-down seat crouched over like a hunchback. I couldn’t lean back because there were boxes beside me. I was glad to get home.

We constructed one of the wardrobes and then Dave and Emma came over to call for us. Lizz said she had to stay to work on the wardrobe because there were no doors or shelves or anything. I went along and we watched Yes Man at Hayley’s house before Hayley dropped us back off at home again.

Lizz went for a bike ride on Sunday, and so I got to work on the second wardrobe. I had just got it standing when Lizz’s dad and Philip arrived with the chicken coop. We moved that to the back garden. Lizz and her mum got back and we all hung out in the garden while Lizz’s dad put some rubber on top of the coop to keep the rain out.

When everyone had gone Lizz and I went upstairs and finished off the wardrobe and tidied up. Lizz got her clothes sorted out for the first time in a very long time and I think it made her very happy indeed. I didn’t have any coat hangers left over, so I’ll have to sort mine out later on.

I spent a while playing Burnout Paradise and managed to gain another couple of trophies, which is nice. Then Lizz and I relaxed on the sofa and watched an episode of Battlestar Galactica before I went upstairs to bed before Lizz because I was so tired.

A very mixed, eventful, busy weekend. Looking forward to a more relaxing one soon!

MySQL case insensitivity on varchar fields

I created a MySQL table like the following:

CREATE TABLE `links` (
`id` int(11) NOT NULL auto_increment,
`short_id` varchar(255) NOT NULL,
`url` text NOT NULL,
`user_id` int(11) default NULL,
`created_at` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`),
CONSTRAINT unique_key_1 UNIQUE (`short_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

This structure caused an error for me when it came to inserting an upper-case ‘A’ in addition to the lower-case ‘a’ into the short_id field. I removed the unique constraint for the short_id field and this allowed me to create a row with ‘A’ as the short_id.

Unfortunately

SELECT * FROM links WHERE short_id='A';

gave me both rows (‘a’ and ‘A’), with the ‘a’ row being first. To fix this I had to set the short_id field to be BINARY. When I’d done that I realised I could make the short_id field unique again.

To create the table properly I now use the following query:

CREATE TABLE IF NOT EXISTS `links` (
`id` int(11) NOT NULL auto_increment,
`short_id` varchar(255) character set utf8 collate utf8_bin NOT NULL,
`url` text NOT NULL,
`user_id` int(11) default NULL,
`created_at` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`)
CONSTRAINT unique_key_1 UNIQUE (`short_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

You can just add the BINARY keyword after the field data type if you like, e.g.:

`short_id` varchar(255) BINARY NOT NULL

Hope this helps someone else out there. 🙂

Stanford pwned by the FBI

I was just reading a news article about a guy named Sir Robert Allen Stanford. He’s basically guilty of doing the same sort of thing as Bernard Madoff, which is taking a shitload of money that doesn’t belong to him.

The part of the article that made me laugh was a quote from Stanford’s attorney, Dick DeGuerin:

“Federal agents in black SUVs surrounded his girlfriend’s house this afternoon, and just sat there. […] I told him to walk out and introduce himself. So he did, and he asked them, ‘If you’ve got a warrant, take me into custody. If you don’t, I’m going to Houston.’ And they did, so they arrested him.”

That’s a brilliant play by the FBI, in my opinion. It’s a proper comedy moment. I imagine the arresting officer shrugging his shoulder and saying “Ok then.” I wish I could have seen the look on his stupid face as he realised they did have a warrant.

The filming of a sit-com – The Scum Also Rises

Yesterday Dave took the day off work from his new job. I left early after working until 7pm the evening before and arriving half an hour early on the day. The reason for this is that we were going to see the filming of a sit-com starring Adam Buxton (as in Adam and Joe) and Iain Lee (as in The 11 O’clock Show).

I got free tickets from SRO Audiences, and so all we had to do was fuel a car and get down there for 6:35pm because the tickets were “priority” tickets. Dave arranged to pick me up from my work at 3:30pm. Unfortunately there was a really bad accident involving a car, a motorbike, and lots of blood on the road. I managed to meet Dave and we ended up leaving at around 3:20pm.

On the way out of Nottingham we got stuck in traffic. Then some of the traffic got stuck behind an ambulance that insisted on moving at around 20mph for some reason. It drove right by the hospital, too.

The M1 was pretty simple and we enjoyed the drive all the way down to London. As we reached London we heard that there had been an accident on the M25 so we decided to get sat nav on the job and go through some of the centre of London. This was a bad idea. Sat nav decided to lose reception while we were underneath a bunch of raised roads. We ended up getting onto the M4. I got directions on my phone because sat nav wasn’t playing any more. We followed the A312 for a bunch of time as the phone directions said. Unfortunately we stayed on it for far too long because we never saw the sign saying where we should turn off. We got sat nav back on and it started working again.

By this time we had already missed the 6:35 priority seats, but were aiming to be there in time for regular seats up until 7:15pm. This was when we ended up stuck in traffic on some annoying little high street somewhere near the A40. Apparently we had gone north on the A312 instead of south, somehow. We were sitting in traffic when 7:15pm came and went, so now we were heading for Teddington Studios as a matter of principle. We arrived around 15 minutes late, and then decided to just go visit JonP instead.

Teddingston Studios

Teddingston Studios

We ended up going to Morrison’s and bought some supplies for a barbecue and went back to JonP’s roof terrace. After eating some food Dave and I headed all the way back up to Mansfield and it was 2AM by the time I got home. On the way home we listened to a radio station that played Unchained Melody, Whiskey In The Jar, and The Ghostbusters theme. 🙂

So basically, I have no idea how good The Scum Also Rises may be. I didn’t get to see it. Perhaps another time…

War of the Worlds

Lizz met me after work yesterday so we could go to see Jeff Wayne’s War of the Worlds at Nottingham Arena.

I’ve liked War of the Worlds since I first heard the radio broadcast that sent people running to the hills.

The Jeff Wayne musical version is something my dad introduced me to shortly after. I know pretty much all of the songs and the music now and it was really great to go there and see it performed live. I do think that most of the effects and things like that were pretty cheesy when it came to the acting, but oh well. I was there for the music and it didn’t disappoint in that regard!

Update
I forgot to mention that at the end of the show we were asked to “show our appreciation” for the musicians, the singers, and then the on-screen cast! Why? When you’ve seen a film in the cinema do you stand up and applaud Jason Statham for another ridiculous action movie that’s somehow still compelling enough to make you go and watch the next one? No, you don’t. They’re on the screen and they can’t hear your applause.

Internet Explorer Quirks Mode Quirks

I have spent a large portion of this week working on getting Internet Explorer to display Flot graphs in the same way as Firefox. There’s a thing called ExplorerCanvas that basically acts as a <canvas> tag for IE.

Unfortunately IE requires that the page is rendered in quirks mode for the graphs to show up properly. This in itself is quite a simple thing to achieve. Adding an HTML comment before the doctype declaration (as below) will make IE render in quirks mode.

<!-- Quirks mode please -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

This has the side-effect of rendering the whole page as if you were using a browser from 1998. If you have well-formed CSS on the rest of your site then quirks mode will almost certainly screw that up for you.

I thought an easy way of getting around that would be to render the graph in an iframe in quirks mode, and render the rest of the page in standard mode. I rewrote a significant amount of code only to find that in Internet Explorer an iframe will be rendered in the same mode as the parent document regardless of the mode you set. It not only ignores a comment before the doctype, but also ignores the X-UA-Compatible header (or meta http-equiv data) sent with the iframed document. You can see this for yourself if you’re unlucky enough to have Internet Explorer to hand by going to my test pages.

Example Flot graph

Example Flot graph

Thankfully my code was all under version control in git so I could step back to how I had it before. I decided to add a configuration setting to this one particular script so that an additional CSS file was included for this script only. Of course this then caused the additional CSS file to be loaded in Firefox, which screwed up the display completely.

Finally I learned about conditional comments (below) that allowed me to only load the CSS file in Internet Explorer.

<!--[if IE]><link href="/IEQuirksMode.css" rel="stylesheet" type="text/css" /><![endif]-->

Still alive

Don’t worry, I’m still alive. I’ve written up a bunch of stuff about the Romania trip and I will be posting it when I get a chance to sit down and type it all. I tend to write things in quite a lot of detail, and from my own perspective, so it might not be overly interesting for everyone. There should be pictures though! 🙂