week 47, 2021

Late-bound argument defaults for Python

Python supports default values for arguments to functions, but those defaults are evaluated at function-definition time. A proposal to add defaults that are evaluated when the function is called has been discussed at some length on the python-ideas mailing list. The idea came about, in part, due to yet another resurrection of the proposal for None-aware operators in Python. Late-bound defaults would help with one use case for those operators, but there are other, stronger reasons to consider their addition to the language.

Source: Late-bound argument defaults for Python, an article by Jake Edge.

Calling Rust from Python using PyO3

Calling Rust code from Python is made easy by PyO3. You can write a Rust library and rely on the combination of PyO3 and maturin, a supporting tool from the PyO3 ecosystem, to compile the Rust library and have it installed directly as a Python module. Among others, PyO3 can translate types between Python and Rust as well as make it easy to export Rust functions to Python through a set of macros.

Source: Calling Rust from Python using PyO3, an article by Said van de Klundert.

Explainer: .DS_Store files

Inside pretty well every folder that you’ve ever opened is a hidden file, one which even showing hidden files doesn’t reveal: .DS_Store. As with other under-the-hood features which Apple really doesn’t want you to know about, you’ll only come across it when it causes trouble.

Source: Explainer: .DS_Store files, an article by Howard Oakley.

Pinning in plain English

Pinning in Rust is a powerful and very convenient pattern that is, in my eyes, not supported well enough in the wider ecosystem.

A common sentiment is that it's hard to understand and that the pin module documentation is confusing. (Personally, I think it works well as reference to answer questions about edge cases, but it's a dense read and not necessarily a good intro text.)

This post is my attempt to make the feature more approachable, to hopefully inspire more developers to make their crates pinning-aware where that would be helpful.

Source: Pinning in plain English, an article by Tamme Schichler.

Everything about Load Balancer with Cheat Sheet

The Load Balancers play a significant role in any System Design. And the beauty of its design is that every engineer takes it for granted, that this will work — one of the best system designs and a lot to learn from this simple yet powerful solution. The LB acts as a middle-man between clients and servers; the client sends requests to LB and internally, via physical NIC to VIPs, forwards to attached web servers.

Source: Everything about Load Balancer with Cheat Sheet, an article by Love Sharma.

Endianness, API Design, and Polymorphism in Rust

I have been working on a serialization project recently that involves endianness (also known as byte order), and it caused me to explore parts of the Rust standard library that deals with endianness, and share my thoughts about how endianness should be represented in a programming language and its standard library, as I think this is also something that Rust does better than C++, and also makes for a good case study to talk about API design and polymorphism in Rust.

Source: Endianness, API Design, and Polymorphism in Rust, an article by Jimmy Hartzell.

Inspecting container filesystems

If you work a lot with containers, then there’s a good chance you’ve wanted to look inside a running container’s filesystem at some point. Maybe the container is failing to run properly and you want to read some logs, maybe you want to check some configuration files inside the container...or maybe you’re like me and want to place some eBPF probes on the binaries in that container (more on this later).

Source: Where are my container's files? Inspecting container filesystems, an article by Omid Azizi.

Klaus (2019)

A simple act of kindness always sparks another, even in a frozen, faraway place. When Smeerensburg's new postman, Jesper, befriends toymaker Klaus, their gifts melt an age-old feud and deliver a sleigh full of holiday traditions.

In the evening we watched Klaus. I liked the movie and give it a 7 out of 10.

Go Does Not Need a Java Style GC

Modern languages such as Go, Julia and Rust don’t need complex garbage collectors like the ones use by Java C#. But why?

To explain why, we need to get into how garbage collectors work and how different languages allocate memory in different ways. However, we will start by looking at why Java in particular needs such a complex garbage collector.

Source: Go Does Not Need a Java Style GC, an article by Erik Engheim.

The fish shell is amazing

I’ve been lurking the fish shell for a couple of years now (and the nushell but it is another story for another time). Not so long ago, I decided to try it, and it’s simply… amazing. If I had to state one feature that makes me like to use it, it’ll be the autocompletion, hands down. It’s the first time I just take a shell and without customization it’s pleasing to use.

Source: The fish shell is amazing, an article by Rufus Mairo.

The Varieties of the Haskelling Experience

Recently, a group of Haskellers within Tweag had a knowledge-sharing event where we shared our varied Haskell setups with each other, and learned some nice tricks and tips for every-day life.

The idea was raised of sharing these findings via the blog, so without further ado, let’s explore the varieties of the Tweag Haskelling experience by covering a few of our personal setups!

Source: The Varieties of the Haskelling Experience, an article by Noon van der Silk.

Transformers from Scratch

Transformers were introduced in this 2017 paper as a tool for sequence transduction—converting one sequence of symbols to another. The most popular examples of this are translation, as in English to German. It has also been modified to perform sequence completion—given a starting prompt, carry on in the same vein and style. They have quickly become an indispensible tool for research and product development in natural language processing.

Source: Transformers from Scratch, an article by Brandon Rohrer.

My Custom CSS Reset

Whenever I start a new project, the first order of business is to sand down some of the rough edges in the CSS language. I do this with a functional set of custom baseline styles.

Source: Modern CSS Reset / Global Styles, an article by Joshua Comeau.

How to Learn Nix

I tried to learn Nix, and it was pretty hard. I kept a diary of every command I tried, every wrong assumption that I made, and every realization that I had along the way.

Source: How to Learn Nix, an article by Ian Henry.

Writing an application using Go and PostgreSQL

By reading this tutorial, you’ll learn how to use PostgreSQL with the Go programming language using the pgx driver and toolkit in a very productive manner. Furthermore, with the provided source code, you’ll be able to learn how to write efficient and sound unit and integration tests, ready to be run locally or on a Continuous Integration environment, such as GitHub Actions.

Source: Back to basics: Writing an application using Go and PostgreSQL, an article by Henrique Vicente.