Results for “Type & reading flow”
Small, practical examples. Search by task or narrow things down below.
Process a text file one line at a time
Java: Use a buffered reader to avoid loading a large file into memory.
Java✓ Tested
Protect a shared container with a mutex
C++: A scoped lock_guard releases the mutex when its scope ends.
C++✓ Tested
Raise and catch a domain-specific exception
Python: Give a validation failure its own exception type so callers can handle it narrowly.
Python✓ Tested
Refresh a cached data attribute deliberately
jQuery: After the first read, data caches a parsed value; removeData forces a new attribute read.
jQuery✓ Tested
Refuse to overwrite an existing file with redirection
Bash Scripts: Noclobber makes a plain greater-than redirection fail when the target already exists.
Bash Scripts✓ Tested
Reject infinite and NaN numeric values
C++: std::isfinite excludes special floating-point values.
C++✓ Tested
Reject insertion when a fixed queue is full
Arduino / C: Track a count separately from circular read and write positions.
Arduino / C✓ Tested
Remove a map entry and inspect the number removed
C++: erase by key reports whether a unique-key map contained the entry.
C++✓ Tested
Rename a known file through filesystem
C++: filesystem::rename reports an error by exception when the operation fails.
C++✓ Tested
Repeat a fixed number of times
C++: Use a counted loop to print three numbered steps.
C++✓ Tested
Repeat the first ordered value beside each row
SQL: FIRST_VALUE reads the first value in the current window frame.
SQL✓ Tested
Repeat the first ordered value beside each row
SQL Server: FIRST_VALUE reads the first value in the current window frame.
SQL Server✓ Tested