By Stuart Herbert

Welcome to my blog.

I write about software development, especially in PHP, T'ai Chi Ch'uan / Taijiquan, and my photography.

You can learn more about me by reading my bio.

You can reach me at

Latest Photos

The Tap In The Farmhouse
Rusting Machinery
Fence Wire Beside The Path
The Gate Beside The Former Railway Line
The Wooden Gate
Banner On The March: Brexshit
Banner On The March: We Know We Were Lied To ... So Time For A NEW VOTE!
Banner On The March: We ARE The People
Banner On The March: Honk For Our NHS
Banner On The March: Where's Nigel? Trump Says Your March Is Bigger Than Ours!

Speaker Slots And Paying To Speak

Posted in Stuart on PHP on September 5th, 2018.

One of the hot discussion topics atm is around the question: who pays a speaker’s costs? And who should pay?

I think there’s a couple of different ways to look at this: from an economic point of view, and then separately from a moral point of view.

The Economic Arguments

Writing and presenting a talk – whether it’s at a user group or a conference – takes both a significant amount of time, and a significant amount of cash.

A new tech talk can take anywhere between 20-40 hours to write, rehearse and polish. That’s 1/2 to a full working week. It takes significantly longer if the talk needs to be accompanied with example code or even a usable code library.

Unless the event is local, you can add in up to two days of travel time on top, plus the time spent at the event itself. And you can add in more days on top to cover both international travel and dealing with jetlag.

It’s impossible to travel without spending money. Whether it’s fuel for the car and car parking charges, or train tickets, or flights, none of that happens without money. And let’s not forget accommodation!

Someone, somewhere, is paying for that time. And someone, somewhere, has to hand over the cash to pay for the travel.

So every speaker – and every employer who lets staff do speaking gigs on company time – has to treat any speaking opportunity as an economic transaction. You may not have ever thought of it in those terms before, but that’s what is happening.

It’s down to individual speakers (and/or their employer) to decide whether or not doing a talk is “worth it” to them. We’ve all got our own motives, and there’s no such thing as a one-size-fits-all approach to it.

I run my own company, and I have over three years now of financial data on whether or not it is worth it or not for me. If you’re curious, the series of talks I’ve been doing to date has cost my firm over £13K in cash paid out, and over £5K in time spent on talks instead of on billable work. So let’s call that about £20K. That’s just for giving talks here in the UK. There’s no international travel at all in that. And it doesn’t account for the many many evenings and weekends I’ve given up of my free time too.

These are just my costs. For several reasons, I am an outlier:

  1. I write a brand new talk for every speaking opportunity, which is very unusual.
  2. I have non-coeliac gluten-intolerance (NCGI). It’s an incurable auto-immune disease. Eating out is very difficult, so I often end up renting an apartment so that I have a kitchen to cook in. That does cost a lot more per-night than a hotel room does.
  3. I’m not tied to an office desk, and can work from pretty much anywhere. I can do billable work on trains and from rented apartments, to reduce the amount of billable hours lost. Many people aren’t that fortunate.
  4. Those costs include the A/V equipment I use to video my talks.

There’s another side to the economic argument, to do with the event itself, and it’s where the moral arguments overlap.

The Moral Point Of View

Generally speaking, events fall into these groups:

  • Community meetups, such as monthly user group nights. Tickets are free (as a rule). Sponsors cover venue costs, free food, and any swag handed out.
  • Community conferences. The tickets aren’t free, but (normally) the tickets are subsidised by the conference’s sponsors. The organisers may (or may not) generate a surplus.
  • Commercial conferences. They’re run to make a profit for the organisers, and it may even be their sole or primary business.
  • Marketing events. They exist to promote the company in one form or another (normally as the third leg in tripod economics), or to provide a platform for attending companies to promote themselves. The economics for these range greatly. Some are run for profit, some are not. Many of them are put on by professional event organisers.

There’s overlap between these groups, and sometimes an event can appear to be one kind (e.g. a community conference) to the attendees when, behind the scenes, it’s actually a commercial conference or a marketing event of some kind.

I think there’s a couple of moral issues here, spread across the different event groups.

The first problem is accessibility. How do we create speaking opportunities for new speakers? Generally speaking, they’re the least likely to have the economic means to pay their own way.

For me, this is important. We need new voices all the time. We need new experiences to be shared, and new perspectives to be shared. It isn’t healthy for the same people to be trotting out the same stuff year after year. It isn’t healthy for our professions, and it isn’t healthy for our communities.

Yes, user groups offer a way to get started. But how do new speakers get from there to other opportunities? Some of them become developer advocates, and (amongst other duties) it becomes their job to speak at events on behalf of their employer. Others find a way to swallow the costs themselves. Most simply drop out, unable to find a way forward.

Then the other problem is around unpaid services. If I’m speaking at your for-profit event, I am (in effect, and often in law too) a supplier. I am supplying a service (a presentation) to your business. Your business is using that service (along with the services of your other suppliers) to make money.

And when your business insists that it cannot afford to pay the suppliers, and trots out an endless stream of creative excuses why, this is in effect a zero-sum game. For them, it’s not about the economics. It’s all about the for-profit event holders believing that they can only have a successful event if they get services supplied for free.

When you come across these people, you’ve got to take a long, hard look at the economic transaction. Are there clear benefits, and are they worth the cost? And is it worth setting aside the moral objections?

Fortunately, as with most things in the software industry, we can look to other (arguably more mature!) walks of life, where this kind of thing has already happened, and learn from them. The music industry is full of stories about pay-to-play gigs, for example.

And there’s always the gold standard. Would a plumber do it, either at all, or on those terms?

JSON Notation for PHP 7.0

Posted in Stuart on PHP on July 9th, 2016.

tldr; I’ve been experimenting with the PHP interpreter, and I made a thing …

JSON is by far the most common API request format. I design, build, and fix API servers for a living. I write a lot of API tests as a result.

I often find myself wishing that I could write JSON directly in PHP code like this:

$payload = {
  "hello": {
     "fish": $fishType

This would save me a lot of time when I’m copying examples from API documentation or JIRA tickets into my test suites.

You’ll find a patch that adds this to PHP 7.0 here: diff against PHP-7.0 tracking branch.

Some caveats: I’m no expert on the internals of PHP, and this patch is very naive. It probably breaks things in ways that I’m not aware of. It passes the PHP test suite locally, but that doesn’t mean you should be trying this in production.

Here’s some examples of what it allows you to do:


// this is an array syntax that PHP
// already supports
$a1 = [
  "hello" => "world"

// and this should be an array too now
$a2 = [
  "hello": "world"

// this is forced to be an array
$a3 = (array){
  "hello": "world"

// and this should be an object
// you can still use array assignment inside
$a4 = {
  "hello": "world",
  "goodbye" => "everyone"

// this should be an object inside an object
$a5 = {
  "hello": {
     "fish": "trout"

// create an array of objects
$a6 = [
        "hello": "world"
        "goodbye" => "everyone"

// this is an object that contains an array
$a7 = {
    "hello": [

// we can still cast nested arrays to objects
$a8 = {
    "hello": (object)[

// we can pass data objects as arguments too
function provide($arg1) {
    return $arg1;
var_dump(provide({"hello": "world"}));

// we can define and return data objects
// without having to assign to a var first
function returnObject() {
    return { "hello": "world" };

Let me know if you’d also find this useful. If there’s enough interest, I’ll see if I can convince someone who is involved in the world of PHP.internals to help me get this turned into an RFC.

Last week, I gave a talk at PHP Cambridge on how to go about setting up and running a positive code review. A huge thanks to Jo for inviting me to speak on this.

We had a great evening looking at the underlying causes of negative code reviews, and what you can tackle to address them. I hope you find the deck useful.

Earlier this month, I gave a talk at the PHP Surrey user group over in Guildford, looking at how to design a functional test.

Over the last four weeks, I’ve been plagued by numerous PHP segfault problems – multiple versions of PHP, on different operating systems, on different hardware, and running completely different codebases.

Yesterday, I ran into a segfault that I couldn’t work around. It is happening with Apache + mod_php, running inside a Centos 6-based Docker container. Docker is hosted on Ubuntu 15.04.

Here are the steps I took to enable core dumps for Apache inside the container, so that I could examine the segfault.

On Ubuntu (the host machine):

  1. sudo sysctl -w fs.suid_dumpable=2
  2. sudo sysctl -w kernel.core_pattern=/tmp/core-%e-%s-%u-%g-%p-%t

That’s it. Your Docker container automatically inherits these settings, and Apache will start coredumping without being restarted.

Why Does This Work?

With Docker, because it’s not a virtual machine in the way that VMWare or VirtualBox is, the container inherits the settings of your host operating system. Inherits, and can’t change them inside the container (which is not ideal).

You have to enable coredumps on your host operating system.

Ubuntu 15.04 ships with coredumps already enabled. Ubuntu also ships with an app that gathers coredumps and ships them off to Canonical for inspection – this is the ‘A system error has been detected’ dialog box that appears all too frequently on a modern Ubuntu system.

Ubuntu’s helper app can’t intercept coredumps that occur within a Docker container, so you don’t have to worry about it in there.

Why We Test: My Talk @PHPOxford

Posted in Stuart on PHP on November 3rd, 2015.

Last week, it was my pleasure to present a new talk to the PHP Oxford user group, called “Why We Test”. A huge thanks to Oliver for inviting, and to everyone who came along.

Another Fantastic PHPNW Conference!

Posted in Stuart on PHP on October 8th, 2015.

I’m back from this year’s PHP North West Conference, and finally have a few moments to talk about what was (yet again!) another excellent year.

I was there to present two talks – Introducing a Quality Model For MVC Applications, and Ways To Measure Your ORM’s Cost. It’s the first time since the php|cruise back in 2004 that I’ve presented twice at the same conference, and brings me up to something like 15 unique talks and workshops presented over the last 11 years.

Are you a good scout? – PHPNW15 Track 3 from phpboyscout

I want to highlight one talk in particular from this year’s conference – Matt Cockayne talking about being a good code scout. This talk got promoted from the Unconference track to a spare slot on the Sunday morning. I’ve been thinking about pitching a keynote about how we all need to be great ambassadors for PHP, and I think Matt’s message would make a great keynote for our community.

Whether I’m speaking or just attending, I always enjoy the PHP North West Conference. Their conference team always do everything that they can to make each conference the best that it can be. In my opinion, the explosion of quality, community-based PHP conferences in Europe owes much to the example set particularly by PHP North West. We’ve come a long way from when I started speaking back in 2004 🙂

I’m really grateful that conference committees here in the UK – both PHP North West and PHP UK – continue to give me opportunities to come and talk at their conferences. Whether it’s about the problems of framework lock-in, component-based architectures, Git workflows, or indeed about driving quality, I’m often talking about things years before the PHP community moves that way. My work is often about solving problems most people don’t yet realise that they have, and that can’t be an easy sell, both within the committees that select talks for conferences nor to attendees when they’re buying their tickets.

This year’s conference may be over, but there’s no rest to be had.

  • I’m already preparing another talk to deliver to the PHP Oxford user group later this month, called “Why Do We Test?” – expect plenty of ethical dilemmas in this one
  • November sees me once again volunteering at Aberystwyth University, coaching 2nd year Comp Sci (and related) students on job hunting
  • I’ll be speaking at PHP Surrey at the start of January 2016, possibly on writing a test suite for PHPFastCGI – you should come just to watch Andrew give his PHPFastCGI talk, it’s cry-out-loud funny

… and I’ve promised both Glasgow PHP and The Edinburgh PHP User Group that I’ll come up and present to them before the end of 2016.

Talk: Ways To Measure Your ORM’s Cost

Posted in Stuart on PHP on October 8th, 2015.

Here is the original blurb for this talk …

Your project has adopted an ORM such as Doctrine because it’s the quickest way to hook your code up to your database. Things are looking up, and your website is about to take off. Aaaand then the first complaints start to come in that your site isn’t coping with the new customers. You can’t find a problem in your own code. Could it be the ORM that’s the problem? How can you tell?

In this talk, Stuart will show you how you can use off-the-shelf open-source tools to work out what your ORM is doing, and whether or not it is the cause of your performance problems. He’ll show you how to measure the database itself and the ORM code, as well as providing useful strategies to reduce the cost of your ORM without having to abandon the ORM altogether. Finally, he’ll show you how you can extend these techniques to other parts of your application, so that you’re never in the dark again.

Here’s the original blurb for this talk …

Your integration, functional and non-functional testing gives you a good idea if your code will work on Production. But how do you go about measuring the quality of code that already seems to work? How do you make that measurement repeatable? How do you share it with clients in government, finance or other large enterprises who are looking for a 3-5 year shelf-life from your code?

In this talk, Stuart will introduce you to SQuaRE, the international standard collection for software quality. He’ll give you a tour of all of the available and upcoming standards in this area, before taking a deep dive into the Product Quality Model from ISO/IEC 25010:2011. He’ll explain what a quality measurement is, how you link them to your project’s quality criteria, and how you incorporate them into code reviews, QA teams and management decisions.

You’ll leave this talk ready to start measuring and improving the quality of your product or service, with the tools you need to not only maintain quality but also to keep increasing it over time, even when faced with staff turnover.

In Defence Of The DSLR

Posted in Stuart's Photography on August 15th, 2015.

This afternoon, I’ve seen several folks on Twitter sharing a well-meaning story called Please Don’t Buy A DSLR. Each time, the tweet echoed the same sentiments: DSLRs are too difficult to use, and they’re too large and bulky.

And that got me thinking.

You see, the SLR as a platform is one that I’ve grown up with. I’ve been shooting with SLRs for the best part of 20 years now. The SLR isn’t just my camera of choice, it’s the one that I know best. Hopefully some of that comes through in the photos I’ve posted here over the years.

But it also means that I don’t see the SLR in the same way that you do, if you’ve been using your camera phone or point-and-shoot compact to date. I’ve never seen the SLR that way, because it was my first kind of camera.

I’m not sure if I’ve ever given much thought to whether a DSLR is too bulky, or too difficult to use. Well, there was that one time I was shooting with a monster Sigma 400mm lens …

Are DSLRs Too Large And Bulky?

Well, the fact that I need a dedicated camera bag alone makes it hard to argue against the idea that it’s bulky. The camera and lens straddle the entire width of the backpack. There’s nowhere for a dedicated macro lens to fit. And the 400mm zoom lens that I have my eye on? I’ll need to find a bigger backpack before I can buy that. My camera bag is already much bigger than my hiking rucksack.

This thing is heavy too. I hurt my right arm earlier this year moving an old amp that I was getting ready to sell on. Until a couple of weeks ago, I couldn’t handle my DSLR camera body and lens because of the weight. I’m not sure how long it will be until I can try an all-day shoot again.

So yes, DSLRs are undeniably large and bulky. But are they too large and bulky? I think that depends on whether you see yourself as a photographer, or whether you prefer to take photos.

When I go out with the camera, I’m going out specifically to do photography. The camera isn’t tagging along on some other adventure. The camera is the reason why I’m going out in the first place.

The majority of my camera bag is taken up by my lens collection. With the DSLR, I can switch lenses to suit my subject and my distance from the subject. I get real zoom, not a fake digital one where you’re losing detail or image quality. I get precise control over what’s in focus in the shot, and what’s out of focus – a key part of the artistic side of photography.

A perfect example of what I mean is this shot taken last year in the Brecon Beacons.

Llyn Cwm Llwch

In this photo, I’ve been able to make Mike the subject of this photo by making him the only part of the shot that’s in focus. At the same time, the photo works because you can still see what he’s doing – trying to capture Llyn Cwm Llwch on his camera phone. That was possible because I could use the zoom the frame the photo.

The rest of the bulk is the camera body itself. Combined with my lenses, I can shoot handheld in moonlight …

Avebury by Moonlight

… or handheld in a conference hall (it’s so dark the laptop screen is the main source of light!)


… or I can take shots like this.

Pratt and Whitney Double Wasp

When it comes to challenging conditions like these, you can’t overcome physics. You need to gather enough light to have an image to capture. You need large lenses to gather that light, and you need a large sensor to capture that light without capturing too much visual noise at the same time.

Try and replicate these shots yourself on your camera phone to see for yourself.

Are DSLRs Too Difficult To Use?

To deliberately take a great shot with a DSLR, you need both technical mastery of your camera and artistic mastery of the medium. Of the top of my head, this includes:

  • ISO speed – sensitivity setting of your sensor
  • aperture size – controlling the amount and angle of light hitting the sensor
  • shutter speed – controlling the length of the exposure when you take your picture
  • focal length – to frame your shot
  • focal length combined with distance to subject – to control visual distortion
  • focal length combined with distance to subject and aperture size – to control depth of field
  • focal length combined with ISO speed and shutter speed – to control camera shake
  • height of the sun – to influence the colours in the photo
  • angle of the sun – to control the blue of the sky
  • angle of sunlight reflecting off the subject – to control highlights and shadows
  • the histogram in the camera – to check for good contrast and exposure without over-exposing the shot
  • image composition – who or what is the focus of the photo?
  • image background – what else is visible in-frame?
  • timing – what is moving? where is it moving to? where do you want it to be when you click that shutter release button?
  • breathing – keeping the camera still so that the shot isn’t blurry

… and so on. Boy, does that seem like a lot of things to be juggling at once when taking a photo. No wonder photography seems hard!

I’m going to let you in on a secret. The whole time I’ve been taking photos, I’ve only once managed to capture exactly the photo that I wanted to. Once. Here it is.

Merthyr Road In Mist

That’s a shot from the end of the road I live on, taken during one of the rare winters where we actually had enough snow to be worthy of the name. Previous weekend, we’d driven along the road on the way to do Christmas shopping, and I’d pictured that exact scene as we carefully made our way out. It’s the one and only time that the final image is 100% what I wanted to capture.

If you’re interested, that’s a success rate of less than 1 in 10,000. It might be closer to 1 in 50,000.

It doesn’t mean that the other 99.99% of my photos aren’t good. With well over 1,000,000 views on Flickr to date, I must be doing something that you like. But yeah, taking photos is hard. Here’s some examples to show why.

Passing By

That shot was taken (handheld again!) one evening in London. There was the technical challenge of shooting at night, where one stable primary light source (the sun) is replaced by lots of competing and sometimes chaotic primary light sources (street lights, shop displays, passing vehicle headlights). The subject is a silhouette of a passerby, reflected in the window of the Museum of London. I had to frame the shot, work out the required exposure, find an angle to manage reflections, all before the passerby had walked by.

Lighting The Way Home

That shot was taken on a walk through the woods at Beyond the Border one year. The main technical challenge was getting precisely focused on the light whilst throwing the leaves behind out of focus. Then there’s the need to find an angle to show the electric cable. It’s black, and could easily disappear because I’m reducing the amount of light that hits the sensor in order to show up the filament of the bulb.

Outside The Core

Some flowers planted in a display at the Eden Project. Should be very simple, right? But what about the shadow being cast by that low sun? The shadow means that the part of the flower that’s nearest the lens is much darker than the leaf on the other side of the plant – and that’s reflecting the sun quite brightly. What’s the best angle to capture the flowers and their stems? Did you notice the building’s wall in the background? Did you notice the lines running along the wall? They’re as much a part of the photo as the flowers are.

Breitling Wing Walker

My last example – a wing walker putting on a show at the Bristol Balloon Festival one year. Any time there’s sky in the photo, I’m thinking about where the sun is. The camera sees a different shade of blue depending on the angle between the sun and the lens. I need to hold the camera steady enough whilst tracking a moving object. Empty blue skies make for boring photos. I need to wait until there’s clouds in shot to make the background more interesting. I need to wait until the moment the wing walker is doing something that will look interesting in a still photo.

In each and every photo that’s worth publishing, from the simplicity of some flowers in a display to the complexity of one of the world’s leading cities at night, there’s always a lot that the photographer has to do to get the shot. Some of it is technical, and some of it is artistic.

If you replace a DSLR with a different kind of camera, does anything become easier? Well, in a word, no. At no time in any of those photos was the DSLR adding any complexity to the shot. If anything, the DSLR often made these shots easier. I’m not sure that any of them could have been duplicated on a camera phone, or on a compact camera that didn’t offer full control over shutter and aperture speed. And several of those shots benefitted from being able to use lenses that you can’t get on camera phones or compact cameras.

The complexity is inherent to photography as an art medium, and is down to physics (light) and composition (artistic taste). All that the DSLR does is expose you to that complexity. Nothing more.

Other Points In Favour Of DSLRs

The DSLR platform brings some important advantages over other types of camera.

I’ve already mentioned physics – the gathering of light, and the capture of light whilst controlling noise. Indoors, late at night, or more northernly or southernly you go, this becomes more and more important. It’s nearly always very dark indoors, and by definition it’s dark outside late at night. No surprises there. But, if you live in Canada or the States, you might not realise that it’s much brighter outdoors there than it is here in Europe. We’re much further north than you are. That makes it much harder to take good photos with smaller kit.

Phase detection auto-focus systems are, for me, the next advantage of the DSLR platform. This is an old technology, but it works almost flawlessly. And it’s fast. By contrast, contrast-based auto-focus systems are slow, inaccurate, and struggle to track subjects well or work in low-light. I’m sure that one day there’ll be enough computing power in cameras to overcome these problems, but right now they’re very hit-and-miss systems.

I must not forget manual focus. The ability to switch the motor off, and dial in the focus entirely by hand is an important artistic tool when combined with manual aperture control. Works best if you’re lugging around a tripod (more bulk!).

Inter-changeable lenses are important. Other platforms (notably micro four-thirds) also have inter-changeable lenses, but only the two leading DSLR platforms (Nikon and Canon) have an extensive range of lenses both from the manufacturer and from third parties such as Sigma. And the quality of those lenses … oh my.

I haven’t mentioned flash photography, as it isn’t something I do. But it’s another area where the DSLR platform offers a major advantage over other camera types.

DSLRs are very versatile tools. You can mix and match bodies and lenses to optimise for the kind of photography that you enjoy the most.

This is all good stuff, but it isn’t what prompted me to post in defence of the humble DSLR.

Final Thoughts

I work in tech, and it pays for my photography hobby. Over the last few years, there’s been a steady rise of a culture that I wasn’t aware of before. Somehow, it’s become acceptable not to know what you’re doing or how anything works. Sometimes it’s presented slightly differently – that’s there’s far too much for anyone to know – but the sentiment is the same. We’re moving from the days of the meta-ignorant to an active cult of the ignorant.

As many of the people I follow on Twitter work in tech, it is this culture spilling over into photography that I saw this afternoon. And honestly, I’m deeply deeply uncomfortable with the notion. It isn’t a culture that I grok.

Because I don’t understand it, I don’t want to call “bullshit” on it, and I don’t want to call people out who promote this culture. I don’t walk in their shoes, and I don’t see things through their eyes. I don’t know what the barriers are that are stopping you from learning the things that I have been able to learn.

The best I can do is offer to teach what I know. So, if there’s enough interest, I’ll make the time to put together an easy step-by-step course to the humble DSLR and basic digital photography. It’ll be a group course, run online, and there will be plenty of homework involved.

Just let me know if this is something you want.