To get an insight into the traffic going around the place, I’ve been using Wireshark and it’s ability to capture remotely, it’s really simple so I thought I’d write down my “recipe” on how to do this in case it’s useful. Continue reading
Author Archives:
PHP 5.6 and the Splat Operator
Using Composer Without GitIgnoring Vendor/
composer install
, it’s probably mostly almost safe” criticism, but actually it’s quite tricky to run Composer without excluding vendor/
from source control so I thought I’d share how we did it so that anyone who wants to do so can learn from my experience!Continue reading
Working with PHP and Beanstalkd
The Scenario
I have an API backend and a web frontend on this project (there may be apps later. It’s a startup, there could be anything later). Both front and back ends are PHP Slim Framework applications, and there’s a sort of JSON-RPC going on in between the two.
The job queue will handle a few things we don’t want to do in real time on the application, such as:
- updating counts of things like comments; when a comment is made, a job gets created and we can return to the user. At some point the job will get processed updating the counts of how many comments are on that thing, how many comments the user made, adding to a news feed of activities … you get the idea. Continue reading
What Does URI Stand For?
Instead, the API publishes each record with a unique uri
field. If this record is referred to by another record, then this full identifier will be used in every case. If this record should be included in a collection, this exact same identifier will be used there, too. You can reach the resource directly by requesting its URI. In the same way that we might refer to a website by its URL, we refer to records in RESTful systems by their URI*. If you need to store these somewhere for your own use, you can use whatever key you like with the local storage, you may even choose to use the uri
field as it is unique.
* URI stands for Unique Resource Identifier
Getting Started with Beanstalkd
Why Beanstalkd?
My requirements were simply to add both asynchronous (for processing things like recalculating counts) and periodic (mostly for garbage collection) tasks to a PHP application. The application has a separate web application and backend API, both made of PHP’s Slim framework, and the API talks to MySQL. It’s all very lightweight and scalable, and I was looking for something to fit in with what we have, with good PHP support.
Enter beanstalkd, it’s a super-simple job queue and has great PHP support in the shape of Pheanstalk (I’m saving my PHP + beanstalkd examples for another day because this post would get too long to read otherwise!). I’ve used gearman in the past but beanstalkd seemed lighter, and when I started looking at their documentation I discovered that I had a working installation in about the time it would take me to fall off a log – which is always a good indicator of a tool that will be fun to work with :) Continue reading
PHP and Git Training Course Dates
Use a GitHub Branch as a Composer Dependency
composer.json
file for this project. Continue reading Git Log All Branches
The remedy for this situation? The --all
switch to git log
. Continue reading
Ubuntu and the X220T Touch Screen
I recently sorted this out, so I thought I’d share the scripts that worked for me on Saucy Salamander Ubuntu 13.10 with Unity.
First, work out which device you actually want:
$ xsetwacom --list
Wacom Bamboo stylus id: 11 type: STYLUS
Wacom ISDv4 E6 Pen stylus id: 13 type: STYLUS
Wacom ISDv4 E6 Finger touch id: 14 type: TOUCH
Wacom Bamboo eraser id: 19 type: ERASER
Wacom Bamboo cursor id: 20 type: CURSOR
Wacom Bamboo pad id: 21 type: PAD
Wacom ISDv4 E6 Pen eraser id: 22 type: ERASER
Then, use xsetwacom
to get the right touch input relating to the correct screen, even with multiple monitors:
$ xsetwacom set "Wacom ISDv4 E6 Finger touch" MapToOutput LVDS1
At this point I should point out that my touch screen is incorrectly configured and therefore needs the script above running every time I plug or unplug an external display. Since I dock my machine, move it almost daily, and regularly present … that’s kinda irritating. Any solutions on improving that are welcome.