Archive for the 'Uncategorized' Category

Android + CircleCI + versionCode

Sunday, December 9th, 2018

Automatically incrementing build numbers in CI is always a hassle. Here’s a simple way of using a generated version number in your CI, based on the current time in 10 second intervals. This is based on this post by esplo but with the missing piece of how to read the version in the build.gradle. Add […]

React Native or Electron: Why?

Wednesday, December 5th, 2018

Many developers hate Electron apps, and have a distaste for React Native apps. There are some good technical reasons for this. They’re inelegant. Inefficient. Bloated, slow, pigs. That’s the reputation. But to the users? They’re fine. They’re good enough. I don’t see users dropping Slack in favour of Skype because Skype is native. That’s just […]

Sending RabbitMQ Message from JavaScript with async / await

Thursday, November 22nd, 2018

I’m doing a lot of JavaScript development these days, and most of the example JS code I find on the web uses callbacks. I much prefer async/await, and sometimes the translation isn’t obvious.   Here’s how to send a message using amqplib to RabbitMQ using async await. The interesting bit here is the waitForConfirms method. […]

Building a Slack bot in Node

Friday, November 16th, 2018

I was looking into how to build a simple Slack bot. I ran across various bot kits and frameworks and whatnot, that seemed to really overcomplicate the issue. Went back to the Slack API and discovered that it’s actually quite straightforward. This particular code listens for messages in a private channel called ‘dev’. Private channels […]

Local Siri

Thursday, May 17th, 2018

Here’s my WWDC prediction for 2018: Siri will be significantly replaced with a new, on-device Siri. A few attributes of this new Siri that would make it interesting, and give it a shot of coexisting in a world with Google Assistant, Alexa and Cortana: Requests will run directly on your device. No more waiting for […]

Formatting CVaListPointer

Monday, April 9th, 2018

So you’re using libtiff in Swift, and need to implement the TIFFErrorHandler. Or, for whatever reason, you have a CVaListPointer (the args parameter, below) and a format string, and you want to format. Here’s how: let errorHandler:TIFFErrorHandler = { (moduleNamePtr, formatPtr, args) in guard let formatPtr = formatPtr else { // No format string – […]

The Amazon Web Services Platform

Thursday, October 19th, 2017

I’ve been working with Amazon Web Services as part of a new job, and I was surprised to see how many rich services Amazon is offering under the AWS banner now.     I made a point of looking at every one of them (as of October 2017) and reading enough about it to get […]

Parsing Hex Strings in Swift

Saturday, August 12th, 2017

I want to turn the string “0x02 0x03 0x04” into an array of bytes ([UInt8]). Seems simple enough right? let hex = “0x02 0x03 0x04″ let components = hex.components(separatedBy: ” “) let array = components.map { UInt8($0) } But the UInt8 constructor that takes a string doesn’t understand the “0x” prefix to indicate hex strings. […]

OperationQueue and dynamic priorities

Sunday, May 7th, 2017

I had a question about OperationQueue that I couldn’t find an easy answer to: Can you modify the priority of an operation once it’s been added to the queue? My situation is that I have some background operations that are executing, but the user may choose to view one of these items interactively, and at […]

BufferBloat, or Gaming on DSL while Uploading

Monday, February 27th, 2017

If you find that when some device on your network is uploading data, the entire network becomes unusable due to excess latency, this post is for you. There's a term for this, BufferBloat, and it refers to the a phenomenon where your ping times increase due to excessive buffering at a choke point on your […]