There’s a bit of a long-standing bug in Textpattern, and its handling of time zones. It’s a bit of a head-scratcher to get your head around, so bear with me. It’s probably best described with a simple example, so here goes:

  • Our writer/site admin lives in the UK. It is British Summertime. His time zone is therefore GMT+1.
  • Textpattern is installed on a server in Australia. Its time zone is GMT+10.
  • The site admin sets the time zone in TXP to his own GMT+1 and writes a few articles.
  • British Summertime ends, so the writer’s time zone is now just GMT. Daylight Savings Time (or whatever) starts in Australia, making it GMT +11.
  • All the date-based permalinks in TXP go all to hell. Most appear a day out of line.
  • New stuff that gets written is inaccessible as TXP can’t decide if the publish time has passed or not.

It’s a strange one, and a bit of a pain in the ass. There’s been some discussion in this forum thread, but no consensus on how to fix it or even if it is a bug. The common workaround – which isn’t an ideal one for many people – is to just keep to one time zone and ignore anything like DST, BST or other “time modifiers”.

I loves me some jQuery – without it I probably wouldn’t write any JavaScript at all (seriously, I hate the stuff). Anyway, today I needed to add some “open in new window” links to an internal application using jQuery. Being the Standardista I am, I wanted to make it a)Accessible, and b) Unobtrusive . If the user has JavaScript disabled (it happens, even on “controlled”, intranet environments), the link should just go to the new page anyway — new window be damned.

My first attempt (below) didn’t work as expected. The following code takes all <a> tags with a class of “newwindow” and applies an onclick event to open a new window.

$(function(){
$('a.newwindow').click(function(){
var w = window.open($(this).href(), 'newWindow', '');
return false;
});
});

Nothing would happen with the above, because of the return false;. Removing return false; would open a new window, but also send the opening window to the new page. In the end, the following worked the way I wanted:

$(function(){
$('a.newwindow').click(function(){
var w = newWindow($(this).href(), 'newWindow', '');
return false;
});
});
function newWindow(url, wName, opts){
w = window.open(url, wName, opts);
return true;
}

Basically the “heavy lifting” was moved to a seperate function. It’s slightly longer to type, but not exactly finger-breaking stuff. No doubt some bright-spark could tell me an even betterway (feel free!), but this’ll do for now.

Seriously.

After last weeks amazing, high-octane episode 4 (write-ups can be found at Binary Bonsai1 and Broken Kode2), this week’s episode had to be something pretty good to keep up the levels of expectation.

Thankfully it lived up to the expectation without having to fall back to more space battles or other big action sequences. If anything, episode 5 was he perfect slow-down to the frenetic opening to the season.

We all knew the resistance were going to start dealing with any and all Cylon “collaborators”. We also knew this was going to end up being to cause a lot of friction and fucked up feelings as people found out their friends helped the enemy. The writers (once again) and actors pulled things off beautifully. We can feel the lust for retribution in every scene. It may have been a bit predictable3having Gaeta sentenced to death, only to be saved at the last minute when it was revealed how he was passing information to the resistance all along, but we’ll forgive them that one.

And damn Starbuck is one crazy-ass, fucked-up (frakked-up?) woman.

1 Battlestar Exodus

2 Battlestar Galactaca Season 3

3 Similarly, my only real criticism of episode 4 was the predictable “Pegasus to the rescue” bit just as the Galactica was about to go down. But hey, it looked good!

So I’m writing my first serious bit of PHP in aaaages. This last few months, I’ve either been adapting existing systems to fit the bill, or I’ve been writing ASP (all while learnng Ruby on Rails).

I feel like I’ve been out of the game. Before I fell out of writing my own PHP every day, I was using the CakePHP framework. CakePHP is a wonderful framework. It greatly speeds up development and makes things so much easier.

Unfortunately, frameworks are only of use to the developer or your customer has someone who knows what they’re doing to set up everything for them. When you’re building a product for those who aren’t so technically minded, giving them something like CakePHP/Rails/Django, etc, to install – before they can use the product – is a big no-no1.

So anyway, I’m writing this new product. It’s not terribly exciting, nor should it be particularly difficult… but what looked a piece of cake on paper is going slower than I would like. I need to get my head around the fact I don’t have a framework or existing application doing 90% of the grunt-work for me. All those framework-specific shortcuts and existing functions I’ve grown used to don’t work any more so I need to do things manually2. Joyful.

On the plus side, this is probably the coding equivalent of getting back into shape for a World Championship fight, after getting slower and fatter from being too comfortable – a la Rocky in Rocky III.

Frameworks are a wonderful thing for speeding up development in large projects where you have control over your environment. Just remember not to rely on them too much.

  1. This isn’t to knock the work of the developers of frameworks like CakePHP and Rails, et al – not at all. I think they’re doing great, great work, which makes the lives of countless developers worldwide just that little bit easier.
  2. Another thing keeping me from top-speed is an insistence I’ve put on myself to follow best coding-practices all the way, and most importantly, document everything as I go. I usually write something then document it later once everything else is finished.

I’m a bit of a phone addict. I tend to upgrade my handset every 6 months or so, whether my contract is due for renewal or not. Ebay is a wonderful thing. That said, I was hoping to put off upgrading for a while yet. I do like my Motorola PEBL. It’s nice and simple, doing onlywhat I wanted it to (phone/SMS/camera), wrapped in a nice design. Horrible, horrible, horrible, UI – solved by setting up a heap of shortcuts – but an otherwise nice phone.

Unfortunately mine seems to be going on the blink. GPRS flat out refuses to work any more (so no media messages or web surfing), signal reception in general seems to be decreasing, the in-built speaker is a bit… spotty and it’s developed a nasty habit of switching itself off now and then when in my trouser pocket. The first two problems point to a failing internal aerial.

I have basic needs for a phone:

  • Good as a phone
  • Good at SMS/MMS
  • Fits comfortably in a front pocket of a pair of jeans
  • Good UI

A few other features are “nice to have”:

  • Decent camera
  • Bluetooth sync with OS X (Calendar + Contacts)

I like Sony Ericsson phones; good UI, robust and reliable… apart from their clam-shells. Great to sync with OS X and usually great cameras. The old s900i was a damn good (if rather chunky) phone.

I don’t really like Nokia phones anymore. The Nokia 3210 was probably the best phone I’ve ever had (going old-skool!), but with the exception of the highly-expensive N70, their recent offerings seem gimmicky and/or plain-old cheap. Build quality has been an issue with most recent Nokias I’ve seen.

I could get another Motorola, but as mentioned, I hate the UI. I also dislike the feel of theRAZR and SLVR handsets – too wide/thin for comfort – and there’s the issue of whether I’d want another Moto after the first one failed after 6 months? Hrmm. The RIZR looks cool though.

Samsung phones suck. I can’t put it any other way; from the design to the UI, they blow goats.

Having thought about it a little while writing this entry, I think I might leave things a while. My PEBL isn’t quite broke yet and there aren’t any handsets I really want to upgrade to. Maybe if I wait a couple of months something awsome will come along. The iPhone, maybe? So um yeah, this entry has pretty much been an inconclusive waste of mine and your time… That said, if you want to give a shout out for your favourite handset, please go ahead!

Hello again, you crusty inhabitants of the Interwebs. It’s been too long – far too long. But, like The Good Ship Galactica, I’m back.

I could bore you all with an in depth look at why I’ve not been blogging, but it doesn’t really matter. Suffice to say it’s been down to a combination of things: the stroke I had last summer; being a ‘family man’; that perennial favourite – work, and a general lack of enthusiasm about the whole blogging thing in general. I’d like to say this time around it will be different, but I just don’t know, so I’m making no promises.

So enjoy it while it lasts (i.e. as long as I do). Much like Stargate1 really.

1 SciFi, how could you?.