Manage your infrastructure in the same ways you manage your applications

We’re shipping containers today! (Image by Pixabay on Pexels)

Docker is a fantastic tool that makes our lives much easier offering us standardization, productivity, efficiency, maintainability and compatibility of our code. It allows us to continuously and rapidly deploy and test our code and it is platform-independent.

If you are unsure of what Docker is, what to use it for or how to use it; this is the article for you! I’ll try to give an explanation that’s as clear as possible for people who are new to Docker. At the end of this article you:

  • See a lot of advantages using Docker
  • Understand what Docker is and how…

Easily plan, validate, and safely apply changes to your database

Imagine these boxes are stuffed with schema’s and tables (Photo by Ketut Subiyanto on Pexels)

If you are not working with migrations in your database you’re missing out. Like Git manages changes to source code, you can use migrations to keep track of changes to your database. Execute and revert changes and get your database back into a previous state.

Setting up migrations is easier than you think and the advantages are huge. Migrations are database-independent, offer one source of the truth, track changes and can even seed your database with some data. When you’ve read this article you’ll be able to:

  • Create tables with indices and foreign keys
  • Easily plan, validate, and safely apply…

Perfect for (unexperienced) developers who just need a complete, working, fast and secure API

Building and using our API will be as easy as using this vending machine (image by Jenna Hamra on Pexels)

You have a great python program that you want to make available to the world. With FastAPI you can speedily create a superfast API that’ll allow you to make your Python code available for other users.

In this article we’re going to create an API in 5 lines of code. What? Five lines?! That’s right; FastAPI isn’t called FastAPI because it is many times faster than frameworks like Django or Flask; it’s also super easy and fast to set up.

After we’ve created our initial API we’ll expand it the next part(s), demonstrating all the necessary bits of knowledge you…

No more waiting for slow queries to finish

How can we quickly find our data in these rows of records? (Image by Fabien Barral on Unsplash)

Ever wondered how a database engine can return data for your queries that fast? How it can search through many tables, and millions of records in a flash? This article explores how the database engine works under the hood and sheds light on how to design your tables and indices in the most optimal way. No more waiting for queries to finish!

As usual we’ll first set up an example, creating some sample data so we have something to work with. Then we’ll check out how the database engine performs without indices. Then we’ll add indices to speed up our…

You’ve got values for which you have IDs in a table. Insert the IDs in one go!

Searching some ids (image by Lucas Pezeta on Pexels)

What do you do when our table expects id’s but all we have are strings? Let’s imagine we’re a restaurant. We store every menu item and its ingredients into our database so that we can keep track of all kinds of statistics; how often a dish is ordered and which ingredients are most popular e.g.

We want to store a new recipe into the recipes table but there’s a problem: this table expects an ingredient_id and not the ingredient_name that we currently have. How can we insert these IDs into the recipes table while we only have the names?


Insert a value into a table if it doesn’t already exist

We only want unique values in our table (image by Darius Cotoi on Unsplash)

Imagine we are a restaurant that sells all kinds of dishes. Because we’re smart we keep track of all of our ingredients in a database. The ingredients table will contain only unique ingredients that each have their own id.

The goal of this article is to create a query that inserts unique ingredients in to the table that are not already in the table. Other tables can refer to the ingredient_id so that we can filter and join on integers, which is a lot faster in large datasets.

1. Creating the table

First we’ll create the table that’ll contain the ingredients. This article uses…

Easily share and run code in a Docker container

Your packaged code is being delivered (image by Kira auf der Heide on Unsplash)

With Docker, it is easy to package your code into an image that we can run anywhere, anytime; regardless of your hardware or software. It will run on a laptop, Raspberry Pi, Server, Mac, Linux or Windows. This article will detail the process of packaging your script into a Docker image that can be shared and run. It focuses particularly on how to run the programs that exist in the Docker image.

By the way: are you new to Docker? Check out this article for a clear, brief introduction on Docker and this article on how to use Docker Compose.

1 Goal and preparation

Lightning-fast insert and/or update with Python

Time to update our storage and insert some new things (image by Steve Johnson on Unsplash)

When you upsert data into a table, you update records that already exist and insert new ones. After reading this article, you’ll be able to connect your Python application to a database and upsert data lightning fast. We’ll go through a few practical examples that demonstrate various ways to do this. They are all geared towards handling large sets of data; focusing on high speed and data validity. Let’s code!

P.S. We’ll use SQL Server for this example but the techniques used are applicable to a wide range of databases.

1. Setup and Preparations

We have a website that sells various musical articles. Every…

Watch and understand how an algorithm learns, mutates and evolves

Just like on the Serengeti it’s survival of the fittest in our algorithm (image by Hu Chen on unsplash)

In this article we’ll go through the application of a self-learning, evolution-based genetic algorithm that augments its own topology. Confused? I can imagine; those are some big words. Stay with me though, I promise you’ll see the beauty of this algorithm at the end of this article.

In order to understand neuro-evolution-algorithms as clearly as possible I’ve programmed a little game called Dots that will illustrate the way the algorithm works. I’m trying to describe what happens in lay-mans terms, not focusing on programming or math. …

This is a complex title but I swear it’s not difficult

This Python is packaged up and ready to be shipped! (image by Worldspectrum on Pexels)

Wow that title contains a lot of terms! Simply said this article offers you the best way to share your Python code privately and easily, even run it in a docker container! In the end you’ll be able to distribute private packages that run everywhere, are easily maintainable and updateable. Let’s code!


You’ve created a Python script with all kinds of handy functions that you want to share with others. You have two choices on how to approach this:

  1. Package your code and distribute it publicly on PyPi as detailed in this article. This means that anyone is able to…

Mike Huls

I'm a full-stack developer with a passion for programming, technology and traveling.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store