Results for “all”
Small, practical examples. Search by task or narrow things down below.
Increment a shared counter safely
C++: Atomic increments prevent lost updates when two threads change the same counter.
C++✓ Tested
Increment a stored value in the database
SQL: An in-database arithmetic update avoids a separate application read-modify-write step.
SQL✓ Tested
Increment a stored value in the database
SQL Server: An in-database arithmetic update avoids a separate application read-modify-write step.
SQL Server✓ Tested
Increment a stored value in the database
Postgres: An in-database arithmetic update avoids a separate application read-modify-write step.
Postgres✓ Tested
Increment a stored value in the database
SQLite: An in-database arithmetic update avoids a separate application read-modify-write step.
SQLite✓ Tested
Initialize a byte buffer to zero
C: memset initializes each byte to the chosen unsigned-char value.
C✓ Tested
Initialize state lazily
Initialize state lazily with a small React component and explicit browser behavior.
React✓ Tested
Initialize structure fields by name
C: Designated initializers make field assignments independent of their declaration order.
C✓ Tested
Inject a data loader into a component
Inject a data loader into a component with a small React component and explicit browser behavior.
React✓ Tested
Insert a map value only when a key is absent
C++: try_emplace preserves the old value when insertion does not take place.
C++✓ Tested
Insert into an array with spare capacity
C: Move the trailing elements before inserting and keep the logical length separate from capacity.
C✓ Tested
Insert only keys absent from a destination
SQL: NOT EXISTS supports a set-based missing-row insert in a single-writer example.
SQL✓ Tested