week 30, 2021

Logging Tips for Postgres, Featuring Your Slow Queries

In the last several months, we've featured simple yet powerful tools for optimizing PostgreSQL queries. We've walked through how the pg_stat_statements extension can show which queries are taking up the most time to run system-wide. We've also looked at how to use the EXPLAIN command to uncover query plans for individual queries.

You can get a lot out of those two, but you may have also wondered, "What about logs? Surely I can use Postgres' logs to help me find and track slow queries too?" Today we're going to take a look at a useful setting for your Postgres logs to help identify performance issues.

Source: Logging Tips for Postgres, Featuring Your Slow Queries, an article by Kat Batuigas.

A Note About Git Commit Messages

I want to take a moment to elaborate on what makes a well formed commit message. I think the best practices for commit message formatting is one of the little details that makes Git great. Understandably, some of the first commits to rails.git have messages of the really-long-line variety, and I want to expand on why this is a poor practice.

Source: A Note About Git Commit Messages, an article by Tim Pope.

Improve PostgreSQL Query Performance

Understanding query performance patterns is essentially the foundation for query performance tuning. It, in many ways, dictates how a database cluster evolves. And then there are obviously direct and indirect cost connotations as well.

PostgreSQL provides very detailed statistics through a number of catalog views and extensions that can be easily added to provide more detailed query statistics. With each view focused on a particular aspect, the picture almost always needs to be stitched together by combining different datasets. That requires effort and still, the whole picture might not be complete.

The pg_stat_monitor extension attempts to provide a more holistic picture by providing much-needed query performance insights in a single view. The extension has been evolving over the past year and is now nearing the GA release.

Source: Improve PostgreSQL Query Performance Insights with pg_stat_monitor, an article by Ibrar Ahmed and Hamid Akthar.

In Defense of Package Managers

Open Source package managers are one of the most maligned pieces of software in common use today. I’m here to correct that criticism and tell developers that it’s not the package managers you hate — it’s what they’ve made you become. This contains a bit of a history lesson to explain how we got here today, as well as what I think the package management world will look like in the future.

Source: In Defense of Package Managers, an article by Dan Lorenc.

6 Command Line Tools for Productive Programmers

Lately, I’ve been doing a lot more things at the command line. I’m not a hard-core terminal guy – I use VSCode more than Vim – but I’m always surprised at the number of complex tasks that can be done using just the POSIX standard command-line tools like grep, cat and sort.

Tools are powerful. A good tool makes work easier and faster, and a great tool unlocks new abilities: Previously impossible things become possible and sometimes easy.

As I’ve learned more, I’ve been adding some new tools to my command-line toolbox, and in this article, I’d like to share some I’ve found valuable.

Source: 6 Command Line Tools for Productive Programmers, an article by Adam Gordon Bell.

Cleaning Up Git History

A clean git commit history is often underrated and can be immensely useful to ease code reviews and understand changes in the future (potentially in the midst of an outage).

Of course we are talking about the final history here as committed to the shared repository, not the intermediate history while we are working on the code. Sometimes the intermediate history is good enough to be pushed directly, but this is actually fairly rare.

Cleaning up the history might seem tedious at first for marginal cosmetic benefits, but it gets much easier and faster with practice. Here I am collecting some tips for cleaning up a git commit history before publishing it to others, for example in the form of a pull request.

Source: Cleaning Up Git History, an article by Robin Schroer.

Life of a Container

I have been programming for almost six years now and have used containers for nearly the entirety of that time. For what comes with being a programmer, curiosity got the better of me and I started asking around the question, that what is a container?

Source: Life of a Container, an article by Indradhanush Gupta.

Python's collections: A Buffet of Specialized Data Types

Python’s collections module provides a rich set of specialized container data types carefully designed to approach specific programming problems in a Pythonic and efficient way. The module also provides wrapper classes that make it safer to create custom classes that behave similar to the built-in types dict, list, and str.

Learning about the data types and classes in collections will allow you to grow your programming tool kit with a valuable set of reliable and efficient tools.

Source: Python's collections: A Buffet of Specialized Data Types, an article by Leodanis Pozo Ramos.

Taking Months to Bits

A calendar system is an attempt to make sense of the passing of time with respect to astronomical phenomena — the positioning of the Sun, the Moon and the stars with respect to our unfixed and moveable Earth. It is perhaps ironic, then, that the widely used Gregorian calendar system is a cobbled-together mishmash that better reflects the arbitrariness of history than it does either celestial order or logical consistency.

Source: Taking Months to Bits. A calendrical journey into low-level programming, an article by Kevlin Henney.

Netcat - All you need to know

Netcat is a tool that reads and writes data across network connections, using TCP or UDP protocol. Netcat has been referred to as the TCP/IP / networking swiss army knife. In this article we’ll look at different applications of netcat and how it can be useful in day to day activities of a pentester, security professional, sysadmin etc…

Source: Netcat - All you need to know, an article by Michael Ikua.

The Black Prism

Guile is the Prism. He is high priest and emperor, a man whose power, wit, and charm are all that preserves a tenuous peace. Yet Prisms never last, and Guile knows exactly how long he has left to live.

When Guile discovers he has a son, born in a far kingdom after the war that put him in power, he must decide how much he's willing to pay to protect a secret that could tear his world apart.

In the evening I started in The Black Prism, Lightbringer book 1 by Brent Weeks. I've already read the Night Angel trilogy by the same author and liked this trilogy a lot so I have high expectations of this series.

My First CSS

CSS can be hard to grasp when you're starting out. It can seem like magic wizardry and you can very easily find yourself playing whack-a-mole adjusting one property only to have something else break. It is frustrating, and that was my experience for quite a long time before things suddenly seemed to "click".

Reflecting back on this time, I think there are a few key concepts that were vital to things finally all making sense and fitting together. These were:

  • The Box Model (e.g. box-sizing, height, width, margin, padding)
  • Layout (e.g. display)
  • Document Flow and Positioning (e.g. position, top, left, etc.)

There are also some useful concepts to keep in mind when building reusable and composable components.

Source: My First CSS, an article by Nathan Hardy.

Shell Field Guide

This booklet is intended to be a catalog of tricks and techniques you may want to use if you're doing some sort of complex scripting. Some are just useful, some are more playful, and might not have such direct impact in your day-to-day life. Some are pure entertainment. You'll have to judge by yourself which things belong to which category. I'll try to keep the rhetoric to the minimum to maximize signal/noise.

Source: Shell Field Guide, an article by Raimon Grau.

A beginner’s guide to kerning like a designer

Have you ever looked at a word or phrase you’re typesetting and something just looked off about it? It might just be a kerning problem. Kerning refers to the amount of space between two letters (or other characters: Numbers, punctuation, etc.) and the process of adjusting that space to avoid awkward-­looking gaps between your letters and improve legibility. In this article, we will outline how to kern like a professional designer.

Source: A beginner’s guide to kerning like a designer, an article by Janie Kliever.

Dark patterns in UX

Dark Patterns are deceptive UX/UI interactions, designed to mislead or trick users to make them do something they don’t want to do. This term was coined in 2010 after the boom of ecommerce industries on the web. In order to generate more sales, get subscriptions, and hit target numbers in transactions etc., designers and business associates started creating deceiving user interfaces to manipulate users.

Source: Dark patterns in UX: how designers should be responsible for their actions, an article by Arushi Jaiswal.