Blog — page 9
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.
Retrieval-augmented generation from scratch with SQLiteBuild RAG in about 130 lines of Python: chunk Markdown, embed it locally, store vectors in SQLite, search by cosine similarity and get cited answers from Claude.
Discriminated unions and exhaustive checks in TypeScriptModel request states and webhook events as discriminated unions, narrow them by a tag field, catch missing cases with never, and parse unknown JSON into a union.
dataclasses, attrs or Pydantic: picking a Python data class libraryThe same order model written with dataclasses, attrs and Pydantic: frozen objects, slots, defaults, validation, conversion and JSON, and when to use each.
State in Jetpack Compose: remember, State Hoisting and ViewModelHow state works in Jetpack Compose: remember and rememberSaveable, stateless composables, state hoisting, and a ViewModel StateFlow collected with lifecycle awareness.
Backtesting a moving-average crossover in pandas without look-ahead biasA vectorised pandas backtest of a 50/200-day crossover: signals on the close, trades on the next bar, transaction costs, and why one price series proves nothing.
Querying CSV and Parquet files with DuckDBUse DuckDB's CLI and Python API to query CSV and Parquet files in place, read many files with globs, write partitioned Parquet, and run SQL on pandas DataFrames.
Background work in .NET with BackgroundService and PeriodicTimerRun recurring jobs in a .NET host with BackgroundService and PeriodicTimer: scoped services per run, clean shutdown, and what happens when the loop throws.
Go generics in practice: constraints, generic types and when to skip themGo 1.25 type parameters: constraints with ~ and unions, cmp.Ordered, a generic Set, Map and Filter helpers, slices and maps, and when an interface is simpler.
A REST API in Rust with Axum 0.8 and SQLxBuild a small todo API with Axum 0.8 and SQLx on SQLite: routing with /{id} paths, State and Json extractors, migrations, an error type, and oneshot tests.
Reusable workflows and composite actions in GitHub ActionsShare CI logic across jobs and repositories with workflow_call reusable workflows and composite actions: inputs, secrets, outputs, when to use which, and versioning.
Getting reliable JSON from an LLM: schemas, structured outputs and validationThree ways to get JSON out of Claude in Python: prompting, a forced tool call and the structured outputs beta, with Pydantic validation, retries and stop reasons.
The satisfies operator in TypeScript: checking values without widening themHow satisfies checks an object against a type while keeping its precise inferred type, with config maps, Record keys, as const satisfies and the gotchas.
© 2026 David Li · Home · Blog · RSS ·Classic site · Built with Astro, Starlight and three.js · Logos:Font Awesome Free (CC BY 4.0)