week 24, 2023

My First Impressions of Nix

Nix is a tool for configuring software environments according to source files. I’ve been hearing more and more about Nix on Hacker News and Twitter. The idea of it appeals to me, so I’ve been tinkering with it over the past few weeks.

Source: My First Impressions of Nix, an article by Michael Lynch.

Designing Pythonic library APIs

This article describes some principles I’ve found useful for designing good Python library APIs, including structure, naming, error handling, type annotations, and more. It’s a written version of a talk I gave in June 2023 at the Christchurch Python meetup.

Source: Designing Pythonic library APIs, an article by Ben Hoyt.

Building Search DSLs with Django

Search capabilities span from free text (think Google) to raw data access (think SQL). In between, there’s a wide range of options for narrowing a search that are often provided with UI elements. But what if there are too many fields for a UI to search on? Search DSLs can give a user more granular access to searching without exposing an overly complicated interface.

Source: Building Search DSLs with Django, an article by Dan Lamanna.

Children of Memory

Earth failed. In a desperate bid to escape, the spaceship Enkidu and its captain, Heorest Holt, carried its precious human cargo to a potential new paradise. Generations later, this fragile colony has managed to survive, eking out a hardy existence. Yet life is tough, and much technological knowledge has been lost.

Then strangers appear. They possess unparalleled knowledge and thrilling technology – and they've arrived from another world to help humanity’s colonies. But not all is as it seems, and the price of the strangers' help may be the colony itself.

In the evening I started in Children of Memory, Children of Time book 3 by Adrian Tchaikovsky.

In the acknowledgements the author gives a nod to his research sources which include the fantastic book The Genius of Birds by Jennifer Ackerman. I read this book several years ago while living in Mexico and highly recommend it.

The best Python feature you cannot use

Instead of having to limit sanity checks to the boundaries of the program, we could re-use those as function contracts using the assert keyword. Indeed, setting PYTHONOPTIMIZE removes all assert, making the check useful in dev, and free in production.

Unfortunately, the community doesn't know about the feature, and use assert for things that should never be removed, so using the flag would likely introduce bugs into your program.

Source: The best Python feature you cannot use.

Ride Along 2 (2016)

As his wedding day approaches, Ben heads to Miami with his soon-to-be brother-in-law James to bring down a drug dealer who's supplying the dealers of Atlanta with product.

In the evening Adam, Alice, Esme, and I watched Ride Along 2. I liked the movie and give it a 7 out of 10.

How does Machine Learning work?

Machine learning (ML) lets computers learn from data on their own without requiring software developers to write out all the logic by hand. Given enough data, the machine can learn useful patterns in the data, which turns out to be quite powerful.

The earliest ML algorithms go back to the 1960’s but machine learning started being commonly used in the early 2000’s. In 2012, “deep learning” involving large neural networks became practical and their usage and capabilities has grown exponentially since then.

Source: How does Machine Learning work?.

The recent breakthroughs in Large Language Model (LLM) technology are positioned to transition many areas of software. Search and Database technologies particularly have an interesting entanglement with LLMs. There are cases where Search improves the capabilities of LLMs as well as where inversely, LLMs improve the capabilities of Search. In this blog post, we will break down 5 key components of the intersection between LLMs and Search.

  • Retrieval-Augmented Generation
  • Query Understanding
  • Index Construction
  • LLMs in Re-Ranking
  • Search Result Compression

We will also conclude with some thoughts on how Generative Feedback Loops fit into this picture.

Source: Large Language Models and Search, an article by Connor Shorten and Erika Cardenas.

Ride Along (2014)

Security guard Ben must prove himself to his girlfriend's brother, top police officer James. He rides along James on a 24-hour patrol of Atlanta.

In the evening Adam, Esme, and I watched Ride Along. I liked the movie and give it a 7 out of 10.

Exploring Dataflow Analysis in the Rust Compiler

Recently I’ve been working in static analysis land and as a part of that have been familiarizing myself with data flow analysis. I look at a fair amount of MIR and so decided to delve into the rustc_mir_dataflow crate to see how these things are handled in the rust compiler. There is a helpful introduction to this topic in the rustc dev guide, and this post fleshes things out a bit.

Source: Exploring Dataflow Analysis in the Rust Compiler, an article by David Anekstein.

Three techniques to adapt LLMs for any use case

Large language models (LLMs) have powerful general capabilities out of the box: they can answer questions, write poems and stories, invent recipes, and write code. But they may not precisely fit your use case. Their answers may be too vague, poorly formatted, or even incorrect.

Fortunately, you can adapt LLMs to meet your needs. There are three levels of LLM customization:

  1. Prompt engineering
  2. Embeddings via vector databases
  3. Fine-tuning

Each level is an order of magnitude more difficult and expensive than the previous, but offers far more customization.

Source: Three techniques to adapt LLMs for any use case, an article by Philip Kiely.

An Ode to Emacs. The Greatest Operating System

Emacs is one of those magical pieces of technology that manages to bridge the gap between being a tool that does useful work, and becoming a deeply personal component in a software developer’s life. It is one half of the editor war and is one of the longest running examples of programmers elevating their personal choices to moral imperatives. But beyond that, it is also a piece of software that has seen decades of iteration. It’s old enough that parts of it were contributed by people that have long since passed. They may be gone, but their code still lives on, making our lives just a bit easier.

Source: An Ode to Emacs. The Greatest Operating System, an article by Diego Crespo.

Why PostgreSQL High Availability Matters and How to Achieve It

Ensuring your application can handle failures and outages is crucial, and the availability of your application is only as good as the availability of your PostgreSQL instance. With that in mind, you may be wondering which PostgreSQL high availability (HA) deployment option is best for your application.

Let’s review several popular solutions that increase the high availability of PostgreSQL deployments and, as a result, the availability overall of your application. Why several and not one? Well, there’s no silver bullet or one-size-fits-all solution when it comes to high availability and PostgreSQL. So, walk through the options for a highly available deployment of PostgreSQL and then you can make a choice that fits your use case.

Source: PostgreSQL High Availability Options: A Guide.

Lou (2022)

A storm rages. A young girl is kidnapped. Her mother teams up with the mysterious woman next door to pursue the kidnapper, a journey that tests their limits and exposes shocking secrets from their pasts.

In the evening I watched Lou. I liked the movie and give it a 7 out of 10.

WWDC23: Passkeys

Last week I managed to glean more insights into Apple’s continuing evolution of their passkeys support from other places online, though, so I decided to pull it all together. Here’s the latest news on changes coming in iOS 17, iPadOS 17, and macOS 14 to Apple’s passkeys experience.

Source: WWDC23: Passkeys, an article by Matthew Miller.

Cruel and Unusual

The fingerprints say the murderer is the man who's just been executed . . .

At 11.05 one December evening in Richmond, Virginia, convicted murderer Ronnie Joe Waddell is pronounced dead in the electric chair. At the morgue Dr Kay Scarpetta waits for Waddell's body. Preparing to perform a post-mortem before the subject is dead is a strange feeling, but Scarpetta has been here before. And Waddell's death is not the only newsworthy event on this freezing night: the grotesquely wounded body of a young boy is found propped against a rubbish skip. To Scarpetta the two cases seem unrelated, until she recalls that the body of Waddell's victim had been arranged in a strikingly similar position . . .

In the evening I started in Cruel and Unusual, Book 4 in the Kay Scarpetta series by Patricia Cornwell.

Modern CSS in Real Life

By any measure, CSS has gotten a lot better in recent years. It’s gotten more useful features, better interoperability between browsers, and become easier to learn thanks to a concerted push toward making CSS a cohesive system free of quirks and hacks.

Source: Modern CSS in Real Life, an article by Chris Coyier.

Monad Transformers 101

In this post, I go over what monad transformers are and how to use them. I go into the internals of some common transformers, and we see how monad transformers are essentially functions that take in a monad and return an "augmented" monad with extra capabilities. We finish with a discussion of two different ways of using monad transformers, mtl-style and transformers-style.

Source: Monad Transformers 101, an article by William Yao.