a tumblelog
week 29, 2020

Go maps: declaring and initializing

What is a Golang map? Why is it useful? How does it compare to a slice? How do you declare a map? How do you initialize a map in Go? Fear not, all these questions are answered in this friendly introduction to one of Go’s most powerful features.

Source: Go maps: declaring and initializing, an article by John Arundel.

Logging — let’s do it right!

Throughout my career, I’ve been writing logs, however, what I didn’t know, is that all this time, I was doing it wrong.

Source: Logging — let’s do it right!, an article by Tal Suhareanu.

Sequential Consistency In Practice

If you are a software engineer today concurrency is everywhere.

On the front-end it manifests as asynchronous web requests, the backend as service-to-service communication, and in systems programming as SMP and thread safety.

With the ubiquity of programming with the 4th dimension in mind it's valuable to expand on the building blocks.

One of these blocks comes in the form of consistency models: specific rules which govern concurrent access to shared resources.

With a focus on sequential consistency I'd like to show you how this model is used in practice with distributed systems.

Source: Sequential Consistency In Practice, an article by Louis DeLosSantos.

Things I Wish I’d Known About CSS

I learned how to build websites the old fashioned way: looking at website source code and trying to replicate the things I saw. I threw in the odd book for the stuff I couldn’t see (like PHP/MySQL), and I was on my way.

This was back in 1999, when we’d write things like <font size="4" color="#000000"> and DHTML was a thing.

When CSS came along my approach to learning didn’t differ. But I really wish I’d taken the time to learn CSS properly: there was so much fundamental stuff I missed.

Here are some things I didn’t know that I wish I’d learned earlier.

Source: Things I Wish I’d Known About CSS.

Python Lazy Streams

Inspired by Java 8’s streams, this Python module provides a fluent syntax for manipulating and querying Python lists. It’s called lazy-streams because it lazy evaluates the requests to increase performance and decrease resource requirements. Because of the lazy evaluation, lazy-streams can work on really large data sets with relatively small delays.

Source: lazy-streams on PyPI.

Assessing Abstractions

Some abstractions are ticking time bombs, while others help you move fast. How can you tell? What follows is my personal exploration for how I assess abstractions.

Source: Assessing Abstractions, an article by Stepan Parunashvili.

The Definitive, Non-Technical Introduction to LaTeX

Ordinarily, when it comes to document editing, tools such as notebooks and word processors come to mind. But alas, that’s usually the last thing math folks have in mind when it comes to the task…

In fact, in what follows, we’ll introduce you to the fascinating world of mathematical typesetting. We’ll also introduce you to a marvelous tool adopted by a wide range of technical scientists — so that they can communicate with each other with precision and ease.

Source: The Definitive, Non-Technical Introduction to LaTeX.

How SHA-2 Works Step-By-Step (SHA-256)

SHA-2 (Secure Hash Algorithm 2), of which SHA-256 is a part, is one of the most popular hashing algorithms out there. In this article, we are going to break down each step of the algorithm as simple as we can and work through a real-life example by hand.

Source: How SHA-2 Works Step-By-Step (SHA-256), an article by Lane Wagner.

What makes a picture good?

What makes a picture good? Not only because this is a very subjective question it is a hard one to answer. We will still try to do that and in the process we will also come across the following questions: why do you take pictures in the first place and: for whom?

Source: What makes a picture good?

Too many objects: Reducing memory overhead from Python instances

Every time you create an instance of a class in Python, you are using up some memory–including overhead that might actually be larger than the data you care about. Create a million objects, and you have a million times the overhead.

And that overhead can add up, either preventing you from running your program, or increasing the amount of money you spend on provisioning hardware.

So let’s see how big that overhead really is (sneak preview: it’s large!) and what you can do about it.

Source: Too many objects: Reducing memory overhead from Python instances, an article by Itamar Turner-Trauring.

Understanding and Decoding a JPEG Image using Python

Today we are going to understand the JPEG compression algorithm. One thing a lot of people don’t know is that JPEG is not a format but rather an algorithm. The JPEG images you see are mostly in the JFIF format (JPEG File Interchange Format) that internally uses the JPEG compression algorithm. By the end of this article, you will have a much better understanding of how the JPEG algorithm compresses data and how you can write some custom Python code to decompress it.

Source: Understanding and Decoding a JPEG Image using Python, an article by Yasoob Khalid.

Vim's Arglist as a File-Centric Todo List

I often find myself wanting to make similar edits to a set of files within a project. More than I can do with sed, but simple enough that ag + vim are the perfect tools for the job.

Source: Vim's Arglist as a File-Centric Todo List, an article by Chris Toomey.

Let's make a Teeny Tiny compiler

It is a beautiful day outside, so let's make a compiler. You don't need any knowledge of how compilers work to follow along. We are going to use Python to implement our own programming language, Teeny Tiny, that will compile to C code. It will take about 500 lines of code and provide the initial infrastructure needed to customize and extend the compiler into your own billion dollar production-ready compiler.

Source: Let's make a Teeny Tiny compiler, part 1, an article by Austin Z. Henley.

Write short paragraphs

Write short paragraphs and cover one topic per paragraph. Long paragraphs discourage users from even trying to understand your material. Short paragraphs are easier to read and understand.

Source: Write short paragraphs.

Crime Scene: Good

In the afternoon I finished Crime Scene, Clay Edison Book 1, by Jonathan Kellerman and his son Jesse Kellerman. I enjoyed this book and look forward to the next one in the series.

Mathematicians Measure Infinities and Find They’re Equal

In a breakthrough that disproves decades of conventional wisdom, two mathematicians have shown that two different variants of infinity are actually the same size. The advance touches on one of the most famous and intractable problems in mathematics: whether there exist infinities between the infinite size of the natural numbers and the larger infinite size of the real numbers.

Source: Mathematicians Measure Infinities, Find They’re Equal, an article by Kevin Hartnett.

Forbidden Haskell Types

Haskell’s type system is pretty great, but one thing it doesn’t have, that some other type systems do have, is recursive types, by which I mean, types directly constructed from themselves. Recursive types are forbidden in Haskell.

Source: Forbidden Haskell Types, an article by Ashley Yakeley.

A Measure of Darkness

Former star basketball player Clay Edison is busy. He’s solved a decades-old crime and redeemed an innocent man, earning himself a suspension in the process. Things are getting serious with his girlfriend. Plus his brother’s fresh out of prison, bringing with him a whole new set of complications.

In the evening I started in A Measure of Darkness, Clay Edison Book 2, by Jonathan Kellerman and his son Jesse Kellerman.

Debunking The Myth Of 10% Brain Usage

The human brain is a marvel of biological engineering. It allowed us to accumulate and pass on the knowledge of many prior generations throughout millennia, resulting in a civilization that went into space, taught computers to see and speak, and that continually discovers and investigates the laws of the Universe.

Its complexity is astounding, and we do not fully understand it yet. And because of that, occasionally, myths about the functioning of the brain pop out. Among the most prominent such legends is the one that claims we are dormant geniuses. But before analyzing and debunking that, let’s discuss some brain facts.

Source: Debunking The Myth Of 10% Brain Usage, an article by Iulian Gulea.

Why you shouldn't use ENV variables for secret data

The twelve-factor app manifesto recommends that you pass application configs as ENV variables. However, if your application requires a password, SSH private key, TLS Certificate, or any other kind of sensitive data, you shouldn't pass it alongside your configs.

Source: Why you shouldn't use ENV variables for secret data, an article by Diogo Monica.

Code-First Configuration approach for Python

In the Code-First approach, you first define your data-model in plain code. You can start working with that model immediately, and only later you worry about schema definitions, bindings, and other necessities. The mapping between the domain model and external entities like database tables/fields usually relies on conventions.

Source: Code-First Configuration approach for Python, an article by David Ohana.