Results for “when”
Small, practical examples. Search by task or narrow things down below.
Convert tab stops to spaces
Linux Commands: Use expand with a fixed tab width when preparing plain-text alignment.
Linux Commands✓ Tested
Convert text without raising a conversion error
Return NULL when a numeric conversion fails.
TRY_CONVERT✓ Tested
Copy a string with a guaranteed terminator
Arduino / C: Reserve one character for the terminator when copying a bounded string.
Arduino / C✓ Tested
Copy nested mutable data independently
Python: Use deepcopy when changes to nested lists must not affect the original object.
Python✓ Tested
Copy text into a fixed buffer
Use snprintf and check for truncation when copying a C string.
C✓ Tested
Correct the latest unpublished commit message
Git: Amend replaces the current commit while preserving its tree when no new changes are staged.
Git✓ Tested
Count a falling edge with an interrupt
Increment a counter when an external input changes.
attachInterrupt✓ Tested
Count a rising edge with an interrupt
Arduino / C: RISING triggers when the input changes from low to high.
Arduino / C✓ Tested
Count rows per category
Aggregate rows sharing the same category.
GROUP BY✓ Tested
Count Unicode code points
Java: Use codePointCount when supplementary characters should count as one rather than two UTF-16 units.
Java✓ Tested
Create a directory tree
Create a directory and its missing parent directories. The -p option also succeeds when the directories already exist.
directory✓ Tested
Create a runtime file during the build
Docker / Compose: RUN executes during the build while CMD executes when a container starts.
Docker / Compose✓ Tested