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.

Tweet Your Heat: Controlling Nest via Twitter

January 24th, 2015

TBC

How To: Write a RTing Twitter bot in PHP

January 19th, 2015

File this one under “stuff I’ve been meaning to look up for ages”: yesterday I finally sat down and wrote a Twitter-bot. You know the kind – a dedicated account that looks for updates containing a certain word or phrase, then retweets them – I often end up being tweeted by @redscarebot, for example.

Anyhow, here’s how to write your own, in just a few lines of PHP. You’ll need:

1) A server running PHP and MySQL (I set up an Appfog instance)

2) A Twitter account to post from, with a mobile phone number entered in settings

3) A computer somewhere to execute the script every X minutes via CRON

So, with all that in place: download and extra the TwitterOAuth library, then start a new PHP file. Require it:

require "twitteroauth/autoloader.php";
use Abraham\TwitterOAuth\TwitterOAuth;

Register an app at apps.twitter.com, then define the secrets required to access the API in your code:

define('CONSUMER_KEY', 'here');
define('CONSUMER_SECRET', 'here');
define('ACCESS_TOKEN', 'here');
define('ACCESS_TOKEN_SECRET', 'here');

Define your connection:

$twitter = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET);

And then you’re ready to make a call to the Twitter API. You’ll probably want to search:

$sstring = '"sleepy cats" OR kittens';
$searchresult = $twitter->get("search/tweets", array("q" => urlencode($sstring), "since_id" => $since, "count" => 100, "result_type" => "recent"));

Note the variable $since – this is the ID of the last tweet processed by the bot on its last execution, used to prevent retweeting the same stuff over and over. Store and retrieve it from MySQL.

You know have $searchresult, and you’ll want to get the tweets out of it:

foreach($searchresult as $tweet) {
$tweettext = $tweet->text;
$tweetid = $tweet->id;
}

.. and you can do whatever you want with those. Want to post a message, probably created by trimming and formatting selected content from the search output? If you have your message in $somestatus

$postthis = $twitter->post("statuses/update", array("status" => $somestatus));

.. and that’s about it. Update your $since ID in MySQL, and close up the PHP file. Call it by CRON every X minutes to check for and retweet new messages.

This is only just barely scratching the surface, of course. Each tweet object contains loads of information that you can process to do more interesting things – see the API reference for details.

The Robot Reporter

January 18th, 2015

Hello. If you’re visiting this post, you’ve probably spotted @theroboreporter on Twitter.

This is an experimental twitter-bot, designed to track breaking news stories by tracing the photos that journalists want to republish.

More details TBC once it’s fully operational.

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.