Skip to content

Practical Examples

Keep callers from changing a cached list result

November 17, 2026

Process only the bytes returned by readinto

November 17, 2026

Reject duplicate CSV headers before building dictionaries

November 17, 2026

Require complete long options with argparse

November 17, 2026

Understand inherited defaults when removing an INI override

November 17, 2026

Invalidate a cached Python property when its inputs change

November 16, 2026

Keep Python groupby results before advancing the iterator

November 16, 2026

Reject duplicate ZIP manifests before reading their contents

November 16, 2026

C++ Basics: Build a Cyclic View Starting at a Chosen Entry

November 9, 2026

C++ Basics: Check a String Search Before Slicing

November 9, 2026

C++ Basics: Combine Two Ranges with a Bounded Transform

November 9, 2026

C++ Basics: Compare Sorted Lists by Unmatched Occurrences

November 9, 2026

C++ Basics: Copy Records While Excluding a Sentinel

November 9, 2026

C++ Basics: Count Matching Records Without Building a Copy

November 9, 2026

C++ Basics: Distinguish an Empty Suffix from an Invalid Offset

November 9, 2026

C++ Basics: Exchange Two Prefixes Without Overrunning Either Range

November 9, 2026

C++ Basics: Find the End of a Ready Prefix

November 9, 2026

C++ Basics: Find the First of Several Delimiters

November 9, 2026

C++ Basics: Generate Values with Local Callable State

November 9, 2026

C++ Basics: Insert After Existing Equal Values

November 9, 2026

C++ Basics: Make Empty-Input Validation Explicit

November 9, 2026

C++ Basics: Normalize Invalid Entries in Place

November 9, 2026

C++ Basics: Probe a Type-Erased Value Without Throwing

November 9, 2026

C++ Basics: Read Every Value for a Repeated Map Key

November 9, 2026

C++ Basics: Reset Only the Used Prefix of a Buffer

November 9, 2026

C++ Basics: Search Using the Same Sort Rule

November 9, 2026

C++ Basics: Show Reverse Order Without Mutating the Source

November 9, 2026

C++ Basics: Update a Map Entry and Detect New Keys

November 9, 2026

C++ Basics: Expand a Tuple into Function Arguments

November 8, 2026

C++ Basics: Fill an Existing Buffer with Consecutive Values

November 8, 2026

C++ Basics: Find a Run of Consecutive Failures

November 8, 2026

C++ Basics: Find the Largest Power of Two Within a Budget

November 8, 2026

C++ Basics: Merge Two Sorted Halves Inside One Vector

November 8, 2026

C++ Basics: Move a List Task Without Invalidating Its Iterator

November 8, 2026

C++ Basics: Preserve a Character Array and Its Terminator

November 8, 2026

C++ Basics: Remove Forward-List Nodes Without Skipping Matches

November 8, 2026

C++ Basics: Select Read-Only Access to a Mutable Object

November 8, 2026

C++ Basics: Sort References Without Reordering the Original Records

November 8, 2026

C++ Basics: Avoid Unnecessary Work in Optional Fallbacks

November 7, 2026

C++ Basics: Call Members Through std::invoke

November 7, 2026

C++ Basics: Compute a Weighted Total with inner_product

November 7, 2026

C++ Basics: Distinguish String Size from C-String Length

November 7, 2026

C++ Basics: Keep Range Search Results Attached to an Owner

November 7, 2026

C++ Basics: Probe a Variant Without Throwing

November 7, 2026

C++ Basics: Round Negative Durations Deliberately

November 7, 2026

C++ Basics: Sort Records with a Member Projection

November 7, 2026

C++ Basics: Split Text on a Multi-Character Delimiter

November 7, 2026

C++ Basics: Transfer a Range of Unique Owners

November 7, 2026

C++ Basics: Advance a Text View Without Copying

November 6, 2026

C++ Basics: Check an Integer Before Narrowing It

November 6, 2026

C++ Basics: Check Fixed-Array Access with at

November 6, 2026

C++ Basics: Check Whether a Value Is a Power of Two

November 6, 2026

C++ Basics: Compare Signed and Unsigned Integers Safely

November 6, 2026

C++ Basics: Compute Starting Offsets from Batch Sizes

November 6, 2026

C++ Basics: Initialize a Maximum for Negative Data

November 6, 2026

C++ Basics: Match Text Prefixes and Suffixes

November 6, 2026

C++ Basics: Sort Records by Multiple Keys

November 6, 2026

C++ Basics: Turn Cumulative Readings into Changes

November 6, 2026

C++ Basics: Compare Repeating Periods with gcd and lcm

November 5, 2026

C++ Basics: Count Only the Flags in a Selected Mask

November 5, 2026

C++ Basics: Find an Integer Midpoint Without Overflow

November 5, 2026

C++ Basics: Interpolate a Reading with std::lerp

November 5, 2026

C++ Basics: Match Bitset Text to Bit Positions

November 5, 2026

C++ Basics: Measure the Bits Needed for an Unsigned Value

November 5, 2026

C++ Basics: Pad Each Output Field Explicitly with setw

November 5, 2026

C++ Basics: Rotate an Eight-Bit Pattern Without Losing Bits

November 5, 2026

C++ Basics: Round-Trip a String with Spaces and Quotes

November 5, 2026

C++ Basics: Validate Calendar Fields Before Counting Days

November 5, 2026

C++ Basics: Check That a Sorted Inventory Covers Required Counts

November 4, 2026

C++ Basics: Clamp a Setting and Store the Result by Value

November 4, 2026

C++ Basics: Combine Sorted Lists with Maximum Duplicate Counts

November 4, 2026

C++ Basics: Compare Sequences with Both End Iterators

November 4, 2026

C++ Basics: Compare Unordered Contents Without Sorting the Inputs

November 4, 2026

C++ Basics: Copy the Smallest Values into a Fixed Buffer

November 4, 2026

C++ Basics: Enumerate Distinct Arrangements from Sorted Input

November 4, 2026

C++ Basics: Erase the Last Matching Value through a Reverse Iterator

November 4, 2026

C++ Basics: Filter Records into a Growing Output Vector

November 4, 2026

C++ Basics: Find a Contiguous Pattern Inside a Sequence

November 4, 2026

C++ Basics: Find the First Drop in a Sequence

November 4, 2026

C++ Basics: Find the Whole Run of a Repeated Sorted Key

November 4, 2026

C++ Basics: Group Priority Tasks While Preserving Arrival Order

November 4, 2026

C++ Basics: Locate the First Broken Sort Order

November 4, 2026

C++ Basics: Merge Two Sorted Lists Without Dropping Duplicates

November 4, 2026

C++ Basics: Order Sequences by Their First Difference

November 4, 2026

C++ Basics: Remove the Largest Heap Value in Two Steps

November 4, 2026

C++ Basics: Rotate a Task List Without Losing Its Order

November 4, 2026

C++ Basics: Select a Median Without Sorting Every Element

November 4, 2026

C++ Basics: Subtract Sorted Inventories with Duplicate Counts

November 4, 2026

C++ Basics: Build Prefix Totals with partial_sum

November 3, 2026

C++ Basics: Choose Copies or References in Structured Bindings

November 3, 2026

C++ Basics: Copy Object Representation with std::bit_cast

November 3, 2026

C++ Basics: Count Independent Events with a Relaxed Atomic

November 3, 2026

C++ Basics: Define Explicit Operators for Scoped Flags

November 3, 2026

C++ Basics: Distinguish a Boolean Snapshot from a Vector Proxy

November 3, 2026

C++ Basics: Find Common Values in Sorted Ranges

November 3, 2026

C++ Basics: Handle Empty Ranges Before Reading Minima and Maxima

November 3, 2026

C++ Basics: Keep a Deque Reference Across End Insertions

November 3, 2026

C++ Basics: Look Up String Keys with a String View

November 3, 2026

C++ Basics: Refresh Iterators After Reserving an Unordered Map

November 3, 2026

C++ Basics: Remove Adjacent Duplicates with unique and erase

November 3, 2026

C++ Basics: Rename a Map Key Without Losing a Rejected Node

November 3, 2026

C++ Basics: Reset a Value and Keep Its Previous State

November 3, 2026

C++ Basics: Retry Initialization after std::call_once Throws

November 3, 2026

C++ Basics: Split Records with partition_copy

November 3, 2026

C++ Basics: Transport Worker Exceptions through a Future

November 3, 2026

C++ Basics: Wait for a Batch with std::latch

November 3, 2026

C++ Basics: Wait for State with a Condition-Variable Predicate

November 3, 2026

C++ Basics: Write Integers into a Bounded Buffer

November 3, 2026

C++ Basics: Choose the Accumulator Type Explicitly

November 2, 2026

C++ Basics: Compose Lazy Filter and Transform Views

November 2, 2026

C++ Basics: Convert Steady-Clock Durations Explicitly

November 2, 2026

C++ Basics: Define a Deterministic Priority Queue Order

November 2, 2026

C++ Basics: Find a Sorted Insertion Position with lower_bound

November 2, 2026

C++ Basics: Handle Alternative Value Types with std::visit

November 2, 2026

C++ Basics: Insert Map Defaults Without Replacing Existing Values

November 2, 2026

C++ Basics: Keep std::string_view Within Its Owner Lifetime

November 2, 2026

C++ Basics: Lock Two Related Counters with std::scoped_lock

November 2, 2026

C++ Basics: Look Up Unordered Map Keys Without Inserting Them

November 2, 2026

C++ Basics: Observe Lifetime with std::weak_ptr

November 2, 2026

C++ Basics: Pass Contiguous Data with std::span

November 2, 2026

C++ Basics: Preserve Equal-Key Order with stable_sort

November 2, 2026

C++ Basics: Reject Partial Integer Input with std::from_chars

November 2, 2026

C++ Basics: Remove Matching Vector Elements with erase_if

November 2, 2026

C++ Basics: Represent Missing Results with std::optional

November 2, 2026

C++ Basics: Restore State with a Small Scope Guard

November 2, 2026

C++ Basics: Separate Vector Capacity from Its Element Count

November 2, 2026

C++ Basics: Stop a std::jthread Cooperatively

November 2, 2026

C++ Basics: Transfer Ownership with std::unique_ptr

November 2, 2026

C Basics: Check Fixed Buffer Relationships at Compile Time

November 1, 2026

C Basics: Check Multiplication Before Allocating an Array

November 1, 2026

C Basics: Detect Truncated Formatting with snprintf

November 1, 2026

C Basics: Distinguish a Short Binary Read from an Error

November 1, 2026

C Basics: Encode a 32-Bit Value with Explicit Byte Order

November 1, 2026

C Basics: Find a Record in a Sorted Array with bsearch

November 1, 2026

C Basics: Grow an Allocation Without Losing Its Owner

November 1, 2026

C Basics: Keep Byte Input Separate from EOF

November 1, 2026

C Basics: Make Configuration Fields Explicit with Designated Initializers

November 1, 2026

C Basics: Move Overlapping Text Within One Buffer

November 1, 2026

C Basics: Pass Array Lengths Explicitly to Functions

November 1, 2026

C Basics: Pass State to a Callback Without Global Variables

November 1, 2026

C Basics: Reject Oversized Lines Without Losing the Next Record

November 1, 2026

C Basics: Remove Line Endings Without Trimming Spaces

November 1, 2026

C Basics: Separate Read-Only Access from Fixed Pointer Bindings

November 1, 2026

C Basics: Sort Integers Without Comparator Overflow

November 1, 2026

C Basics: Switch an Update Stream Between Reading and Writing

November 1, 2026

C Basics: Update Independent Options with Unsigned Bit Masks

November 1, 2026

C Basics: Validate an Entire Decimal Number with strtol

November 1, 2026

C Basics: Validate Argument Count Before Reading Values

November 1, 2026

Go Basics: Avoid Typed-Nil Error Surprises

October 31, 2026

Go Basics: Build URL Queries Without String Concatenation

October 31, 2026

Go Basics: Copy Slices Before Editing Shared Data

October 31, 2026

Go Basics: Count Concurrent Events with Typed Atomics

October 31, 2026

Go Basics: Distinguish Missing Map Keys from Zero Values

October 31, 2026

Go Basics: Encode Fixed-Width Records with Explicit Byte Order

October 31, 2026

Go Basics: Escape Untrusted Text in HTML Templates

October 31, 2026

Go Basics: Exercise an HTTP Handler Without Opening a Port

October 31, 2026

Go Basics: Finish a Channel Stream Without Sentinel Values

October 31, 2026

Go Basics: Parse CLI Options Without Exiting the Process

October 31, 2026

Go Basics: Parse CSV Records Without Splitting on Commas

October 31, 2026

Go Basics: Parse Timestamps and Durations Explicitly

October 31, 2026

Go Basics: Pass Subprocess Arguments Without a Shell

October 31, 2026

Go Basics: Preserve Error Identity Through Context

October 31, 2026

Go Basics: Reject Extra JSON Values in Configuration

October 31, 2026

Go Basics: Set Explicit Limits for Line-Oriented Input

October 31, 2026

Go Basics: Share One Lazily Computed Value

October 31, 2026

Go Basics: Stop a Worker with Context Cancellation

October 31, 2026

Go Basics: Understand Deferred Calls Before Using Cleanup

October 31, 2026

Go Basics: Wait for Concurrent Work Before Reading Results

October 31, 2026

JavaScript Basics: Decode UTF-8 Across Buffer Boundaries

October 30, 2026

JavaScript Basics: Distinguish a Symbolic Link from Its Target

October 30, 2026

JavaScript Basics: Drain Child Output Before Reporting Completion

October 30, 2026

JavaScript Basics: Parse Configuration Text Before Applying It

October 30, 2026

JavaScript Basics: Read and Update MIME Parameters

October 30, 2026

Linux Basics: Convert Text Encodings Without Accepting Partial Output

October 30, 2026

Linux Basics: Copy Reference Timestamps with GNU touch

October 30, 2026

Linux Basics: Distinguish Bytes, Characters, and Width with GNU wc

October 30, 2026

Linux Basics: Keep Earlier File Versions with GNU cp Backups

October 30, 2026

Linux Basics: Reproduce a Command with a Small Explicit Environment

October 30, 2026

Python Basics: Check Simple Crawl Rules with urllib.robotparser

October 30, 2026

Python Basics: Decode UTF-8 Across Chunk Boundaries

October 30, 2026

Python Basics: Inventory Directory Entries Without Following Symlinks

October 30, 2026

Python Basics: Round-Trip PCM Samples with wave

October 30, 2026

Python Basics: Run a Spawned Worker with Explicit Result Handling

October 30, 2026

SQLite Basics: Bound Generated Queries with Connection Runtime Limits

October 30, 2026

SQLite Basics: Compute a Grouped Weighted Mean with a Python Aggregate

October 30, 2026

SQLite Basics: Observe a Stable Reader Snapshot in WAL Mode

October 30, 2026

SQLite Basics: Open an Existing Database Read-Only with a File URI

October 30, 2026

SQLite Basics: Register a Small Python Function for SQL Queries

October 30, 2026

Git Basics: Catch Staged Whitespace Errors Before Committing

October 29, 2026

Git Basics: Compare Two Versions of a Patch Series

October 29, 2026

Git Basics: Preview Author Identity Mappings Without Rewriting History

October 29, 2026

Git Basics: Review Small Prose Edits with Word Diffs

October 29, 2026

Git Basics: Trace One File Back Through a Rename

October 29, 2026

Linux Basics: Compare Apparent and Allocated File Size with GNU du

October 29, 2026

Linux Basics: Order Numbered Filenames with GNU Version Sort

October 29, 2026

Linux Basics: Order Prerequisites with GNU tsort

October 29, 2026

Linux Basics: Pass Difficult Filenames from find to xargs

October 29, 2026

Linux Basics: Select Text Report Pages with GNU pr

October 29, 2026

Python Basics: Detect a CSV Delimiter and Validate Every Row

October 29, 2026

Python Basics: Exchange Bytes and Detect EOF with socketpair

October 29, 2026

Python Basics: Replace a Complete File Without Exposing a Partial Write

October 29, 2026

Python Basics: Round-Trip XML and Binary Property Lists

October 29, 2026

Python Basics: Wait for Multiple Local Streams with selectors

October 29, 2026

SQLite Basics: Access Query Columns by Name with sqlite3.Row

October 29, 2026

SQLite Basics: Back Up a Database with Python and Verify the Copy

October 29, 2026

SQLite Basics: Cancel Expensive Queries with a Progress Handler

October 29, 2026

SQLite Basics: Reject SQL Actions with a Connection Authorizer

October 29, 2026

SQLite Basics: Update Part of a BLOB with Python

October 29, 2026

Git Basics: Attach Local Review Notes Without Rewriting a Commit

October 28, 2026

Git Basics: Build an Explicit Local Branch Inventory

October 28, 2026

Git Basics: Check Whether a Branch Contains an Ancestor

October 28, 2026

Git Basics: Count Commits Unique to Each Branch

October 28, 2026

Git Basics: Find Commits That Add or Remove a Specific String

October 28, 2026

Git Basics: List a Committed Snapshot Without Checking It Out

October 28, 2026

Git Basics: Separate Tracked, Untracked, and Ignored Paths

October 28, 2026

Git Basics: Summarize Commit Authors in a Chosen Range

October 28, 2026

Git Basics: Trace a Line to Its Last Changing Commit

October 28, 2026

Git Basics: Transfer a Commit as a Mailbox Patch

October 28, 2026

Python Basics: Bound Diagnostic Representations with reprlib

October 28, 2026

Python Basics: Check XZ Stream Completion and Trailing Bytes

October 28, 2026

Python Basics: Decode Quoted-Printable Bytes Before Text

October 28, 2026

Python Basics: Display Grouped Hex and Incremental CRC Values

October 28, 2026

Python Basics: Distinguish Metadata Equality from File Content Equality

October 28, 2026

Python Basics: Inspect Fixed Byte Ranges with mmap

October 28, 2026

Python Basics: Read Compressed Text and Concatenated bzip2 Streams

October 28, 2026

Python Basics: Retrieve Source Lines and Refresh Cached Text

October 28, 2026

Python Basics: Test Scheduled Event Order with a Virtual Clock

October 28, 2026

Python Basics: Track Line Origins Across Several Files

October 28, 2026

Git Basics: Compare Arbitrary Files with diff --no-index

October 27, 2026

Git Basics: Describe a Commit Relative to a Release Tag

October 27, 2026

Git Basics: Inspect Effective Attributes with check-attr

October 27, 2026

Git Basics: Inspect Stored Objects with cat-file

October 27, 2026

Git Basics: Validate Revisions and Inspect Repository Context

October 27, 2026

JavaScript Basics: Classify Built-In Values with util.types

October 27, 2026

JavaScript Basics: Compare Nested Values with isDeepStrictEqual

October 27, 2026

JavaScript Basics: Inspect Shared File Identity with Hard Links

October 27, 2026

JavaScript Basics: Load CommonJS from an ES Module with createRequire

October 27, 2026

JavaScript Basics: Match Path Strings with path.matchesGlob

October 27, 2026

Linux Basics: Check Portable Path Names with GNU pathchk

October 27, 2026

Linux Basics: Format Output Explicitly with GNU printf

October 27, 2026

Linux Basics: Generate Controlled Numeric Sequences with GNU seq

October 27, 2026

Linux Basics: Sample Lines with GNU shuf

October 27, 2026

Linux Basics: Split Path Strings with basename and dirname

October 27, 2026

Python Basics: Distinguish Incomplete Input with codeop

October 27, 2026

Python Basics: Execute a Trusted Script with runpy

October 27, 2026

Python Basics: Expose a Read-Only Mapping View

October 27, 2026

Python Basics: Parse Compact Option Lists with getopt

October 27, 2026

Python Basics: Persist Small Trusted Objects with shelve

October 27, 2026

Git Basics: Export a Committed Snapshot with git archive

October 27, 2026

Git Basics: Limit Working Files with Sparse Checkout

October 27, 2026

Git Basics: Preview Untracked Cleanup with git clean

October 27, 2026

Git Basics: Search Working Files, the Index, and Commits

October 27, 2026

Git Basics: Transfer Committed History with a Bundle

October 27, 2026

JavaScript Basics: Adapt Error-First Callbacks with promisify

October 27, 2026

JavaScript Basics: Consume Timer Ticks with an Async Iterator

October 27, 2026

JavaScript Basics: Inspect OS Capabilities Without Dumping Host Details

October 27, 2026

JavaScript Basics: Manage Local Listeners with EventTarget

October 27, 2026

JavaScript Basics: Match URL Components with URLPattern

October 27, 2026

Linux Basics: Combine Lines by Position with GNU paste

October 27, 2026

Linux Basics: Copy Files with Explicit Modes Using GNU install

October 27, 2026

Linux Basics: Match Sorted Text Records with GNU join

October 27, 2026

Linux Basics: Reverse Record Order with GNU tac

October 27, 2026

Linux Basics: Wrap Display Lines with GNU fold

October 27, 2026

Python Basics: Discover Local Module Names with pkgutil

October 27, 2026

Python Basics: Inspect Bytecode Instructions with dis

October 27, 2026

Python Basics: Inspect Installation Schemes with sysconfig

October 27, 2026

Python Basics: Precompile Source Trees with compileall

October 27, 2026

Python Basics: Read Distribution Metadata Without Importing Code

October 27, 2026