Tutorial by Examples

Grunt is a JavaScript Task Runner, used for automation of repetitive tasks like minification, compilation, unit testing, linting, etc. In order to get started, you'll want to install Grunt's command line interface (CLI) globally. npm install -g grunt-cli Preparing a new Grunt project: A typica...
Guice is the default dependency injection (further DI) framework of Play. Other frameworks may be used as well, but using Guice makes development efforts easier, since Play takes care for things under the veil. Injection of Play API-s Starting from Play 2.5 several API-s, which were static in the ...
Thread Pools are used mostly calling methods in ExecutorService. The following methods can be used to submit work for execution: MethodDescriptionsubmitExecutes a the submitted work and return a future which can be used to get the resultexecuteExecute the task sometime in the future without gettin...
Premise These instruction shows a procedure to install native OCaml binaries in Windows. If your operative system is Windows 10 (Insider Preview) build 14316 or later you can also install OCaml through Bash on Ubuntu on Windows. In this case, follow the instruction to install OCaml on Ubuntu. Inst...
These are general tips that in general improve performance. If your code is slow, it is always important to profile it to figure out what parts are slow. Guessing is never enough. Improving the execution speed of something that only takes up 1% of the execution time probably isn't worth the effort. ...
CountDownTimer is useful for repeatedly performing an action in a steady interval for a set duration. In this example, we will update a text view every second for 30 seconds telling how much time is remaining. Then when the timer finishes, we will set the TextView to say "Done." TextView ...
In this example, we will pause/resume the CountDownTimer based off of the Activity lifecycle. private static final long TIMER_DURATION = 60000L; private static final long TIMER_INTERVAL = 1000L; private CountDownTimer mCountDownTimer; private TextView textView; private long mTimeRemaining; ...
FlowRouter is more modular compared to Iron Router. Install FlowRouter meteor add kadira:flow-router Rendering a template In particular, you must manually add a layout rendering package to link with your rendering engine: Blaze Layout for Blaze: meteor add kadira:blaze-layout React Layout ...
A set of high-level mapping functions is available in Common Lisp, to apply a function to the elements of one or more lists. They differ in the way in which the function is applied to the lists and how the final result is obtained. The following table summarize the differences and shows for each of ...
MAPCAR is the most used function of the family: CL-USER> (mapcar #'1+ '(1 2 3)) (2 3 4) CL-USER> (mapcar #'cons '(1 2 3) '(a b c)) ((1 . A) (2 . B) (3 . C)) CL-USER> (mapcar (lambda (x y z) (+ (* x y) z)) '(1 2 3) '(10 20 30) '(1...
CL-USER> (maplist (lambda (list) (cons 0 list)) '(1 2 3 4)) ((0 1 2 3 4) (0 2 3 4) (0 3 4) (0 4)) CL-USER> (maplist #'append '(a b c d -) '(1 2 3)) ((A B C D - 1 2 3) (B C D - 2 3) (C D - 3))
MAPCAN: CL-USER> (mapcan #'reverse '((1 2 3) (a b c) (100 200 300))) (3 2 1 C B A 300 200 100) CL-USER> (defun from-to (min max) (loop for i from min to max collect i)) FROM-TO CL-USER> (from-to 1 5) (1 2 3 4 5) CL-USER> (mapcan #'from-to '(1 2 3) '(5 5 5)) (1 2 3 4 5...
MAPC: CL-USER> (mapc (lambda (x) (print (* x x))) '(1 2 3 4)) 1 4 9 16 (1 2 3 4) CL-USER> (let ((sum 0)) (mapc (lambda (x y) (incf sum (* x y))) '(1 2 3) '(100 200 300)) sum) 1400 ; => (1 x 100) + (2 x 200) + (3 x 30...
After installing gnuplot it's a good idea to run a simple example to ensure all is working fine. Open your terminal Type gnuplot. Your prompt should now change to gnuplot> Type: plot sin(x) If all is well you should see now a sin(x) graphic generated by gnuplot. Note: if you are on Wind...
#include <omp.h> #include <stdio.h> int main (int argc, char *argv[]) { #pragma omp parallel { printf ("Hello world! I'm thread %d out of %d threads.\n", omp_get_thread_num(), omp_get_num_threads()); } return 0; } This code simply ...
The per-directory context is a part of the static configuration file between <Directory> and </Directory> tags. The entire content of dynamic configuration files is within the per-directory context of the folder in which the .htaccess resides. RewriteRule's in per-directory context matc...
The virtual host context is a part of the static configuration file between <VirtualHost> and </VirtualHost> tags. RewriteRule's in virtual host context match against the part of an url after the protocol, hostname and port, and before the query string. When the following rule is used ...
As mentioned in "Remarks", a partition is a part/slice/chunk of an RDD. Below is a minimal example on how to request a minimum number of partitions for your RDD: In [1]: mylistRDD = sc.parallelize([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 2) In [2]: mylistRDD.getNumPartitions() Out[2]: 2 No...
Sometimes we want to repartition an RDD, for example because it comes from a file that wasn't created by us, and the number of partitions defined from the creator is not the one we want. The two most known functions to achieve this are: repartition(numPartitions) and: coalesce(numPartitions, s...
As rule of thumb, one would want his RDD to have as many partitions as the product of the number of executors by the number of used cores by 3 (or maybe 4). Of course, that's a heuristic and it really depends on your application, dataset and cluster configuration. Example: In [1]: data = sc.textF...

Page 838 of 1336