Results for “Context & shared state”
Small, practical examples. Search by task or narrow things down below.
Find values shared by two collections
Python: Use set intersection and sort the result for deterministic display.
Python✓ Tested
Give related form fields a shared title
HTML: Learn how to give related form fields a shared title in a complete browser example.
HTML✓ Tested
Handle a failed file open through stream state
C++: An unopened input stream is not an empty successful file read.
C++✓ Tested
Highlight a relevant phrase in context
HTML: Mark identifies text relevant to the current activity, such as a search match.
HTML✓ Tested
Ignore a personal scratch file without changing shared rules
Git: The repository-local exclude file applies only to this checkout.
Git✓ Tested
Increment a shared counter atomically
C#: Interlocked performs an indivisible update without a separate lock for this operation.
C#✓ Tested
Increment a shared counter safely
C++: Atomic increments prevent lost updates when two threads change the same counter.
C++✓ Tested
Initialize shared data once
Initialize shared data once in a complete Rust program using the standard library.
Rust✓ Tested
Initialize state lazily
Initialize state lazily with a small React component and explicit browser behavior.
React✓ Tested
Inspect a deferred’s lifecycle state
jQuery: state reports pending, resolved, or rejected.
jQuery✓ Tested
Join two sorted files by a shared key
Linux Commands: Use join for sorted, simple delimiter-separated records with one row per key.
Linux Commands✓ Tested
Keep a child’s large z-index inside a stacking context
CSS: Isolation creates a stacking context so an internal stack level cannot outrank an outside sibling’s higher context.
CSS✓ Tested