Stuff I'm Up To

Technical Ramblings

Spectre and VMWare — March 8, 2019

Spectre and VMWare

For some time we’ve suffered a problem with our Windows 7 VDI systems that has prevented us from applying Windows Updates.

If we applied any of the rollups from March 2018 onward the VDI session would reboot itself under one special condition. If a user/client used the Cisco AnyConnect VPN software within the VDI Guest then almost exactly 2 minutes and 10 seconds after connecting, the VDI machine would throw a fatal error and reboot. Instantly terminating the users session.

Continue reading
PHPUnit Code Coverage — March 5, 2019

PHPUnit Code Coverage

The more development time we spend on the corporate Laravel app the more mature the code becomes and the more our development practices evolve.

One of the introductions was to ensure we carried out unit testing on our modules and classes to ensure we don’t break any existing functionality by introducing new features.

We started using PHPUnit to carry out the testing for our Laravel/PHP API’s. Now when we run our tests can we really be sure we haven’t broken anything? All we’re really doing is proving that we get consistent results to our tests. What we aren’t sure of is if the tests we have built are sufficient to cover all eventualities handled by our code eg. we know the test works when we pass in valid parameters, but did we write a test that passed in bad parameters, or test that we get a failure when we should?

This is where PHPUnit’s code coverage plugin comes into it.

Continue reading
PostGIS Query Optimisation — March 1, 2019

PostGIS Query Optimisation

I started to do some work on how efficient the spacial SQL queries I was using are. That meant looking at the indexing that is used on the geometry column and understanding the functions I used a bit more.

I made a simple change from using ST_Contains to ST_Within and made a tenfold increase in the performance of my query. Similarly with a change from ST_Distance to ST_DWithin.

Now if only I read the documentation more!

Prior to 1.3, ST_Expand was commonly used in conjunction with && and ST_Distance to achieve the same effect and in pre-1.3.4 this function was basically short-hand for that construct. From 1.3.4, ST_DWithin uses a more short-circuit distance function which should make it more efficient than prior versions for larger buffer regions.

Sophos Mobile 9.0 — February 28, 2019

Sophos Mobile 9.0

Today saw me upgrading our Sophos Mobile Control v8 server.

Mandatory Upgrade Notice: Sophos Mobile 9.0

Dear Customer,

Please be advised that, effective April 2019, management of Android devices will cease to function with versions of Sophos Mobile older than 8.6. All instances of the Sophos Mobile management server should be upgraded to the latest version, 9.0, to ensure continuous management. Read how to easily upgrade to Sophos Mobile 9.0 and find out what’s new.

Continue reading
Chocolatey Package Manager — February 27, 2019

Chocolatey Package Manager

Using package managers is second nature in Linux, but in Windows you get free reign to go download and install anything you like from anywhere. Not a bad thing, but when you have a host of packages installed, keeping them all up to date can be frustrating. That’s where “chocolatey” comes in.

Chocolatey is a windows package manager based on Powershell. You can use it in the same sort of way you’d use a Linux repository using choco install or choco uninstall to download and install packages.

But there is a GUI. Once you have installed chocolatey just use the installer (from the command line) to install the GUI:

C:\> choco install chocolateygui 

If you then use it to install all your required programs such as 7-Zip, Git, Java SE, Notepad++, VirtualBox, inkscape, etc. then each time you visit the GUI you can just click to upgrade everything and it will go fetch and install the latest version of all the software you used chocolatey to install.

PostGIS and geoJson — February 22, 2019

PostGIS and geoJson

On with this current theme of spacial systems and mapping, one of the interesting challenges I faced was querying spacial data.

My particular problem was trying not to publish masses of polygons up onto an Esri map layer and make the data layer too cumbersome for our intended visitors purpose.

We have a lot of plots of land that we care for and needed to check that when a web site visitor clicks on the Esri map that we check to see if the location they have clicked actually belongs to a plot we manage.

Continue reading
ESRI ArcGIS — February 21, 2019


Over the past few weeks I’ve entered into the world of spacial systems and mapping. We have a couple of members of staff who look after our GIS (Geographic Information Systems) that plot all kinds of spacial data onto maps for properties, water courses, streets, etc. The data they produce is used widely through many of our services, but now we’re starting to provide more interactive online mapping for the public.

ESRI ArcGIS Online

Continue reading
Apt Version Pinning — February 7, 2019

Apt Version Pinning

Today after running some apt upgrades my Laravel development environment failed to compile because of a newer version of nodejs than I currently require.

Module build failed: ModuleBuildError: Module build failed: Error: Missing binding /home/paulb/itsm/node_modules/node-sass/vendor/linux-x64-64/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 10.x

Found bindings for the following environments:
  - Linux 64-bit with Node.js 8.x

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
Continue reading
PHPUnit – Version Mismatch — February 4, 2019

PHPUnit – Version Mismatch

As our codebase matures we return to develop unit tests to ensure our QA process captures any code changes that may have altered the functionality of the product.

When calling PHPUnit on Windows or Linux we ran into some issues relating to the version of PHPUnit we had installed.

On Windows it was an ancient PHPUnit version 3 and on Linux It was running version 7. Neither of which were compatible with our Laravel 5.5 project which uses php version 7.0.

In order to use PHPUnit with our project we must use PHPUnit version 6 (see Supported Versions)

What I hadn’t realised is that we had installed PHPUnit both locally into the OS and with our Laravel project so it exists in composer.json and gets installed under the projects ./vendor. The version installed in the OS path is the version that isn’t compatible with our project, but because it’s in our path it’s taking precedence over our project installed version.

To run the project version we just need to be specific in how we call it.

$ ./vendor/phpunit/phpunit/phpunit
PHPUnit 6.5.13 by Sebastian Bergmann and contributors.

....F                                                               5 / 5 (100%)

Time: 345 ms, Memory: 16.00MB

There was 1 failure:

1) Tests\Unit\Finance\CostCodeTest::testApiGetCostCodes
Expected status code 401 but received 200.
Failed asserting that false is true.


Tests: 5, Assertions: 14, Failures: 1.

Gitahead — February 1, 2019
What’s in My EDC — January 30, 2019

What’s in My EDC

EDC All Packed

Every Day Carry is an up and coming buzz, but we’ve all probably been doing it for years. I’ve always had a few essentials in the car that includes a multi-tool, torch, a pen and packet of paracetamol.

I just decided to pad it out a bit and include some more useful stuff that could be grabbed from the car and chucked into an away day bag or rucksack. This is just a list of what goes into it.

The pack I chose to bundle this into comes from Amazon for £8. It’s a 1000D nylon pouch with two zip pockets, a buckle pocket and most importantly Molle fastenings. The Molle fastenings mean it’s able to be attached to any other Molle on a rucksack or vest. In this case the Molle has also been thought out to allow it to fit on to a regular belt.

I’m finding this an evolutionary process. Things I hadn’t thought put into my EDC are being added as I discover them and things I have are replaced by better or simpler versions.

What’s inside
Continue reading
apt-get Hash Sum Mismatch #2 — January 16, 2019

apt-get Hash Sum Mismatch #2

I’m still not sure why I’m getting this problem occur again. But when running apt-get upgrade the upgrades fail with a message like this:

Get:8 stretch/updates/main amd64 libudev1 amd64 232-25+deb9u8 [125 kB]
Err:8 stretch/updates/main amd64 libudev1 amd64 232-25+deb9u8
Hash Sum mismatch
Hashes of expected file:
SHA1:6590379bbc85f8d90c05a1b32cd27dac49431b7a [weak]
MD5Sum:40ace91d2e4c633f89d1571b3022dcdd [weak]
Filesize:125364 [weak]
Hashes of received file:
SHA1:7c501c7b49f4fe93d78309f5b5c635f1db487989 [weak]
MD5Sum:9b8faa999b5db9581ef0df62f697e4df [weak]
Filesize:877368 [weak]
Last modification reported: Sat, 08 Dec 2018 08:05:18 +0000

To resolve it I resorted to bypassing any caching and use apt to pull the update and upgrade:

$ sudo apt -o Acquire::https::No-Cache=True -o Acquire::http::No-Cache=True update
$ sudo apt -o Acquire::https::No-Cache=True -o Acquire::http::No-Cache=True upgrade