Desk Clarity

A field guide to everyday digital problems.

The guidebook / 181 guides

Developer tools

Code, configuration and workflows. Source-linked checks to help you move forward.

Developer tools · GUIDE

Python sqlite3 foreign keys stay off with autocommit=False: initialize and verify the connection

Native Python 3.13 tests compare PRAGMA timing and setconfig, verify cascading and orphan rejection, and expose the side effect of changing autocommit.

5 min readSource-linked guide
Developer tools · GUIDE

Python sample can repeat values: without replacement refers to occurrences

Separate unique sampled positions from repeated values, compare replacement behavior, and use choices with the keyword k rather than a positional count.

4 min readSource-linked guide
Developer tools · GUIDE

Bash find loops split filenames: keep NUL records and quote each path

Compare five original filenames with a broken command-substitution loop, then use find -print0 and Bash read without losing record boundaries.

4 min readSource-linked guide
Developer tools · GUIDE

Node ES modules have no __dirname: use module metadata and file URL helpers

Compare the ESM dirname error with modern metadata and fileURLToPath, including a real path containing spaces and a hash character.

4 min readSource-linked guide
Developer tools · GUIDE

curl JSON requests: verify the body, Content-Type and actual HTTP method

Compare local curl requests for JSON media type, exact body bytes, POST versus PUT and the limits of --json without claiming an original server fix.

4 min readSource-linked guide
Developer tools · GUIDE

Git branch already checked out: find the owning worktree before forcing it

Inspect linked checkout paths and branch ownership, preserve local work, and distinguish ordinary occupancy from metadata repair or pruning cases.

5 min readSource-linked guide
Developer tools · GUIDE

VS Code Ctrl+P misses ignored files: separate ignore rules from exclude settings

Check filename Quick Open separately from text Search, review ignore-file settings and exclude globs, and verify a narrow exception or workspace change.

5 min readSource-linked guide
Developer tools · GUIDE

Git divergent branches: compare merge, rebase and fast-forward-only before pulling

Inspect a shared-base divergence, compare actual local merge and rebase graphs, and distinguish one-time pull choices from defaults and IDE behavior.

5 min readSource-linked guide
Developer tools · GUIDE

Python copy without overwriting: create the destination exclusively

Copy regular-file bytes into an exclusively created destination, verify collisions preserve old contents, and account for partial copies and metadata limits.

4 min readSource-linked guide
Developer tools · GUIDE

Git unrelated histories after an initial README: choose one starting history

Reproduce independent initial commits, compare an explicit merge with clone-and-import, and preserve local history before choosing a first-upload workflow.

5 min readSource-linked guide
Developer tools · GUIDE

Python local time to UTC: attach a named zone, then convert the instant

Convert known local calendar times with ZoneInfo, keep pytz rules separate, and test seasonal offsets, repeated times and nonexistent local times.

5 min readSource-linked guide
Developer tools · GUIDE

npm --legacy-peer-deps: installation success is not a compatible peer tree

See an offline peer-conflict fixture, separate --legacy-peer-deps from --force, and verify the lockfile, install policy and application together.

5 min readSource-linked guide
Developer tools · GUIDE

Bash variable stays zero after a piped while loop: keep the work in one shell

Reproduce a lost loop counter, compare process substitution and grouped output, and choose a direct match test when a loop is unnecessary.

5 min readSource-linked guide
Developer tools · GUIDE

Python generator after next(): loop over the remaining items safely

Verify how consuming a first item changes the remaining for loop, handle the empty case, and distinguish exhaustion from an infinite or blocking producer.

4 min readSource-linked guide
Developer tools · GUIDE

jq string output has quotes: choose raw output without deleting data

Compare JSON strings with jq raw output, preserve embedded quotes and backslashes, and verify the downstream record boundary instead of stripping characters.

4 min readSource-linked guide
Developer tools · GUIDE

Git revert -m selects a parent baseline, not a branch to remove

Read the recorded merge-parent order, compare each parent to the merge, and understand why -m 3 can reverse two branches in an octopus merge.

5 min readSource-linked guide
Developer tools · GUIDE

Python mutable defaults: why a list survives between calls

Trace definition-time default evaluation, verify repeated-call identity, and choose between fresh defaults, caller mutation and copied input.

6 min readSource-linked guide
Developer tools · GUIDE

Python CSV output has blank rows: let csv handle the newline boundary

Compare explicit text newline translation with csv-managed output, inspect raw CRLF bytes and round-trip an embedded newline without deleting valid data.

4 min readSource-linked guide