Sorting in Go – Don’t Reinvent This Wheel

sorting hat

Sorting is a common task in programming, and for that reason most languages have a default sorting algorithm in their standard library. Go is one such language. Go has gone about providing sort functionality in one of the most elegant ways possible, via an interface. Any type that satisfies this interface can be sorted using … Read more Sorting in Go – Don’t Reinvent This Wheel

Using Concurrent Subscribers – RabbitMQ in Python (pika)

rabbit and python

It’s a fairly common scenario to subscribe to a Rabbit queue and process messages before acknowledging receipt. The pika package for dealing with RabbitMQ in Python however is only single-threaded out of the box. If we want to make a network or database call before each acknowledgment our subscribers can get really slow. Waiting on … Read more Using Concurrent Subscribers – RabbitMQ in Python (pika)

Don’t Go To Casting Hell; Use Default Native Types in Go

hell red sky

Go is strongly typed, and with that, we get many options for simple variable types like integers and floats. The problem arises when we have a uint16, and the function we are trying to pass it into takes an int. We find code riddled with int(myUint16) that can become slow and annoying to read. Go’s … Read more Don’t Go To Casting Hell; Use Default Native Types in Go

Loops in Rust; Breaking From Nested Loops

Looping in Rust isn’t the same as standard C-style languages. The syntax is different and there are some powerful options that make looping easier. First, let’s go over some looping basics, then we will cover how to handle breaking and continuing in nested loops. Standard For-Loop Which prints: 0..10 is an iterator where the lower-bound … Read more Loops in Rust; Breaking From Nested Loops

Quantum Programming 101: Backend Monitor

Introduction In a previous tutorial we showed how you can get basic information on all quantum devices using backend_overview(). While this function is great to get information on all quantum devices at a glance it is not detailed on specific information such as qubit and gate errors. To get more detailed information on a quantum … Read more Quantum Programming 101: Backend Monitor

Range Over Ticker In Go With Immediate First Tick

The Go standard library has a really cool type – Ticker. Tickers are used when you want to do something at a regular interval, similar to JavaScript’s setInterval. Here’s an example: As per the docs, a ticker is a struct that holds a receive-only channel of time.Time objects. In the example at the beginning of … Read more Range Over Ticker In Go With Immediate First Tick

Connecting To RabbitMQ In Golang

RabbitMQ is a message broker that’s great for pub-sub systems in a micro-services architecture. At my current day job, we use RabbitMQ in our data ingest pipeline. All the services are written in Go, and they all push data through hundreds of RabbitMQ queues. Let’s take a look at how to efficiently publish and subscribe … Read more Connecting To RabbitMQ In Golang

Using ‘Go Generate’ To Deploy Multi-Process Apps

In microservice architectures, it is fairly common to have a project that includes different worker types. A Makefile can be used to manage the creation of multiple programs, but the Go toolchain has a great tool that can be used as well, go generate. Here are some examples of how we take advantage of ‘go … Read more Using ‘Go Generate’ To Deploy Multi-Process Apps

I Wrote Go-TinyDate, The Missing Golang Date Package

time.Time makes dealing with dates and times in Go a breeze, and it even comes bundled in the standard library! However, a time.Time{} struct uses more than 24 bytes of memory under most conditions, and I’ve run into situations where I need to store millions of them in memory, but all I really needed was … Read more I Wrote Go-TinyDate, The Missing Golang Date Package

Best Practices For Writing Clean Interfaces in Go

Interfaces allow us to treat different types as the same type when it comes to specific behaviors. They are central to a Go programmers toolbelt and are often used improperly by new Go developers… leading to hard to read and buggy code. Recap on Interfaces Let’s look to the standard library as an example of … Read more Best Practices For Writing Clean Interfaces in Go