$ hg push -f // will create a branch with multiple heads

$ hg heads // will show if multiple heads

$ hg update -r <head-to-close:number>

$ hg commit — close-branch -m ‘Closing old branch’

$hg heads // check has been closed and hidden

$ hg update -r <head:number>

$ hg push

Compilation (for dummies like me)

Lexing (tokenizer)

Takes an input and produces a list of tokens e.g. variable declaration and remove whitespace and comments

var a = 5;---------------[{value: 'const', type: 'keyword'}, {value: a, type: 'identifier'..... }]

Lexical errors arise when the input does not correlate with any tokens regex. Eg const a = @ 54; using @ generates a lexical error.



Dissects the tokens into logically meaningful parts to produce an Abstract Syntax Tree.

[{value: 'const', type: 'keyword'}, {value: a, type: 'identifier'..... }]---------------{"type": "VariableDeclarator", "id": {"type": "Identifier", "name": "a"}}

Syntax errors arise when the src code can be tokenized however the syntax…

Truthy, Falsy and Comparisons in Javascript

There are number of for loops with javascript which use the following syntax.

for (var i = 0, key; key = uniqueLocations[i++];) {
colorMap[key] = colorArray[index + i];
  1. Initialisation, initialise both values: var i = 0, key
  2. Condition, performs assignment and rests the result of the assignment: key = uniqueLocations[i++];
  3. Control factor, absent (e.g. i++): Managed within the condition
while (condition) {
control factor;

So when we substitute the loop, we get:

var i = 0, key;
while (key = uniqueLocations[i++]) {
// fancy stuff here

The condition checks whether the newly assigned value is…

So you want to set up a react application? ….there’s more than one way to skin a cat…

Browser Based?

Managed by Facebook, create-react-app is a starter kit. It creates boilerplate configuration for your application.

yarn global add create-react-app
create-react-app <project-name>
cd <project-name>

Native App?

Image for post
Image for post

There are three main ways to start a new react native application. React Native CLI, Create React Native App or via Expo.

React Native CLI

Managed by Facebook, React Native CLI is a command line shell used to scaffold a react native application leveraging the react-native library.

yarn global add react-native-cli
react-native init <project-name>
cd <project-name>
react-native run-ios / run-android


Managed by…

Dependencies, understand them, manage them

I use yarn in my react development environment. As someone with experience in Composer (PHP), there are a number of similarities, but enough differences to make this post useful for me.

There is a lot of documentation out there regarding Node, NPM and Yarn, however it is important to understand that unlike many dependency management tools, NPM installs a tree of dependencies.

Image for post
Image for post

NPM, great, so what?

With many other dependency tools, we choose one version of a package, which is made available to any other module that may need it. …

{Babel, Webpack } = this.post

{NVM, Node, NPM, Yarn, VSCode, ESLint} = that.post // create-react-app
{VirtualBox, Genymotion, Watchman} = another.post // react-native-app
{Expo, Android Studio} = another.post // expo ap

CRA (create-react-app) installs and configures webpack and babel automatically. However if you want to work on your own projects outside of this realm you will need to configure these manually.

Image for post
Image for post


> Why: At is core ‘webpack’ is simply a module bundler and task runner.


Identifying the root [path]/ src directory. Everything that is bundled with a webpack application is normally included via one entry point (normally index.js), when deploying, webpack…

{NVM, Node, NPM, Yarn, VSCode, ESLint, Flow} = this.post

{Babel, Webpack } = another.post // custom js project
{VirtualBox, Genymotion, Watchman} = another.post // react-native-app
{Expo, Android Studio} = another.post // expo app

Node Package Managers

Node Version Manager (NVM)
>Why: Node Version Manager allows easy updating of node versions, it also avoids permission errors as global packages are installed via ~/.nvm
> Install: https://github.com/creationix/nvm


> Why: Yarn is the Facebook interpretation of NPM aimed at solving some issues such as speed, dependencies, cache management. With two Node Package Managers (NPM comes packaged with Node) they need to play nice. …

ASCII(American Standard Code for Information Interchange).

A representation a text using numbers. It was originally designed for teletypes, essentially plain text with no formatting. ASCII is a 7 bit character set containing 128 characters. It includes upper and lower case A-Z, numbers and special chars (line break, carriage return, escape etc.).

N.B. Line breaks

CR and LF are ASCII control characters. CR is a bytecode for carriage return (from the days of typewriters) and LF similarly, for line feed.

Different OS uses different bytecode for line breaks (Windows uses CR LF line endings while Unix just uses LF). This can cause issues when saving documents cross-platform.


UniCode is a…

1) Check there are no existing keys on the system

$ ls -la id_* ~/.ssh

2) Create new ssh key

$ ssh-keygen -t rsa

3) Get new ssh public key

$ cat ~/.ssh/id_rsa.pub

ssh: service that connects to remote machines via OpenSSH SSH

sshd: the daemon that allows other to connect to the machine via OpenSSH

ssh-keygen : bash command to create new private ssh key and corresponding public key.

ssh-add : adds RSA or DSA identities to the authentication agent

ssh-agent is a program to hold private keys used for public key authentication (RSA, DSA).

Setting up SSH Keys For Multiple Accounts

Like most people I…

We have a few alerts which send out an email if the mail queue gets a bit unwieldy on our server. This helps us to identify any potential spammy hacks which get onto our server. Wordpress and Drupal being the most popular CMS’s are normally the most at risk unless security updates are regularly applied.

Recently a Wordpress site was hacked and placed a nicely base encoded script which spammed and got our server on a blacklist. Looking in our logs we could see a file ‘view.php’ was being run to spam from our servers. …

John Williams

Internet Things

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store