Passing strings between TinyGo and JavaScript

After getting a “Hello, World!" WebAssembly application working I thought it would be fun to try and implement a toy programming language in the browser. However before I could even start thinking about parsers, abstract syntax trees and the like I had to be able to pass strings between my WebAssembly module and the surrounding JavaScript.

Turns out that is much trickier than I expected.

Saying 'Hello, World!' with TinyGo and WebAssembly

WebAssembly is something I’ve wanted to play with for quite a while now and I’ve finally got around to taking a look at it. In this post I describe how I managed to use TinyGo to compile a “Hello, World!” Go program into WebAssembly and execute it in the browser. So that I have something to refer back to I also describe setting up my development environment as a container using LXD.

Learning Vulkan: Enumerating Physical Devices

Being an API for talking to GPUs and other compute devices every Vulkan program starts off by looking for an appropriate physical device to use. In this post I write a little C program that initialises the Vulkan API and lists out the available devices in the system.

$ vkdevice
Device Name:            Intel(R) HD Graphics 520 (Skylake GT2)
  Type:                 Integrated GPU
  Vendor ID:            32902
  Device ID:            6422
  API Version:          v1.1.102
  Driver Version:       v19.3.1
Learning Vulkan: Overview

I have always been interested in graphics and have on numerous occasions tried to dip my toe into the world of OpenGL and more recently Vulkan. However I have never been able to get past the “Hello, World” of these technologies - drawing a triangle on screen, I think mostly becuase I never really had a goal in mind once I got that far…

But that’s (hopefully) about to change! What better excuse than a new decade to jump back into this world for the 100th time and try to get to all those interesting ideas I see people playing with all the time!

Implementing Click & Drag with Vanilla JS

Try clicking and dragging on this circle.


This post makes use of a number of interactive elements to help illustrate a few concepts. Unfortunately these do not yet work on mobile devices - sorry mobile users!

I have for quite some time now wanted to play around with web development some more, particularly using web technologies to build user interfaces of some kind. However there is just so much out there it’s been impossible for me to really get anywhere past a “Hello, World!” tutorial before I find myself trying out the next new shiny.

So I’ve decided to abandon everything and try a bottom up approach where I see how far I can push the core web technologies - HTML, CSS and JavaScript. Hopefully then by the time I start using one of the gazillion libraries out there I will have a better understanding of why I needed it in the first place.

In this post I will be looking at implementing clicking and dragging functionality using only vanilla JavaScript. Clicking and dragging as a concept can apply to many kinds of interactions so in this instance I’m specifically referring to clicking on an SVG element moving it around on the page as illustrated by the demo above.

Introducing Stylo Doodles!

A few weeks back at PyConUK I gave my first lighting talk at a conference. During that talk I spoke publically about stylo for the first time. Stylo is a Python library that I have been working on for just over a year and a half and it aims to make the creation of images easier by bringing together ideas from programming and mathematics.

Version 0.6.0 was recently released which included the first feature that wasn’t written by me! It’s very exciting not only to see other people starting to take an interest in the project but taking the time to make a contribution!

Now that stylo seems to be getting to the point that it might me useful to other people wouldn’t it be great if there was a community driven example gallery that people could get inspired by? - Well now there is! And it’s called Stylo Doodles

I've Started a Blog… Again!

Not that you would have known it, but I’ve had a blog since 2014. Well 2015 if you’re feeling generous, the first (and only) post went up in the last few hours of New Year’s Eve. It was a look back on some of the projects I had worked on that year and I announced my intentions to start blogging.

Fast forward nearly 4 years and here I am announcing my intentions to start blogging - again. So I guess you are wondering what happened?

I got lost.

My first attempt at running a blog was using Jekyll and for some mystical reason (It’s been so long I can’t actually remember why), I decided that it was not the static site generator I was looking for. So I promptly set off on a voyage of discovery in search of the ultimate static site generator.

Cloning Git Repos with Submodules
To clone a repo that contains submodules we can run the following command $ git clone --recurse-submodules <repo-url> Or if you’ve already cloned a repo only to later discover that it contained submodules $ git submodule update --init --recursive
Custom Jupyter Kernels
It’s possible to create custom Python environments for use within a Jupyter notebook without having to run a jupyter server from each of them. The following steps will allow you to have a single jupyter server running and have it use a variety of Python environments in its notebooks Create a virtualenv and install any packages that you want available pip install ipykernel ipykernel install --user --name <envname> --display-name <display name> Then the new environment should become available in the Change kernel menu