Tutorial by Examples: l

#include <omp.h> #include <stdio.h> int main (void) { int t = (0 == 0); // true value int f = (1 == 0); // false value #pragma omp parallel if (f) { printf ("FALSE: I am thread %d\n", omp_get_thread_num()); } #pragma omp parallel if (t) { printf (&quo...
Reading the content of an InputStream as a byte array: // Reading from a file try (InputStream in = new FileInputStream("in.dat")) { byte[] content = ByteStreams.toByteArray(in); // do something with content } Copying an InputStream to an OutputStream: // Copying the content f...
#include <omp.h> #include <unistd.h> #include <iostream> #include <list> static void processElement (unsigned n) { // Tell who am I. The #pragma omp critical ensures that // only one thread sends data to std::cout #pragma omp critical std::cout <...
To get a list of the processes running in the current terminal, you can use ps : $ sleep 1000 & $ ps -opid,comm PID COMMAND 1000 sh 1001 sleep 1002 ps To kill a running process, use kill with the process ID (PID) indicated by ps: $ kill 1001 $ ps -opid,comm PID COMMAND 1000 sh...
Reading the content of a Reader as a String: // Reading from a file try (Reader reader = new FileReader("in.txt")) { String content = CharStreams.toString(reader); // do something with content } Reading the content of a Reader as a list of line contents: try (Reader reader = n...
Consider the following example: public class Example { public int a, b, c, d; public void doIt() { a = b + 1; c = d + 1; } } If this class is used is a single-threaded application, then the observable behavior will be exactly as you would expect. For instan...
# create the co-process coproc bash # send a command to it (echo a) echo 'echo Hello World' >&"${COPROC[1]}" # read a line from its output read line <&"${COPROC[0]}" # show the line echo "$line" The output is "Hello World".
C:\makefile: helloWorld : [TAB]echo hello world run results: C:\>make echo hello world hello world Note: [TAB] should be replaced by an actual tab, stackoverflow replaces tabs with spaces, and spaces are not used the same as tabs in a makefile.
Convert from wide form to long form Load data USArrests from datasets. data("USArrests") head(USArrests) Murder Assault UrbanPop Rape Alabama 13.2 236 58 21.2 Alaska 10.0 263 48 44.5 Arizona 8.1 294 80 31.0 Arkansas 8...
Convert from long form to wide form To recover data from the previous example, use dcast like so. DTc <- dcast(DTmu, State + UrbanPop ~ Crime) This gives the data in the original wide form. State UrbanPop Murder Assault Rape 1: Alabama 58 13.2 236 21.2 2:...
The WHILE loop is executed untill the condition of end is fulfilled. Simple example: DECLARE v_counter NUMBER(2); --declaration of counter variable BEGIN v_counter := 0; --point of start, first value of our iteration WHILE v_counter < 10 LOOP --exit condition dbms_output....
Loop FOR works on similar rules as other loops. FOR loop is executed exact number of times and this number is known at the beginning - lower and upper limits are directly set in code. In every step in this example, loop is increment by 1. Simple example: DECLARE v_counter NUMBER(2); --declaration...
Here is a basic class documentation example: /// Class description class Student { // Member description var name: String /// Method description /// /// - parameter content: parameter description /// /// - returns: return value description func say...
SAML specifies three key roles: The Identity Provider (IdP) The party which provides and maintains the identity of the users. This can be a directory service like ADFS or a custom database solution. The Service Provider (SP) The Service Provider is the actual service which the user tries...
With all the requests and assertions going back and forth, it can be cumbersome to debug issues with your SAML claims and assertions. As within SAML a core principle is not needing a direct connection between the IdP and the SP, the user's browser acts as a message carrier between the two. Because ...
Nginx configuration to detect request from mobile user-agent and redirect them to mobile site. location / { #mobile site handling as per user agent set $mobile_rewrite do_not_perform; // variable to store action. default set to not perform redirection to mobile site. if ($htt...
@at-root directive can be used to localize variables. $color: blue; @at-root { $color: red; .a { color: $color; } .b { color: $color; } } .c { color: $color; } is compiled to: .a { color: red; } .b { color: red; } .c { color: blue; }
Define the variables within a formula field: Shared NumberVar x := 1000; Shared NumberVar y; Assigning the values is optional. To display the variable in a second formula later on in the report, the call is nearly identical: Shared NumberVar x; x
In many application it is necessary to compute the function of two or more arguments. Traditionally, we use for-loops. For example, if we need to calculate the f = exp(-x^2-y^2) (do not use this if you need fast simulations): % code1 x = -1.2:0.2:1.4; y = -2:0.25:3; for nx=1:lenght(x) for n...
Traditionally, you can use routing to map an the request with the Routing Component who handled request and response parameters by HttpFoundation Component. Additionally, a custom route parameter can be created by using the FOSRestBundle to extends the default functionalities of the Routing Compone...

Page 592 of 861