The notebook index
Post archive
45 posts.
- A durable idempotency key in one SQLite transaction
Use a SQLite key, payload digest and counter in one transaction to demonstrate retries, conflicts and persistence across reopen.
- Parsing GTFS times beyond midnight
Parse GTFS service times as seconds from the service day’s start, allowing hours above 23 while rejecting malformed values.
- CSV round trips: commas, quotes and embedded newlines
Use Python’s CSV reader and writer to round-trip commas, quotes and newlines while accounting for type loss and spreadsheet formula risks.
- A byte stream does not know where your messages end
TCP delivers an ordered byte stream, so an application protocol must define message boundaries. A four-byte length prefix provides one simple framing rule, with explicit size limits and buffering for incomplete or coalesced frames.
- Reading Tempest as a systems project
Tempest’s repository describes an experimental replacement for Sandstorm, with sandbox setup work and HTTP plumbing already present. Its README is a map of questions to investigate, not evidence for production guarantees.
- IRC presence is not an appointment to answer
IRC exposes connection state and an explicit away message, but neither is a promise about when a person will reply. Treat messaging as asynchronous and write bug reports that include a reproducible exchange.
- ActivityPub has actor identity, object identity and delivery identity
ActivityPub uses actors to identify accounts, objects to identify content, and activities to describe actions delivered between inboxes. Keeping those identities separate is central to reliable handling of retries.
- Read the ownership boundary before upgrading an RPC binding
Before upgrading a Haskell Cap’n Proto binding, separate schema-generated types, message data ownership, serialization, and RPC behavior. Then check project status, protocol assumptions, and the API changes an upgrade may introduce.
- Why len(x) is not just x.__len__() in disguise
Implicit operations such as len use a type-level special method protocol, which differs from ordinary attribute lookup on an instance.
- A Python name is a binding, not a box containing a copy
Python assignment binds names to objects, so mutating a shared list is visible through every alias while rebinding one name changes only that binding.
- A Nix derivation describes a build; it does not prove reproducibility
A derivation records a build step and its declared dependencies, but matching that recipe does not guarantee identical output bytes when the process can observe undeclared inputs or nondeterminism.
- Changing a Cap’n Proto schema without renumbering history
Cap’n Proto field ordinals preserve a schema’s evolution history. Adding a field can keep old messages readable, provided the new declaration respects ordinal ordering and defaults.
- Cross compilation: build, host and target are different questions
The build, host, and target labels describe a compiler’s own construction and output roles. Ordinary package cross compilation adds separate questions about headers, libraries, and where the result can run.
- A closure in C is a function plus an environment
A callback and an explicit context pointer form a portable way to represent closure-like behavior in C. Keeping the environment visible makes its lifetime and calling convention part of the design.
- C is an abstract machine, even on familiar hardware
C arithmetic follows language rules, not a promise about the processor’s usual instruction. That distinction matters when a compiler reasons about overflow and when code needs a checked result.