Saturday, 19 January 2013

The Fort Saint George becomes a Cafe?

There is an unspoken contract when it comes to pubs. You ask for your drink, your drink is served, and then you pay. There is a similar contract when it comes to restaurants: you makes you choice, order your victuals, consume the grub and then pay. A pub couldn't do that except if you had a tab and agreed to pay at the end of the evening - and then only if the pub knew you. A Cafe is differentiated from a restaurant in that in a nice greasy spoon you makes your choice, pays your money and the food gets delivered to your table when it's suitably burnt.

Why then is The Fort Saint George becoming a Cafe? Twice last Friday (11th January 2013) evening, whilst out with a friend, I went to the bar and asked for a pint. I was told how much it would cost and then there was a pause. I looked up and the barkeep was looking at me in expectation, after a further awkward pause I clocked that I was expected to pay my money before the beer could be poured.

Now I couldn't be called pretty, when I was younger I was ever so much more pretty (my kids get bored about hearing how I was 6'1", thin with suitable muscle tone for someone who worked as a carer without access to a hoist and had hair so long his hit my (perfectly toned - some things don't change) bum). I have been called ever so slightly intimidating in appearance - but that doesn't correspond to my internal image of myself as a giant teddy-bear. Whatever the case I don't look like some sort of thug. I guess I'd just shaved all my hair off so maybe I was looking a little scary - but if you were scared of someone surely the approach would be to pour me my pint as soon as possible rather than to wind me up?

I wandered back to my table to wait for my mate and, when he arrived and got himself a pint, the correct thing happened: "Pint of Bitter please", beer was poured and placed afore him, he paid. We chatted for about half an hour and I needed another pint - I goes up and asks for my pint from a different member of the bar staff (after all - it might be the other persons first day and they might not know how a pub works) and the same thing happens. At this point I'm keeping an eye on the bar when I return to my seat. Everyone else is served as though in a pub except me.

Now I've always liked The Fort Saint George (unfortunately FaceBook doesn't allow you to dislike a page). It's over the river from a rather affluent part of Cambridge that I always get lost in, it's also on the river Cam so the cliental have always struck me as an interesting mix of posh people, students from the rowing clubs and boaters from the narrowboats all along that stretch of river. Me and 'er indoors once split up over a couple of plates of Fish and Chips there (think that it was for all of 6 hours or so and it was long before we were wed). The pub seems like a posh alternative from The Green Dragon and I had a whale of a time there in the Summer on my 40th.

You see I like the pub but I'm not sure what's going on with it. I'd hate to have to not go in because the staff are just weird but I'll be buggered if I'm going to be treated like some sort of second class citizen. Maybe it's Will and Kate's visit that's gone to their head?

Whatever the reason I'm not tempted to go back to a place which I cycle past at least once a day - and I have done for the past 14 years... what a shame :-(

Wednesday, 9 January 2013

Fancy a Date?

I spend an awful lot of time thinking about Dates, not the going to a restaurant and the cinema type, but the period of time.

I guess that to an extent we in the UK are in a similar situation to the rest of the world when it comes to English as most web-based technologies use American date format, which is a pain!

The American's use Month, Day and then Year when they write down their dates... that's just silly! We use Day, Month and then Year... which is cool and goes from smallest to largest whereas the American version goes from the middle to the smallest to the largest - where's the sense in that? I guess that to some extent it might be because they're used to measuring dates in terms of Months - perhaps because it used to take weeks or months to get from one end of their country to the other...?

Whatever the reason though, it's just silly! Ohh, and a pain!

Thankfully the programming language I primarily use has a built in Date object - but when I'm using JavaScript to talk to another programming language I get a little stuck. Thankfully a Date can be just a string so I can manipulate it into UTC for example - something I'm doing a lot lately thanks to SalesForce using UTC. But I think I'm going to alter that approach and use ISO format dates as the lovely JSPro released these two articles about writing and parsing ISO format dates and they seem to have enough detail for pretty much anything... of course that means I'm going to have to get the C# chaps at work to use it...

Tuesday, 11 December 2012

JavaScript Base64

This is brilliant! I've used this once already and dare say I will again soon, so good to encode text within data-attributes!

Thank you webtoolkit!

/**
*
*  Base64 encode / decode
*  http://www.webtoolkit.info/
*
**/
var Base64 = {
    // private property
    _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
    // public method for encoding
    encode : function (input) {
        var output = "";
        var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
        var i = 0;
        input = Base64._utf8_encode(input);
        while (i < input.length) {
            chr1 = input.charCodeAt(i++);
            chr2 = input.charCodeAt(i++);
            chr3 = input.charCodeAt(i++);
            enc1 = chr1 >> 2;
            enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
            enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
            enc4 = chr3 & 63;
            if (isNaN(chr2)) {
                enc3 = enc4 = 64;
            } else if (isNaN(chr3)) {
                enc4 = 64;
            }
            output = output +
            this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
            this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
        }
        return output;
    },
    // public method for decoding
    decode : function (input) {
        var output = "";
        var chr1, chr2, chr3;
        var enc1, enc2, enc3, enc4;
        var i = 0;
        input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
        while (i < input.length) {
            enc1 = this._keyStr.indexOf(input.charAt(i++));
            enc2 = this._keyStr.indexOf(input.charAt(i++));
            enc3 = this._keyStr.indexOf(input.charAt(i++));
            enc4 = this._keyStr.indexOf(input.charAt(i++));
            chr1 = (enc1 << 2) | (enc2 >> 4);
            chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
            chr3 = ((enc3 & 3) << 6) | enc4;
            output = output + String.fromCharCode(chr1);
            if (enc3 != 64) {
                output = output + String.fromCharCode(chr2);
            }
            if (enc4 != 64) {
                output = output + String.fromCharCode(chr3);
            }
        }
        output = Base64._utf8_decode(output);
        return output;
    },
    // private method for UTF-8 encoding
    _utf8_encode : function (string) {
        string = string.replace(/\r\n/g,"\n");
        var utftext = "";
        for (var n = 0; n < string.length; n++) {
            var c = string.charCodeAt(n);
            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }
        }
        return utftext;
    },
    // private method for UTF-8 decoding
    _utf8_decode : function (utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;
        while ( i < utftext.length ) {
            c = utftext.charCodeAt(i);
            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            }
            else if((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i+1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i+1);
                c3 = utftext.charCodeAt(i+2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }
        }
        return string;
    }
}

Monday, 10 December 2012

empty()

This is just brilliant and deserves to be kept forever:

function empty(data) {
    if (typeof (data) == 'number' || typeof (data) == 'boolean') {
        return false;
    }
    if (typeof (data) == 'undefined' || data === null) {
        return true;
    }
    if (typeof (data.length) != 'undefined') {
        return data.length == 0;
    }
    var count = 0;
    for (var i in data) {
        if (data.hasOwnProperty(i)) {
            count++;
        }
    }
    return count == 0;
}

It's from the fabulous JSPro.

Yon peeps who are Java and C# heads at work used to sneer at my various attempts to check to see if a value was null or an empty string, well not any more thanks to this little gem!

Sunday, 2 December 2012

Five Kisses

It's about three months since we lost #3 son. Three months of utter shite!

People have, by and large, been bloody brilliant!

But it's getting on for Xmas and I've been hitting Amazon. Lovely as they'll even wrap the presents.

Normally I'd write something along the lines of:

Dear [whoever],
Have a lovely Christmas and all the best for [next year]
Lots and lots of Love,
Dominic, Katrina (reverse, depending who it's for), #1, #2 and #3 XXXXX

This year I'm having to alter the last line to:

Dominic, Katrina (reverse, depending who it's for), #1 and #2

But I'll be buggered if I'm just putting 4 kisses!

Friday, 9 November 2012

You say "expenses" and I hear "benefit".

So how would we feel if some slapper from a sink-hole council estate conned the tax-payer out of more than £60K and went to court with a pair of underpants on her head and sticking two pencils up her nose and the judge said that she wasn't well?

I know how the Tory media would portray it (Yes, I'm looking at you Daily Mail (I'm not allowed to read it any more in the pub as I get all ranty... even more ranty than I was this evening whilst listening to the news on Radio 4 and the idiocy of Cameron (Pie would've been proud!))).

So someone who claims to work for our good is guilty of stealing £60K from us and we say, "There, there love. You sit down and have a nice cup of tea. Don't you worry your pretty little head, just go home and we'll tell you all about it when it's all over"?

What's wrong with the system of government in this, and probably other, countries? We've just had the most expensive election campaign ever in the USA and China has just told it's population who it's leader is going to be. Do we really need government? Belgium managed 535 days without a leader, in that time did anything dodgy happen? It's arguable that the only reason that they had to form a proper government was the Eurozone crisis; a crisis caused by other governments!

Thursday, 8 November 2012

What? No straight witch-hunt?

Is anyone else confused by Cameron's warning of a gay witch-hunt?

There hasn't been a straight witch-hunt after the Jimmy Savile furore.

And just why was Leah McGrath Goodman banned by Theresa May from entering the UK a year ago (hint, follow the link)?

Just don't make sense to me. I know Cameron isn't the brightest bulb in government but all the same - it does sound ever so slightly silly. A little like the joke:

Q: What's the difference between an apple and an orange?

A: A tub of margarine.

Or:

Q: Would you be interested in knowing which of your predecessors were nasty kiddy-fiddlers?

A: A tub of margeri... I don't want to start a gay witch-hunt!