Tutorial by Examples: al

#include <stdio.h> #define is_const_int(x) _Generic((&x), \ const int *: "a const int", \ int *: "a non-const int", \ default: "of other type") int main(void) { const int i = 1; int j = 1; double...
A lambda expression provides a concise way to create simple function objects. A lambda expression is a prvalue whose result object is called closure object, which behaves like a function object. The name 'lambda expression' originates from lambda calculus, which is a mathematical formalism invented...
If you specify the variable's name in the capture list, the lambda will capture it by value. This means that the generated closure type for the lambda stores a copy of the variable. This also requires that the variable's type be copy-constructible: int a = 0; [a]() { return a; // Ok, 'a' ...
Tuples can be decomposed into individual variables with the following syntax: let myTuple = (name: "Some Name", age: 26) let (first, second) = myTuple print(first) // "Some Name" print(second) // 26 This syntax can be used regardless of if the tuple has unnamed properti...
Functions can return tuples: func tupleReturner() -> (Int, String) { return (3, "Hello") } let myTuple = tupleReturner() print(myTuple.0) // 3 print(myTuple.1) // "Hello" If you assign parameter names, they can be used from the return value: func tupleReturner(...
To begin, install Node.js on your development computer. Windows: Navigate to the download page and download/run the installer. Mac: Navigate to the download page and download/run the installer. Alternatively, you can install Node via Homebrew using brew install node. Homebrew is a command-line pac...
Browse to File > New > Project to bring you up the New Project dialog. Navigate to Visual C# > Android and select Blank App: Give your app a Name and press OK to create your project. Set up your device for deployment, or configure an emulator To run your application, select the Debug...
A value of a Preferences node can be of the type String, boolean, byte[], double, float, int or long. All invocations must provide a default value, in case the specified value is not present in the Preferences node. Preferences preferences = Preferences.userNodeForPackage(getClass()); String som...
To store a value into the Preferences node, one of the putXXX() methods is used. A value of a Preferences node can be of the type String, boolean, byte[], double, float, int or long. Preferences preferences = Preferences.userNodeForPackage(getClass()); preferences.put("someKey", "...
Iterators and pointers pointing into an std::vector can become invalid, but only when performing certain operations. Using invalid iterators/pointers will result in undefined behavior. Operations which invalidate iterators/pointers include: Any insertion operation which changes the capacity of...
You can apply any kind of additional processing to the output by passing a callable to ob_start(). <?php function clearAllWhiteSpace($buffer) { return str_replace(array("\n", "\t", ' '), '', $buffer); } ob_start('clearAllWhiteSpace'); ?> <h1>Lorem Ipsum&l...
Suppose we have a plain object called prototype: var prototype = { foo: 'foo', bar: function () { return this.foo; } }; Now we want another object called obj that inherits from prototype, which is the same as saying that prototype is the prototype of obj var obj = Object.create(prototype); N...
C++14 Lambdas can capture expressions, rather than just variables. This permits lambdas to store move-only types: auto p = std::make_unique<T>(...); auto lamb = [p = std::move(p)]() //Overrides capture-by-value of `p`. { p->SomeFunc(); }; This moves the outer p variable into th...
To authenticate to Watson services, you need credentials for each service that you plan to use. Depending on the service, you will need to pass a username and password with Basic Authentication, or you will need to pass an API key in a parameter for each request you make. How to get credentials for...
In this tutorial we're going to learn how to set up the PayPal Android SDK to process a simple payment via either a PayPal payment or a credit card purchase. At the end of this example, you should have a simple button in an application that, when clicked, will forward the user to PayPal to confirm a...
The extension method to be called is determined at compile-time based on the reference-type of the variable being accessed. It doesn't matter what the variable's type is at runtime, the same extension method will always be called. open class Super class Sub : Super() fun Super.myExtension()...
Mocks are used when it is necessary to verify the interactions between the system under test and test doubles. Care needs to be taken to avoid creating overly brittle tests, but mocking can be particularly useful when the method to test is simply orchestrating other calls. This test verifies that ...
PM> Uninstall-Package EntityFramework
PM> Uninstall-Package -ProjectName MyProjectB EntityFramework
PM> Install-Package EntityFramework -Version 6.1.2

Page 13 of 269