week 05, 2021

Snow in the Netherlands II

In the night we got a lot of snow. In the late afternoon we went outside to admire the white winter landscape.

Adam sitting in a pile of snow
Adam sitting in a pile of snow.

Because there was quite some wind it felt colder than we expected. Also the wind had piled up the snow in some locations, which Adam liked a lot; he jumped on those small dunes only to sink away.

A garden covered in snow
A garden covered in snow.

The last time we had snow in the Netherlands; the first time for Adam to see snow in person, was the 16th of Januari 2021. Alice had already played in the snow when she was very young: near the summit of a volcano in Mexico (about 3800 meters above sea level).

Rust for Haskell Programmers!

While we focus on Haskell at MMH, it's also good to branch out to other languages every once and a while. If you're a diehard Haskell developer, Rust is one of the more interesting languages to try out when you broaden your horizons. Its syntax has a lot in common with more common, object oriented languages like C++ and Java. But it also incorporates a lot of ideas that Haskell developers would find familiar. In this series, we'll learn the basics of Rust, coming from the perspective of Haskell programmers.

Source: Rust for Haskell Programmers!.

The Guide to Git I wish I had before I started my current job

I've been working with software for well over a decade, and honestly cannot remember when I started using Git. I used to be a bit wary of many commands but thought I had a good grasp on what to do when it came to git. Then I started a new role at a larger company, which had strict git guidelines. No more messy branches, no crappy commit messages, everything rebased.

Source: The Guide to Git I wish I had before I started my current job.

Open-sourcing Thrift for Haskell

Thrift is a serialization and remote procedure call (RPC) framework used for cross-service communication. Most services at Facebook communicate via Thrift because it provides a simple, language-agnostic protocol for communicating with structured data. Thrift can already be used in programming languages such as C++, Python, and Java using fbthrift. We are also open-sourcing Thrift support for Haskell (hsthrift).

The hsthrift package includes the full collection of tools and libraries for using Thrift in your own Haskell projects. The Haskell Thrift compiler generates the Haskell code needed to communicate with other Thrift services, and the included libraries allow you to build both Thrift clients and servers in Haskell. Haskell Thrift is fully compatible with all other fbthrift languages, so your Haskell project can freely communicate with other services no matter what language they are implemented in!

Source: Hsthrift: Open-sourcing Thrift for Haskell, an article by Noam Zilberstein and Simon Marlow.

A Complete Machine Learning Project From Scratch: Setting Up

In this first of a series of posts, I will be describing how to build a machine learning-based fake news detector from scratch. That means I will literally construct a system that learns how to discern reality from lies (reasonably well), using nothing but raw data. And our project will take us all the way from initial setup to deployed solution.

Source: A Complete Machine Learning Project From Scratch: Setting Up, an article by Mihail Eric.

Below Zero (2021): first part

On a lonely road, a prison transport is brutally assaulted. Martin, the policeman who was driving, survives and fortifies his position while the con men search for a way to finish him.

In the evening I watched Below Zero (2021) on Netflix. About half-way I got too tired and paused the movie. I liked what I had seen so far.

Setting Up Time Machine on Ubuntu Server 20.04

After building my home server last week, I was faced with a tough question - why exactly do I need one of these again? Setting up a Time Machine backup for both my wife's Mac and mine seemed like a pretty solid endeavor. Unfortunately, the process took longer than expected - partly because my Linux skills are dull, but mostly because I needed things to run perfectly.

So please enjoy the fruits of my labor if this is something you're looking to do also.

Source: Setting Up Time Machine on Ubuntu Server 20.04.

Constant Folding in Python

Every programming language aims to be performant in its niche and achieving superior performance requires a lot of compiler level optimizations. One famous optimization technique is Constant Folding where during compile time the engine tries to recognize constant expressions, evaluate them, and replaces the expression with this newly evaluated value, making the runtime leaner.

In this essay, we dive deep and find what exactly is Constant Folding, understand the scope of it in the world of Python and finally go through Python's source code - CPython - and find out how elegantly Python actually implements it.

Source: Constant Folding in Python, an article by Arpit Bhayani.

Practical Use of the Monad Abstraction

The infamous Monad is well known for it’s confusing name and countless useless tutorials. I won’t attempt to explain what it is here, but to explain why it is useful to have it available as an abstraction. One common objection to Monads is that, while they do seem to capture a shared interface and abstraction, it’s hard to see what benefit is derived from using Monads. In Haskell, it’s easy enough to say that the do-notation syntactic sugar requires the Monad interface and no more, but why are some people so intent on getting Monads working in Rust, OCaml, and even Java and Python?

Source: Practical Use of the Monad Abstraction.

Use your shell’s history

The command line is a powerful tool, and writing shell scripts lets you write a series of commands once and replay them any time you like.

But sometimes you will write a series of commands without putting them into a script. This may be because you are exploring a problem or because you haven’t bothered to put together a script. No sense in making something repeatable if you aren’t sure exactly how you are going to repeat it.

But you may want to look back over past commands you have run, whether to run them again, modify them or even just remind yourself what you’ve done. For this, the shell history is very handy. Another time I often look at the shell history is when I am signing into a machine that I don’t visit very often. Perhaps there’s a command to look at some log files that I know, distantly, in the back of my mind, that I ran four weeks ago. I could have documented it, but maybe I didn’t. If I look in my command line history, I can see it.

Source: Use your shell’s history, an article by Dan Moore.

More than you ever wanted to know about font loading on the web

When I started thinking about writing a post about web font loading my intention was to propose relatively sophisticated ideas that I've been playing with for a while. However, as I was trying to use them in real-world websites I realized that deployment of the more advanced techniques is de-facto impossible without the creation of new web standards.

With that the TL;dr of this post is: Use font-display: optional. However, I and many others really like our custom fonts. See the rest of the post for how we can get our cake and eat it, too–with a tool that automatically makes fallback fonts behave like their respective custom font counterpart.

Source: More than you ever wanted to know about font loading on the web, an article by Malte Ubl.

Building Docker Images The Proper Way

At this point probably everybody has heard about Docker and most developers are familiar with it, use it, and therefore know the basics such as how to build a Docker image. It is as easy as running docker built -t name:tag ., yet there is much more to it, especially when it comes to optimizing both the build process and the final image that is created. So, in this article we will go beyond the basics and we will look at how we can influence the build process of Docker images to make it faster and to produce much slimmer and more secure images for our applications.

Source: Building Docker Images The Proper Way, an article by Martin Heinz.

Non standard CSS selectors

Most of the time you want to use class selector using CSS. That's the most obvious and recommended approach. If these selectors are properly combined with for example BEM methodology (or any other methodology), chances are high that your CSS is written in a clear and reusable way.

However, in long-term projects with legacy code you may find yourself in such situations:

  • class names of elements cannot be changed,
  • HTML can't be changed,
  • elements can't be reorganized,
  • elements are loaded dynamically and there's no easy way to add a class name,

The list is open. The point is, that you can encounter situations where the class, type, or id selectors are not enough. This is when the other CSS selectors come into play.

Source: Non standard CSS selectors, an article by Michał Muszyński.