Connecting to Public WiFi with Custom DNS Settings on MacOS

Where’s my free Wifi?

For months I have been having an issue with connecting my MacBook to public WiFi hotspots and nothing would coax it into life. It would be showing as connected but wouldn’t connect to any internet pages.

This was highly frustrating as it meant that I couldn’t do any work on public hotspots (I appreciate that there are a couple of positives of that scenario in that I couldn’t do any work and I was probably more secure).

In an effort to fix this I tried all of the following at one time or another:

  • Cleared the browser cache
  • Forgotten the network
  • Deregistered my device on the providers sites
  • Tried going to

Light at the end of the tunnel?

And then last week I found myself on a train with three hours to kill and so I decided that I needed to fix this once and for all.

I spent a happy half an hour revisiting the above list before I started to delve deeper into the network settings when I spotted this:

DNS Settings

In an effort to bolster security and improve speed I had switched over from the DNS servers handed out by whichever router I was connected to and move to using Cloudflare’s service. I wondered if that was it. So I removed them and lo and behold suddenly I had internet access!

While this was great it wasn’t very useful as I had to remember to add and remove the IP addresses when I switched between public and private networks. Turns out that Apple have thought of this and MacOS has the ability to create what it calls Locations and to easily switch between them making this much more convenient.

Setting up Locations in MacOS

Turns out that added a new location is easy. Firstly go to System Preferences and then choose Network. At the top you will see a drop down list labelled Location. Select this and then “Edit Locations…”.

Next add your required locations and click Done.

Location Manager

Now select the Location that you want to amend from the drop down and go through all the changes in each of the relevant tabs. In my case I only need to remove the IP addresses from the DNS tab from one location and leave them in for the other. Finally, click the Apply button at the bottom of the page to save the changes.

To switch locations you now just need to click on Apple symbol () in the top left of the menu bar, then Location and finally your desired location from the list.

Quickly Selecting your Location

All of this has certainly taken me some time to resolve but now I have it setup it is a real time saver. Hopefully it will save you some time too.

How to store UNICODE in a non-UNICODE database

For a side project I am working on (Glad you asked! PostRecycler which makes the most of your social posts) I needed to all entry of unicode characters for just one field.

This left me in a bit of a quandary as I really didn’t want to have to convert the whole of my database to UTF-8 just so I could have this one column accept unicode characters.

Then I remembered something I had discovered in our companies web app which accepted unicode characters but I knew the database wasn’t unicode enabled. However, I knew that this column was encrypted and this proved to be the key.

If you are using a framework such as as I am with Codeigniter then this is incredibly easy. All I needed to do was the following before writing to the database. Of course I needed to decrypt when read too.

    $ciphertext = $this->encryption->encrypt($text);

Why does this work? Simply the encrypted text contains only basic alphanumeric characters and some symbols all of which appear within the ASCII character set and can be stored without resorting to changing the database structure.

If you want to test this out I suggest that you take a look at the big list of naughty strings and try copy and pasting some in to check it is working as expected.

It feels like a cheat doing it this way but it has the advantage of being quick AND you get encrypted data too!

Laptop Stickers

What is it with developers and laptop stickers? It seems that in every coffee shop there will be individuals scattered around hunched over their (usually) Apple Macs and the lid will be covered in stickers. And you know what? I’m exactly the same!

The laptop above is my old trusty Macbook Air along with its accompanying stickers. In fact since that picture was taken it has gained even more. It has stickers covering all my areas of interest:

  • development (including the “Cutting and pasting from Stack Overflow” classic)
  • music (from Real World records)
  • Evernote
  • Star Wars (from here)

Many of my stickers I have picked up over the years from conferences and various tech events which seem to give them out like sweets. You can also get a great set here from which includes the awesome Stack Overflow one.

Why am I mentioning this now? Well because I saw a an article by Graham Stevens called “Preserving Laptop Stickers on MacBooks” which I found an intriguing.What Graham has done and kudos to him for the effort that he has put into this, is basically find a wrap that exactly matches the colour of his MacBook which he applies onto the lid and then onto which he applies the stickers.

Why would he go to all this trouble? Well for one he is conscious of not damaging the lid of his laptop and reducing the resale value. Secondly it is an opportunity to save all the stickers at the machines end of life and keep it as a permanent reminder.

I was very taken by this idea and it seems so were many others as he received so many enquiries on how they could go about it themselves that he has set up a Kickstarter campaign.

Right now the campaign has reached half its target so if you want to help Graham over the line get backing!

Setting the Codeigniter Environment for both CLI and Browser

I’ve recently been getting to grips with the Codeigniter framework after years of using a home-grown monstrosity. I was becoming more and more concerned about the level of security in my own framework and decided I would be better off with something that’s maintained.

I researched the many PHP frameworks to find one that was going to work for me. I toyed with the idea of using Symfony, which is what our products are based on, but the time to get up-to-speed with it was greater than I wanted to invest. I therefore settled on Codeigniter which looked easier to get started with while still offering a lot the scaffolding I knew I needed.

I’m currently in the process of rewriting PostRecycler to use CodeIgniter and it has been pretty swift and straightforward. One thing that threw me for quite a while though was getting the environments to work across all platforms and domains.

By default the environment setting (which you can find in index.php in the root of your project) is simply the following:

define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');

This is straightforward enough but gives no flexibility at all so I set about crafting the perfect environment setter which is below. None of this is completely original. Some comes from Lonnie Ezell’s excellent book Practical Codeigniter 3, some from other blogs and other bits I added.

The code starts by setting an array with all the domains that you are using and assigning them an environment. This is taken from Lonnie’s book. The difference here is in the handling of CLI calls. My app has both web and command line controllers so it was important that it should be able to handle both.

Unlike when being called from the browser where you can infer the environment from the domain name with the CLI you need to tell it. This is done as follows:

php index.php controller index --env development

By checking php_sapi_name() you can see if the controller is being called from the command line. Then grab the arguments and look for ‘–env’ taking the following one as the environment.

My change is to firstly bring these two approaches together (browser and CLI environment setting) along with setting a default environment for CLI in case the parameters aren’t passed. Like calling from the WWW this defaults to setting the environment as production, the safest option to take. The final code is as follows:

$domains = array(
	'application.local' => 'development',
	'' => 'testing',
	'' => 'production',
	'' => 'production'

if (php_sapi_name() === 'cli') {
	if (isset($argv)){
		// grab the --env argument, and the one that comes next
		$key = (array_search('--env', $argv));

		if (empty($key)){
			define('ENVIRONMENT', 'production');
			$environment = $argv[$key +1];

			define('ENVIRONMENT', $environment);

			// get rid of them so they don't get passed in to our method as parameter values
			unset($argv[$key], $argv[$key +1]);
			define('ENVIRONMENT', 'development');
	// Have we defined a server for this host?
	if ( ! empty($domains[$_SERVER['HTTP_HOST']]))
		define('ENVIRONMENT', $domains[$_SERVER['HTTP_HOST']]);
	// Or is it a development machine, like
	else if (strpos($_SERVER['HTTP_HOST'], '.local') !== FALSE)
		define('ENVIRONMENT', 'development');
	// Else - be safe...
		define('ENVIRONMENT', 'production');

Hopefully you will find the code useful and save you some time.

Mouse support in iPadOS/iOS13 Public Beta 3

The latest beta version of iOS13/iPadOS was released yesterday evening and I gave it a quick test this morning to see how the mouse support was coming along.

I know form comments made elsewhere that mouse support is not for everyone and some don’t understand why it is even necessary. For me it is a useful tool for when working away from my desk as I find it speeds up my work and make it a more pleasant experience. I still don’t think I could ever use the iPad as a permanent desktop replacement but it is a lot more usable than it once was.

In the video below I am using this TeckNet Bluetooth Mouse which at £10 is a lot cheaper than some others that have been suggested online. Several have sung the praises of the Citrix X1 but at £95 that’s more than I would want to spend on a mouse!

So here’s a quick video looking at the improving mouse support in the latest released beta version of iOS13 on an iPad. What works and what does not…

Have you installed the beta on your device? How are you finding the mouse support?

Using Google Translate to Automatically Translate a Symfony Language File

Recently the company I work for launched a new version of our product with multi-language capabilities. This was great for us but when we wanted to expand out to other languages we found that it was expensive to have the file translated.

Given that our language file is in a standard format (Symfony’s message YML format) we wondered if it would be possible to convert the file automatically via Google Translate and then give it to a translator to polish. It turns out that it is and this is quicker and cheaper than having all the file translated straight from English by a translator.

The routine itself is pretty straightforward but does require some set up beforehand. This includes creating a Google developer account, installation of Composer and the Google Translate API. All of this is described in detail with a step-by-step guide here.

I am going to assume that you have done all the necessary set-up. One important thing to remember is to setup you credentials on your machine for me (on a Mac but should be the same on Linux) you need to do the following:


The routine itself is written in PHP and runs from the command line and takes three parameters as follows:

  • name of the file you want translated
  • name of the output file
  • ISO code of the language you want to translate to (see here for list of supported languages)

So you might run it as follows:

php ./trans.php messages.en.yml es

So here is the code, remember to change line 29 to include your Google project ID.


// grab the file to be translated
if (empty($argv[1])) {
  die('You must give an input file'.PHP_EOL);
  $in = $argv[1];

// grab the file it is to be written to
if (empty($argv[2])) {
  die('You must give an output file'.PHP_EOL);
  $out = $argv[2];

// grab the target language
if (empty($argv[3])) {
  die('You must give a target language'.PHP_EOL);
  $targetLanguage = $argv[3];

require __DIR__ . '/vendor/autoload.php';

use Google\Cloud\Translate\TranslateClient;

$translate = new TranslateClient([
    'projectId' => 'YOUR-GOOGLE-PROJECT-ID'
// open the input file to an array
$messages = file($in);

// create the output file
$translated = fopen($out, 'w');

// process each message
for ($i = 0; $i < count($messages); $i++) {

  // does this have any message text?
  if (strpos($messages[$i], ": ") !== FALSE){
    // translate the text
    $text = substr($messages[$i], strpos($messages[$i], ": ")+3,(strlen($messages[$i])-(strpos($messages[$i], ": "))-6));

    $result = $translate->translate($text, [
      'target' => $targetLanguage,

    // write the translated line
    fwrite($translated, substr($messages[$i], 0, strpos($messages[$i], ": ")).": '".html_entity_decode($result)."'".PHP_EOL);
    // rewrite the line
    fwrite($translated, $messages[$i]);

// close the output file

echo 'Translated '.$i.' lines';


In action it takes just a few minutes to translate the 1,000 or so stings we have in our language file.

Automatically Translate a Symfony Language in action

There would be a cost associated with this but I am currently using the free credits that I got when I created my Google account. Even so the costs are going to be tiny compared to having someone translate the whole file.

I am sure that there are ways that this could be improved but should prove useful as a starting point when you want a quick way to get a Symfony messages file translated.

iPad Pro, iOS13 and USB-c Dongles

Each year, regular as clockwork, Apple releases a new version of their operating system for mobile devices – iOS. This years version, iOS13, has recently been release for public beta and I took the plunge and installed it on my iPad Pro so you don’t have to!

Can’t we all run the beta?

Before we get too much into the new features of iOS here are a couple of reasons why you might not want to be installing it on your main device just yet. Beta software by definition is not fully baked and still has a number of bugs in it. The idea of releasing a public beta is so that Apple can get some valuable feedback and fix the major issues before go live to the masses, likely some time in October.

That means that if you are testing the beta version you will find issues and oddities such as the following…

Vertical toolbar on landscape screen anyone?

And this less that useful on-screen keyboard…

More icons

Probably the most visible change is to the home screen and the size of the icons which have shrunk. This allows for a greater number to be shown at once and has also allowed for a couple of widgets to be shown on the left hand side in landscape mode.

While this is fine as far as it goes when you have all slots filled (that’s 30 icons + another 11 on the toolbar) it does become increasingly difficult to find exactly what you are looking for!

Dark Mode

Since the introduction of the OLED screen on the iPhone X people seem to have been clamouring for a native dark mode on iOS and here it is.

Options are as you would expect with the ability to have it come on automatically at sunset and off again at sunrise or you can set your own schedule. Or turn it off completely.

For this to be of real use we will have to wait until apps on the app store are launch to take advantage of this.


One of the reasons I upgraded to the beta was for the support of external storage such as SD cards, usb sticks and even hard drives. You can now plug in, via a cable or hub if you don’t have a USB-C drive, storage and finally manage it from the Files app.

What’s great about this is that with a USB-C hub you can plug in multiple devices at the same time and as long as they don’t use too much power all will work simultaneously. All storage appears as a separate section in the Files app.

This will be useful to be able to carry more media such as videos around without having to clog up the memory on the iPad itself and for transferring files.


Another nifty feature is the ability to support a mouse. Or at least it would be if I could get it to work. In theory both wired and bluetooth mice are supported but, to date, I can only get an old Logitech mouse to work. The Microsoft mouse connects be refuses to work unless the wired mouse is also connected. Of course this could be a beta issue that’s rectified in a later release.

The mouse support does work well though even if it does take a little getting used to. You can map the buttons onto a variety of actions such as opening the home screen. Scrolling also works but in the opposite direction to what I have set on my Mac so I hope that an option will be added to swap this in future.

I have read a number of posts online with people saying things like “wE doNT nE3D moUsE SuPpOrT” (literally like that!). For many that’s probably true but sometimes it makes no sense to be prodding the screen all the time and it is more natural to use a mouse. Having only the wired mouse doesn’t really work for me but if my Microsoft Bluetooth Notebook Mouse 5000 can be coaxed into life then I would be much more onboard with it.

Oh and one more thing…

It is no longer iOS on the iPad but iPadOS reflecting all the extras that it brings.

iPadOS has lots of other changes but they are covered just as well elsewhere. Are you going to load up the beta on your devices?

Text Expansion with Alfred

I’ve had my MacBook Air for over five years now and by and large it is still performing pretty well. Certainly better after that time than any Windows machines I’ve had in the past would have done.

Just recently, though, I’d been having a performance problem which led me to do a root and branch check of my machine (turned out it was the Sophos Home Virus scanner). As part of this I stumbled upon the fact that Alfred can do text expansion and this left me to wonder whether it was worth having two programs sat in the background waiting to do the same thing.

For years now I have used TextExpander for my text expansion needs and found it indispensable using it many times each day. But like so many others the company behind the program have moved to a subscription model and I am trying to wean myself off having lots of little subscriptions (I think that might be a post for another day). It’s not that I don’t value the program, I absolutely do, but I just am not a power user and so didn’t feel I’d be getting the value from the subscription.

That Alfred can do text expansion was, as I said, a bit of a surprise. I know it is very capable and again I use it all day every day but I did wonder what load was being added to my machine having two programs just sitting there looking at my keyboard input waiting for my to type my snippet keyword.

I have a reasonable number of snippets and didn’t relish entering them all again. Fortunately someone has written a routine to convert TextExpander snippets to Alfred format so testing it out was easy.

And how does it compare? I can safely say that I haven’t noticed any difference at all. So that was goodbye TextExpander. If you have both I would highly recommend taking a look and see if the switch might work for you too.

photofeeler – do I look good on this?

Everyone knows that looking good in your social media profile pictures is important and nowhere more so than on LinkedIn. But how do you know what is the best picture to use? Well that is where online service photofeeler comes in.

Photofeeler attempts to take some of the guesswork out of selecting the optimum picture by crowdsourcing views on pictures you upload aggregating the responses to give you a score.

You start by uploading a picture that you are interested in and select a category that this would be used with, so business or social. This is then available to other users to score on three attributes depending on the category. On the free account you can only have one test running at any one time and the responses are throttled so if you want quicker answers you’ll have to pay up.

After a few days you will start to see some results come through which look like the following. Here I have shown my current and previous LinkedIn profile pictures for comparison. I score more highly on the current one which is good!

The respondents also have the ability to add notes to go along with their score. Examples of these you can see below. If you think that they look a bit repetitive that’s because photofeeler suggests a list of notes you might like to choose from. Where people have taken the time and trouble to make their own comment it seems my shirt comes in for a bit of stick but hey I like it so I’m keeping it.

Does all this really matter you might ask. Well, according to LinkedIn, just having a photo “results in up to 21x more profile views and 9x more connection requests” so yes and having something that is appealing to people make sense.

Photofeeler makes sense for those that can’t work out what would be appropriate for their profile pictures and why what you use on LinkedIn might not be suitable for your Tinder profile. Judging by the number of dodgy holiday snaps I see on LinkedIn there are plenty that could make use of it.

Using the iPad Mini as a Kindle Replacement

I like reading and for years I have been happily doing so on a very old Amazon Kindle which was a hand-me-down from the wife. I never bothered to upgrade as the newer models always seemed bulkier than what I had.

That was until like everyone else on the planet when you reach a certain age you need glasses and things become difficult to see, particularly in low light. My existing Kindle had no light and so I was forced to start thinking about a replacement.

Initially I toyed with the idea of a new Kindle or more likely my wife getting a new Kindle and me getting her old backlit model. But I am all in on Apple and so I wondered if an iPad Mini might not be a suitable alternative. So I picked up a generation 1 16gb model off eBay in order to find out and this is what I thought.

The first shocker was that it could only run iOS9 which meant it felt slow and the latest Kindle app isn’t compatible! Fortunately as I had previously downloaded it I offered the chance to download a previous version which works just fine. Phew!

Next issue was that the glass screen is highly reflective and it was almost impossible to see anything due to the light. After a quick bit of research I found these anti-glare screen protectors which are brilliant. Not only have they completed eliminated the glare but it also give the screen a very similar feel to the Kindle.

With the hardware side of things out the way I was finally able to read a book! Unsurprisingly this is very similar experience to my previous Kindle with the bonuses of it being lit and colour which means you can change the paper type for example.

That it’s colour also means that it is great for graphical content such as comic books and it is here where the iPad scores highly over the Kindle. As it is running iOS you can download anything from the app store (albeit with the iOS9 compatible restriction). So I have installed Comic Zeal and Instapaper and, of course, Safari so you have the whole of the web too.

Another plus is the Audible integration. If you are not familiar with Audible it is Amazon’s audiobook arm, an area growing quicker than ebooks. What’s neat about this is that your progress is synchronised between the ebook and audiobook (assuming that you own both). You can download the audiobook in the Kindle app and listen or read.

Of course the battery life on the iPad is worse than the Kindle but nowhere near as bad as I expected it to be. Just using it as an ereader gives me days worth of use without worrying about recharging. Of course as it is charger from a lightning cable I have lots of those around so there is always one to hand.

All in all I am happy with the switch and would recommend it for anyone that wants a colour, multi-talented ereader.


  • Works well
  • Can read at night
  • Can be used for other things
  • Colour screen so better for graphic content
  • Better synchronisation between kindle apps and devices
  • Audible


  • Screen very bright and needs an anti glare cover
  • How long is the software going to continue to be supported? 
  • Very slow!
  • Battery life not as good. Charge more frequently.