Tutorial by Examples: pre

h = 1.0 / n; #pragma omp parallel for private(x) shared(n, h) reduction(+:area) for (i = 1; i <= n; i++) { x = h * (i - 0.5); area += (4.0 / (1.0 + x*x)); } pi = h * area; In this example, each threads execute a subset of the iteration count. Each thread has its local private copy ...
h = 1.0 / n; #pragma omp parallel private(x) shared(n, h) { double thread_area = 0; // Private / local variable #pragma omp for for (i = 1; i <= n; i++) { x = h * (i - 0.5); thread_area += (4.0 / (1.0 + x*x)); } #pragma omp atomic ...
An expression in Scheme is what is going to get executed. A S-expression, as it's usually called starts with a ( and end with a ). The first member of the expression is what is going to get executed. The following member of the expression are the parameters that will be sent to the expression during...
Node.js apis can be easily constructed in Express web framework. Following example creates a simple GET api for listing all users. Example var express = require('express'); var app = express(); var users =[{ id: 1, name: "John Doe", age : 23, e...
Following example create POST api using Express. This example is similar to GET example except the use of body-parser that parses the post data and add it to req.body. Example var express = require('express'); var app = express(); // for parsing the body in POST request var bodyParser = require...
To get this example working, you'll need to create an IIS 7/8 app on your IIS host and add the directory containing the Node.js Web App as the Physical Directory. Ensure that your Application/Application Pool Identity can access the Node.js install. This example uses the Node.js 64-bit installation....
If you want to use the MySQL command IN() in the QueryBuilder, you can do it with the in() function of the ExpressionBuilder class. // get an ExpressionBuilder instance, so that you $expressionBulder = $this->_em->getExpressionBuilder(); $qb = $this->_em->createQueryBuilder() ->se...
Predefined exceptions are internally defined exceptions but they have names. Oracle database raise this type of exceptions automatically. Example create or replace procedure insert_emp is begin insert into emp (emp_id, ename) values ('1','Jon'); exception when dup_val_on_index then ...
Based on this blog post. Assume you have a method like this: def get[T]: Option[T] = ??? When you try to call it without specifying the generic parameter, Nothing gets inferred, which is not very useful for an actual implementation (and its result is not useful). With the following solution t...
A Cron expression consists of six sequential fields - second, minute, hour, day of month, month, day(s) of week and is declared as follows @Scheduled(cron = "* * * * * *") We can also set the timezone as - @Scheduled(cron="* * * * * *", zone="Europe/Istanbul") ...
Pass a method into a directive. It provides a way to execute an expression in the context of the parent scope. Method will be executed in the scope of the parent, you may pass some parameters from the child scope there. You should not use {{...}} for interpolation. When you use & in a directi...
var httpRequest = new XMLHttpRequest(); httpRequest.onreadystatechange = getData; httpRequest.open('GET', 'https://url/to/some.file', true); httpRequest.send(); function getData(){ if (httpRequest.readyState === XMLHttpRequest.DONE) { alert(httpRequest.responseText); } ...
The following-sibling and preceding-sibling axes contain the siblings before or after the context node, and the following and preceding axes contain all nodes in the document before or after the context node, but: None of these axes contain attribute or namespace nodes. The following axis doesn'...
Swift let image = UIGraphicsGetImageFromCurrentImageContext() imageView.image = image //assuming imageView is a valid UIImageView object Objective-C UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); imageView.image = image; //assuming imageView is a valid UIImageView object
The RegularExpressionValidator allows validating the input text by matching against a pattern of a regular expression. The regular expression is set in the ValidationExpression property. The following table summarizes the commonly used syntax constructs for regular expressions: Character EscapesDe...
//'client.jade' //a button is placed down; similar in HTML button(type='button', id='send_by_button') Modify data #modify Lorem ipsum Sender //loading jQuery; it can be done from an online source as well script(src='./js/jquery-2.2.0.min.js') //AJAX request ...
Absolute value: $ for n in -8 -2 0 3 4; do > echo $((n<0?-n:n)) > done 8 2 0 3 4 Fix variable range: $ min=2 $ max=4 $ for n in 1 2 3 4 5; do > echo $((n<min?min:n>max?max:n)) > done 2 2 3 4 4
Add the required libraries into the dependencies section of your Android module's build.gradle: android { ... defaultConfig { ... testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } } dependencies { ... androidTestCompile 'com.android.su...
A layout manager for templated views. Used within a ControlTemplate to mark where the content to be presented appears.
In Express, you can define middlewares that can be used for checking requests or setting some headers in response. app.use(function(req, res, next){ }); // signature Example The following code adds user to the request object and pass the control to the next matching route. var express = req...

Page 23 of 34