Updating Remote Recorder

My job has recently changed from mostly programming in Perl to mostly Java. As such I’ve been playing around with Java at home a bit too.

A couple of weeks ago I got an email from someone who bought my Sky+ Remote Recorder app asking if I’d be updating it. I replied saying that I wouldn’t because I didn’t think it was worth the effort when Sky have their own app and at least my asp still worked for people with older versions of Android.

A couple of days ago I read that Sky’s apps got pulled because they got hacked. I cursed myself for not having bothered to update my own app and decided it would be good practice at Java and would be a welcome improvement to the people who still use my app regularly.

I’ve spent my evenings working on a new version this week. It’s coming along quite slowly because I’ve got no experience of most of the new Android development practises or designs.

I hope to have a very basic ugly version working by the middle of next week and then spend some time polishing it and doing what testing I can on the devices at my disposal before releasing it.

Rik, snow, Android

Rik moved down to London not so long ago and he’s been staying with Cheryl and me since then. It’s been kind of weird having someone else in the house again, not in a horrible way, just different. I’d forgotten what it was like. Anyway, glad to help him out in what is normally a very difficult and expensive thing to do.

It’s cool having him at work too, especially since Dan is abandoning me for Australia in a matter of weeks now.

It snowed in London for the first time this winter over the weekend. Cheryl, Charlotte, Aron, and I spent a good hour or two on the roof terrace in the middle of the night throwing snowballs and building snowmen. It was a lot of fun. I was soaking wet when I got back into the apartment, but it was enjoyable.

I’ve been working on one of my Android apps quite a bit recently. It’s really frustrating me at the moment though because things aren’t working how I’d expect them to. I think it’s just the dimension definitions that are making it look so horrible, but I can’t be sure. It also seems that there’s no font anti-aliasing on my phone. It could just be the dimensions and some horrible scaling though. Oh well.

Dots

Last week Dan and I were sitting down at lunch and we somehow got onto the topic of creating a website that just printed dots to the screen. As usual we got a bit carried away with the idea and decided that each dot could be an object and could be stored in a database and accessed through an API so that all created dots were stored for the future.

What began as a silly idea at the lunch table soon turned into a quick fun little project. Dan wrote most of the front-end code, I wrote most of the back-end API stuff, created the database, and registered a domain pointing to my VPS. We posted about it a fair bit over the weekend and it turned out to be quite popular among a couple of hundred people.

We hit our target of a million dots in a little over 2 days, and were both amazed it happened so quickly. Especially when you consider there is little-to-no reason for anyone to visit the site at all.

Anyway, we’re making changes to bits and bobs all the time at the moment. You can see the stats for your browser as well as the total on a new page, and there might be other little bits of analysis coming up in the future if we don’t get completely bored and do something else instead.

Create some dots.

Getting settled

I’m starting to get things together at work now.

I’ve got a computer to call my own and I’ve taken in my keyboard, a new mouse, and my headphones. I’ve started to set up my environment so my keyboard shortcuts work. I’ve switched the Caps Lock and Escape keys so I can use vim comfortably again. It messes everything up for other people who try to use my computer though.

I am looking forward to getting to work tomorrow and getting some proper code written. I haven’t written any for a while and I’m starting to wonder if I’ll be able to remember how to do it.

There’s a barbecue at work tomorrow afternoon after an all-hands meeting. It’ll be quite nice to see people ever-so-slightly out of the work environment, even if it is just in the car park. 🙂

I’ve started reading on the tube so it’s making the journey seem faster, and helping me get through my massive reading list. I’m looking forward to making some serious progress over the next few months. For now I’ll just be quite pleased to finish A Room With a View and then maybe renew my efforts of defeating Ulysses.

So yeah, basically things are going well. 😀

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. 🙂

New job

Since Cheryl was looking like getting a job in London I’ve been looking for one myself. I sent an application to LoveFilm after thinking about how much of a good fit it would be for my interests. They’re a Perl house, so I know the language. They’re a company that deals with films, which I spend a lot of time and money on. The Playstation 3 app kind of made my mind up because I thought that it would be something I would like to work on.

I had to complete a programming test before anything else. After doing that I thought that I hadn’t done very well, but apparently I was worrying over nothing. I was offered an interview last Friday and so I went out and bought a new suit, got a haircut, had a shave, and went down there.

The interview itself went pretty well. I had a technical test/interview with two of the developers there, and then I had an interview with the head of the digital distribution team. I felt fairly comfortable during most of this process. The only issue was the pressure of being tested on programming stuff without a computer nearby. I don’t like writing SQL on paper. I much prefer to try a query once, then adjust it if it’s wrong, but oh well.

After the interview I was told that I should hear back fairly soon, so I went away not knowing what would happen, or how long it would really take.

I met up with JonP and we went for some drinks before my train at 20:30. At around 20:15 we realised that there was no chance of me making the train to Nottingham, so JonP offered to let me stay at his. We left the Bull in Shepherd’s Bush and went to the London Cocktail Club for a couple of drinks. Then we headed to Soho to a weird bar that serves drinks infused with garlic and stuff. We each had a shot of tequila infused with chilli. It was disgusting, so we chased it down with a beer.

On the way out of that bad JonP realised that he no longer had his bag. We headed back to the London Cocktail Club, which was closed. JonP rang their phone and left a message while I banged on the shutter door. Eventually someone came to the door to clean the steps with a mop, and thankfully JonP’s bag was still in there.

We caught a bus back to JonP and Emma’s apartment and I fell asleep fully suited up. I woke up a few times the next morning, then eventually noticed that I had a missed call from my contact at the agency. He said he’d got some feedback for me, and asked me to call him when possible.

I called him back and he told me that the interview was positive and that I had been offered the job. 😀

I rang Cheryl and my immediate family to let them know how it went, and started to feel pretty happy.

We decided to go and get some Mexican breakfast at Wahaca. JonP got as far as the DLR station before he decided to go back home to sleep. Emma and I powered on through. We decided to begin the drinking straight away. We ordered a tequila and a Corona, and during the course of eating our lunch we also ordered another tequila.

At about 2:30 Emma had to go to meet some of her friends so I decided to wander around London on my own for a while.

Cheryl called just as Emma left and said that she was thinking of coming down to London for the night. We discovered that the coach would be much cheaper, and Emma and JonP were fine with it, so we made plans.

I decided that I wanted to read a book and enjoy the day. I bought A Room with a View by E. M. Forster and made myself comfortable in Costa Coffee. I was reading in there for about 4 hours while Cheryl made her way to London. JonP’s band were playing a gig in Camden so we arranged to meet over there. I set off for Camden and met Cheryl at the tube station. She’d just seen JonP walk by with his guitar, so we headed off looking for the pub.

The venue was pretty small and incredibly warm, but the gig itself was good. 🙂

After the gig we went back to JonP’s apartment and Emma was asleep on the couch. She woke up after a little while and went to bed instead. We stayed up and had some pizza and stuff from Pizza Planet, and then called it a night.

We left fairly early on Sunday so that we could have some of the weekend chilling out at home. It was a really good weekend. 😀

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.

Kaboom!

After a brief conversation with a colleague I decided to write a little bookmarklet that you can use to make your days just a bit more fun.

Everyone knows that when Batman hits someone there’s a big Kaboom! or Kapow!

If you drag this Kaboom! link to your bookmarks toolbar and press it on any page you will be able to Batman punch things at the click of a button.

A man being punched by Batman

Batman punching some poor guy.

The bookmarklet is a little bit of Javascript that generates a random selection of stars using the canvas tag introduced in HTML5. That means it might not work on rubbish old browsers, but should work just fine if you’re living in the second decade of the 21st century.

Gmail strips HTML emails

At work we have a section where people can set up emails that go out to their own customers (we have a reseller scheme). There are placeholders like [NAME] and [BASKET] that the customers can put in their email templates which we then replace with the actual information when we send the emails out.

Recently I’ve been asked to add some IDs and classes to the HTML elements we generate for the placeholders so that the whole section can be styled by our resellers.

I quickly added a bunch of classes and then began testing with a <style> tag in in my email. I spent quite a while wondering why it wasn’t working correctly before the DOM Inspector showed me that Google strips the IDs of elements. I then went on to read that they also remove all <style> content. You also can’t use a <link> tag to include a stylesheet (which is a good thing).

The only way to style email for Gmail is apparently to use the style attribute for each element. This is fine if you are fully writing the emails yourself, but our resellers never even see the actual tags, they just put in a placeholder. That leaves them no way of adding a style attribute to a section, which means we can’t let our resellers fully style their emails. Ridiculous.

Thanks Google.

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.