Tutorial by Examples

To start the process: $ forever start index.js warn: --minUptime not set. Defaulting to: 1000ms warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms info: Forever processing file: index.js List running Forever instances: $ forever list i...
In Python 2, True, False and None are built-in constants. Which means it's possible to reassign them. Python 2.x2.0 True, False = False, True True # False False # True You can't do this with None since Python 2.4. Python 2.x2.4 None = None # SyntaxError: cannot assign to None In ...
If you need to sort the results of a UNION, use this pattern: ( SELECT ... ) UNION ( SELECT ... ) ORDER BY Without the parentheses, the final ORDER BY would belong to the last SELECT.
When adding a LIMIT to a UNION, this is the pattern to use: ( SELECT ... ORDER BY x LIMIT 10 ) UNION ( SELECT ... ORDER BY x LIMIT 10 ) ORDER BY x LIMIT 10 Since you cannot predict which SELECT(s) will the "10" will come from, you need to get 10 from each, then further whittle do...
Strict mode also prevents you from deleting undeletable properties. "use strict"; delete Object.prototype; // throws a TypeError The above statement would simply be ignored if you don't use strict mode, however now you know why it does not execute as expected. It also prevents you fr...
std::vector<std::string> split(const std::string &str, std::string regex) { std::regex r{ regex }; std::sregex_token_iterator start{ str.begin(), str.end(), r, -1 }, end; return std::vector<std::string>(start, end); } split("Some string\t with whitespace &...
Remember to npm install all the files into devDependencies first. E.g. npm install --save-dev gulp gulp-concat gulp-rename gulp-uglify gulp-uglifycss Gulpfile.js var gulp = require('gulp'); var gulp_concat = require('gulp-concat'); var gulp_rename = require('gulp-rename'); var gulp_uglify = ...
To create a parallel collection from a sequential collection, call the par method. To create a sequential collection from a parallel collection, call the seq method. This example shows how you turn a regular Vector into a ParVector, and then back again: scala> val vect = (1 to 5).toVector vect:...
Do not use parallel collections when the collection elements must be received in a specific order. Parallel collections perform operations concurrently. That means that all of the work is divided into parts and distributed to different processors. Each processor is unaware of the work being done by...
The most common mode of using TensorFlow involves first building a dataflow graph of TensorFlow operators (like tf.constant() and tf.matmul(), then running steps by calling the tf.Session.run() method in a loop (e.g. a training loop). A common source of memory leaks is where the training loop conta...
To improve memory allocation performance, many TensorFlow users often use tcmalloc instead of the default malloc() implementation, as tcmalloc suffers less from fragmentation when allocating and deallocating large objects (such as many tensors). Some memory-intensive TensorFlow programs have been kn...
PyPar is a library that uses the message passing interface (MPI) to provide parallelism in Python. A simple example in PyPar (as seen at https://github.com/daleroberts/pypar) looks like this: import pypar as pp ncpus = pp.size() rank = pp.rank() node = pp.get_processor_name() print 'I am r...
Detailed instructions on getting dropwizard set up or installed.
There are several scopes that are available only in a web-aware application context: request - new bean instance is created per HTTP request session - new bean instance is created per HTTP session application - new bean instance is created per ServletContext globalSession - new bean instance i...
When using async queries, you can execute multiple queries at the same time, but not on the same context. If the execution time of one query is 10s, the time for the bad example will be 20s, while the time for the good example will be 10s. Bad Example IEnumerable<TResult1> result1; IEnumera...
In [188]: s = pd.Series(["a","b","c","a","c"], dtype="category") In [189]: s Out[189]: 0 a 1 b 2 c 3 a 4 c dtype: category Categories (3, object): [a, b, c] In [190]: df = pd.DataFrame({"A":["a&q...
All lines must be terminated with a line feed character (LF, ASCII value 10) and not for instance CR or CR+LF. There may be no trailing white space at the end of a line. The name of a source file must equal the name of the class it contains followed by the .java extension, even for fil...
Apart from LF the only allowed white space character is Space (ASCII value 32). Note that this implies that other white space characters (in, for instance, string and character literals) must be written in escaped form. \', \", \\, \t, \b, \r, \f, and \n should be preferred over corres...
package com.example.my.package; The package declaration should not be line wrapped, regardless of whether it exceeds the recommended maximum length of a line.
// First java/javax packages import java.util.ArrayList; import javax.tools.JavaCompiler; // Then third party libraries import com.fasterxml.jackson.annotation.JsonProperty; // Then project imports import com.example.my.package.ClassA; import com.example.my.package.ClassB; // Then stat...

Page 519 of 1336