Set up Angular CLI and simple angular application

Source: https://angular.io/guide/quickstart

Install Node.js® and npm if they are not already on your machine.
Verify that you are running at least node 6.9.x and npm 3.x.x by running node -v
and npm -v in a terminal/console window.
Older versions produce errors, but newer versions are fine.
Then install the Angular CLI globally.
npm install -g @angular/cli






 Create a new project

Open a terminal window.
Generate a new project and skeleton application by running the following commands:
ng new my-app
Patience, please. It takes time to set up a new project; most of it is spent installing npm packages.

Serve the application

Go to the project directory and launch the server.
cd my-app
ng serve --open

The ng serve command launches the server, watches your files, and rebuilds the app as you make changes to those files.
Using the --open (or just -o) option will automatically open your browser on http://localhost:4200/.
Your app greets you with a message:



The app works!

Bower: Install 2 versions of jQuery

Source: https://stackoverflow.com/questions/16442012/bower-install-2-versions-of-jquery

According to the bower docs
Bower offers several ways to install packages:
# Using the dependencies listed in the current directory's bower.json
bower install
# Using a local or remote package
bower install <package>
# Using a specific version of a package
bower install <package>#<version>
# Using a different name and a specific version of a package
bower install <name>=<package>#<version>
You can install two different versions of jQuery like so:
bower install jquery-legacy=jquery#1.10 jquery-modern=jquery#2
Or, if you prefer to set that up in a bower.json
"dependencies": {
    "jquery-legacy": "jquery#1.10",
    "jquery-modern": "jquery#2"
}

db.collection is not a function when using MongoClient v3.0

Source: https://stackoverflow.com/questions/47662220/db-collection-is-not-a-function-when-using-mongoclient-v3-0/47662979

For people on version 3.0 of the MongoDB native NodeJS driver:

(This is applicable to people with "mongodb": "^3.0.0-rc0", or a later version in package.json, that want to keep using the latest version.) 
In version 2.x of the MongoDB native NodeJS driver you would get the database object as an argument to the connect callback:
MongoClient.connect('mongodb://localhost:27017/mytestingdb', (err, db) => {
  // Database returned
});
According to the changelog for 3.0 you now get a client object containing the database object instead:
MongoClient.connect('mongodb://localhost:27017', (err, client) => {
  // Client returned
  var db = client.db('mytestingdb');
});
The close() method has also been moved to the client. The code in the question can therefore be translated to:
MongoClient.connect('mongodb://localhost', function (err, client) {
  if (err) throw err;

  var db = client.db('mytestingdb');

  db.collection('customers').findOne({}, function (findErr, result) {
    if (findErr) throw findErr;
    console.log(result.name);
    client.close();
  });
}); 

Initialization of an ArrayList in one line

Source: https://stackoverflow.com/questions/1005073/initialization-of-an-arraylist-in-one-line
It would be simpler if you were to just declare it as a List - does it have to be an ArrayList?
List<String> places = Arrays.asList("Buenos Aires", "Córdoba", "La Plata");
Or if you have only one element:
List<String> places = Collections.singletonList("Buenos Aires");
This would mean that places is immutable (trying to change it will cause an UnsupportedOperationException exception to be thrown).
To make a mutable list that is a concrete ArrayList you can create an ArrayList from the immutable list:
ArrayList<String> places = new ArrayList<>(Arrays.asList("Buenos Aires", "Córdoba", "La Plata"));

String null to empty

You can use Objects.toString() (standard in Java 7):

Objects.toString(gearBox, "")

Objects.toString(id, "")

or 

StringUtils.defaultString(String str)

Returns either the passed in String, or if the String is null, an empty String ("").
 StringUtils.defaultString(null)  = ""
 StringUtils.defaultString("")    = ""
 StringUtils.defaultString("bat") = "bat"

Renewing Facebook Graph API token automatically?

  Mã truy cập dài hạn https://developers.facebook.com/docs/facebook-login/guides/access-tokens/get-long-lived/ https://community.n8n.io/t/re...