CIRP: iPhone 6 Plus sales are jumping 🔗

The Loop:

iPhone 6 sales dropped from 56% down to 53% and iPhone 6 Plus sales jumped from 22% to 29%. The survey is based on 500 Apple customers. Large enough to be a trend indicator, small enough to have a significant margin of error.

I am surprised there’s a jump in iPhone sales in the March–June quarter, but I’m not surprised that the 6 Plus is the one that increased.

I was one of those who laughed at the larger size and wondered who would buy such a thing. But turns out, I got it wrong. From what I understand, the Plus is better.

I still prefer the iPhone 5 generation size, but when it comes between the iPhone 6 and 6 Plus, the larger one is easier to use. The middle ground of the iPhone 6 compromises too much, and it still doesn’t feel comfortable to hold (also, it’s too easy to drop).

If given the choice again, hands down I’d pick the Plus.

Why the Great Glitch of July 8th Should Scare You 🔗

Zeynep Tufekci, on why we should worry about the state of software:

From our infrastructure to our privacy, our software suffers from “software sucks” syndrome which doesn’t sound as important as a Big Mean Attack of Cyberterrorists. But it is probably worse in the danger it poses.

I agree. Duct tape fixing duct tape, and taking short cuts because it has to make money (and never fixed because of ill thought out cost-benefit analysises) is a big problem that will only get worse before it gets better if we aren’t careful.

As a profession, we’re lucky that we have relativity lax regulation. And we are a massively growing profession which is moving at an incredible pace.

Yes, we did things badly in hindsight, I bet most engineers look at work they did only six months ago and cringe.

But we can’t let quality be a second class citizen, and we have to keep things maintained: just as we do with buildings, roads, and cars.

It shouldn’t be “more glamorous” to be working on a brand new greenfield project. Me, I love working my skills on keeping things ticking, pushing systems to its limits then putting the bits back together again.

Let’s hope I’m not a dying breed.

Speaking: PHPNW

On 7th July at PHPNW.

Testing can be boring, but there’s also some interesting ways you can check your application. I’ll be going through some interesting tools and techniques, showing them in action, and who knows — maybe we’ll break something while we do so.


What Steve Jobs Knew That the Rest of Us Didn't 🔗

Michael E. Gerber, on Steve Jobs:

What did he know that the rest of us did not? My answer was simply that Jobs didn’t actually know more than the rest of us; he simply cared more.


★  Apple Watch In Review

It’s been around 6 weeks since I’ve had my Apple Watch. Whilst not perfect, I’m still very happy with it. Here’s a rundown of my thoughts.

I’ve got the 38mm Sport edition, with the black sports band. It’s a lot smaller than I imagined it would be, which is for the better. This means that it doesn’t have the bulk of other smart watches, and after the first few days I don’t feel conspicuous at all.

Not only does it look good, it feels really nice too. In fact, you forget it’s even there. There is a bulge at the bottom where the sensors sit, which I thought may be a problem, but that isn’t the case at all.

This is something I never thought would be said in a watch review: the sports band is really quite soft too. It’s firm enough to feel secure, but also smooth so that the last thing you’re thinking as you put it on is “I’m basically wearing a rubber band around my wrist”.

I have to admit, the box was a little bigger than I was expecting: the Watch comes in a case just like any other watch on the market. Unlike other smart watches, this is not a gadget. Apple clearly wants this to be an accessory: using technology to change how we think of watches.

And what a watch it is. Granted, this isn’t something that is kept for generations – I expect the Watch to have an update cycle of about five years – but I truly think that this is a watch wearer’s watch. Unlike the Pebble, which doesn’t really have much in terms of quality watchfaces, the Apple Watch has carefully designed faces that look beautiful and are genuinely useful.

But what makes this better than a regular watch, and indeed other smart watches, is the notifications. Within minutes I had muted all sounds, and had turned off both sound and vibration on my phone. The taptic engine is very subtle, and it really does feel like someone tapping you on the wrist. It feels nice, and it doesn’t disturb you or anybody else.

One thing, however, that does make it frustrating as a watch is Activation on Wrist Raise. With a classic watch, the time is always there for you to glance at. The Apple Watch requires you move your wrist, then wait, to see the time. The gesture detection isn’t quite right either, and so you find yourself exaggerating your arm movement, especially when wearing a coat.

The slight sluggishness is a problem in other areas, too. Apps can often take a noticable time to load; even the glances can take time for the data to appear. But being a first generation device I can’t see this being a problem for too long.

Sluggishness aside, compatibility with apps and services is at a high level, especially considering the watch has only been on general sale for a couple of months. Requiring a pairing with an iPhone has been a really smart move: Watch apps can talk to Phone apps, which means that any data you can access on your phone you can access on your wrist.

However, the best integration so far in my book has to be with Health. I put the activiy rings as a complication on my watchface, and whenever I look at my Watch, I know how active I am being, and how close I am to my goal. This is the feature which I’m sure I would miss if I had to do without my Apple Watch.

So, would I recommend it? Absolutely. Especially if you are a watch wearer and a heavy user of iPhone apps, the Apple Watch is a genuinely useful second screen, and turns the timepiece on your wrist into a “Watch Plus”.

It’s a purchase I don’t regret at all. I wouldn’t go back to my Pebble Watch, and certainly wouldn’t go back to a regular watch. The Apple Watch gives me far too many advantages that improves my life in small ways.

But then again, I’m a gadget lover. And if you’re not into gadgets, I’m not sure that you will see the point behind the Apple Watch. And that’s ok: it’s not for everybody.

Achieving the Ken Burns effect using CSS

The Ken Burns effect is a common technique used in video-making where a photograph or image is zoomed in and panned across, to make for more interesting visuals.

This effect can now be achieved using CSS’s animations properties. I’ve made up some example code to give a basic demonstration of what can be achieved.

To be able to pan across an image, we would need to use a size that’s bigger (either taller or wider) than we’ll be showing on the page, and we need to use CSS to tell the browser not to try and squeeze the image to the size we gave it. We use the object-fit property alongside setting a width, height, and overflow property to do this:

img:hover {
    object-fit: cover;
    overflow: hidden;
    width: 300px;
    height: 300px;

Once we’ve done that, we need to do the effect! This is achieved using CSS animations. Here, I’ve used CSS classes which I give the image to create two different animations depending on whether the image is a landscape or portrait image: each will pan in a different direction (across or up).

.portrait {
    animation: portrait 30s;
@keyframes portrait {
    from {
        object-position: bottom;
    } to {
        object-position: top;

    animation: landscape 30s;
@keyframes landscape {
    from {
        object-position: left;
    } to {
        object-position: right;

Notice that I’ve used unprefixed attributes here, but some browsers may need to be prefixed, or may not support either animations or object-fit.

Mocking in phpunit

To test a class in PHPUnit, it’s easier if you use dependency injection which enables you to mock other classes that we aren’t interested in testing (such as your database layer). So for example, instead of writing code like this to test a made-up User class:

class User() {
    private $db;

    function __construct()
        $this->db = new Database;

    function getUserData()
        return $this->db->getUserData();

$user = new User();

We can pass in the database class instead:

class User() {
    private $db;

    function __construct($db) {
        $this->db = $db;

    function getUserById($userid) {
        return $this->db->getUserData($userid);

$db = new Database; $user = new User($db);

This means that we can mock the Database object when we’re testing the User class, and pass the former into the latter. We do this as PHPUnit won’t override the new keyword.

In PHPUnit, it’s a case of creating the class but in place of using the new keyword we use a slightly longer one instead:

$mockDb = $this->getMock( 'Database', array('getUserData') );
                          array('userid' => 'joebloggs', 'name' => 'Joe Bloggs')

$user = new User($mockDb);
$this->assertEquals( $user->getUserById('joebloggs'), array('joebloggs', 'Joe Bloggs') )

In a nutshell, those two commands says what the class should be, and what the method should expect and return respectively. To break down what each bit of the two commands do:

  • getMock() is saying mock the class given in the 1st parameter, and we want to return given values for the methods given in the array in the 2nd parameter

  • The second command has a bit more too it. expects($this->any()) will mean that it doesn’t matter whether the method gets called or not: changing it to expects($this->once()) will mean that if the method isn’t called (or is called more than once) the test will fail

  • with() is the parameters that you should expect to be passed in (which is a good way to check that the parameters that’s being passed into a particular method are sensible), and will($this->returnValue()) is what you want to give as the known return value, for when you do your test

Of course, there’s much more you can do with PHPUnit mocking. The documentation is a pretty good start to find out what else is there.

Setting the proxy for command-line OS X

In OS X, it’s pretty simple to set a Location to set a proxy for whenever you’re somewhere you need to use one

However, this doesn’t affect some commandline applications, such as Homebrew. If you want to send this through a proxy, you’ll have to edit .curlrc to read something like

proxy =

Files not loading in a Virtualbox virtual machine

Every so often, randomly I see a problem where a virtual machine will only partly load a CSS or Javascript file, and when you load it in the browser it will have a bunch of strange unicode characters in there

We even saw it in

The fix is fairly simple - just edit your vhost configuration and add the following lines:

EnableMMAP Off
EnableSendfile Off

Switching branches in Subversion without losing changes

The problem: you want to switch branches in Subversion, but you’ve got changes in your local code that you’re not ready to commit

The solution: export a patch that you can store somewhere safe (or even commit into the repo so others can see it or work on it)

To export all changes, use svn diff to create a patch file:

svn diff > fix-that-annoying-bug.diff

As a sidenote, if I’m using a bug tracker, I like to put the bug ID in the filename: not only does this keep all the different projects together, it makes it easy to know what exactly the code changes does:

svn diff > myproject-1234-fix-that-annoying-bug.diff

From there I can revert all changes and switch branch:

svn revert -R . svn switch

Once I’m done with the new branch and want to go back, and assuming I’ve committed all my changes I switch back to my old branch:

svn switch

And I import my original changes patch file to start work again, carrying on from where I left off:

patch -p0 -i fix-that-annoying-bug.diff