Plurrrr

a tumblelog
week 15, 2020

Forecasting with (un)certainty

A model can be anything from 2 numbers scribbled on the back of a napkin, to 100s of numbers tied together in a spreadsheet, to an entire software program performing millions of calculations.

These models are simplified versions of reality that can help us to think better by using numbers. With calculators and spreadsheets, we can build models to help us decide where to go on holiday, how much money to save, and how many employees to hire.

But there's one ingredient that our models, and therefore our decisions, tend to neglect — uncertainty.

Source: Forecasting with (un)certainty, an article by Taimur Abdaal and Lukas Koebis.

Happy Birthday Alice

Today our daughter Alice turned 13. Around 4PM her aunt and uncle paid us a visit, standing outside of the house at a safe distance. They had brought some presents, including one from Alice's grandmother.

Alice enjoying the sparkler on the crumble pie
Alice enjoying the sparkler on the crumble pie.

After they had left we enjoyed some crumble pie. And a little later we played triominos, a game she got as a present from her grandmother.

Alice considering her next move in triominos
Alice considering her next move in triominos.

When we had finished playing one game Alice wanted to play with the painting set she got as a present from her aunt and uncle.

Alice painting
Alice painting.

What I Wish I Knew When Learning Haskell

This is a guide for working software engineers who have an interest in Haskell but don’t know Haskell yet. I presume you know some basics about how your operating system works, the shell, and some fundamentals of other imperative programming languages. If you are a Python or Java software engineer with no Haskell experience, this is the executive summary of Haskell theory and practice for you. We’ll delve into a little theory as needed to explain concepts but no more than necessary. If you’re looking for a purely introductory tutorial, this probably isn’t the right start for you, however this can be read as a companion to other introductory texts.

Source: What I Wish I Knew When Learning Haskell 2.5 by Stephen Diehl.

zz: a smart and efficient directory changer

A nice feature I’ve become used to in the last year is a so-called “smart directory changer” that keeps track of the directories you change into, and then lets you jump to popular ones quickly, using fragments of the path to find the right location.

There is quite some prior art in this, such as autojump, fasd or z, but I could not resist building my own implementation of it, optimized for zsh.

Source: leah blogs: zz: a smart and efficient directory changer by Leah Neukirchen.

C Needs Better Syntax and Macros

Today I’ve decided that I want to write a little rant on the topic of language design. Since I’m a C programmer, and I use it on a daily basis, I’ve had many thoughts about C syntax over past few years. I like C, and it is a good language, that defined modern operating systems and software. But I think that C still needs a better syntax and macro system. Not because C syntax is inconvenient to use, but because syntax is a tool of expression. And macros can extend this concept even further.

Source: C Needs Better Syntax and Macros, an article by Andrey Orst.

Understanding GADTs

Generalized algebraic datatypes, or simply GADTs, are a generalization of the algebraic data types that you are familiar with. Basically, they allow you to explicitly write down the types of the constructors. In this chapter, you'll learn why this is useful and how to declare your own.

Source: Haskell/GADT

map in JavaScript

When I first started learning JavaScript I thought it was hard to understand map. I will attempt to explain map to someone who never heard of it, a beginner trying to learn JavaScript.

Source: map in JavaScript, an article by Claes-Magnus Berg.

Generics in Go – How They Work and How to Play With Them

Go is a bit infamous for not supporting generics, but lately generics have come much closer to becoming a reality. There's a draft design that seems to be relatively stable and is gaining traction in the form of a prototype source-to-source translator implemented by the Go team. Here's what the latest design looks like and how you can try out generics yourself.

Source: Generics in Go – How They Work and How to Play With Them, an article by Chris Brown.

Lessons in Managing Haskell Memory

This time, we are going to describe our journey of getting Haskell garbage collection times under control when dealing with heap sizes of up to 100 GB per instance. Ultimately, we managed to reduce the garbage collection time while parsing 320,000 product rows from 68s to 3s, reducing the total parsing time from 110s to 46s.

Source: Lessons in Managing Haskell Memory, an article by Fabian Thorand and Yorick Sijsling.

Diving into Nix

As you probably know, setting things up in a developer's environment is wild — you don't know what to expect. It's hard to set things up deterministically, and reproduce one environment into another. Homebrew for instance, tries to do as best as it can, but since it treats the environment as a global space in which dumping things, alike a singleton class that anyone can modify, that often results in hard-to-debug errors.

The first time that I heard about Nix was on this blog post from Pinterest, but it didn't catch my attention until now. I started reading about it and watching some internal videos that Burke is creating to evangelize the idea. The more I read about it, the more amazed I am with the idea.

Source: Diving into Nix, an article by Pedro Piñera.

phpBB image upload

In the morning I tested image upload in a phpBB forum I installed recently. I could upload a small photo as an attachment, but a larger one failed. So I configured the board settings to accept attachments of maximum 10MB. But now I got an HTTP error.

The error log of the Nginx web server showed a client intended to send too large body message. To fix this, I logged in and changed to the root account using /bin/su -. Next, I added the following line:

client_max_body_size 10M;

to the http section of /etc/nginx/nginx.conf and reloaded the server using systemctl reload nginx.

Next, I changed one setting in /etc/php/7.3/fpm/php.ini and added another one. Those settings are as follows:

upload_max_filesize=10M
post_max_size=10M

Finally, I restarted php7.3-fpm as follows:

systemctl restart php7.3-fpm

Note that I use php7.3-fpm on Ubuntu 18.04 LTS because the version that (still) comes with it, PHP 7.2, comes with a php-xml package that prevents phpBB version 3.3 from working correctly. See this how to for instructions.

Mosh

I remember when mosh first came out and thinking "that sounds like a great idea, maybe I'll set it up sometime" and then never getting around to it. Several times over the years I've thought similarly, but it never seemed worth it. A week ago a coworker asked if there were good tools for handling remote terminal use over laggy internet connections, and I suggested mosh. They really liked it, which then had me feeling silly for never trying it, and got me to actually do it. So: I'm typing this over mosh, and it's excellent! I should have done this years ago.

Source: Mosh, an article by Jeff Kaufman.

A humble guide to database schema design

Having a good database schema design is crucial for building applications that will need to scale in traffic and complexity. If you happen to do a bad design choice you will see that it takes a lot of effort to stop the pattern from propagating to your backends’ services and controllers, and finally to your frontend.

So there is a need to be able to evaluate if a database design is better than another.

But what does good mean when we are talking about design?

Source: A humble guide to database schema design, an article by Mike Alche.

Getting Started with WireGuard

WireGuard is a relatively new VPN tunnel protocol that aims to be very fast and easy to setup. It follows the Unix Philosophy closely in that it only does one thing (creating secured VPN tunnels) and does it well.

Source: Getting Started with WireGuard, an article by Miguel Mota.

Chromatopelma cyaneopubescens drinking

In the evening I saw my Chromatopelma cyaneopubescens grooming itself on top of a piece of coco peat that I keep moist to provide a humid section to its otherwise dry container.

Chromatopelma cyaneopubescens drinking
Chromatopelma cyaneopubescens drinking.

I used a dosing syringe to moisten the piece of coco peat a little more and saw the tarantula lower itself to the substrate; it was taking some of the moisture.

Soon after it returned to its "house": a few small twigs that it has covered in some webbing.

More Arachnids

Last Saturday I ordered the following four tarantulas with Fatbob's Exotics:

  • 0.0.1 Hapalopus sp Columbia big 3FH €5
  • 0.0.1 Heteroscodra maculata 2FH €4
  • 0.0.1 Psalmopoeus irminia 3/4FH €5
  • 0.0.1 Pterinochilus murinus RCF 3FH €5

Three of which were on the wishlist I made back in March.

I also ordered one scorpion:

  • 0.0.1 Chaerilus sp Java 2FH €6

Although the order added up to €25 and shipping was €7 I was asked to pay €31.

Psalmopoeus irminia just out of its vial
Psalmopoeus irminia just out of its vial.

This morning the order, shipped on Monday, arrived. After some shopping for containers, cork tubes, fake plants, and coco peat I started the rehousing of the arachnids as all animals were shipped in small vials.

Psalmopoeus irminia terrarium from above
Psalmopoeus irminia terrarium from above.

First, I prepared a terrarium for the Psalmopoeus irminia, an arboreal species, guided by a care sheet. Rehousing the small spider was easy. Next, I prepared a terrarium for the Heteroscodra maculata, another arboreal species. Again I used a care sheet for guidance. However, when I opened the vial to rehouse the tarantula I noticed that it was much smaller than the Psalmopoeus irminia, and for sure too small for the terrarium I just prepared. Luckily, I had a much smaller container, and used that one instead.

Pterinochilus murinus, red color form
Pterinochilus murinus, red color form.

Next, I rehoused the Pterinochilus murinus into a terrarium I had prepared using a care sheet for guidance. When I carefully tried to move the tarantula with a soft brush it attacked the brush. A common name for this species is Orange Bitey Thing; a play on the common name Orange Baboon Tarantula (OBT) for this species.

Pterinochilus murinus terrarium
Pterinochilus murinus terrarium.

For the final two arachnids I needed also a much smaller terrarium. So Esme and I went out again. First I went to a shop to buy two small cups with garlic sauce; the right size for the tiny Chaerilus sp. Java, a scorpion. We also bought a few additional containers in another shop.

For the scorpion I used some coco peat and a small piece of cork to provide a hiding place. For the Hapalopus sp Columbia I used once more a care sheet for guidance.

Snail terrarium with fake plants
Snail terrarium with fake plants.

As Alice and Adam had collected a bunch of snails at my mother's place last Sunday, I helped Alice with preparing a nice terrarium for their collection.

Terrariums and empty vials
Terrariums and empty vials.

JavaScript Comparison Operators

Comparison operators are frequently used in JavaScript applications, and are an important part of controlling the logic flow of the app. But if you don’t have a good understanding of how they work you can run into a couple issues. Understanding strict comparisons and abstract comparisons is also really important, and in this article we’ll cover both of these comparisons.

Source: JavaScript Comparison Operators, an article by Preston Lamb.

Common JSON patterns in Haskell, Rust and TypeScript

A lot of web development is transforming JSON one way or another. In TypeScript/JavaScript this is straightforward, since JSON is built into the language. But can we also achieve good ergonomics in Haskell and Rust? Dear reader, I am glad you asked! 🙌

Source: Common JSON patterns in Haskell, Rust and TypeScript, an article by Christian Kjær Laustsen.