Developing software in the Real World

2015 in pictures

It's that time of year again where I look back at what happened over the past 12 months. Obviously this is mostly an excuse for me to look at the photos I've taken over the year and share some of them as I've done previously. I attended a lot of conferences this year, though one thing that was different this year was that I attended more than I spoke at. I also spoke at a… continue reading.

Function pointers in my Swift CCurl library

By default, libcurl writes the data it receives to stdout. This is less than useful when writing an application, as we want to store the received data internally and process it. This is done using the libcurl settings CURLOPT_WRITEFUNCTION which takes a function pointer where you can process the received data and CURLOPT_WRITEDATA which lets you set a pointer to something that can store the received data. You get access to this pointer within your… continue reading.

Using Composer with shared hosting

I can't use Composer because I'm using shared hosting and don't have SSH I've seen this sentiment a few times now, so this seems like a good time to point out that you do not need SSH access to your server in order to use Composer. In fact, I don't run Composer on a live server (regardless of whether it's using shared hosting) and it's not on my list of things to do in the… continue reading.

Wrapping variadic functions for use in Swift

As I noted in my post about getting libcurl working with Swift, curl_easy_setopt() is a variadic function which means that Swift will not import it. If you try to use it you get this error:

It's mildly annoying as curl_easy_setopt only ever takes three parameters! I assume that it's marked as a variable argument function because the last parameter can be any type? To solve this, I wrote a simple C library that exposes… continue reading.

Using a C-library in Swift

I'm still enjoying playing with Swift and am beginning to quite like the language. At the moment, I've only ever written with it on Linux, so I'm sure I'm making my life harder than if I was using OS X where it's more mature. On the flip side, if I ever use Swift professionally, it's most likely going to be on a Linux server as a microservice or a command line app at the other… continue reading.

Swift around the web

To get started with messing around with Swift, IBM have created a Swift Sandbox on the web, so you can run Swift on Linux within a browser to play with it. Interesting stuff as it appears that IBM are interested in Swift on server. Also interesting is the Perfect application server for creating server side API applications. I've also found these resources helpful: The Swift Programming Language book (epub) Erica Sadun' Twitter & blog Jesse… continue reading.

An Ansible playbook for Swift

I've been learning Swift recently and now that it's Open Source, I'm looking at using it on my Linux server. Firstly however, I wanted to run it within a Vagrant box locally and as I provision all my boxes via Ansible, I created a simple playbook and am recording it here in case its useful to anyone else! The installation instructions are easy to follow, so I simply replicated them as a set of actions.… continue reading.

Running Phan against Slim 3

Having installed Phan, I decided to use it against the upcoming Slim 3 codebase. Phan needs a list of files to scan, and the place I started was with Lorna's article on Generating a file list for Phan. I started by removing all the developer dependencies:

and then built the file list for the vendor and Slim directories. I started by using Lorna's grep statement, but that found too many non-PHP files in vendor,… continue reading.

Installing Phan on OS X

I use Homebrew for my local PHP installation on OS X and am currently running PHP 7.0.0 RC8. Phan is a static analyser for PHP 7 which was written by Rasmus and then rewritten by Andrew Morrison. As it benefits from PHP 7's abstract syntax tree it can find all kinds of subtle errors, so I wanted to install it locally to have a play with it. I started by trying to install Phan into… continue reading.

Installing 32 bit packages on Ubuntu 14.04

This had me stumped for a bit, so I've written it down. If you have a 64 bit version of Ubuntu and want to install a 32-bit package, you simply add :i386 to the end of the package name like this:

However, this didn't initially work for me as apt-get couldn't find the package:

It turned out that my installation only had the 64 bit architecture configured which you can tell by running:… continue reading.