Skip to content

Instantly share code, notes, and snippets.

View OlivierLD's full-sized avatar
Working on the next big thing

Olivier LeDiouris OlivierLD

Working on the next big thing
View GitHub Profile
@OlivierLD
OlivierLD / README.md
Last active March 29, 2023 14:14
Load a json file from JavaScript

Load JSON file into JS variable

This shows how to load data defined in a json resource into a local variable, in JavaScript code.
The snippet.js loads the content of a baroData.json resource into a variable named graphData.

Enjoy!

@OlivierLD
OlivierLD / 01.README.md
Last active February 12, 2024 23:34
Manage Ctrl-C from Java

Ctrl-C from Java

This shows how to manage a Ctrl-C interrupt from a Java program.
Look into the synchonized blocks...

@OlivierLD
OlivierLD / README.md
Last active October 20, 2023 06:50
Manage CLI parameters from Java

Manage Command Lin Interface (CLI) Parameters from Java

This is just an example, a suggestion, a "generic" way to do the job.
Like when you have the possibility to add those parameters to your command line, like in

$ java -cp archive.jar sample.SampleMain --first-prm:value01 --second-prm:123 --third-prm:true

The goal here is to show a way to parse those parameter and extract the expected values, for the rest of the process to use them.

Look into the code, how we are using BiConsumer<String, CLIPrm>. The parsing itself happens in the main method, obviously.