Results for “Ordering & set operations”
Small, practical examples. Search by task or narrow things down below.
Clamp a numeric setting to a valid range
Bash Scripts: Use arithmetic comparisons before applying a user-supplied bounded setting.
Bash Scripts✓ Tested
Combine collections as a distinct set
C#: Union retains each value once across both inputs.
C#✓ Tested
Convert a timestamp to a different fixed offset
C#: ToOffset changes the displayed local time while retaining the same instant.
C#✓ Tested
Convert an aware datetime to another offset
Python: Use astimezone for conversion; replacing tzinfo alone does not convert an instant.
Python✓ Tested
Convert Unix seconds to an offset-aware timestamp
C#: DateTimeOffset preserves the UTC offset explicitly.
C#✓ Tested
Create an index matching filter and ordering columns
SQL: Place the equality-filter column before the ordering column in this composite index.
SQL✓ Tested
Create an index matching filter and ordering columns
SQL Server: Place the equality-filter column before the ordering column in this composite index.
SQL Server✓ Tested
Create an index matching filter and ordering columns
Postgres: Place the equality-filter column before the ordering column in this composite index.
Postgres✓ Tested
Create an index matching filter and ordering columns
SQLite: Place the equality-filter column before the ordering column in this composite index.
SQLite✓ Tested
Discard incidental output from a setup command
PowerShell: Out-Null prevents setup objects from becoming part of a function or script’s useful result.
PowerShell✓ Tested
Display an instant at a fixed offset
Display an instant at a fixed offset using a complete Go program with explicit sample inputs.
Go✓ Tested
Distinguish unset variables from empty strings
Bash Scripts: Omitting the colon tests only whether a variable is unset; including it also treats an empty value as missing.
Bash Scripts✓ Tested