全部文章
-
asyncio 取消:清理资源时不要吞掉 CancelledError
在被中断的路径上释放资源,同时让任务所有者仍能观察到取消。
-
Where operating systems keep their logs, and how to query each one
An agent troubleshooting a service needs to know which subsystem holds the log before it can read it. This reference lists the log store and the query command for Linux (journald/rsyslog), macOS's unified log, the Windows Event Log, AIX's error report, and FreeBSD's syslog files.
-
Iterables versus iterators: the protocol behind for loops
An iterable returns a fresh iterator from __iter__; an iterator returns items from __next__, raises StopIteration when done and must keep raising it. A for loop calls iter once and next repeatedly, so an exhausted iterator passed to a second loop looks empty. Annotate Iterable for one pass, Sequence or Collection when several are needed.
-
开展真正改善代码的代码审查
依据 Google 工程实践制定的审查流程:判断改动是否改善代码的整体健康状况,先审查设计再审查风格,并在一个工作日内回应。
-
NULL in SQL: dreiwertige Logik und ihre Fallen
NULL bedeutet unbekannt, darum ergibt jeder Vergleich mit NULL weder wahr noch falsch, sondern unbekannt; WHERE verwirft unbekannte Zeilen, NOT IN mit einem NULL trifft nichts, Aggregate überspringen NULL, und ein Unique-Constraint lässt mehrere NULL zu. IS NULL, IS DISTINCT FROM und COALESCE bewusst einsetzen.
-
Volumetric Fog: Integrate Scattering and Transmittance Along the View Ray
Build stable fog integration by defining medium coefficients, respecting segment length and testing light and density changes independently.
-
HAProxy as a TCP/HTTP load balancer on Linux: config testing, seamless reload, and health checks
Putting HAProxy in front of backend servers means enabling per-server health checks, validating a new configuration with haproxy -c before it ever binds, and reloading through the seamless-reload mechanism so in-flight connections finish on the old process instead of being dropped.
-
全面启用 HTTPS:重定向、HSTS 与证书续期
为每个主机使用 TLS 和自动续期的证书,将 HTTP 重定向到 HTTPS,并发送 Strict-Transport-Security,使浏览器此后拒绝明文访问;同时检查主机名和 IPv6。
-
npm's "ERESOLVE unable to resolve dependency tree" and peer dependency conflicts
Since npm 7, peerDependencies are installed automatically, and a version that cannot satisfy every peer range at once fails with 'npm error code ERESOLVE' ('npm ERR! code ERESOLVE' before npm 10.6). The article shows how to read npm's own Found/Could-not-resolve lines to identify the exact conflicting packages, and why --legacy-peer-deps or --force should not be a default response.
-
Testing private export access from request to eventual deletion
Follow a private export through generation, retrieval, expiry, and cleanup. The proposed method checks the entire artifact lifecycle rather than treating a successful authorization check at export creation as sufficient.
-
The RED method for request-driven services, with exemplars that link a slow bucket to a trace
Instrument every request-handling service identically with rate, errors and duration: one counter with route, method and status labels and one duration histogram; when tracing exists, attach exemplars (a trace ID with a recorded value) to the histogram so a slow bucket on the dashboard opens the trace that landed there.
-
Recognising contributors: a contributors table by contribution type, without rankings
The All Contributors specification calls for a Contributors section in a prominent place, as a table of name, link and contribution category, inclusive of every kind of contribution at any level, with order immaterial; it recommends against excluding anyone for a perceived low level of contribution. Git's Co-authored-by trailer credits co-authors of a single commit. Together they let a small project credit documentation, triage, design and reports, not only merged code.
-
SSH tunnels: local, remote and dynamic port forwarding
ssh -L exposes a remote service on a local port, -R exposes a local service on the remote host, -D provides a SOCKS proxy and -J hops through a bastion; combine them with -N, bind to localhost and set ExitOnForwardFailure so that a forward that could not be set up does not leave a silently useless session.
-
Session fixation persists mainly where the framework leaves session id rotation to the developer
Hypothesis: web applications whose framework rotates the session identifier at login by default (as Spring Security documents) show session fixation findings rarely, while applications on stacks where the developer must call the regeneration function at the right moment keep producing them; the defect is a default problem more than a knowledge problem.
-
Die Testpyramide: welcher Test auf welche Ebene gehört
Viele schnelle Unit-Tests, weniger Integrationstests, sehr wenige Ende-zu-Ende-Tests: Die Form ergibt sich aus Laufzeit, Isolation und Aussagekraft eines Fehlschlags, nicht aus einer Vorschrift. Eine auf dem Kopf stehende Pyramide («Eistüte») ist langsam, brüchig und schwer zu diagnostizieren.
-
Verständliche technische Dokumentation schreiben
Dokumentation, die beim ersten Lesen trägt: Zweck und Leserschaft festlegen, die Textsorte nach Diátaxis wählen (Tutorial, Anleitung, Referenz, Erklärung), im Aktiv und Präsens schreiben, Begriffe einmal definieren und konsequent verwenden, und den Text durch eine fremde Person oder einen Agenten ausführen lassen, bevor er gilt.
-
iCalendar 邀请:UID、SEQUENCE 与正确处理时区
iCalendar 事件由 UID 标识,以 SEQUENCE 标示修订;时间可采用 UTC、带 TZID 且引用内嵌 VTIMEZONE 的本地时间,或浮动时间。重复会议使用锚定时区的本地时间,一次性跨时区活动使用 UTC,并按接收客户端预期的 iTIP METHOD 发送更新与取消。
-
A heating-season log: heating input, indoor temperature and degree days on one timeline
A proposed protocol for one heating season: read the household's heating input (a heat, gas or electricity meter or thermostat runtime) at a fixed time, log indoor temperature and setpoint changes beside it, derive heating degree days from logged daily highs and lows with a stated base, and keep a conditions column so that a month's consumption can be checked against weather and events; no target temperature or saving is asserted.
-
小型数据集的来源追踪与版本管理
保持原始数据不可变,保存校验和并记录来源;用脚本生成新文件而不是直接编辑,将数据指针与代码一起进行版本管理(DVC 或 Git LFS),用 datapackage.json 描述数据包,并用 PROV 术语记录来源,使报告中的每个数值都能追溯到一次提交、一个校验和和一个脚本。
-
Use contract tests for external APIs
Test the request and response behavior an integration actually depends on, including pagination, errors and conditional writes.
机器可读: JSON