will

Where there is a Will

Will McGugan's Blog

I am a freelance software developer (code monkey) living in London.

I post mostly about tech and photography (all photos are my work unless otherwise stated)

Edinburgh, I am in you

From one capital to another; I have moved from London to Edinburgh!

I'm looking forward to connecting with Edinburgh Pythonistas, techies and/or photographers. Get in touch if you would like to meet up for a beer or coffee.

Here's a few Edinburgh photos. You can tell by the sunshine that they are not recent shots...

A view from Calton Hill at sunset.

Edinburgh has some grand buildings.

An alternative view from Calton Hill.

A view of Edinburgh from inside the Nelson monument.

Announcing Moya 0.6.0

I'm happy to announce release 0.6.0 of Moya.

Moya is a web-application platform written in Python. In that respect it is a lot like other Python frameworks such as Django, Pyramid, Flask, Bottle etc. Moya has versatile URL routing, a fast template language, an ORM, a forms library, i18n support, image processing, and a variety of other tools to build a modern web app. Where Moya differs from other Python frameworks in that Python is not required to make use of these features. continue reading…

Using a Raspberry Pi + Camera to Monitor the Nocturnal Activities of Tropical Insects

Raspberry Pis are useful little computers. I own several, since I work with them in my day job, and I thought it was about time I put one to use.

I also happen to keep tropical insects. Specifically, beetles. These are not your garden variety beetles, unless you happen to live in a rain forest. The ones I have at the moment are elephant beetles which come from Central and South America. Here's a photo:

Male elephant beetle. Banana for scale.

These insects are mostly nocturnal. During the day they tend to burrow under their bedding material (moss), or hang out on a branch. But during the night, they can be quite active. I know this because in the morning they have re-arranged the branches in their tank. continue reading…

Moya Template Language

Moya's template language is a spiritual successor to Django, and Jinja templates. It borrows a number of constructs from both, and adds a few of its own.

There is a slight difference in the syntax in that variables are substituted with ${variable} rather than {{ variable }}, but tags still use the familiar {% tag %} syntax.

Template languages are generally quite extensible, so there is probably nothing that Moya templates can do that Django / Jinja can't (via a plugin or extension), but there are a few things which are I think are more elegant in Moya's templates language (and built-in). I'm going to talk about a few of them in this post.

How often have you written code like this? continue reading…

Deploy Encrypted Notes 1.0.0 to Heroku

A few weeks ago I built a little web application to store notes, which encrypts your notes in the browser and stores them in the cloud (yeah, I hate that term). The idea was that even if the server was compromised, nobody could read the notes without a password.

From the server logs it looks like a few people at least are actively using it, even though there is a big warning saying it is for testing only. No idea for what of course, because even in the admin all I can see is a string of random characters.

This is how notes are stored in the database.

I've jumped straight to version 1.0.0 with the latest release, since it has been running quite happily for quite some time with no issues. It's still 'use at your own risk', but it is such a simple application that there is so little to go wrong. continue reading…

Deploy Moya Techblog with Heroku

A quick way to get Moya Techblog up and running (or just to test it) is to deploy it with Heroku.

If you click the following button, it will deploy Techblog on a public server:

When that's done you should have a working version of this site (sans my content obviously). It's remarkably easy to customize if you aren't happy with my coder design skills.

There is one caveat you should be aware of; Heroku has an ephemeral filesystem, which basically means that your uploaded files will disappear after a while. That is bit of a deal-breaker for a site designed for photography, but there is a solution. You can host your uploads with Amazon S3.

To use Amazon S3 with Techblog, set the following environment variables (you will have a chance to edit these when you deploy): continue reading…

Introducing Moya Techblog, a Blogging Engine for Coders and Photographers

I've had a blog on my vanity domain for nearly a decade now. For the last 6 years, it has been powered by Django Techblog, which I wrote out of my frustration with syntax highlighting plugins in Wordpress. Techblog has happily served my blog those 6 years, with only minor hiccups when I half-heartedly ported the code to the latest Django.

There was nothing terribly wrong with Django Techblog; it had multiple blogs, tags, search etc., but there were some annoyances that I didn't have the motivation to do much about. The custom markup system I used was clever, but I would often forget the syntax! The support for images was rudimentary and the single-threaded comment system wouldn't notify me of replies. continue reading…

Looking for an experienced Python Developer

My client, WildFoundry, is looking for an experienced Python developer to join us. We work in the field of IoT, and you will get to work with a variety of really cool technologies. Here's the job description:

WildFoundry is seeking a senior Python web application developer on a 8 month contract to help us in the development of the dataplicity Internet-of-Things platform (dataplicity.com). You would be expected to work from your home or own office most of the time and very high quality candidates based in Slovakia, Poland and the United Kingdom will be considered.

This is an unbeatable opportunity to work from home, earn excellent rates and join in with fast growing projects. continue reading…

Photographing Wild Bears in Finland

This year I spent my birthday in a Forest in Finland with no company other than about dozen (wild)! Eurasian brown bears and more mosquitoes that I care to count.

I stayed at Martinselkosen wilderness centre, in the North of the country. Comfortable enough, plenty of rustic food, and surprisingly decent coffee.

After a night in the Wilderness centre we were to stay in the Forest hide, which is regularly visited by a dozen or so bears and cubs. On the way to the hide, one of the other photographers suggested that my 500mm lens was too long. She was right, the large communal hide was directly in front of a clearing where food was left to attract the bears . At times the bears were so close all I could shoot was a patch of blurry fur. continue reading…

Build a database driven Markdown Wiki in 25 lines of code

This screencast demonstrates how to build a database driven, Markdown powered wiki from scratch in around 25 lines of code. Lines of code is of course a poor metric, but I think the end result of part 1 (more planned) packs quite a lot of functionality for what is very simple and readable code. I'll be building on this code in future screencasts, to create something which is more feature complete.

I found creating this to be a challenge; thinking, typing and talking is about 50% more things than I can do at once! Hopefully I'll master it as I go.

For more information on Moya, please see www.moyaproject.com.