FIND YOUR NEXT FEW LINES

Results for “Errors & optional values”

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

354 snippets foundClear filters
PostgresReporting & grouped calculations

Turn known group values into columns

Postgres: Conditional aggregation gives a portable pivot when the category set is known.

Postgres✓ Tested
SQLiteReporting & grouped calculations

Turn known group values into columns

SQLite: Conditional aggregation gives a portable pivot when the category set is known.

SQLite✓ Tested
GoGetting Started

Understand default zero values

Understand default zero values using a complete Go program with explicit sample inputs.

Go✓ Tested
JavaNumbers & dates

Use an optional fallback

Use Optional.orElse to provide a default for a missing Java value.

Java✓ Tested
jQueryDeferred work & queues

Wait for several deferred values

jQuery: when resolves only after every supplied deferred has resolved.

jQuery✓ Tested
PythonFunctions & error handling

Yield values on demand

Python: Use a generator to produce a sequence without storing all intermediate values.

Python✓ Tested
Arduino / CBinary values & packets

Assemble a big-endian 16-bit value

Arduino / C: Cast to an unsigned 16-bit type before shifting the high byte.

Arduino / C✓ Tested
Arduino / CBinary values & packets

Assign a bit from a Boolean state

Arduino / C: bitWrite accepts a bit position and a zero or nonzero value.

Arduino / C✓ Tested
C++Containers & compound values

Build a minimum-priority queue

C++: Supply greater as the comparator because priority_queue defaults to the largest value first.

C++✓ Tested
Arduino / CBinary values & packets

Calculate a CRC-8 over a byte sequence

Arduino / C: This implementation uses polynomial 0x07, initial zero, and no reflection.

Arduino / C✓ Tested
JavaEncoding & structured values

Calculate a SHA-256 content digest

Java: Hash UTF-8 bytes and format the result as lowercase hexadecimal.

Java✓ Tested
Arduino / CBinary values & packets

Calculate a simple packet XOR checksum

Arduino / C: XOR all payload bytes to produce a basic error-detection byte.

Arduino / C✓ Tested