Week #451, 452, 453

Friday, October 18th, 02019 at 11:11 UTC

These last three weeks we have been transitioning over to a big new project. The survey work is mostly self-sustaining and running smoothly, so we’ve negotiated a four month contract on a new project. That will last us through to Feb 2020. It keeps us from hunting for work right at the start of the new year, but this is one of those projects that will continue to grow and grow if it is successful.

This project is still in stealth-mode, but it has been a lot of fun to work on so far. With all our capabilities, we’ve managed to go from nothing to a working website (front and back-end programming), a web-based JSON API, and an accompanying iOS app which dog-foods the API and reads the data from the website. Nothing is consumer ready, but as a proof-of-concept, we managed to get a lot done, part-time, in three weeks. It is already shown itself to be very useful and we’ll continue to expand what the website can do and how it interacts (mostly via push notifications) to iOS and later Android devices.

Since this is still in stealth-mode, we can’t talk too much about the specifics but we can show-off a few nuggets. In this app, there are a lot of profiles which in turn have profile images. When a customer changes their avatar we’re uploading these images to Amazon S3. Before they begin to customise these profiles, we needed a default avatar image.

Sample Avatars
Default Avatar Images named 0-f (0-16 in hex)

To make it a bit more fun and interesting we found some airplane silhouettes and made 16 icons, naming them 0-9a-f. Now each time there is a new sign-up or account that needs a profile image, we work some mathematical magic. This is a snippet of python code, but it is easily translatable into other languages.

hashlib.sha1(username).hexdigest()[0:1]+'.png'

Using the username as input we run that through a sha1 hash function. This gives us a really long hexadecimal string. We then only take the first character of that. It will be 0-9a-f only and we add ‘.png’ to the end of that to randomly select a default avatar image.

random.choice(['0','1','2','3','4','5','6','7','8',9','a','b','c','d','e','f'])

You could also simply choose a random file name from a list if you wanted more or less than 16 variations. The first code example is repeatable, the same username will produce the same image, whereas the second is random.

This may or may not make it into the final product, but it is a really simple way to create a bit more variety for your default avatar images.

Invoices

We currently have two one open unpaid invoices. One is in processing, but needs approval from someone who’s been travelling and busy. Even the most well intentioned companies who usually pay on time have some hiccups which are out of your control. (Paid right before publishing)

The other is only for a few hours, which we already know we will add 1-2 more too. So we are waiting for the changes, implement those changes, then send a final invoice. It is more sane than sending a second invoice for 1 hour of work.

This month we are moving over to a retainer for this stealth project. The hope is to invoice for October before this month is over so we can get into a good payment schedule rather than get the October invoice processed in November and paid in December.

That’s the CashFlow Life™