week 11, 2022

Color Your Logs And Stack Traces

One of the problems we had was the readability of logs. When you know what you’re looking for in a log, it is easy to search for an exception. But when you don’t know what is wrong, going through gigabytes of logs in white text on a black background can be very time consuming and error-prone.

Essentially, solution is to add colors to our logs to facilitate the readability. Wouldn’t it be great if every level (i.e., info, warning, error) message had a different color? What if we could have different colors in our stack trace to highlight different exceptions?

Source: Color Your Logs And Stack Traces, an article by Manasvi Gupta.

Understanding async/await in JavaScript

The async and await keywords have been in JavaScript for some time now, with full support across all major browsers and Node. While a lot has been written on how to use them, they are still a mystery to many fresh JavaScript and Node developers.

This article aims to explain what async and await do and how they work, in simple terms, while not treating them as black magic.

Source: Understanding async/await in JavaScript.

Optimization in Swift

This will be yet another exploratory series on my blog — this time around, I want to write a little about optimizing performance in Swift code. This is, of course, an endless topic so what I’m going to do is, similarly to previous posts, focus on a problem and then track my way through working on it.

Source: Optimization in Swift, part 1, an article by Marin Todorov.

Apple Mac Studio review: finally

I’ve, once again, given this device to a host of professionals on The Verge’s team, and the reactions I saw couldn’t be more different from those we saw in 2020. They were impressed. For their workloads, it’s faster than anything they’ve ever used. It’s changed what they can do.

Source: Apple Mac Studio review: finally, an article by Monica Chin.

Review: The Mac Studio shows us exactly why Apple left Intel behind

The Studio reminds me of a few Macs we’ve seen before—it’s sort of a trashcan Mac Pro by way of the PowerMac G4 Cube. It borrows elements of the Mac Pro and the Mac mini, but it replaces neither. It’s both a glimpse at what is possible now that Apple is leaving the Intel era behind, and yet another recommitment to the Mac as a powerful and flexible platform for getting work done.

Source: Review: The Mac Studio shows us exactly why Apple left Intel behind, an article by Andrew Cunningham.

Setting up Kubernetes on AWS

All the cool kids are on AWS, and all the cool kids are definitely using Kubernetes. So I thought it was about time to do a definitive guide on how to set it up. I will be setting up EKS - Elastic (because amazon) Kontainer Service - which is amazon-speak for Kubernetes.

Source: Setting up Kubernetes on AWS, an article by Anders Borch.

Abstract types and methods in Swift

In object-oriented programming, an abstract type provides a base implementation that other types can inherit from in order to gain access to some kind of shared, common functionality. What separates abstract types from regular ones is that they’re never meant to be used as-is (in fact, some programming languages even prevent abstract types from being instantiated directly), since their sole purpose is to act as a common parent for a group of related types.

Source: Abstract types and methods in Swift, an article by John Sundell.

Types versus sets

A recent Twitter thread brought home to me that there is widespread confusion about what types actually are, even among the most prominent researchers. In particular: are types the same thing as sets? At the risk of repeating some of my prior posts, perhaps it’s time for a little history about type theory, set theory and their respective roles as foundations of mathematics.

Source: Types versus sets (and what about categories?), an article by Lawrence C Paulson.

Hands-on with PostgreSQL Authorization

While it's controversial to put business logic in your database, I suspect it is not controversial to claim that it's important to understand the permissions and security of your database. If you neglect learning how your database handles authorization, then you probably aren't following the principle of least privilege — your database might be accessed by coworkers (e.g. developers, data scientists, marketers, accountants), contractors, continuous integration processes, or deployed services that have more privileges than they should, which increases the risk of data leaks, improper data access (e.g. of personal identifiable information), and accidental or malicious data corruption and data loss.

Source: Hands-on with PostgreSQL Authorization - Part 1 - Roles and Grants, an article by Greg Schafer.

Introduction to Apple Silicon

This document attempts to explain the Apple Silicon (i.e. M1 and later) Mac boot ecosystem (henceforth "AS Macs"), as it pertains for how open OSes interoperate with the platform.

It is intended for developers and maintainers of Linux, BSD and other OS distributions and boot-related components, as well as users interested in the platform, and its goal is to cover the overall picture without delving into excessive technical detail. Specifics should be left to other wiki pages. It also omits details that only pertain to macOS (such as how kernel extensions work and are loaded).

Source: Introduction to Apple Silicon.

Processing large JSON files in Python without running out of memory

If you need to process a large JSON file in Python, it’s very easy to run out of memory. Even if the raw data fits in memory, the Python representation can increase memory usage even more.

And that means either slow processing, as your program swaps to disk, or crashing when you run out of memory.

One common solution is streaming parsing, aka lazy parsing, iterative parsing, or chunked processing. Let’s see how you can apply this technique to JSON processing.

Source: Processing large JSON files in Python without running out of memory, an article by Itamar Turner-Trauring.

Swift 5.6 Released!

Swift 5.6 includes a number of enhancements to the type system, improved interaction with pointers, and adds the ability to run new plugin commands using the package manager.

Source: Swift 5.6 Released!, an article by Ted Kremenek.

Monorepos done right

There’s a lot of arguments for and against monorepos. Done right, I believe monorepos will help you move with urgency and focus as your engineering organization grows. That doesn’t mean it’s easy! I’ve also seen monorepos turn into monoliths that block teams from getting anything out in a timely manner.

Source: Monorepos done right, an article by Felix Mulder.

Storing UTC is not a silver bullet

The general advice of “just convert all local date/time data to UTC and store that” is overly broad in my view. For future and near-past events, it doesn’t take into account that time zone rules change, making the initial conversion potentially inaccurate. Part of the point of writing this blog post is to raise awareness, so that even if people do still recommend storing UTC, they can add appropriate caveats rather than treating it as a universal silver bullet.

Source: Storing UTC is not a silver bullet, an article by Jon Skeet.

When or If

The CSSWG (CSS Working Group) is currently debating what to name a conditional structure, and it’s kind of fascinating. There are a lot of strong opinions, and I’m not sure how many of them are weakly held.

Source: When or If, an article by Eric Meyer.

Hacking sum types with Go generics

I’ve been writing Go professionally for five years now, and the feature I’ve wanted the most – more than generics, even – is a sum type.

Specifically, I want to define a type comprising several distinct values, and to write code that handles all possible values of that type which is checked by the compiler.

Such a type is key in large projects where the compiler should help you find modules that need updating when you extend the base sum type. With generics in go 1.18, it’s possible to write an ergonomic switch statement that can help polyfill for sum types, until they are supported properly.

Source: Hacking sum types with Go generics, an article by Lawrence Jones.