Pragmatism in the real world

A Kitura tutorial

Swift only became interesting to me when it was released as Open Source with an open development model. I'm exploring using it on Linux for APIs and as worker processes at the end of a queue, such as RabbitMQ or beanstalkd. To this end, I've been playing with Kitura, a web framework for Swift 3 by the Swift@IBM team. It's inspired by Express and so the basic operation is familiar to me. As is my… continue reading.

10 years since my ZF Tutorial

Incredibly, it's been 10 years since I announced my Zend Framework 1 tutorial! The first code release of Zend Framework (0.1.1) was in March 2006 and I wrote my tutorial against 0.1.5. Just under a year later, in July 2006, version 1.0 was released and I updated my tutorial throughout all the releases up to 1.12. ZF1 had a good run, but all good things come to an end and the official end of life… continue reading.

Passing on the baton

Lorna Mitchell has posted Needs Help: For the last 6 years I've been a maintainer of this project, following a year or two of being a contributor. Over the last few months, myself and my comaintainer Rob Allen have been mostly inactive due to other commitments, and we have agreed it's time to step aside and let others take up the baton. I'm proud of my contributions to as a contributor and maintainer.… continue reading.

Screenshot of the active window on Mac

I find myself needing to take screen captures of the currently active window in OS X reasonably frequently. The built-in way to do this on a Mac is to use shift+cmd+4, then press space and then use your mouse to highlight the window and click. For a good proportion of the time, I'm not using a mouse, so this doesn't work great. There's a built-in command line utility called screencapture which requires you to know… continue reading.

Introducing SwiftDotEnv

Regardless of which language you use, there are always configuration settings that need to be handled. One of the tenets of twelve factor app is that config should be stored in the environment. This is easy enough on the command line or in the config of our preferred hosting solution. When developing locally without a VM however it gets a little more complicated as we may need the same environment variable set to different values… continue reading.

Checklist for releasing Slim

Release process for Slim so that I don't forget any steps; based on a check list created by Asgrim. I should probably automate some of this! Preparation: Ensure all merged PRs have been associated to the tag we're about to release.Find them via this search: [is:pr is:closed no:milestone is:merged]. Close the milestone on GitHub. Create a new milestone for the next patch release. Ensure that you have the latest master & that your index is… continue reading.

Auto reloading a PDF on OS X

Currently, I create presentations using rst2pdf and so I regularly have vim open side by side with the Preview app showing the rendered PDF. I use a Makefile to create the PDF from the rst sources, so I just use :make in vim to rebuild the PDF file and then had to switch to Preview in order for it to reload the updated PDF file. Recently a friend wondered why the PDF viewer couldn't reload… continue reading.

API errors are first class citizens

It seems to me that error handling is an afterthought in far too many APIs. When designing an API, I implore you to design your error handling too! The way that your API presents an error is key to a good API; developers integrating with your API will judge you on it. Follow the HTTP rules Just because it's an error doesn't mean that you can forget your HTTP. You need to be a great… continue reading.

Standalone Doctrine Migrations redux

Since, I last wrote about using the Doctrine project's Migrations tool independently of Doctrine's ORM, it's now stable and much easier to get going with. Installation and configuration As with all good PHP tools, we simply use Composer: $ composer require –dev doctrine/migrations This will install the tool and a script is placed into vendor/bin/doctrine-migrations. To configure, we need to add two files to the root of our project: migrations.yml: name: Migrations migrations_namespace: Migrations table_name:… continue reading.

Ctags with Swift

I always seems to end up in vim sooner or later and I use Tim Pope's excellent Effortless Ctags with Git process to keep my ctags file up to date for my projects. As I'm now coding in Swift too, I needed ctags to support Swift. This is what I've added to my .ctags file: –langdef=Swift –langmap=Swift:+.swift –regex-swift=/(var|let)[ \t]+([^:=]+).*$/\2/,variable/ –regex-swift=/func[ \t]+([^\(\)]+)\([^\(\)]*\)/\1/,function/ –regex-swift=/class[ \t]+([^:\{]+).*$/\1/,class/ –regex-swift=/protocol[ \t]+([^:\{]+).*$/\1/,protocol/ Any improvements, welcome! vim.swift As I'm writing about Swift and… continue reading.