Tutorial by Examples: c

We can create empty thread objects and assign work to them later. If we assign a thread object to another active, joinable thread, std::terminate will automatically be called before the thread is replaced. #include <thread> void foo() { std::this_thread::sleep_for(std::chrono::seco...
To obtain a reference to a KClass object representing some class use double colons: val c1 = String::class val c2 = MyClass::class
Functions are first-class citizens in Kotlin. You can obtain a reference on it using double colons and then pass it to another function: fun isPositive(x: Int) = x > 0 val numbers = listOf(-2, -1, 0, 1, 2) println(numbers.filter(::isPositive)) // [1, 2]
To obtain a Java's Class object from Kotlin's KClass use the .java extension property: val stringKClass: KClass<String> = String::class val c1: Class<String> = stringKClass.java val c2: Class<MyClass> = MyClass::class.java The latter example will be optimized by the compile...
The conventional connect syntax that uses SIGNAL and SLOT macros works entirely at runtime, which has two drawbacks: it has some runtime overhead (resulting also in binary size overhead), and there's no compile-time correctness checking. The new syntax addresses both issues. Before checking the synt...
Given that the 8086/8088 was used in the IBM PC, and the Operating System on that was most often from Microsoft, Microsoft's assembler MASM was the de facto standard for many years. It followed Intel's syntax closely, but permitted some convenient but "loose" syntax that (in hindsight) onl...
Suppose that you have a pointer to an object of a polymorphic class: Shape *ps; // see example on defining a polymorphic class ps = get_a_new_random_shape(); // if you don't have such a function yet, you // could just write ps = new Square...
Function is a set of instructions, which are grouped together. These grouped instructions together perform certain task. In erlang, all the functions will return a value when they are called. Below is an example of a function that adds two numbers add(X, Y)-> X + Y. This function performs an...
Background pages are implicit pages which contain background scripts. A background script is a single long-running script to manage some task or state. It exists for the lifetime of your extension, and only one instance of it at a time is active. You can declare it like this in your manifest.json: ...
A content script is extension code that runs alongside a normal page. They have full access to the web page's DOM (and are, in fact, the only part of the extension that can access a page's DOM), but the JavaScript code is isolated, a concept called Isolated World. Each extension has its own content...
Loop control statements are used to change the flow of execution from its normal sequence. When execution leaves a scope, all automatic objects that were created in that scope are destroyed. The break and continue are loop control statements. The break statement terminates a loop without any furthe...
Save with default parameters: df.to_csv(file_name) Write specific columns: df.to_csv(file_name, columns =['col']) Difault delimiter is ',' - to change it: df.to_csv(file_name,sep="|") Write without the header: df.to_csv(file_name, header=False) Write with a given head...
Got to Tools | Options | Source Control | Visual Studio Team Foundation Server click on the Configure User Tools: You can add separate overrides for 'Compare' and 'Merge' operations. Click on Add and select the operation you want to override. You'd need to type the path to the tool you use, and ...
An extensible derived type may be abstract type, abstract :: base_type end type Such a derived type may never be instantiated, such as by type(base_type) t1 allocate(type(base_type) :: t2) but a polymorphic object may have this as its declared type class(base_type), allocatable :: t1 o...
ansible-playbook -i path/to/static-inventory-file -l myhost myplaybook.yml
ansible-playbook -i path/to/dynamic-inventory-script.py -l myhost myplaybook.yml See dynamic inventory for more details.
var a:Number=0.123456789; trace(a); // 0.123456789 trace(a.toPrecision(4)); // 0.1235 trace(a.toFixed(4)); // 0.1235 trace(a.toExponential(4)); // 1.2345e-1 trace(a.toString(16)); // 0 - works for integer part only var b:Number=12345678.9876543; // a bigg...
AngularJS directives are what controls the rendering of the HTML inside an AngularJS application. They can be an Html element, attribute, class or a comment. Directives are used to manipulate the DOM, attaching new behavior to HTML elements, data binding and many more. Some of examples of directives...
Python 2.x2.3 x = 'hello world!' vowels = [x for x in 'AEIOU'] print (vowels) # Out: ['A', 'E', 'I', 'O', 'U'] print(x) # Out: 'U' Python 3.x3.0 x = 'hello world!' vowels = [x for x in 'AEIOU'] print (vowels) # Out: ['A', 'E', 'I', 'O', 'U'] print(x) # Out: 'hello world!' ...
The following example adds a column admin to the users table, and gives that column the default value false. class AddDetailsToUsers < ActiveRecord::Migration[5.0] def change add_column :users, :admin, :boolean, default: false end end Migrations with defaults might take a long tim...

Page 185 of 826