FIND YOUR NEXT FEW LINES

Results for “read-only”

Small, practical examples. Search by task or narrow things down below.

990 snippets foundClear filters
C#Collections & data structures

Add a dictionary entry only if absent

C#: TryAdd reports a duplicate key without replacing its existing value.

C#✓ Tested
CStrings & byte buffers

Append text only when the destination has enough capacity

C: Check the combined lengths including the terminator before using strcat.

C✓ Tested
CSSResponsive conditions & sizing

Apply an enhancement only when a feature is supported

CSS: A supports rule preserves the baseline outside browsers that understand the selected declaration.

CSS✓ Tested
Arduino / CData & storage

Average a fixed set of readings

Accumulate sample values without overflowing a 16-bit total.

array✓ Tested
C++Sequence algorithms

Calculate changes between successive readings

C++: adjacent_difference keeps the first value and then writes each difference from its predecessor.

C++✓ Tested
JavaScriptArray restructuring

Calculate differences between adjacent readings

JavaScript: Slice off the first value and compare each remaining value with its predecessor.

JavaScript✓ Tested
TypeScriptArray restructuring

Calculate differences between adjacent readings

TypeScript: Slice off the first value and compare each remaining value with its predecessor.

TypeScript✓ Tested
SQLReporting & grouped calculations

Calculate each group’s numeric spread

SQL: Subtract MIN from MAX to report the difference between extremes.

SQL✓ Tested
SQL ServerReporting & grouped calculations

Calculate each group’s numeric spread

SQL Server: Subtract MIN from MAX to report the difference between extremes.

SQL Server✓ Tested
PostgresReporting & grouped calculations

Calculate each group’s numeric spread

Postgres: Subtract MIN from MAX to report the difference between extremes.

Postgres✓ Tested
SQLiteReporting & grouped calculations

Calculate each group’s numeric spread

SQLite: Subtract MIN from MAX to report the difference between extremes.

SQLite✓ Tested
Bash ScriptsProcesses & environment

Change directory only for one operation

Bash Scripts: A subshell makes a temporary directory change without affecting later commands.

Bash Scripts✓ Tested