Blog — page 6
664 posts on software development, newest first. Browse by topic:Rust, Go, Python, JavaScript & web, AI & data, DevOps & tooling, Mobile & Android, .NET & C#, C++ & systems, LaTeX, Investing, Everything else.
Timeouts and cancellation for fetch with AbortSignalfetch has no timeout option. Use AbortController, AbortSignal.timeout and AbortSignal.any to cancel requests, tell timeouts from aborts, and clean up in React.
contextlib patterns in Python: contextmanager, ExitStack, suppress and chdirWrite context managers with @contextmanager, handle exceptions in them, manage many resources with ExitStack, and use suppress, chdir and async versions.
Records and pattern matching in modern C#How C# records work (record class vs struct, with-expressions, value equality) and how to match them with property, relational and list patterns in switch expressions.
Iterators in Go: range over functions and the iter packageWrite Go iterators with iter.Seq and Seq2: generators, tree walks, early break and the yield contract, slices.Collect and maps.Keys, and merging with iter.Pull.
Builders and the typestate pattern in RustFrom a plain Rust builder to one where missing required fields are compile errors, then a PhantomData state machine, with the trade-offs of encoding state in types.
Running Services and Scheduled Jobs with systemd Units and TimersWrite a systemd service for a web app with restarts and an environment file, read its logs with journalctl, and replace cron jobs with timers, including user units.
Validating DataFrames with Pandera schemasDeclare pandas DataFrame schemas as Pandera DataFrameModel classes: Field checks, custom checks, dtype coercion, lazy error reports and validation at pipeline boundaries.
Cutting LLM costs with prompt caching in the Claude APIHow prefix caching works, where to put cache_control breakpoints, minimum lengths and TTLs, and how to read the cache usage fields to confirm you are getting hits.
Running TypeScript directly in Node.js with type strippingNode 22.18+ and 23.6+ run .ts files by erasing type annotations. What syntax works, what doesn't, the tsconfig settings to match, and why you still need tsc.
Caching in Python with functools.cache, lru_cache and cached_propertyMemoise functions with functools.cache and lru_cache, cache per instance with cached_property, avoid the method-caching leak, and add TTLs with cachetools.
Span<T> and Memory<T> in C#: parsing without allocationsParse strings and buffers in C# without allocating: ReadOnlySpan<char> slicing, span overloads of Parse, stackalloc, MemoryExtensions.Split, and Memory<T> for async code.
Table-driven tests and native fuzzing in GoWrite table-driven Go tests with t.Run and t.Parallel, keep fixtures in testdata, then add a fuzz target that finds a real bug in a small version parser.
© 2026 David Li · Home · Blog · RSS ·Classic site · Built with Astro, Starlight and three.js · Logos:Font Awesome Free (CC BY 4.0)