A Magic VIC 20 in John Wick 2

John Wick 2 is a movie like a violent shoot-em-up game with a body count approaching that of a typical Call of Duty game. But it’s also got a retro heritage, with old fashioned telephone exchanges, rotary dial telephones and even a venerable Commodore VIC 20.

It’s also a magic computer because it wasn’t even plugged in, and the power light was unlit. It was a hero prop so they should have noticed!

The Automattic Photo, 2017 Edition

Last September almost 600 employees of Automattic travelled to Whistler in Canada for our annual Grand Meetup. As is now a company tradition a photograph was taken of everyone who attended. It’s a challenge taking a photograph of that many people. Remember how hard it was taking that family photo? The difficulty of getting everyone to look at the camera at the moment the shutter closed, or even just getting everyone in one place is multiplied when you have this number of people.

The last company photo was also taken in Whistler and we took a photo in the that same location again but it wasn’t good enough. The camera wasn’t up high enough, so people in the back were all but invisible in the photo. This photo was taken around the corner, where the photo was taken from a first floor balcony. Plenty of height and a perfect vantage point.

Taking the photo was one challenge, but then came development of the image. The camera had to be handheld because of the location on the balcony but the photographer took plenty of shots so I had a lot of material to work with.
The first issue was lining up the photos and I tried using Affinity Photo. Unfortunately it wasn’t quite up to the job (at least with the knowledge I have, it’s an excellent tool otherwise) but I learned a lot about working with layers and layer masks as I swapped parts of different images around.

Eventually I used Photoshop, loaded 3 photos in a stack and the auto align did a great job of correcting for changes in each photo.

What turned out to be the biggest pain point in developing a photo like this was removing people from the background. Here’s a few of them:

Blond Guy
This guy stayed in the crowd for about ten images. I only realised he wasn’t part of the group when I saw him with his friends in an earlier photo.
Two guys showed off their bikes for the camera. It was easy to tell they weren’t part of Automattic!
This lady thought it would be fun to join us in the photo. Her friend was laughing in the background and can be seen in the photo below.
This man stood mostly still throughout the photos that were taken making it more difficult to remove him, but he’s gone from the final image. 🙂

I’m already planning for next year. We’ll get some shots of the background to make it easier to to clone bystanders out, and have more volunteers to help organise the shoot so we make best use of the available space.

The dog bar in the Cosy Cafe

The Cosy Cafe is a small cafe in Kinsale with seating outside where, even on a cold day like this, dog obsessed customers can come for a bite to eat and their dogs can have a meal too.

Diego enjoying some doggy kibble at the Dog Bar. The food and water was originally on the raised platform but it was too high for my little chihuahua. I’m sure it won’t be a problem for most dogs!
My fish and chips were delicious.

Writing WP Super Cache Plugins

WP Super Cache is a full page caching plugin for WordPress. When a page is cached almost all of WordPress is skipped and the page is sent to the browser with the minimum amount of code executed. This makes the page load much faster.

Unfortunately if you want to run code on every page load you’re out of luck as regular WordPress plugins are not loaded or executed. You’ll need to write a WP Super Cache plugin. This short introduction will not teach you how to write plugins but the example plugins that ship with WP Super Cache will get you a long way towards understanding how they work.

Screen Shot 2017-10-25 at 16.49.10

WP Super Cache ships with some example plugins in wp-super-cache/plugins/. Some of them even do useful tasks like help with domain mapping and Jetpack integration. There’s one called “awaitingmoderation.php” which removes the text “Your comment is awaiting moderation.” when someone writes a moderated comment.
There’s also dynamic-cache-test.php which is a complicated beast but it’s heavily commented. It allows you to add template tags to your site that are replaced when the cached page is loaded.

Since WP Super Cache 1.6.3 you can use the “wpsc_add_plugin” action to activate a plugin. You must pass the full path and filename of the plugin to the action like this:

do_action( 'wpsc_add_plugin', ABSPATH . 'wp-content/plugins/myplugin/wpsc-helper.php' );

In a similar fashion you can use the “wpsc_delete_plugin” action to deactivate a plugin. You only need to add a plugin once but if run multiple times it will only be added once.

WP Super Cache plugins can be put anywhere that the web server can load them. If you’re writing a plugin or theme you can activate the plugin in your distribution directory.

Actions

These plugins run before most of WordPress has loaded. That means you can’t rely on some of the nice features of WordPress such as filters and actions. However, WP Super Cache has it’s own action/filter system that is similar to actions and filters in WordPress:

  • add_cacheaction( $action, $func )
  • do_cacheaction( $action, $value = ” )

A cacheaction is also a filter. If you hook on to a cache action that has a parameter, you must return that parameter at the end of the function like you would with a WordPress filter.

Screen Shot 2017-10-25 at 16.52.59

If you need to hook into a WordPress filter use the imaginatively named cache action “add_cacheaction”. That runs on “init” so the function that is executed can use add_action() or add_filter(). You can see this in action in the plugins/dynamic-cache-test.php or plugins/awaitingmoderation.php scripts.

Two very useful filters are the WordPress filter, “wpsupercache_buffer” (in wp-cache-phase2.php) that is used to modify the page before it is cached and the cache action “wpsc_cachedata” (in wp-cache-phase1.php) is used to modify the cached page just before it’s served.

Cookies

WP Super Cache 1.6.3 added the wpsc_add_cookie action. This allows you to change the key used to identify a cache file.

Cookies are one part of the key that tells WP Super Cache what cache file to serve to a visitor. By adding a cookie to the internal cookie list the plugin will know that visitors will a certain cookie should be served a different cache file.

For example, a translation plugin may use the cookie “language” to identify visitors who opted to view a translated website. If that cookie has the value “ie” it will show an Irish translation, “fr” will serve a French translation and so on. If WP Super Cache knows about the “language” cookie it can cache each translated page correctly and then serve it to the appropriate visitor.

The plugin will use the name of the cookie and the value of the cookie to determine the cache file to be used.

Example:

do_action( 'wpsc_add_cookie', 'language' );

You can remove a cookie by using the “wpsc_delete_cookie” action with the same parameter.

Please note that cache files are not refreshed when cookies are added or deleted. You can use the function “wp_cache_clear_cache()” to clear the cache for a given blog. If on a multisite install pass the blog_id of the blog otherwise the contents of the cache directory will be deleted.

Clearing the Road of Fallen Trees

The trees that fell on the Waterloo Road were cut down and cleared off the road surface this evening, observed by Minister for Housing, Planning and Local Government Eoghan Murphy. A fire engine illuminated the scene, with a wood chipper at the side of the road, a small lorry and a JCB completed the perimeter of plastic railing surrounding the site. They made short work of the branches and other debris on the road. 🙂

The Aftermath of Hurricane Ophelia

Hurricane Ophelia hit Ireland yesterday and while it was a baby compared to the monsters that ravaged the Caribbean and US it still did plenty of damage and left 3 people dead. Many areas were left without electricity or running water for most of the day. A day later and there are still areas without those basic amenities. Telecoms services were disrupted too as lines were cut and exchanges and mobile sites ran out of power. 30,000 people were without access to phone or Internet access. A red alert was declared nation-wide. Schools closed (for 2 days), public transport wasn’t running, shops and businesses didn’t open. There was a definite fear and expectation that this would be a big one. And it was. Gusts of 156kmh were recorded off Roches Point!

We were without power from just after 11am, then the mobile phone network, Eir, went down, except my wife’s phone was able to go online for minutes at a time throughout the day. Winds really picked up around 10am, and lasted until after 2pm with driving rain almost horizontal in the wind. Later in the day I walked around Blarney village and from the far corner of the square got a weak signal from a remote antenna and had just enough connectivity to get a few text messages.

Trees behind our home were knocked down by the wind, blocking most of the main Waterloo Road. Luckily the very tallest trees survived as they’re within reach of some of the houses!

Even this stop sign was twisted around by the wind, and mushrooms flattened too..

Two trees were knocked down in the village square, and someone had attempted to drive a car and caravan up that narrow road before getting stuck and abandoning their vehicle!

Power came back late yesterday evening, as did mobile data, but friends are still without power even now so it’s going to take some time before things are back to normal. Our satellite dish is broken, and it’ll be early November before someone can come out to replace it. Parts of my garden fence blew over too, but that was on it’s last legs anyway! A TV antenna ended up in our front garden, but I have no idea who owned it.

This morning there was a lovely sunrise, and the sky was a gorgeous mix of blue and soft orange. 🙂

Next weekend we can look forward to apparently. Hopefully it won’t be as bad as Ophelia.