https://www.tecmint.com/install-pm2-to-run-nodejs-apps-on-linux-server/
https://www.digitalocean.com/community/tutorials/how-to-use-pm2-to-setup-a-node-js-production-environment-on-an-ubuntu-vps
https://www.tecmint.com/install-pm2-to-run-nodejs-apps-on-linux-server/
https://www.digitalocean.com/community/tutorials/how-to-use-pm2-to-setup-a-node-js-production-environment-on-an-ubuntu-vps
ShopCategoryIds.stream().map(String::valueOf)
.collect(Collectors.joining(","));
Pass a object that hold you parameters then pass that object to function.
Avoid longlist parameters use Object or array of parameters
Advantage
Consider you used longlist function on three place and you want to add more 1 then in this case you need to modify code at three places .
If you use object or array then once place change is required.
https://stackoverflow.com/questions/2432443/best-practice-for-passing-many-arguments-to-method
https://stackoverflow.com/questions/36904955/passing-single-object-vs-passing-multiple-parameters
https://stackoverflow.com/questions/54338297/how-can-i-execute-a-command-line-task-for-a-spring-boot-application-like-a-rake
package com.example.tasks;
@Component
public class WeeklyReport implements CommandLineRunner {
@Override
public void run(String... args) throws Exception {
Arrays.asList(args).stream().forEach(a -> System.out.println(a));
if (!(args.length > 0 && args[0].equals("-task report:weekly"))) return;
System.out.println("weekly report");
System.exit(0);
}
And running it from a 'cron' job with
$ mvn spring-boot:run -Drun.arguments="-task report:weekly"
https://github.com/SonarSource/sonarlint-eclipse/wiki/Connected-Mode
https://docs.sonarqube.org/latest/setup/get-started-2-minutes/
https://stackoverflow.com/questions/34086500/how-can-i-read-the-same-file-two-times-in-java#:~:text=Close%20the%20first%20Reader%2C%20then,to%20read%20a%20second%20time.&text=You%20are%20running%20through%20the,readline)%20!%3D
try { // try to read the file
br = new BufferedReader(new FileReader("movies.txt"));
String line; int numberOfMovies = 0;
while (br.hasNextLine()){
numberOfMovies++;
}
br.close();
Movie[] movies = new Movie[numberOfMovies];
// store in a Movie
// array every movie of
// the file
String title = "";
int id = 0;
int likes = 0;
int icounter = 0;
// count to create new movie for each line
br = new BufferedReader(new FileReader("movies.txt"));
while ((br.hasNextLine()) {
line = line.trim();
line = line.replaceAll("/t", "");
line = line.toLowerCase();
String[] tokens = line.split(" ");
// store every token in a
// string array
id = Integer.parseInt(tokens[0]);
likes = Integer.parseInt(tokens[tokens.length]);
for (int i = 1; i < tokens.length; i++) {
title = title + " " + tokens[i];
}
movies[icounter] = new Movie(id, title, likes);
icounter++;
}
} catch (IOException e) { e.printStackTrace(); }
Read same file two times.
https://stackoverflow.com/questions/17269329/how-to-read-a-bufferedreader-twice-or-multiple-times/34558791#34558791BufferedReader br = new BufferedReader(new FileReader( "D:/log_2071-04-31.txt" ));
String strLine;
ArrayList<String> ans= new ArrayList<String>();
// Read rows
while ((strLine = br.readLine()) != null) {
System.out.println(strLine);
ans.add(strLine);
}
// Read again
for (String result: ans) {
System.out.println(result);
}
https://www.mysqltutorial.org/calling-mysql-stored-procedures-from-jdbc/
To call stored procedures or stored functions in MySQL from JDBC, you use CallableStatement object, which inherits from PreparedStatement object. The general syntax of calling a stored procedure is as follows:
{?= call procedure_name(param1,param2,...)}You wrap the stored procedure call within braces ({}). If the stored procedure returns a value, you need to add the question mark and equal (?=) before the call keyword. If a stored procedure does not return any values, you just omit the ?= sign. In case the stored procedure accepts any parameters, you list them within the opening and closing parentheses after the stored procedure’s name.
The following are examples of using the syntax for calling stored procedures in different contexts:
| Syntax | Stores Procedures |
| { call procedure_name() } | Accept no parameters and return no value |
| { call procedure_name(?,?) } | Accept two parameters and return no value |
| {?= call procedure_name() } | Accept no parameter and return value |
| {?= call procedure_name(?) } | Accept one parameter and return value |