General

Posts that cover general aspects of programming.

Keychron K2 Wireless Mechanical Keyboard: A Review

13th July 2020 - 8 minutes read time
I (like a lot of other people) recently started to work at home a lot more, and with a permanent desk setup at home I wanted a decent keyboard to work with. My work machine is a MacBook Pro 2018 and I dislike the keyboard quite a lot. It feels 'poppy', has some interesting key placements (the up and down arrows in particular), has no escape key or function keys at all.

Grep Context

27th June 2020 - 3 minutes read time

Grep is a really powerful tool for finding things in files. I often use it to scan for plugins in the Drupal codebase or to scan through a CSV or log file for data.

For example, to scan for user centric ViewsFilter plugins in the Drupal core directory use this command (assuming you are relative to the core directory).

grep "@ViewsFilter(\"user" -r core

The -r flag here recursively scans the 'core' directory. This command returns the following output.

Wrap Around Increments

21st June 2020 - 5 minutes read time
Something I've been writing long hand for a number of years is wrap around increments. This is essentially adding to a value that has an upper limit, and wrapping back to 0 when that max value is reached. This can be done with an if statement.

Creating A Chatbot Agent With Dialogflow And Kommunicate

19th April 2020 - 12 minutes read time

Having a chat feature on your website (commonly called 'live chat') is useful when helping your users overcome any difficulties they are having. You can pop up a little chat window in the page and ask if they need any help finding what they need. This can be especially useful on large commerce sites where users might get stuck looking for things.

The addition of a chatbot also allows you to automatically answer some of more common questions. For example, if a user asks where they can find the delivery and returns policy then a chatbot can automatically respond with a response. These rules can get more complicated, but it depends on what you instruct the bot to answer to.

Adventures In FizzBuzz

29th February 2020 - 8 minutes read time

Tests for programmers in an interview process are not uncommon. For the last couple of years I have asked a quick pre-interview question to junior developers to see what sort of stuff they come up with.

As I don't want to set any developer a task that will take longer than absolutely needed I opted to set a very simple task for them. Commonly known as "FizzBuzz", this task is as follows.

"Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz"."

The expected output for this would be something like this.

Image Colorising In PHP

14th January 2019 - 3 minutes read time

Colorising images is fairly simple to accomplish, especially using PHP's GD library. All we need to do is load an image, create a blank image of the same size in a particular color and then merge the two images together.

In fact, we can do this entirely with the imagecopymerge() function, but creating a function to wrap all of this makes sense as well.

The following function takes an image resource (as created by imagecreatefrompng()), the red, green, and blue values of the color, and the percentage to overlay the color on top of the image. The percentage can be set to 0 for no effect and 100 to fully replace the image with the given color.

BSides Manchester 2018

18th August 2018 - 7 minutes read time
For the second year running I attended BSides Manchester conference, held at the Manchester Metropolitan University Business School on Thursday 16th August. This is a technical cybersecurity conference that is organised by a dedicated team of volunteers. I was really impressed by last years conference so was really keen on attending this year.

BSides Manchester 2017

8th October 2017 - 7 minutes read time

I recently attended the BSides Manchester conference, which was held at Manchester Metropolitan University Business School on 17th August 2017. This was a security and hacking conference that was free to attend, but had a very limited number of tickets available. After missing the first two releases of tickets I managed to get one from the waiting list.

After some introductions we got started with the first talk of the day, which was Dominic Chell & Vincent Ylu talking about A Year In The Red. As a non-security professional I had to Google exactly what some of the terms in this talk meant. So apparently red team refers to a security consultancy who are hired to attack a system or network. Conversely, blue team is a security team that is resident within an organisation. A funny talk with some good demonstrations of hacking attacks.

Why I Went For A Macbook Pro

13th September 2012 - 7 minutes read time

I very recently took delivery a 15 inch MacBook Pro (my first Apple computer) and I thought I would write about my reasoning behind it. Normally, people don't tend to ask why you bought a computer, but with Apple products it seems to be different. I think I have stated my reasons to a few different people already, so I thought it would make a good blog post.

LAMP And Beyond: A Review

3rd July 2012 - 4 minutes read time

Saturday 30th June saw a one off event organised by the PHPNW community called LAMP and Beyond. The idea was that it would bring together people of differing abilities with the aim of sharing skills and experience with servers, programming, source control, or whatever happened to be of interest at the time.

With 30 or so people signed up to the event we filled the top floor of MadLab in Manchester and got started (after a bit of coffee first). Taking some post-it notes we wrote down what we wanted to know about and what we could teach about onto a board and then broke off into groups where people's interest matched.