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.
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.
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.
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:
error: 'curl_easy_setopt' is unavailable: Variadic function is unavailable
curl_easy_setopt(handle, CURLOPT_VERBOSE, true)
CCurl.curl_easy_setopt:2:13: note: 'curl_easy_setopt' has been explicitly marked unavailable here
public func curl_easy_setopt(curl: UnsafeMutablePointer<Void>, _ option: CURLoption, _ varargs: Any...) -> CURLcode
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.
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.
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.
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.
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:
$ composer update --no-dev
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.
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.
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:
$ sudo apt-get install libstdc++6:i386
However, this didn't initially work for me as apt-get couldn't find the package:
$ sudo apt-get install libstdc++6:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libstdc++6
E: Couldn't find any package by regex 'libstdc++6'
It turned out that my installation only had the 64 bit architecture configured which you can tell by running:… continue reading.