deanjrobinson.com

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 0 comments
·•·

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
·•·

Classic comments. There are some highly entertaining comments in this post (if you’re following the #thesiswp ‘debate’). By the reasoning of @pearsonified the 27,000 users of Thesis make him “one of the top 3 most important figures in the history WordPress”, so do the 83,000+ users of Redoable (plus however many thousands use it on WordPress.com) make me one of the top two in WP history. Of course it doesn’t. Just one of the many stupid arguments he’s put forward in the last couple of days.

Link 16 Jul 2010 0 comments
·•·

Fluency 2.3.2 — bug fixes and translations

Ok, it has taken a couple of weeks and about a dozen different WP installations, but I finally managed to replicate the mysterious “disappearing ‘hide menu’ button” bug that so many of you were reporting — so hopefully this update should resolve that issue (it resolved the occurrence that I produced). Also included are the first batch of translations (Italian, Turkish, Spanish and Chinese). As always, grab the update from here or use the built-in auto-updater.

·•·

Fluency 2.3.1 update now available

This minor update should hopefully fix the two common issues people were experiencing with the initial release of 2.3 — the menu overlap problem on the ‘Menu’ management page, and the lack of two-column hover menus. There are a couple of other small tweaks in there too, plus a new ‘coffee’ colour scheme. Grab the update from here or just use the auto-updater that’s built into WordPress.

·•·

Bad News Kev.

Bad News Kev.

So Australia’s gone an gotten itself a new Prime Minister on the eve of the Federal Election, and its a Female PM with Julia Gillard (and the rest of Labor) changing their minds about not challenging Kev for the top job prior to the election. “Kevin Rudd will lead Labor to the next election” they’ve been saying for weeks, only for him to be thrown from the roof in the final day of Parliament before the election.

So, yes we have a Female PM, but for how long? I can’t help feeling that Labor’s little stunt has hurt their re-election chances more than helping it, even if Julia is more popular that KRudd. Only time will tell.

Image 24 Jun 2010 0 comments
·•·

Fluency Admin 2.3 now available

Now compatible with WordPress 3.0. I’ve also added more customisation options including iPad friendly menus, and the ability to turn on/off hover menus and hot keys as needed.

Fluency Admin 2.3 now available

Fluency 2.3 is a recommended upgrade for all Fluency users who’ve already upgraded to WordPress 3.0 (which was released earlier this week). Included in this update, in addition to WP3.0 support, are fixes for a number of small issues that were pointed out by users over the past 6 months, and a few additional options to ‘fine-tune’ how you use Fluency.

Well, what are you waiting for? Read more about the updates here, or head to your admin panel to upgrade/install Fleucny 2.3 (of course, you can also jump straight over to WordPress.org to grab the download from there too.)

As always, if you spot a bug or something I’ve missed please let me know. The best place for you to do so is in my help forums, or, if you prefer, in the WordPress.org support forums.

·•·

More Nextga.me updates

Finished up the latest round of additions to nextga.me last night, newly added sporting fixtures include the 2010 NFL preseason and regular season, the 2010 FIFA world Cup and the 2010/2011 A-League. You can read more about the other improvements here.

I also really need to get around to writing a full post introducing nextga.me, but for those of you that don’t already know its a central sporting fixtures site that I’ve set up, with game times converted to your local timezone and its currently tracking almost 9,000 games covering 370+ teams from across the globe, with more being added all the time.

twitter was not updated. | lastfm was not updated. |