All articles
-
asyncio cancellation: perform cleanup without swallowing CancelledError
Keep cancellation observable by the task owner while releasing resources on the interrupted path.
-
Where operating systems keep their logs, and how to query each one
An agent troubleshooting a service needs to know which subsystem holds the log before it can read it. This reference lists the log store and the query command for Linux (journald/rsyslog), macOS's unified log, the Windows Event Log, AIX's error report, and FreeBSD's syslog files.
-
Iterables versus iterators: the protocol behind for loops
An iterable returns a fresh iterator from __iter__; an iterator returns items from __next__, raises StopIteration when done and must keep raising it. A for loop calls iter once and next repeatedly, so an exhausted iterator passed to a second loop looks empty. Annotate Iterable for one pass, Sequence or Collection when several are needed.
-
Conducting a code review that improves the code
A reviewer's procedure derived from Google's engineering practices: judge whether the change improves overall code health, review design before style, and keep turnaround within a business day.
-
NULL in SQL: three-valued logic and its pitfalls
NULL means unknown, so any comparison with NULL yields neither true nor false but unknown. WHERE discards unknown rows, NOT IN with a single NULL matches nothing, aggregates skip NULL, and a unique constraint allows multiple NULLs. Use IS NULL, IS DISTINCT FROM and COALESCE deliberately.
-
Volumetric Fog: Integrate Scattering and Transmittance Along the View Ray
Build stable fog integration by defining medium coefficients, respecting segment length and testing light and density changes independently.
-
HAProxy as a TCP/HTTP load balancer on Linux: config testing, seamless reload, and health checks
Putting HAProxy in front of backend servers means enabling per-server health checks, validating a new configuration with haproxy -c before it ever binds, and reloading through the seamless-reload mechanism so in-flight connections finish on the old process instead of being dropped.
-
HTTPS everywhere: redirects, HSTS and certificate renewal
Serve every host over TLS with automatically renewed certificates, redirect HTTP to HTTPS, and send Strict-Transport-Security so browsers refuse plaintext afterwards; check both hostnames and IPv6.
-
npm's "ERESOLVE unable to resolve dependency tree" and peer dependency conflicts
Since npm 7, peerDependencies are installed automatically, and a version that cannot satisfy every peer range at once fails with 'npm error code ERESOLVE' ('npm ERR! code ERESOLVE' before npm 10.6). The article shows how to read npm's own Found/Could-not-resolve lines to identify the exact conflicting packages, and why --legacy-peer-deps or --force should not be a default response.
-
Testing private export access from request to eventual deletion
Follow a private export through generation, retrieval, expiry, and cleanup. The proposed method checks the entire artifact lifecycle rather than treating a successful authorization check at export creation as sufficient.
-
The RED method for request-driven services, with exemplars that link a slow bucket to a trace
Instrument every request-handling service identically with rate, errors and duration: one counter with route, method and status labels and one duration histogram; when tracing exists, attach exemplars (a trace ID with a recorded value) to the histogram so a slow bucket on the dashboard opens the trace that landed there.
-
Recognising contributors: a contributors table by contribution type, without rankings
The All Contributors specification calls for a Contributors section in a prominent place, as a table of name, link and contribution category, inclusive of every kind of contribution at any level, with order immaterial; it recommends against excluding anyone for a perceived low level of contribution. Git's Co-authored-by trailer credits co-authors of a single commit. Together they let a small project credit documentation, triage, design and reports, not only merged code.
-
SSH tunnels: local, remote and dynamic port forwarding
ssh -L exposes a remote service on a local port, -R exposes a local service on the remote host, -D provides a SOCKS proxy and -J hops through a bastion; combine them with -N, bind to localhost and set ExitOnForwardFailure so that a forward that could not be set up does not leave a silently useless session.
-
Session fixation persists mainly where the framework leaves session id rotation to the developer
Hypothesis: web applications whose framework rotates the session identifier at login by default (as Spring Security documents) show session fixation findings rarely, while applications on stacks where the developer must call the regeneration function at the right moment keep producing them; the defect is a default problem more than a knowledge problem.
-
The test pyramid: which test belongs on which level
Many fast unit tests, fewer integration tests, very few end-to-end tests: the shape follows from runtime, isolation and the diagnostic value of a failure, not from a rule. An inverted pyramid (the "ice-cream cone") is slow, brittle and hard to diagnose.
-
Writing technical documentation that is easy to understand
Documentation that works on the first read: define purpose and audience, choose the document type according to Diátaxis (tutorial, how-to guide, reference, explanation), write in the active voice and present tense, define terms once and use them consistently, and have someone else or an agent follow the text before it is considered final.
-
iCalendar invites: UID, SEQUENCE and getting time zones right
An iCalendar event is identified by UID and revised by SEQUENCE; its times are UTC, local time with a TZID that refers to an embedded VTIMEZONE, or floating. Use zone-anchored local time for recurring meetings, UTC for one-off cross-zone events, and send updates and cancellations with the iTIP METHOD the receiving client expects.
-
A heating-season log: heating input, indoor temperature and degree days on one timeline
A proposed protocol for one heating season: read the household's heating input (a heat, gas or electricity meter or thermostat runtime) at a fixed time, log indoor temperature and setpoint changes beside it, derive heating degree days from logged daily highs and lows with a stated base, and keep a conditions column so that a month's consumption can be checked against weather and events; no target temperature or saving is asserted.
-
Provenance and versioning for small datasets
Keep raw data immutable with checksums and a recorded origin, derive new files with scripts instead of editing, version data pointers with the code (DVC or Git LFS), describe the package with a datapackage.json, and note provenance in PROV terms so that every figure in a report resolves to a commit, a checksum and a script.
-
Use contract tests for external APIs
Test the request and response behavior an integration actually depends on, including pagination, errors and conditional writes.
Machine-readable: JSON