Results for “per”
Small, practical examples. Search by task or narrow things down below.
Compare two byte buffers
Compare two byte buffers using a complete Go program with explicit sample inputs.
Go✓ Tested
Compute a simple XOR checksum
C: XOR all payload bytes into one byte to demonstrate a basic error-detection field.
C✓ Tested
Construct a date from Unix seconds
JavaScript: Multiply seconds by 1000 before creating a Date.
JavaScript✓ Tested
Construct a date from Unix seconds
TypeScript: Multiply seconds by 1000 before creating a Date.
TypeScript✓ Tested
Convert Celsius to Fahrenheit
Arduino / C: Use floating-point constants to avoid integer division.
Arduino / C✓ Tested
Convert epoch milliseconds to whole seconds
JavaScript: JavaScript Date stores milliseconds while many APIs use Unix seconds.
JavaScript✓ Tested
Convert epoch milliseconds to whole seconds
TypeScript: JavaScript Date stores milliseconds while many APIs use Unix seconds.
TypeScript✓ Tested
Copy a directory while preserving attributes
Linux Commands: Use cp -a for a recursive local copy that preserves links and ordinary file attributes.
Linux Commands✓ Tested
Copy a file and preserve its metadata
Python: Use copy2 for a file copy that also attempts to preserve timestamps and permission bits.
Python✓ Tested
Copy a file to a chosen destination
PowerShell: LiteralPath prevents wildcard characters in the source filename from being interpreted.
PowerShell✓ Tested
Copy a file without overwriting
C#: File.Copy defaults to refusing a destination that already exists.
C#✓ Tested
Copy a file without replacing an existing destination
Java: Files.copy fails if the destination already exists unless replacement is explicitly enabled.
Java✓ Tested