jon black

"I am in a charming state of confusion"

Using freenas and syncthing to automate mobile photo organisation

I take a ridiculous number of photos and videos on my phone. Every couple of months I'd get one of the most annoying notifications you can get on your phone. It's the kind of notification that's often followed by an expletive:

screenshot of storage space warning

The problem with this message is that you can't solve it quickly. You either need to carefully delete photos that are poorly composed or out of focus, or move them off the device. For the latter, Google suggests two methods:

  1. Move files with your Google Account; or,
  2. Move files with a USB cable.

In an increasingly connected world with age-old software like ssh and rsync, the only options on Android are sending your files to Google's cloud, which has massive privacy implications, or using a USB cable. In other words, Android sucks at transferring files.


What are the best headphones for programming?

When we sit down to write code we all desire coding nirvana, where the world around us melts away and we achieve an inner peace, the code appearing to write itself.

One of the obstacles to reaching such a relaxed and focused mental state is distraction from noise. Like a toddler incessantly poking your arm, it robs you of your attention.

This is why headphones are essential gear for programmers.

They enable us to shut out the world and concentrate on the code, making coding nirvana easier to attain. But with so many different types of headphones on the market, how do we know which ones to choose? Are some better than others for programmers?

Types of headphones

There are four different types of headphones, and knowing how these types affect sound isolation is essential for understanding which are more suitable for programmers.


Earbuds sit loosely in the outer-ear facing,


How to program the Arduino using vim

The Arduino IDE leaves a lot to be desired. Granted, it's easy for beginners to build and upload sketches, but as a text-editor it makes you want to smash your keyboard against your monitor. Repeatedly.

Files open in new windows instead of a tab, and there are no advanced features like auto-complete; did I mention it looks like a relic from the Windows 95 era?

This article describes how you can free yourself from the shackles of the Arduino IDE and program your Arduino using vim.

arduino-makefile

arduino-makefile by Sudar Muthu is a great project that allows you compile, upload, and monitor the serial port using a simple makefile.

How simple you ask? 4 lines! Seriously. And one of those is blank!

Let's work through an example together, from scratch. Let's create a makefile for the legendary Blink sketch.

1. Install the Arduino IDE

The Arduino IDE is still required


Arduino multitasking using finite state machines

Beginner Arduino programs tend to focus on a single goal, such as blinking an LED or spinning a servo, where the timing is controlled using delay; the famous blink sketch is a prime example:

void setup() {
  pinMode(13, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(1000);
}

This works well for single tasks like blinking an LED; however, delay prevents multiple tasks from running concurrently. We can easily add another LED to the blink sketch and have it blink in time with the existing LED...

void setup() {
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
}

void loop() {
  digitalWrite(13, HIGH);
  digitalWrite(12, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  digitalWrite(12, LOW);
  delay(1000);
}

...but if we want the LED's to blink at different rates, where for example the first LED stays on for three seconds and the second stays on for two seconds, we'll find that delay pauses


Perfection and procrastination

The amount of pressure that software engineers put on themselves is monstrous. Our view of world as a finite, discernible system causes us to aim for nothing less than perfection. With such high expectations, it's no wonder that we procrastinate, struggling to find a place to start. Thankfully, according to The Book of Life, this is a very honourable problem:

People who don’t know where to start are often perfectionists. It’s an honourable problem: you’re doing nothing not because you’re lazy but because you’re very ambitious. Perfectionism is one of the causes of procrastination – because it makes us so worried about getting things wrong.

Yet in spite of this honour, and when faced with the daunting task of creating perfection, we lay down our arms and reach for the white flag. We then compose a list of our inadequacies and view our perceived failure, and