deanjrobinson.com

Twenty20 cricket in Australia

Twenty20 is all the rage in the cricketing world. The popularity of the shortest form of the game as exploded in recent years, thanks mostly to its faster, more action-packed style and the shorter game time. The ‘length’ of test matches and even traditional 50-over one-day games does still put off many people, but T20 which is all over and done with in three hours is perhaps more accessible to the masses.

Twenty20 is all the rage in the cricketing world. The popularity of the shortest form of the game has exploded in recent years, thanks mostly to its faster, more action-packed style and the shorter game time. The ‘length’ of test matches and even traditional 50-over one-day games does still put off many people, but T20 which is all over and done within three hours is perhaps more accessible to the masses.

Cricket Australia are now looking at changing things up in relation to the domestic cricket landscape. They’ve already announced a new 45-over split-innings concept for the forthcoming domestic one-day season (originally, the change was just going to be trialled in a few games, but now it encompassing the whole season), and now they’ve all but confirmed that the current 6-team Big Bash T20 tournament will make way for a new 8-team competition starting in the 2011-12 season. What changes might this bring? Who knows, but I’ve got more than a few suggestions…

Only cricket lovers, or the curious, really need to continue reading.
» Continue reading “Twenty20 cricket in Australia”

Article 15 Aug 2010 0 comments

jQuery Mobile This looks very interesting, along the same lines as jQTouch and Sencha touch but expanded to devices other than just iOS and Android powered units. This from the jQuery mobile site:

A unified user interface system across all popular mobile device platforms, built on the rock-solid jQuery and jQuery UI foundation. Its lightweight code is built with progressive enhancement, and has a flexible, easily themeable design.

I look forward to playing with it. Provided it is actually “lightweight”.

Link 14 Aug 2010 0 comments
·•·

The A-Team (2010)

Before I saw this part of me was wondering if they had included all the “good” bits in the trailer and if the rest would be so-so. Thankfully that wasn’t the case. It is hard to say something bad about all the far-fetched action, especially when one sequence involves the A-Team falling to the ground aboard a tank — a tank which they use to shoot down the plans that are trying to kill them. This is the A-Team, its allowed to be silly, right? The cast wasn’t too shabby either — Sharlto Copley (District 9) plays a great nutter.

8/10

****

·•·

The Losers (2010)

Not terrible, but could have been better. My opinion of it now is probably a bit lower than it was given that I watched The A-Team the following day and its essentially a very similar movie just better. And when I say similar I’m not kidding — for example both movies have their big final showdowns set at the Port of Los Angeles. Coincidence?

6/10

***

·•·
·•·

Grown Ups (2010)

Goes something like this. Adam Sandler gathers up all his comedian/actor friends and writes a movie casting them all in their usual typecast roles. For example David Spade is the short creepy ladies-man, Rob Schneider is the weirdo and Chris Rock is the annoying black guy who you know probably wouldn’t be friends with these guys in real life. I don’t think is Sandler’s fault that this movie was ‘lacking’, he just had too many cooks in the kitchen.

5/10

**+

Review 30 Jul 2010 0 comments
·•·

27-inch iMac + Cinema Display would be (more) awesome if…

27-inch iMac + Cinema Display would be (more) awesome if...

…more awesome if the displays sat at the same height when the two were sat side-by-side.

Sure, if you’ve got the dollars to throw towards a setup like this, the slight misalignment probably isn’t going to be a deal breaker, but I can’t work out why the misalignment is there to begin with. I would have thought that with both the iMac and Cinema Display getting a refresh last night it would have been the perfect opportunity to make the relevant change required to get the two displays to sit at the same height. And yes, perhaps the image I’ve pulled from Apple’s site isn’t 100% accurate, but hopefully you can see my point. In any case, my 24-inch Cinema Display now feels undersized and inferior.

Source: http://www.apple.com/au/imac/

Image 28 Jul 2010 1 comment
·•·
·•·

Inception (2010)

Quite simply the best film I’ve seen in a very long while. Christopher Nolan not only created an incredible story but he also managed to piece together a top-notch cast to tell it. Like some of Nolan’s other films its long (2.5 hours) but with hardly a dull moment the times flies (my only wish is that cinema seats were more comfortable). I’d seen a comment on twitter regarding the timing of the final shot, and how that if it had been cut in any other way that it just wouldn’t have been the same — I couldn’t agree more. …and the best thing about the whole film? That it wasn’t in 3D.

10/10

*****

Review 24 Jul 2010 1 comment
·•·

Custom Shortlinks for WordPress

I was lucky and managed to get my hands on a neat little .co domain, djr.co, and I decided that since it is now the shortest domain that I own that I’d first put it to use for the short links on my blog, and as my own personal url shortener.

I was lucky and managed to get my hands on a neat little .co domain, djr.co, and I decided that since it is now the shortest domain that I own that I’d first put it to use for the short links on my blog, and as my own personal url shortener.

The (really) short version

  • I’ve set up Lessn to take care of the personal url shortener side of things
  • And I’m using a simple combination of a WordPress filter function and an .htaccess/index.php redirection combo to handle the shortlinks for my blog.

The long version (for those who want more info)

Personal URL shortener

For the general url shortener there a few different options floating around, but I didn’t need anything super fancy with graphs and counters and all that stuff, I just wanted something simple and easy to setup — and most importantly something that worked. So I went with Shaun Inman’s nice little Lessn script and its working great.

Summary — if you want to set up your own url shortener using your own domain, then give Lessn a go. It is dead simple to setup.

Custom WordPress ‘shortlinks’

As of version 3.0, WordPress now come with a built in function called ‘wp_get_shortlink’ which, as you can probably guess, returns a ‘shortlink’ for the relevant post/page.

By default these ‘shortlinks’ take the form of http://deanjrobinson.com/?p=1345 — which also happens to be the default post links if you don’t have pretty permalinks set up, I’ll explain why this point is important shortly.

Getting djr.co ready for redirection

The first thing I needed to do was to set up things on djr.co and make sure it was working as I expected.

I had considered using the api built into Lessn to auto generate a shortlink when I publish a post, I even found a plugin that would have done it for me pretty easily, however I rules this out for a couple of reasons:

  • It would have meant adding additional meta data fields against posts — not necessarily a bad thing, but also not really necessary for my needs
  • I would have had to either modify my templates to output the new short links, or create a filter to take care of it for me
  • And the main reason was that I wanted ‘shortlinks’ to be available for all my old posts as well — without me having to go back and generate them.

The ‘solution’ I decided on is essentially a really stripped back version of Lessn — without the need to call off to the Lessn database etc because our WP posts already have unique ids which we can use for the redirection. More specifically it just two files a .htaccess file and an index.php file.

First, the .htaccess file, this is exactly the same as the one from Lessn.

This takes the url, eg. http://djr.co/m/1345, and passes it to
http://djr.co/m/index.php?token=1345 ready for the redirection.

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond	%{REQUEST_FILENAME}	!-d
  RewriteCond	%{REQUEST_FILENAME}	!-f
  RewriteRule	(.*) index.php?token=$1	[QSA,L]
</IfModule>

You might be curious as to why I haven’t just redirected it to my primary url using the htaccess, I’ll get to that in a sec.

Second, the simple index.php

This is based on the index.php file from Lessn, but cut down to just what I needed for my blog redirection. That means no need to call any of the Lessn includes, or make any database queries, just grab the id and redirect it off to my blog.

If no ‘token’ is passed though the page will simply return a 404. The two reasons for using this index.php file to handle the actual redirect are so that I can clean up the token (using strip_tags) just in case someone tries something nasty, and so that I can check that the token is numeric (using is_numeric) — this is because WordPress post/page IDs are only numeric, so any other values obviously aren’t going to work anyway.

This is what the cut-down, modified index.php file looks like. You’ll notice that the url format for the ‘Header Location’ matches the default WordPress ‘shortlink’ format I mentioned above. This is because no matter how you have your pretty permalinks set up, these default links will always work.

<?php

if (!empty($_GET['token'])) {
  $id = strip_tags($_GET['token']);
  if(is_numeric($id)) {
    header($_SERVER['SERVER_PROTOCOL'].' 301 Moved Permanently');
    header('Location:http://deanjrobinson.com/?p='.$id);
    exit();
  }
}

header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found');
header('Status:404');
die('404 Not Found');

?>

Getting WordPress to use these custom shortlinks

To get this working, all I needed to do was add a really simple ‘filter’ to the functions.php file in my current theme.

I’m using a filter so that I can continue to use the built-in ‘wp_get_shortlink’ function that is available in WordPress (since 3.0). This function can be used something like this:

<a href="<?php echo wp_get_shortlink(); ?>" title="ShortURL for this post">Short URL</a>

By running the filter over the standard function not only do I not have to update any of my theme templates, I will also be able to retrieve my custom short url by using the “Get Shortlink” button that has been added to the create/edit post screen in the WordPress admin, just below the post title.

<?php

function my_custom_shortlink_filter() {
  global $post;
  return 'http://djr.co/m/'.$post->ID;
}
add_filter('get_shortlink','my_custom_shortlink_filter');

?>

Best of all, because the shortlinks are based on the unique post ids (which every post has) the shortlinks will instantly work for all my posts going right back to the beginning of this blog without me needing to change anything else. Yay.

Article 23 Jul 2010 1 comment
twitter was not updated. | lastfm was not updated. |