week 49, 2020

Skater Girl

In the afternoon Alice went out to test the skateboard she got yesterday as a "Sinterklaas" present.

Alice riding her skateboard
Alice riding her skateboard.
Alice with her skateboard
Alice with her skateboard.

Alice actually doesn't like the above photo because she's holding the skateboard in what's called a mall grab which nowadays is somehow a big no. But I think she looks great!

Alice trying to jump on her skateboard
Alice trying to jump on her skateboard.

On navigating a large codebase

A while ago, I’ve been working on a very large codebase that consisted of a few million lines of code. Large systems are usually a big mess and this one was no exception. Since this is a rather common problem in software engineering, I thought the internet would be littered with stories about this topic. There is a lot of talk about software carpentry, while software maintenance is rarely debated. Either large programs are being maintained by dark matter developers or nobody thinks that writing stories about large systems are interesting enough.

In the past I’ve encountered a few of those large monsters and they seem to have a lot in common. This article will try to present some of the problems and tricks that I am using when I have to deal with them. Hopefully this will inspire others to write similar posts and share tips from their own bag of tricks.

Source: On navigating a large codebase.

The Law of Innocence

On the night he celebrates a big win, defense attorney Mickey Haller is pulled over by police, who find the body of a former client in the trunk of his Lincoln. Haller is immediately charged with murder but can’t post the exorbitant $5 million bail slapped on him by a vindictive judge.

In the night I started in The Law of Innocence by Michael Connelly, one of my favourite authors.

The Rusty Honda

In the morning Alice and I went to Scheveningen to pay a visit to Skate Shop Rollerwave. Alice wanted a skateboard and protective gear for her "Sinterklaas" present.

On our way to the shop we encountered a nice looking but rusty Honda motorcycle so I took a photo.

A rusty Honda motorcycle
A rusty Honda motorcycle.

Evolution: What the Fossils Say and Why It Matters

Donald R. Prothero’s Evolution is an entertaining and rigorous history of the transitional forms and series found in the fossil record. Its engaging narrative of scientific discovery and well-grounded analysis has led to the book’s widespread adoption in courses that teach the nature and value of fossil evidence for evolution. Evolution tackles systematics and cladistics, rock dating, neo-Darwinism, and macroevolution. It includes extensive coverage of the primordial soup, invertebrate transitions, the development of the backbone, the reign of the dinosaurs, and the transformation from early hominid to modern human. The book also details the many alleged “missing links” in the fossil record, including some of the most recent discoveries that flesh out the fossil timeline and the evolutionary process.

Source: Evolution: What the Fossils Say and Why It Matters.

Evolution second edition by Donald R. Prothero
Evolution second edition by Donald R. Prothero.

In the late afternoon we went to my mother's house to celebrate "Sinterklaas". I got the hardcover of Donald R. Prothero’s Evolution (second edition). I plan to read this book front to back very soon. The book is recommended by Jerry Coyne, the author of Why Evolution Is True which I read, with a lot of pleasure, a few years ago.

Linesman: OK

Just before midnight I finally finished Linesman by S. K. Dunstall, which is the pen name used by Australian sisters Sherylyn and Karen Dunstall. While I love the idea of "lines", to me it's very original, the book was quite a slow read. Only in the end the pace increased. I am not sure yet if I am going to read the sequel.

Spiders Can Fly Hundreds of Miles Using Electricity

Every day, around 40,000 thunderstorms crackle around the world, collectively turning Earth’s atmosphere into a giant electrical circuit. The upper reaches of the atmosphere have a positive charge, and the planet’s surface has a negative one. Even on sunny days with cloudless skies, the air carries a voltage of around 100 volts for every meter above the ground. In foggy or stormy conditions, that gradient might increase to tens of thousands of volts per meter.

Ballooning spiders operate within this planetary electric field. When their silk leaves their bodies, it typically picks up a negative charge. This repels the similar negative charges on the surfaces on which the spiders sit, creating enough force to lift them into the air. And spiders can increase those forces by climbing onto twigs, leaves, or blades of grass. Plants, being earthed, have the same negative charge as the ground that they grow upon, but they protrude into the positively charged air. This creates substantial electric fields between the air around them and the tips of their leaves and branches—and the spiders ballooning from those tips.

Source: Spiders Use Earth's Electric Field to Fly Hundreds of Miles, an article by Ed Yong.

Parser Combinators: a Walkthrough

Today, I want to explore Parsec, and most specifically how Parsec works. Parsing is ubiquitous, and most Haskell programs will use Parsec or one of its variants (megaparsec or attoparsec). While it’s possible to use those libraries without caring about how they work, I think it’s fascinating to develop a mental model for their inner design; namely, monadic parser combinators, as it is a simple and elegant technique that is useful beyond the use case of parsing raw text. At Hasura, we have recently used this technique to rewrite the code that generates a GraphQL schema and checks an incoming GraphQL query against it.

Source: Parser Combinators: a Walkthrough, an article by Antoine Leblanc.

Git stash doesn't have to be scary

It was only when I recently heard someone else say, “git stash is scary” that I realized it was top of my list of fears too. It just usually feels like there’s a chance I’ll just lose all of my in progress work to the depths of stashes and never be able to get the right incantation of git commands to reincarnate my code.

Source: Git stash doesn’t have to be scary, an article by Jemma Issroff.

Sockets In Your Shell

Something I learned recently and I thought was amazing - you can create sockets straight from your shell! Well, assuming you use bash or zsh - from some surface level digging, I couldn’t find anything for fish.

Source: Sockets In Your Shell.

Testing the UI without UI Testing in Swift

Normally I’ve reached for UI Testing. Unfortunately, more and more issues with XCUITest seem to pop up. It’s become (always has been?) a tad too flaky and unreliable. And even when it works it’s orders of magnitude slower than XCTest.

Whats been working for me is a middle ground: testing the UI in XCTest. In other words, integration- or feature-level tests written in Xcode’s unit testing framework.

Source: Testing the UI without UI Testing in Swift, an article by Joe Masilotti.

The Power of Recursive Macros in Vim

Macros represent a simple concept which can be described as “record the sequence of my actions, save them, and anytime I need them again, execute them.”

This is probably the most underused Vim feature which can improve your productivity dramatically. You can do all sorts of amazing stuff with your code using macros.

Source: The Power of Recursive Macros in Vim, an article by Jovica Ilic.

Why should you use an ORM (Object Relational Mapper)?

Budding web developers learning Model-View-Controller frameworks are taught that they should use an Object Relational Mapper (ORM) to interface with their databases. But the “why” is often brushed aside or omitted entirely, leaving a fledgeling programmer with burning questions like ”What are ORMs, anyway?” and “What problems do they solve?”

ORMs are a class of tools that facilitate interactions between a programming language and a relational database management system. They can range in complexity and opinionation from a simple set of abstractions for interactions with relational databases (SQLAlchemy Base) to fully opinionated tools for mapping database rows to language structs (Django ORM, SQLAlchemy ORM). To get a better understanding of how ORMs work, it’s helpful to work through the kind of problems they can solve.

Source: Why should you use an ORM (Object Relational Mapper)?, an article by Karim Marzouq.

macOS to FreeBSD migration a.k.a why I left macOS

Not so long ago, I was using macOS as my daily driver. The main reason why I got a macbook was the underlying BSD Unix and the nice graphics it provides. Also, I have an iPhone. But they were also the same reasons for why I left macOS.

I did not want to write this post right after the migration, I wanted to take my time, use FreeBSD daily, see if I will ever miss macOS.

Source: macOS to FreeBSD migration a.k.a why I left macOS, an article by Antranig Vartanian.

How I Made a Self-Quoting Tweet

The original idea to make a tweet that quote tweets itself is from the 28th of May 2020—as recorded in Evernote—but I think had likely occurred to me earlier when considering what ramifications Twitter having an edit button would have—most notably being able to mislead, being able to vandalize someone's timeline post-retweet, and of course being able to edit your tweet to refer to itself.

Fundamentally the challenge is just correctly guessing what ID a given tweet is going to get, then appending that onto the URL for our profile and tweeting it.

Source: How I Made a Self-Quoting Tweet, an article by Oisín Moran.

System Font Stack

Defaulting to the system font of a particular operating system can boost performance because the browser doesn’t have to download any font files, it’s using one it already had. That’s true of any “web safe” font, though. The beauty of “system” fonts is that it matches what the current OS uses, so it can be a comfortable look.

Source: System Font Stack, an article by Geoff Graham.

How to Understand and Solve Conflicts in Git

There it is, the word that every developer hates to see: conflict. 😱 There's just no way around the occasional merge conflict when working with Git (or other version control systems).

But when speaking with developers, I often hear that there's a sense of anxiety or discomfort around the topic of merge conflicts.

Handling conflicts often remains a dark, mysterious place: a situation where things are badly broken and it's unclear how to get out of it (without making things worse).

While it's true that merge conflicts are an unavoidable part of a developer's life, the discomfort in these situations is fully optional.

My intention with this article is to bring some clarity to this topic: how and when conflicts typically occur, what they actually are, and how to solve - or undo - them.

When you properly understand these things, you'll be able to deal with merge conflicts in a much more relaxed and confident way. 😍

Source: How to Understand and Solve Conflicts in Git, an article by Tobias Günther.

Apple's M1 chip: Making desktop computing cool again

This past summer, at the World Wide Developer Conference (WWDC), Apple announced that it would be transitioning from Intel to its in-house Apple Silicon over the next two years. Apple said the first Macs with in-house silicon would arrive by the end of 2020. Well, here we are, and we have a new MacBook Air, 13 inch MacBook Pro, and a Mac mini.

The form factors of these devices are identical, but the real magic is the new M1 chip inside. Is it as fast as Apple claims? Will it run our apps properly? What does the M1 chip mean for desktop computing generally? In this article, I will try and answer these questions.

Source: Apple's M1 chip: Making desktop computing cool again, an article by Erik Christiansen.