week 51, 2021

Image (2014)

When Eva, a young journalist, films a documentary about the mean streets in Brussels she soon gets involved in the life of a young Moroccan guy.

Esme and I watched Image. I liked the movie and give it a 7.5 out of 10.

Don't Look Up (2021)

Two low-level astronomers must go on a giant media tour to warn mankind of an approaching comet that will destroy planet Earth.

In the afternoon we watched Don't Look Up. I liked the movie a little and give it a 6 out of 10.

Fast Counting with PostgreSQL and Haskell

Problem: Counting large result sets in PostgreSQL is… slow.

While researching potential solutions to this problem, I learned that PostgreSQL can provide fast counting if you’re willing to sacrifice some accuracy. Whether or not this matters of course depends on the kind of application you’re writing. In my case, I’m fairly certain my users don’t care. Knowing that there are a few million results for a query is more than good enough.

Source: Fast Counting with PostgreSQL and Haskell, an article by Jezen Thomas.

Tools You Should Know About: nix-shell

I've been aware of the Nix toolset for over a decade now, but until recently it's always looked like it required a pretty big investment. Most of the documentation I've come across explains what the benefits are and how the tooling works in order to deliver those benefits, but always from the perspective of wanting to build a project using Nix as your build system. And, well, I usually already have a build system I'm pretty happy with, and I've never bit the bullet and actually learned the pretty arcane syntax of the Nix language.

Source: Tools You Should Know About: nix-shell, an article by Gary Verhaegen.

That Is Not How Your Brain Works

As a neuroscientist, I see scientific myths about the brain repeated regularly in the media and corners of academic research. Three of them, in particular, stand out for correction. After all, each of us has a brain, so it’s critical to understand how that three-pound blob between your ears works.

Source: That Is Not How Your Brain Works, an article by Lisa Feldman Barrett.

Five Tips For a Healthier Postgres Database in the New Year

It's been a busy year building Crunchy Bridge and we've shipped a lot of new awesome things. Instead of doing a wrap-up of all the growth and exciting features, instead I wanted to take the time to try to teach a few more things to those that follow us. While onboarding customer after customer this year I've noted a few key things everyone should put in place right away - to either improve the health of your database or to save yourself from a bad day.

Source: Five Tips For a Healthier Postgres Database in the New Year, an article by Craig Kerstiens.

FreeBSD jails for fun and profit

Docker has stormed into software development in recent years. While its concepts are powerful and valuable, similar tools have been used in systems for decades. FreeBSD's jails in one of those tools which build upon even older chroot(2). To put it shortly, with these tools, you can make a safe environment separated from the rest of the system.

Jails in FreeBSD are by no means a new tool (introduced in 4.x), but for a reason or another, I haven't used them that often, which is a shame since they are so powerful. So I wanted to explore this concept in a concise and summarized manner.

Source: FreeBSD jails for fun and profit, an article by Topi Kettunen.

FreeBSD, Jails and SYSV IPC

I run all my stuff in FreeBSD jails which used to make things even more complicated, because SYSV IPC stuff wasn't namespaced, so two jails with allow.sysvipc=1 could see and modify each others shared memory and semaphores - not ideal. In FreeBSD 11 and beyond this is no longer an issue, as I will demonstrate later in this post.

Source: FreeBSD, Jails and SYSV IPC, an article by Thomas Steen Rasmussen.

Parser Combinators in Haskell

Welcome! If you are reading this, you likely have decided to take on the journey of learning parser combinators. We hope this article will make your adventure smoother and hopefully give you a strong foundation for writing your grammars.

This article is composed of three major parts. In the first part, we will implement a small parser combinator library from scratch, which should hopefully help to give a feeling of how industrial-strength parsing combinators work. In the second part, we will learn how to use the Megaparsec library to implement a parser for S-expressions. Finally, as a bonus, we will use the power of Template Haskell to implement a quasi-quoter for our parser.

Source: Parser Combinators in Haskell, an article by Heitor Toledo Lassarote de Paula.

Generics facilitators in Go

Go 1.18 is going to be released with generics support. Adding generics to Go was a multi-year effort and was a difficult one. Go type system is not a traditional type system and it was not possible just to bring an existing generics implementation from other language and be done. The current proposal was accepted after years of user research, experiments and discussions. The proposal got iterated a few times during the implementation phase. I found the final result delightful.

Source: Generics facilitators in Go.

Three Minor Features in Go 1.18

Everyone is excited that after a decade or so of devs asking for generics, the Go programming language is getting generic types and functions in Go 1.18 in Q1 2022. Generics are no doubt going to lead to a lot of experiments, some good, some bad, some just weird. Go 1.18 is also poised to lead to an increase in software reliability by including fuzzing as part of the standard testing package. But today, I want to look at some minor changes in Go 1.18 that might otherwise get lost in all the excitement around the marquee features.

Source: Three Minor Features in Go 1.18, an article by Carl M. Johnson.

Invoking C Code from Golang

The article attempts to explore Golang’s “C” package which allows invoking C code from Golang. Before we get into the idea of invoking C code from Golang, let’s see a use-case where this might be needed.

Source: Invoking C Code from Golang, an article by Sarthak Makhija.

Modern Perl features for Perl’s birthday

Friday, December 17, 2021, marked the thirty-fourth birthday of the Perl programming language, and coincidentally this year saw the release of version 5.34. There are plenty of Perl developers out there who haven’t kept up with recent (and not-so-recent) improvements to the language and its ecosystem, so I thought I might list a batch. (You may have seen some of these before in May’s post “Perl can do that now!”)

Source: 34 at 34 for v5.34: Modern Perl features for Perl’s birthday, an article by Mark Gardner.

Implementing RSA in Python from Scratch (Part 1)

I'm sure many programmers, particularly web developers have heard of the RSA cryptography system. RSA is an asymmetric cryptography system, meaning that one key is used for encryption and the other for decryption. I've seen a lot of articles explaining the general principles of asymmetric cryptography, but I have not seen any that give easy-to-understand explanations of the mathematical background behind these algorithms, so I decided to write this article.

Source: Implementing RSA in Python from Scratch (Part 1).