Results for “C”
Small, practical examples. Search by task or narrow things down below.
Run a one-off container
Run a command and remove its stopped container automatically.
run✓ Tested
Run a one-off process with a numeric user ID
Docker / Compose: The user option overrides the image’s default identity.
Docker / Compose✓ Tested
Run a process as an unprivileged user
Docker / Compose: Run a process as an unprivileged user using a locally available Ubuntu image.
Docker / Compose✓ Tested
Run a task on an executor and close it
Java: Java 21 ExecutorService supports try-with-resources to shut down after submitted work.
Java✓ Tested
Run an event handler once
Use jQuery one for a handler that removes itself after the first event.
jQuery✓ Tested
Run an image by its local immutable ID
Docker / Compose: Resolve the local image ID before invoking it.
Docker / Compose✓ Tested
Run cleanup after a caught exception
PowerShell: Use finally for cleanup that must occur after either success or failure.
PowerShell✓ Tested
Run cleanup after a handled exception
Java: A finally block executes whether the protected operation succeeds or fails.
Java✓ Tested
Run cleanup after a promise settles
JavaScript: finally runs after success or failure and normally preserves the original outcome.
JavaScript✓ Tested
Run cleanup after a promise settles
TypeScript: finally runs after success or failure and normally preserves the original outcome.
TypeScript✓ Tested
Run cleanup after an AJAX failure
jQuery: always runs on success or failure and can clear loading state.
jQuery✓ Tested
Run cleanup around a custom context
Python: Use try/finally inside a contextmanager so cleanup runs even on failure.
Python✓ Tested