Tutorial by Examples: and

To get the size of a communicator (e.g. MPI_COMM_WORLD) and the local process' rank inside it: int rank, size; int res; MPI_Comm communicator = MPI_COMM_WORLD; res = MPI_Comm_rank (communicator, &rank); if (res != MPI_SUCCESS) { fprintf (stderr, "MPI_Comm_rank failed\n"); ...
PREPARE prepares a statement for execution EXECUTE executes a prepared statement DEALLOCATE PREPARE releases a prepared statement SET @s = 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse'; PREPARE stmt2 FROM @s; SET @a = 6; SET @b = 8; EXECUTE stmt2 USING @a, @b; Result: +------------+ |...
The pickle module implements an algorithm for turning an arbitrary Python object into a series of bytes. This process is also called serializing the object. The byte stream representing the object can then be transmitted or stored, and later reconstructed to create a new object with the same charact...
#include <stdlib.h> #include <stdio.h> int main(void) { result = EXIT_SUCCESS; char file_name[] = "outbut.bin"; char str[] = "This is a binary file example"; FILE * fp = fopen(file_name, "wb"); if (fp == NULL) /* If an erro...
#include <stdio.h> #include <stdlib.h> int main (void) { int * pdata; size_t n; printf ("Enter the size of the array: "); fflush(stdout); /* Make sure the prompt gets printed to buffered stdout. */ if (1 != scanf("%zu", &n)) /* If zu is n...
Creating a custom directive with isolated scope will separate the scope inside the directive from the outside scope, in order to prevent our directive from accidentally change the data in the parent scope and restricting it from reading private data from the parent scope. To create an isolated scop...
The two functions fn1 and fn2 can return multiple tensors, but they have to return the exact same number and types of outputs. x = tf.constant(1.) bool = tf.constant(True) def fn1(): return tf.add(x, 1.), x def fn2(): return tf.add(x, 10.), x res1, res2 = tf.cond(bool, fn1, fn2)...
Since npm itself is a Node.js module, it can be updated using itself. If OS is Windows must be running command prompt as Admin npm install -g npm@latest If you want to check for updated versions you can do: npm outdated In order to update a specific package: npm update <package name>...
Let's consider this example: <?php $myClosure = function() { echo $this->property; }; class MyClass { public $property; public function __construct($propertyValue) { $this->property = $propertyValue; } } $myInstance = new MyClass('Hello world...
We define two sets a and b >>> a = {1, 2, 2, 3, 4} >>> b = {3, 3, 4, 4, 5} NOTE: {1} creates a set of one element, but {} creates an empty dict. The correct way to create an empty set is set(). Intersection a.intersection(b) returns a new set with elements present in bot...
Common Lisp already has a reverse function, but if it didn't, then it could be implemented easily using reduce. Given a list like (1 2 3) === (cons 1 (cons 2 (cons 3 '()))) the reversed list is (cons 3 (cons 2 (cons 1 '()))) === (3 2 1) That may not be an obvious use of reduce, but if we ha...
This feeds a while loop with the output of a grep command: while IFS=":" read -r user _ do # "$user" holds the username in /etc/passwd done < <(grep "hello" /etc/passwd)
Python 3 allows you to define function arguments which can only be assigned by keyword, even without default values. This is done by using star * to consume additional positional parameters without setting the keyword parameters. All arguments after the * are keyword-only (i.e. non-positional) arg...
Ubuntu On recent Ubuntu versions, you can install an up-to-date version of CouchDB with sudo apt-get install couchdb. For older versions, such as Ubuntu 14.04, you should run: sudo add-apt-repository ppa:couchdb/stable -y sudo apt-get update sudo apt-get install couchdb -y Fedora To install ...
Hashes can be freely converted to and from arrays. Converting a hash of key/value pairs into an array will produce an array containing nested arrays for pair: { :a => 1, :b => 2 }.to_a # => [[:a, 1], [:b, 2]] In the opposite direction a Hash can be created from an array of the same form...
Basics Anonymous functions are a powerful tool of the MATLAB language. They are functions that exist locally, that is: in the current workspace. However, they do not exist on the MATLAB path like a regular function would, e.g. in an m-file. That is why they are called anonymous, although they can h...
Complete the Installation and setup part. This will create the project in Firebase console and will also install the base SDK in your Android App. Add the dependency for Firebase Realtime Database to your app-level build.gradle file: compile 'com.google.firebase:firebase-database:9.4.0' N...
The std::borrow::Borrow and std::borrow::BorrowMut traits are used to treat borrowed types like owned types. For types A and B, impl Borrow<B> for A indicates that a borrowed A may be used where a B is desired. For instance, std::collections::HashMap.get() uses Borrow for its get() method,...
Sometimes builds take longer than expected. There are a few environment variables you can set to better understand what's happening during the build process. METEOR_DEBUG_BUILD=1 (logs progress) METEOR_PROFILE=<n> (logs time spent) METEOR_DEBUG_SPRINGBOARD=1 (?) METEOR_DEBUG_...
What? : A fully supported and extensible framework for building HTTP based endpoints. In the world of HTML5, mobile devices, and modern development techniques HTTP have become the default option for building rich, scalable services. The ASP.NET Web API provides an easy to use set of default options...

Page 37 of 153