Spider by Tom Royal on Flickr
Spider by Tom Royal on Flickr
Dubrovnik by Tom Royal on Flickr
Dubrovnik by Tom Royal on Flickr
Dubrovnik by Tom Royal on Flickr
Dubrovnik by Tom Royal on Flickr
Dubrovnik by Tom Royal on Flickr
Dubrovnik by Tom Royal on Flickr
Dubrovnik by Tom Royal on Flickr
Dubrovnik by Tom Royal on Flickr

You're using a very old version of Internet Explorer which can't show the photos that should be in this box. Please consider upgrading to a newer version of IE or an alternative such as Firefox. Thanks.

App Preview Videos for Newsstand

October 30th, 2014

If you're promoting an interactive magazine – and if you're putting a magazine on a tablet, it really should be interactive – nothing really shows it off like a video, so we've been producing preview videos of our apps, like the one above, for some time. But with iOS8 comes the new option to embed a video right into your store listing, and a few people have asked how to do that – so here's a quick guide based on our experiments at Apptitude Media.

A few notes up front:

1) You need a Mac running Yosemite*

2) In our experience, the app preview videos for Newsstand apps only update with a new app version. This is inconsistent and strange, but there you go.

3) App Video Previews are new, and Apple has already changed the video spec once, so this may become out of date. If so, I'll attempt to update it as soon as possible.

That said, here's how to do it.

1) Prepare your Content

App previews are limited to 30 seconds – as in, anything longer is automatically rejected. That's not enough time to show off anything like a whole issue of a magazine, really, so you'll probably want to pick and choose your content. We're using Mag+, so I quickly used the Production Tool to create  a short preview of our current issue:

psuk_short

.. and sent that over to my iPad via WiFi. You could alternatively just pick a few pages and click "Review Selected".

2) Rehearse

This sounds dumb, but there's not much point making recording after recording as you learn how quickly you can swipe through pages, and where the best content to highlight can be found. You'll be able to edit later, of course, but the better your source recording, the less work that'll be. So grab a timer, and swipe your way through the pages a few times until you're ready.

3) Record

Connect your iOS device and Mac via Lightning cable. Open Quicktimer Player on the Mac. Choose "New Movie Recording" from the File menu, then when the record window appears click the down arrow next to the record button. Choose your iOS device, which should be listed here.

record

Once you see your device on screen, as shown above, click Record and swipe through your app. When done, click the Stop button. How you do this part is up to you – for most of our videos I want to set the results to music, so we use a robot (seriously – it's made of Lego, you can hire it) to swipe through at an exact pace.

Once you're done, click Save from the File menu – I just dropped the resulting Quicktime file on my desktop, because I'm lazy.

4) Edit

The next step is to edit. If you're using Final Cut X, open up a new project and drag your video onto the timeline – you'll be asked to set the project properties:

fcx1

For an iPad this should be 900 by 1200 at 30p - see Apple's document here for iPhone resolutions. If you're using Premiere Pro, use these values as your sequence settings.

Whatever software you use, though, a warning: remember to detach and remove the audio included in your iOS screen recording, as this will be the sound of you tapping and swiping, plus background noise and breathing – it sounds more like a nuisance call than anything you'd want to release into the app store.

5) Export

Once you've removed the audio, cut to 30 seconds and made any other edits you want (cuts, titles, music – whatever you want, really) you're ready to export. In Final Cut X, go to File, Share, Master File, and just use the default Quicktime settings to render out a finished file. In Premiere Pro use Export Media as usual, then set the output to H.264 in MP4 with AAC audio at the desired resolution:

Screen Shot 2014-10-30 at 12.19.55

Once your video is exported, open iTunes Connect in Safari (you have to use Safari on Yosemite, sigh) and create a new version for your app – you can add a video to your current version if you like, but we found that it didn't appear until our next binary was reviewed and approved. You'll see an option to add the preview alongside your screenshot images:

safari

So, choose your video file, and pray to the deity of browser-based uploaders that it makes it safely to Apple's servers in one try. When we first tried this a few weeks back Apple seemed to be enforcing a very strict filesize limit, which necessitated recoding the video over and over at progressively lower quality until it was accepted (by which time it looked, frankly, pretty rough), but this has now been raised to 500MB.

Once uploaded, you'll see an option to "Edit Poster Frame" option – use this to set the poster image that'll appear before the video is played:

setposter

.. and then save your app version. When you send this new app version off for review, and it's approved, the preview video should appear alongside your listing. Congratulations, you're done.

And finally, a word from my sponsors: I look after this stuff for Apptitude Media, where we turn print materials and publications into interactive apps for customers ranging from publishers to banks to film festivals and catalogues. If you have a publication that you'd like to see on the App Store, we can help – just say hello here.

 

* Yosemite is great – it even works better than Mavericks with our Mavericks server.

The Tour de France Peloton hits London

July 7th, 2014

The Tour de France Peloton, in a GIF (might take a while to load). Snapped it in one burst on my iPhone as they passed Poplar.

Japan on a Budget: Sapporo to Ueno on the Hokutosei

June 8th, 2014

For Ueno

Having returned from Furano to Sapporo, I needed to get back to Tokyo in time to fly back home. There's one simple and obvious way to do that: domestic flights from New Chitose airport to Haneda run just about every 30 minutes, take 90 minutes, and aren't too expensive. Instead, I took a 16 hour long journey on a slightly knackered night train.

The Hokutosei, which runs from Sapporo to Ueno and back, is one of a dying breed of 'blue train' sleeper trains. Once to be found all over Japan, with more than 25 services, they're now down to four – all of which are due to be stopped soon, making them popular with the nostalgic and trainspotters alike. And with one of them running exactly where I wanted to go, I figured I'd catch one while I could. Besides, anything's more fun than an airport, right?

Getting a Ticket

I arrived back in Sapporo after stopping overnight in Asahikawa*, and already prepared with a ticket for the night's train, which leaves at about 5pm from Sapporo's main JR station. Tickets present something of a problem for tourists: you'll absolutely need to have one in advance – and they sell out pretty quickly – but that leaves you with a choice of booking online and paying full fare, or booking late using a Japan Rail Pass to cover most of the cost. I did the latter, paying about £60 for my berth a week before departure.

There are five types of accommodation on the train:

1) Royal. Ludicrously expensive (about 18,000 yen just for the room), and there are only a few of these.

2) Twin Deluxe. Apparently these have sinks. About 14,000 yen for the two of you.

3) Duet – a normal twin room for around 12,000 yen.

4) Solo – a normal single compartment for the standard fare of around 6500 yen.

5) B class berth – one of four beds in a shared compartment, which bizarrely costs the same as a Solo room.

Having booked late, guess where I ended up.

Welcome to B Class

Waiting for the train, I noticed a trend: everyone waiting to board was either three times, or half, my age: with the exception of one particularly earnest train enthusiast, everyone else was either a pensioner or looked like a broke student. But no matter, because at that point a huge – and, yes, really very blue – train clanked into the station.

People rushed to the front to take photos, and I followed to take a look, only to be a bit surprised – in the place of the boxy electric train I'd expected, it was being towed by two giant, chuffing diesel contraptions that looked like they should be pushing heavy goods. Turns out the service has to change trains somewhere en-route (I'm guessing near Aomori) as it moves onto electrified lines, every single trip.

b class

But I had to get on board, and find my berth. It turned out to be in the car nearest to those two giant diesel monsters (makes sense, I suppose – the posh rooms get the quiet end), and in a room shared with two very polite, and very quiet, students – one of whom seemed to fall asleep pretty much as soon as the train started rolling.

The amenities of a B class berth, as pictured above, are: some space in the luggage store above the compartment door (that's my backpack), a light with two settings, a sheet and duvet, a huge pink curtain that pulls around the bed to give you some privacy, and a JR-branded yukata. The bed itself is fine, if not quite long enough for me to lie down straight. You can sleep in it, but you won't want to pass all 16 hours there. I made for the lounge.

Lounge and Facilities

The Hokutosei has a lounge car, a dining car and a vending machine – all of which are found at the posh end of the train, so to get there I had to wobble down something like ten corridors, and between a lot of carriages. This gives you a pretty good overview of the train's fittings: the cheap bit seems to have emerged unchanged from the 1970s, while the posher areas must be a decade newer maybe. If you can't use a Japanese style toilet in a train that's jumping around from side to side, you'll need to avoid the cheap berths.

The lounge car has seating for maybe 20 people at most, with some tables on one side and a long bench table down the other side. On my trip, it was mostly empty, except for the young train enthusiast, who sat by the door, greeting everybody with the same "北斗星、最高ですね" (The Hokutosei, isn't it the best?") – even if it was the second time in as many minutes that they'd passed by.

そうですね、we all agreed, all the time. Isn't it just?

At one point, I tried to strike up a train-related conversation: what about the new Shinkansen service, wasn't that due to start quite soon?

Oh, he explained, the Shinkansen isn't the same.

Train-fans aside, people who had compartments tended to stay in them, except for a brief crowd just before "Pub Time" – when you can buy food without a reservation – opened in the restaurant.

Hokutosei

The near end of the lounge car, from where this photo was taken, also holds the train's other key amenity: showers. A few hundred yen buys you a little magnetic card, and a half hour timeslot in one of the two showers – during which you'll get six minutes of hot water (a red LED countdown keeps you on your toes). You need to take a towel and wash kit.

And beyond that, there's the restaurant car. In the early evenings, this is the "Grand Chariot" restaurant, for which you'll need a reservation weeks in advance – one of the men on the train, who didn't have a reservation, was very excited to have obtained the menu card for that evening. After that it's the aforementioned "Pub Time", which attracted a rush of pensioners, and in the morning you can buy a pretty decent breakfast for £15 or so, killing 45 minutes as you do – no reservations required, but there aren't many seats (I'd guess around 20) so it gets quite crowded.

Outside of those hours, the restaurant sells the shower cards, and there's also a trolley that rattles through the train selling beer and snacks – oddly, though, no booze in the vending machine. More surprisingly, a JR man passed through the train selling Hokotosei souvenirs – wallets, keyfobs, and the like – attracting plenty of business.

Getting some Sleep

After maybe five hours in the lounge, watching the sun set somewhere near Toyako and then nursing a book and a beer, I hit the sack – and, with the aid of alcohol and earplugs (grabbed some in Sapporo, in anticipation of a long, noisy night), I was surprised to wake up fairly refreshed around 7am as the light bled through the curtains.

The train makes a few stops as it heads down Honshu – you could disembark at Sendai, for example, if you could wake up on time – but the last four hours or so see it rumbling through the outskirts towards Ueno. People shuffled up and down the carriages in pyjamas, watched their watches, clicked away on cellphones. It's about this point that you realise that you could have just woken up in Sapporo, nipped to the airport from there, and you'd still beat the train to Tokyo.

hoku

But that wasn't ever really the point. As I dragged my backpack off the train at Ueno station, a crowd of people had gathered to take photos of its arrival, and I had begun to see why: like the Hakkoda Maru before it, the Hokutosei is a service out of time – a fixture for decades, but soon to be gone and largely forgotten.

When the Hokkaido Shinkansen does soon reach up from Aomori to Hakodate, Oshamambe and Sapporo, it'll be great – fast, smooth and reliable, getting you from Tokyo to Sapporo, or back, in less than half a day. But I doubt anyone will ever spend that whole trip watching the door and greeting complete strangers: "新幹線、最高ですね"。

Because, like he said, it won't be the same.

 

* Asahikawa has a zoo (I'm not really keen on zoos), an enormous and brand new JR station roughly the size of Paris and a bus system so fantastically complicated that, after two hours attempting to make my way to the Yukaraori cultural museum outside town, I gave up and decided to just find an izakaya. If you do find yourself there, a word of warning: the 'Buses by location' sign in English is hopelessly out of date – ignore it (and the buses in the direction of the Yukaraori leave from the a stop just in front of the Chuo highway bus terminal).

 

Futzing with Swift and Cocoa

June 6th, 2014

I've never learned Objective C – my iOS stuff is written in Titanium (essentially Javascript, because anyone can play guita.. uh, write Javascript), and my personal tools for Mac are all scripts to run from Terminal. So the idea of a simpler language that could be used for both iOS and Mac OSX is pretty attractive to me.

Problem is, I've never used Xcode, or the Cocoa libraries before. But I thought I'd give it a shot. Based on a few hours of futzing around, here's what I've found – my planned starting point was some button handlers, text inputs, and then some XML file manipulation.

Button Handlers

You can easily drag-and-drop a button onto the window in the Interface Builder view. To handle it, you can add a handler to AppDelegate.swift. First I imported Cocoa and Foundation:

import Cocoa

Then, inside the class AppDelegate:

@IBOutlet var window: NSWindow
@IBOutlet var testButton: NSButton

Then, after the applicationWillTerminate function, add a new function to be called on button click:

@IBAction func buttonclick1(AnyObject) {
  // do stuff
  println("button clicked")
}

You can then link the button to this function from the Interface Builder (it's a control-key-and-drag job).

Text Fields and Alerts

After dragging two text fields onto the window in Interface Builder, I added IBOutlet variables for them:

@IBOutlet var text1 : NSTextField
@IBOutlet var text2 : NSTextField

It's possible to get these – and link them up – automatically by control-dragging the text fields from the Interface Builder into the right area of your code. That done, you can then a value from one field, and put it in the other one:

var fromtextbox = text1.stringValue
text2.stringValue = fromtextbox;

It's easy to display it in a simple alert box:

let myPopup:NSAlert = NSAlert()
myPopup.messageText = "Modal NSAlert Popup";
myPopup.informativeText = "Echo that variable: \(fromtextbox)"
myPopup.runModal()

Because who doesn't love extraneous alerts. Or, if you need an OK / Cancel:

let myPopup:NSAlert = NSAlert()
myPopup.addButtonWithTitle("OK")
myPopup.addButtonWithTitle("Cancel")
myPopup.messageText = "Are you sure?";
myPopup.informativeText = "Do you really want to do that?"
if myPopup.runModal() == NSAlertFirstButtonReturn {
// yes, they're sure.
}

Else, handle the cancel action, etc.

A File Selector

I want to choose an XML file, in order to later manipulate it. I found that I could get a file dialog box like this:

let myFiledialog:NSOpenPanel = NSOpenPanel()
myFiledialog.allowsMultipleSelection = false
myFiledialog.canChooseDirectories = false
myFiledialog.runModal()  
var chosenfile = myFiledialog.URL // holds path to selected file, if there is one

And to check that a file has been chosen:

if chosenfile {
// do something with it
}

Maniuplating XML

Next up is opening, reading and manipulating that XML file. Getting a local file to manipulate it is pretty easy:

let xmlurl = "/var/tmp/file.xml" // or from your file chooser
let nxmlurl:NSURL = NSURL(fileURLWithPath: xmlurl)
var xmlasstring:NSString = NSString(contentsOfURL: nxmlurl);

Once you have the XML as a string, you could feed it into a proper XML parser – but I just wanted to grab a few values, so used some string manipulation using NSRange objects. You can also bust a string that's delineated (in my case a com.something.something GUID) into an array of values really easily:

var substrofguid:NSArray = currentguid.componentsSeparatedByString(".")

.. and then when you're ready to write the string data back to an XML file:

var myfileman:NSFileManager = NSFileManager();
var xmldatatowrite:NSData = myeditedstring.dataUsingEncoding(NSUTF8StringEncoding)
var writethefile = myfileman.createFileAtPath("/var/tmp/file.xml", contents: xmldatatowrite, attributes: nil)

You can then check that writethefile variable to see if the operation completed properly.

QNAP Nas to Nas RSYNC – Stuck at 0%

May 29th, 2014

Something I learned, and which may be useful to someone else:

One of Apptitude's servers is a QNAP NAS running firmware 4.0.7. Every 24 hours it runs a backup, via RSYNC (SSH encrypted) to a remote site where we have another QNAP.

Last night, the backup job glitched – no errors were logged, but it just sat uselessly at 0% for six hours. Here's what I learned:

  • The QNAP Rsync system can only handle file paths up to 260 characters
  • It doesn't fail gracefully if you exceed this

To find the offending files, here's what I did (on a Mac, in my case, via Terminal):

  • cd to the Volume root
  • find . > filelist.txt
  • perl -nle 'print if length$_>260' filelist.txt

Or, thinking about it, you could probably do it in one command:

  • find . | perl -nle 'print if length$_>260'

Once done, remove or rename the offending files. In my case the names were too long for the Mac to handle, even via Terminal – if that happens, SSH into the NAS and delete them there.