Cleaning Up Your Postgres Database

I am an application/backend developer who has to quibble with databases more often than desired. I can get my way around Postgres pretty well, but I can always use a hint or two, especially when it comes to fine-tuning and performance. I stumbled upon Cleaning Up Your Postgres Databases. It offers useful advice on spotting performance bottlenecks in your Postgres database. Take the cache and index hit queries, for example. The first thing you’re going to want to look at is your cache hit ratio and index hit ratio. Your cache hit ratio is going to give the percentage of time your data is served from within memory vs. having to go to disk. Generally serving data from memory vs. disk is going to orders of magnitude faster, thus the more you can serve from memory the better. For a typical web application making a lot of short requests I’m going to target > 99% here. ...

March 9, 2021

Book Review: The Library at Night

As any other bookworm worth its salt, I digested a generous amount of books on books and the history of libraries. Alberto Manguel’s The Library at Night was last, and that is a pity. It probably arrived just a little too late on my shelves. I wish I found it at the beginning of my reading journey when my enthusiasm for libraries and their contents was pristine. Manguel’s writing is mesmerizing and capable. The lover of libraries and their books (in that order because this text is more about libraries than the books they contain) will undoubtedly fall into the rabbit hole and devour this book. Check this out: ...

March 6, 2021

Semantic Versioning Will Not Save You

The always brilliant Hynek recently posted Semantic Versioning Will Not Save You. Primarily targeted at consumers of SemVer-versioned packages, it is full of insightful advice. From my perspective as an open-source maintainer, I can tell you that versioning is hard. Judging when a new release is going to break backward compatibility is not as simple as it might seem on the surface, and Hynek does a great job explaining why. Sometimes it is also hard for me to tell if a change in a codebase classifies as a new feature, small improvement, or fix—subtle differences. In the context of SemVer, it matters a lot because version numbers have a meaning. Consumers will likely decide whether to upgrade or not based on that meaning. ...

March 4, 2021

Reverse engineering an obfuscated codebase and fixing it in the process

Today’s mandatory reading is How I cut GTA Online loading times by 70%. As someone who’s been fighting the protection/obfuscation cat & mouse game for twenty+ years, let me tell you one thing. The way this guy reverse-engineered parts of the GTA5 codebase and then proceeded to single-handly triage and fix a long-standing (7+ years) performance issue is simply mindblowing. All he had to work with were heavily obfuscated dlls. This also shows how we, the protectors, are always playing a losing game. ...

March 2, 2021

On the CEO and founder of Signal

Last weekend’s reading list also included Taking Back Our Privacy, yet another1 New Yorker piece but this time signed by Anna Wiener. This article is a long-read on Moxie Marlinspike, co-founder and CEO of Signal. Moxie is a childhood nickname. That alone signals (pun intended) an original personality. I mean, how many times have you heard of a CEO going by his childhood nickname? Indeed the personal story of Marlinspike, along with that of the ascent of Signal, is fascinating. I did not know, for example, that in 2013 he met Brian Acton, founder of WhatsApp. Brian expressed interest in adding end-to-end encryption into WhatsApp. Then came Facebook’s acquisition, and, for obvious reasons, Signal Protocol never landed into the messaging service. The story was not over, however: ...

March 1, 2021

The Activists Who Embrace Nuclear Power

Today, my Sunday long-reading list included New Yorker’s The Activists Who Embrace Nuclear Power by Rebecca Tuhus-Dubrow. Can nuclear power possibly be a viable solution for climate change? Twenty or even ten years ago, my answer would have been a big fat No. Today? Not so sure anymore. Today, the looming disruptions of climate change have altered the risk calculus around nuclear energy. James Hansen, the NASA scientist credited with first bringing global warming to public attention, in 1988, has long advocated a vast expansion of nuclear power to replace fossil fuels. Even some environmental groups that have reservations about nuclear energy […] have recognized that abruptly closing existing reactors would lead to a spike in emissions. ...

February 28, 2021

How to increase upload file size in ASP.NET Core

Today I learned the hard way that since ASP.NET Core 2.0, the request body has acquired a default size limit at 30MB (~28.6 MiB). If the request body size exceeds the configured max request body size limit, the call to Request.Body.ReadAsync will throw an IOException. If this exception is uncaught, Kestrel will respond with a 413 Payload Too Large response and HttpSys will respond with a generic 500 Internal Server Error response (source). ...

February 26, 2021

Five Minutes to Make You Love Classical Music

I already mentioned what background music (or sounds) I like when I am coding. In that list, I included classical music. I know classical is not exactly a favorite. Not in my field, at least. I suspect the vast majority of people disregard it in advance, not really knowing what they’re missing out on, just because, well, you know, it’s dinosaurs stuff. If you are among them, you should reconsider and repent your sins. But have no worries, and rejoice, for I am here to save your soul. ...

February 25, 2021

Musings on Python's Pattern Matching

Pattern Matching is coming to Python, and I am not sure I like it. Don’t get me wrong, I love pattern matching. I use it all the time in F#. I am sure that once it lands in the language, it will be wildly adopted. So what’s the problem with Python’s pattern matching? The community, some core developers included, has expressed several concerns. The Python Steering Council has acknowledged them and is willing to look into improvements should they be proposed. I am not going into the details here. You can look them up yourself. Let’s just say that there are a few gotchas, like the requirement to use dotted names as constants, to prevent them from being interpreted as capture variables instead (doh!) The lack of local scope bites hard here. ...

February 23, 2021

The Lasting Lessons of John Conway's Game of Life

In March 1970, Dr. John Conway sent the “fatal” (as he later referred to it) letter to Martin Gardner. He was submitting ideas for Gardner’s Mathematical Games column in Scientific American. The New York Times features a good article on the fifty-year parable of The Game of Life. What’s appreciable, they asked some of Life’s most steadfast friends to reflect upon its influence and lessons over half a century. Among them, Brian Eno, who, being Brian Eno, has some smart things to say: ...

February 20, 2021