Plurrrr

week 19, 2022

Golang Diaries: Generics

My coding time this year has been invested in Quamina, an event-filtering library implemented in Go. Just in the last couple of weeks I spotted an opportunity to bring Go’s shiny new generics to bear, and not just anywhere, but for a central data structure. I got good results, but the process was sort of painful; I kept trying things that looked like they ought to work but didn’t. I’m sharing this tour through that experience because I’m a reasonably competent programmer with mainstream tastes and if I hit these bumps in the road others probably will too.

Source: Golang Diaries: Generics, an article by Tim Bray.

sqlite-utils: a nice way to import data into SQLite for analysis

Recently I wanted to do some basic data analysis using data from my Shopify store. So I figured I’d query the Shopify API and import my data into SQLite, and then I could make queries to get the graphs I want.

But this seemed like a lot of boring work, like I’d have to write a schema and write a Python program. So I hunted around for a solution, and I found sqlite-utils, a tool designed to make it easy to import arbitrary data into SQLite to do data analysis on the data.

Source: sqlite-utils: a nice way to import data into SQLite for analysis, an article by Julia Evans.

Dune Messiah

Dune Messiah continues the story of Paul Atreides, better known--and feared--as the man christened Muad'Dib. As Emperor of the known universe, he possesses more power than a single man was ever meant to wield. Worshipped as a religious icon by the fanatical Fremen, Paul faces the enmity of the political houses he displaced when he assumed the throne--and a conspiracy conducted within his own sphere of influence.

And even as House Atreides begins to crumble around him from the machinations of his enemies, the true threat to Paul comes to his lover, Chani, and the unborn heir to his family's dynasty...

In the evening I started in the second book of the Dune Chronicles by Frank Herbert: Dune Messiah.

Safer Enums

How to “do” enums is a common problem in Go, given that it doesn’t have “real” enums like other languages.

Source: Safer Enums, an article by Nate Finch.

Improved Process Isolation in Firefox 100

In this article, we would like to dive a bit further into the latest major milestone we have reached: Win32k Lockdown, which greatly reduces the capabilities of the content process when running on Windows. Together with two major earlier efforts (Fission and RLBox) that shipped before, this completes a sequence of large leaps forward that will significantly improve Firefox’s security.

Source: Improved Process Isolation in Firefox 100, an article by Gian-Carlo Pascutto.

Boring Python: dependency management

This is the first in hopefully a series of posts I intend to write about how to build/manage/deploy/etc. Python applications in as boring a way as possible. So before I go any further, I want to be absolutely clear on what I mean by “boring”: I don’t mean “reliable” or “bug-free” or “no incidents”. While there is some overlap, and some of the things I’ll be recommending can help to reduce bugs, I also want to be clear: there will be bugs. There will be incidents where a feature or maybe an entire service is down.

Source: Boring Python: dependency management, an article by James Bennett.

Party Cat

Since yesterday we have been looking after Sheba the Maine Coon, a cat that belongs to Esme's coworker. And because it's Adam's birthday today the cat joined us in the festivities.

Sheba the Maine Coon
Sheba the Maine Coon.

Clear explanation of Rust’s module system

Rust’s module system is surprisingly confusing and causes a lot of frustration for beginners.

In this post, I’ll explain the module system using practical examples so you get a clear understanding of how it works and can immediately start applying this in your projects.

Since Rust’s module system is quite unique, I request the reader to read this post with an open mind and resist comparing it with how modules work in other languages.

Source: Clear explanation of Rust’s module system, an article by Sheshbabu Chinnakonda.

Podman v4.1 has been released!

The new Podman v4.1.0 release is now available. This release is all about new features, with some of the most exciting being improved support for running on Mac and Windows, and adding support for Docker Compose v2.0. These are just the beginning, though, as this release also includes the ability to clone containers, significant improvements to checkpointing, and over 25 bug fixes. Read on for more details!

Source: Podman v4.1.0 Released.

PyScript: Python in the Browser

Are you a data scientist or a developer who mostly uses Python? Are you jealous of developers who write Javascript code and build fancy websites in a browser? How nice would it be if we could write websites in Python? Amazingly, at PyCon US 2022, Anaconda’s CEO Peter Wang announced a shiny new technology called PyScript that allows users to write Python and in fact many languages in the browser.

Source: PyScript: Python in the Browser, an article by Sophia Yang.

Existential optics

Optics make it possible to conveniently access and modify data structures in an immutable, composable way. Thanks to that, they catch lots of attention from the functional programming community. Still, you can have a hard time understanding how they work just by looking at data declarations and type definitions.

In this post, I present a way of encoding optics that is different from usual. This encoding, called existential optics, is easier to understand than the other encodings, since it makes more explicit the structure of each optic. This is not new and is well known in the category theory academic circles. Still, these ideas do not seem to appear in libraries for languages like Haskell, Purescript, or Scala.

The most well-known type of optics are lenses, which were also the first to be analyzed and used. We will use them as our recurring example to compare the several ways we have to encode optics.

Source: Existential optics, an article by Marco Perone.

What is JSON Patch?

JSON Patch is a format for describing changes to a JSON document. It can be used to avoid sending a whole document when only a part has changed. When used in combination with the HTTP PATCH method, it allows partial updates for HTTP APIs in a standards compliant way.

The patch documents are themselves JSON documents.

JSON Patch is specified in RFC 6902 from the IETF.

Source: JSON Patch.

Parsing / Recursive Descent Parser

Recursive Descent Parser is a top-down parser where every non-terminal in the BNF grammar is a subroutine. The parser works by recursively calling each subroutine to construct the parsed output. It’s not the only algorithm to implement a parser, but it’s one of the most simple ones that are very easy to understand and implement.

Source: Parsing/Recursive Descent Parser.

Ordering CSS Declarations

In my personal projects, I’ve never imposed any order on my CSS declarations. Or rather: I’ve ordered my declarations, just not mindfully. To Eric’s point, it’s mostly been: “arbitrarily adding properties everywhere until it looks right in the browser.” That’s me.

After reading Eric’s article, I’m feeling convinced to go alphabetical.

Source: Ordering CSS Declarations, an article by Jim Nielsen.