Tutorial by Examples

You cannot pass a reference (or const reference) directly to a thread because std::thread will copy/move them. Instead, use std::reference_wrapper: void foo(int& b) { b = 10; } int a = 1; std::thread thread{ foo, std::ref(a) }; //'a' is now really passed as reference thread.join()...
In C++, threads are created using the std::thread class. A thread is a separate flow of execution; it is analogous to having a helper perform one task while you simultaneously perform another. When all the code in the thread is executed, it terminates. When creating a thread, you need to pass somet...
std::this_thread is a namespace which has functions to do interesting things on the current thread from function it is called from. FunctionDescriptionget_idReturns the id of the threadsleep_forSleeps for a specified amount of timesleep_untilSleeps until a specific timeyieldReschedule running threa...
What are Array-like Objects? JavaScript has "Array-like Objects", which are Object representations of Arrays with a length property. For example: var realArray = ['a', 'b', 'c']; var arrayLike = { 0: 'a', 1: 'b', 2: 'c', length: 3 }; Common examples of Array-like Objects...
null is used for representing the intentional absence of an object value and is a primitive value. Unlike undefined, it is not a property of the global object. It is equal to undefined but not identical to it. null == undefined; // true null === undefined; // false CAREFUL: The typeof null i...
At first glance it may appear that null and undefined are basically the same, however there are subtle but important differences. undefined is the absence of a value in the compiler, because where it should be a value, there hasn't been put one, like the case of an unassigned variable. undefined...
1 / 0; // Infinity // Wait! WHAAAT? Infinity is a property of the global object (therefore a global variable) that represents mathematical infinity. It is a reference to Number.POSITIVE_INFINITY It is greater than any other value, and you can get it by dividing by 0 or by evaluating the express...
When local changes are present, the git pull command aborts reporting : error: Your local changes to the following files would be overwritten by merge In order to update (like svn update did with subversion), you can run : git stash git pull --rebase git stash pop A convenient way coul...
To get info from the requesting url (notice that req is the request object in the handler function of routes). Consider this route definition /settings/:user_id and this particular example /settings/32135?field=name // get the full path req.originalUrl // => /settings/32135?field=name // get...

NaN

NaN stands for "Not a Number." When a mathematical function or operation in JavaScript cannot return a specific number, it returns the value NaN instead. It is a property of the global object, and a reference to Number.NaN window.hasOwnProperty('NaN'); // true NaN; // NaN Perhaps con...
Unlike the WHERE clause, HAVING can be used with aggregate functions. An aggregate function is a function where the values of multiple rows are grouped together as input on certain criteria to form a single value of more significant meaning or measurement (Wikipedia). Common aggregate function...
The STUFF() function inserts a string into another string by first deleting a specified number of characters. The following example, deletes "Svr" and replaces it with "Server". This happens by specifying the start_position and length of the replacement. SELECT STUFF('SQL Svr D...
Linking to other Javadocs is done with the @link tag: /** * You can link to the javadoc of an already imported class using {@link ClassName}. * * You can also use the fully-qualified name, if the class is not already imported: * {@link some.other.ClassName} * * You can link to members...
Apple's Reachability class periodically checks the network status and alerts observers to changes. Reachability *internetReachability = [Reachability reachabilityForInternetConnection]; [internetReachability startNotifier];
Reachability uses NSNotification messages to alert observers when the network state has changed. Your class will need to become an observer. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reachabilityChanged:) name:kReachabilityChangedNotification object:nil]; Elsewher...
- (void)reachabilityChanged:(NSNotification *)note { Reachability* reachability = [note object]; NetworkStatus netStatus = [reachability currentReachabilityStatus]; if (netStatus == NotReachable) { NSLog(@"Network unavailable"); } }
- (void)reachabilityChanged:(NSNotification *)note { Reachability* reachability = [note object]; NetworkStatus netStatus = [reachability currentReachabilityStatus]; switch (netStatus) { case NotReachable: NSLog(@"Network unavailable"); br...
Many IDEs provide support for generating HTML from Javadocs automatically; some build tools (Maven and Gradle, for example) also have plugins that can handle the HTML creation. However, these tools are not required to generate the Javadoc HTML; this can be done using the command line javadoc tool. ...
Functional Interfaces Lambdas can only operate on a functional interface, which is an interface with just one abstract method. Functional interfaces can have any number of default or static methods. (For this reason, they are sometimes referred to as Single Abstract Method Interfaces, or SAM Interf...
This example demonstrates how Angular expressions are evaluated when using type="text" and type="number" for the input element. Consider the following controller and view: Controller var app = angular.module('app', []); app.controller('ctrl', function($scope) { $sco...

Page 87 of 1336