Useful iPlayer addition

I currently have 2 laptops, an iMac, a PS3, an Xbox 360, Cheryl’s laptop, and Cheryl’s PS3 all capable of playing content from BBC iPlayer. If I want to view HD content I have to download it using the desktop app. This is available on the computers and laptops regardless of the operating system, which is very nice as I have Linux, Mac, and Windows installations at the moment.

My improvement comes from a situation I have found myself in a couple of times since Cheryl and I got the iMac the other day. I can download HD content on here, but if I do then I have no way of playing it on my TVs. The iMac has a nice 27 inch screen, but the dining chairs aren’t anywhere near as comfortable as the sofa.

When I’ve downloaded the HD copy of some media it would be great if I could connect to my BBC iPlayer installation on any of my other devices and stream that content over my local network. The DRM can all be handled in the same way it is by the app on the PS3 or whatever. It’s just a locally-hosted copy of the exact same file. They could even make it so that you can only stream the content from within the iPlayer app if they wanted.

I don’t want to pirate anything, I just want to be able to play media I’ve downloaded on one device on another. This would be possible if I did illegally download a copy of the media, I shouldn’t be punished for being honest.

Comic Sans

I decided that what the world really needs is more Comic Sans. I’m sick of having to read Facebook in another font. So, with that in mind I made a bookmarklet that I can click to change all text on a page to be in Comic Sans. 😀

If you drag this Comic Sans link to your bookmarks toolbar and press it on any page you will be able to view the web how it should be at the click of a button.

Enjoy. 🙂

MySQL annoyances

I’m working on creating a table in MySQL for keeping track of some votes. I want to limit the data so that someone on a specific IP, with a specific user agent (browser) cannot vote more than once for a specific item per month. The constraint at the table level is just to stop it filling up with false entries submitted by script. There will be client-side constraints too, for regular users.

To set this up I created a table for the votes with the following fields: vote, ip, ua, item_id, created_at.

I decided I could probably do it all with a simple UNIQUE KEY, but half way through writing it I realised that I only wanted part of the created_at field to be taken into account because people should be able to vote for the same item in another month, but not another day in the same month. I wondered if I could include a function in the unique key like this:

UNIQUE KEY `vote_constraint` (`item_id`, `ip`, `ua`, YEAR(`created_at`), MONTH(`created_at`))

Sadly that’s not allowed.

I decided to include year and month columns in the table so that I could stick them in the unique key without using a function. Since the month and year will always be the current month and year I figured I could set up a clever default based on the created_at value, but that didn’t work either. MySQL only allows you to use constants as defaults (barring a couple of half-constant keywords like AUTO_INCREMENT and CURRENT_TIMESTAMP).

I looked into triggers, which I have never used before. The theory is that you can create a trigger that is called when certain events happen. In my case I would want to create a trigger that is called BEFORE INSERT on the table that sets the year and month values to the right thing. This would allow me to insert a row and get values inserted by default. Frustratingly MySQL doesn’t really give a crap about the name of the trigger. BEFORE INSERT actually gets called AFTER checking whether the data you’ve passed is valid or not. So I’d have to pass in a valid value for each field before the trigger (that would create valid data) would even be considered, rendering the entire trigger pointless.

There are many reports of this being an issue over the last 7 years or so (yeah, honestly), and there have been patches submitted to fix this since May last year, but it’s not out there in the current version, and it might not appear for quite a while in the stable MySQL we use at work.

So despite everything it seems like I might as well just create the values in my Perl script and pass them through to MySQL to save it having to think.

Hey Motorola, I won’t be buying a Xoom

I was just reading about the Motorola Xoom tablet. It runs a new version of Android intended specifically for larger screen devices rather than mobile phones and it looks pretty cool in the bits I’ve seen.

As much as I want to buy one of these things I’m afraid that I’m not going to. Why? I own a Motorola Milestone.

My Milestone was advertised as Flash Ready™ when I bought it many months ago. Sadly Motorola still haven’t managed to get Android 2.2 on it, so I can’t actually view any Flash content at all. It’s not that I really care about Flash, but more the fact that Motorola lied to me. They lied to owners of some of their other Android phones too. Some people are stuck on Android 1.6 forever even though their phone is only a year old. It’s just not in the spirit of Android, as far as I’m concerned.

I will be patiently waiting for HTC or Google to release a tablet before I consider buying one.

I bet I’m not the only Motorola customer who won’t be buying anything else from them ever again.

Problems with LOVEFiLM on PS3

I recently subscribed to LOVEFiLM again because I saw that I could stream movies to my PS3. I was mostly pleased with how the application worked initially, but now I’ve been using it for a while there are a few things that bother me about it.

A-Z should mean A-Z
When you view a genre of movies you can view the most popular ones, the highest rated ones (usually pretty much the same list), or you can choose to view the entire genre A-Z. I decided I wanted to view all of the comedy movies on there to look for something a bit less popular. I scrolled down until I reached somewhere in the B section of the list and then it stopped scrolling. The problem is that the application only lets you view 100 movies in a list. No more get added to the list when you near the bottom, and there’s no pagination at all. This means you have to search for a film specifically if its title comes after the beginning 2 letters of the alphabet and it’s not in the popular/highest rated lists. That brings me neatly to my next gripe.

Searching is clunky
Rather than use the PS3 system keyboard there is a very limited keyboard in the application. Every time you press any key the list of matching movies is fetched again. When the list of movies is being fetched the keyboard no longer responds properly. If I have filtered the results by clicking on the “Watch Now” tab then it flicks back to all movies before showing me the results. On most sites with an auto-complete field on the web there is a delay of half a second or so before the search begins. This helps to prevent extraneous searches, and improve the experience for the user. A delay of a second or so without the focus moving or a button being pressed on the keyboard before a search is sent would help greatly. I could type in a more specific search and find what I’m looking for much more quickly. If I’ve previously chosen the “Watch Now” tab then this should be the default tab that I’m shown when the results are returned.

I can understand that the keyboard isn’t the default system keyboard for the PS3 because LOVEFiLM’s keyboard allows a narrowing down of results in something like real-time, whereas the PS3 keyboard takes over the whole screen and only fills in the text field after you’ve finished typing. So perhaps there’s some work that could be done by Sony there to have a keyboard as a popup when in a text field or something. Perhaps LOVEFiLM could allow me to use the system keyboard if I want to. It would certainly make the search section easier to use for now.

Default PS3 controls are replaced
I use my Playstation to play a lot of media. Whether I am watching a DVD, Blu Ray, or downloaded video I know I can fast forward by holding down R2, rewind using L2, and pause by pressing Start, which is pretty much universal in the console world. In the LOVEFiLM application fast forward is the right-direction on the d-pad, rewind is left, and pause is the X button. This was quite confusing at first and I always pressed the wrong button the first time. Why is there a disagreement? Don’t Sony have guidelines similar to Apple/Google when it comes to apps for their systems? Things should behave in a similar way across a platform. To do otherwise just adds problems for the user.

No personal recommendations
When it comes to picking movies to watch you’ve either got to know what you want and search for it, or find it in the Most Popular section, the Highest Rated Section, or the collections. LOVEFiLM have a bunch of ratings from films I’ve rented from them. They suggest films that I might like to watch when I visit their website. Why not pass that information over to the PS3 application? In fact, why not just return a section called “Films on your Rental List” that are available to Watch Now? The information is available with a simple call to their API.

I’m sure the whole thing will get better with updated versions of the software, and it is usable for now, but it could be so much better.

Twofifty Facebook app

I recently went to update my progress on IMDb’s top 250 films on the handy Facebook app by Tim Broddin only to find that it redirects to a domain that no longer seems to be working. I suspect this app has run its course now. How very annoying. The reason I’m most annoyed is that I used to be a member of twofifty.org a few years back. This site was also created by Tim Broddin, and it was also allowed to expire, so I lost track of my progress.

I wrote my own version to use for a while, but then this Facebook app turned up and I figured that was going to be a good replacement. How wrong I was.

I’m considering writing my own, again, and I will keep it running because I want to use it.

Subscription TV over the Internet

I recently signed up for Lovefilm again when I saw that I can stream a bunch of stuff via my PS3. They’ll also send me DVD/Blu-ray/PS3 games in the post and I can send them back when I’m done. I pay £14 a month no matter how much I watch, which seems like a good deal to me.

I pay for an Unlimited card at Cineworld so that I can go and see as many films as I like at the cinema for £13.50 a month. Cheryl and I tend to go to 4 or 5 films a month, which makes it considerably cheaper per film than not having the card and seeing the same number of films. We get to see all of the latest films as they come out in awesome quality complete with surround sound (and idiots with their phones on).

I pay £10 a month to Spotify so that I can stream whatever music I like (with very few limitations) to my work and home computers, and also my mobile phone without any advertising, at a high quality.

When I want to watch a TV show I have to watch it as it plays out on TV with advertising, or record it with a DVR when it’s on so I can watch it later. Other than sometimes on Virgin there seems to be no concept of an on demand catalogue of shows. Why? I would quite happily pay £15 a month or so for an archive of TV shows to be available at the press of a button on a variety of my devices in different locations. If LoveFilm had rights to more shows I would definitely go there for them, but sadly they don’t.

An additional problem is that I am a fan of shows on Facebook, so I get all sorts of updates as the latest episodes of How I Met Your Mother or House get shown over there, and then I get to wait 6 months for the episode to air over here on a channel (as part of a package) I have to pay Sky to watch even though I only want 1 or 2 shows.

Why would I do that? Why should I do that? If I want I can download the entire episode within hours of it airing in the US with ads removed and play it on my PS3, my phone, burn it to DVD and play it basically anywhere, etc..

It is obvious that the subscriber model works, I subscribe to almost all of my media these days. If you guys make it available in a sensible way then I will happily give you my money for it. If you continue doing it this way then people will continue to make it freely available. If you want to succeed you have to make your stuff as available as TeH pIrAtEz do, but legally and for a decent price.

Old web techniques

I often go around looking at the source for the websites I frequent. It’s not very interesting to most people, but I am not most people.

Something I’ve noticed a few times in the last couple of weeks is that sites are suddenly using an evolved form of a script I was very familiar with many years ago:

if(top.location != self) {
  top.location.replace(document.location.href);
}

That’s how it appears on Last.fm. Essentially the script checks to see if the page is contained within another page, and then takes the user to the page by itself if it is. This gets rid of page headings you sometimes see from sites like Digg and Facebook when you follow a link from there.

The script used to be used to make your own site break out of frames put there by sites like Geocities (R.I.P.) before domains and hosting were quite so affordable. Obviously now there are basically no sites on the Internet that use frames in the traditional sense (that’s a good thing), but the modern equivalent (iframes) are pretty much all over the place. They tend to be used for displaying external content rather than the layout of internal content, but the idea is mostly the same: multiple documents on one page.

I just find it somewhat interesting that “web 2.0” seems to be encountering the exact same things I really hated about web 1.0 all those years ago.

Facebook share button shows no count

Share

I was working on adding a Facebook Share button to blog posts at work and I couldn't seem to get it to display the speech bubble with the number of shares without clicking on the icon.

I did a whole bunch of searching and it turned out that it was caused by some Javascript from Facebook that only displays the count if it's more than 3. I don't really like the inconsistency of that, so I looked for a way to get it displayed even if it's zero. A guy named Patrick Kelly suggests getting your own local copy of the Facebook Javascript (FB.Share) and modifying the displayBox() function call so it shows any number. This is fine for now in that it will work, but as Patrick points out on his blog, it will potentially break if Facebook update their API, or make other changes to the underlying code.

I decided to pick apart the code and come up with a solution that doesn't involve the same issues. The fix is fairly basic. You just need to include the share button in the same way as Facebook tells you, and then insert the following Javascript after that:

<script type="text/javascript">
var buttons = document.getElementsByName('fb_share');
var count = buttons.length;
for(var i = 0; i<count; i++) {
  var data = FB.Share.getUrl(buttons[i]);
  if(FB.Share.results[data]) {
    buttons[i].fb_count = FB.Share.results[data].total_count;
  }
  FB.Share.displayBox(buttons[i], 0);
}
</script>

Hopefully that's a bit tidier than copying and editing the FB.Share file. It also means that you'll benefit from a cached version of the code being presented to the user if they've been on any other site with that button. A fairly tiny benefit, but every little helps. 🙂

Patched Digg Digg WordPress plugin

I was adding a Digg button to the company blog using the Digg Digg plugin when I found an issue that meant that the post ID was lost by the time it reached Digg’s description page.

It seemed that the plugin wasn’t escaping the = symbol in the URL which caused Digg to not understand the query. I added the following code to the construstURL function in dd.class.php file:

$url = str_replace('=', "%3D", $url);

Everything went through correctly, and so if you’re having a similar issue then you might want to check that you’re properly escaping the URL you’re passing to Digg, especially if it has parameters.