Tutorial by Examples: bi

Angular has reputation for having awesome bidirectional data binding. By default, Angular continuously synchronizes values bound between model and view components any time data changes in either the model or view component. This comes with a cost of being a bit slow if used too much. This will hav...
Assuming we want to modify bit n of an integer primitive, i (byte, short, char, int, or long): (i & 1 << n) != 0 // checks bit 'n' i |= 1 << n; // sets bit 'n' to 1 i &= ~(1 << n); // sets bit 'n' to 0 i ^= 1 << n; // toggles the value of bit 'n' Us...
AngularJS code for rendering plain text: <p>{{ ScopePropertyX }} and {{ ScopePropertyY }}</p> KnockoutJS equivalent: <p> <!-- ko text: ScopeObservableX --><!-- /ko --> and <!-- ko text: ScopeObservableY --><!-- /ko --> </p> or: ...
A template autorun may be used to (re)subscribe to a publication. It establishes a reactive context which is re-executed whenever any reactive data it depends on changes. In addition, an autorun always runs once (the first time it is executed). Template autoruns are normally put in an onCreated met...
The bisect command helps you to track down the changeset that introduced a bug. Reset the bisect state and mark the current revision as bad (it contains the bug!) hg bisect --reset hg bisect --bad Go back to a point where you think the bug isn't present hg update -r -200 Now...
The Scala compiler prefixes every argument in the parameter list by default with val. This means that, by default, case classes are immutable. Each parameter is given an accessor method, but there are no mutator methods. For example: case class Foo(i: Int) val fooInstance = Foo(1) val j = fooIn...
int a = 6; // 0110b (0x06) int b = 10; // 1010b (0x0A) int c = a & b; // 0010b (0x02) std::cout << "a = " << a << ", b = " << b << ", c = " << c << std::endl; Output a = 6, b = 10, c = 2 Why A bit wise A...
int a = 5; // 0101b (0x05) int b = 12; // 1100b (0x0C) int c = a | b; // 1101b (0x0D) std::cout << "a = " << a << ", b = " << b << ", c = " << c << std::endl; Output a = 5, b = 12, c = 13 Why A bit wise OR o...
int a = 5; // 0101b (0x05) int b = 9; // 1001b (0x09) int c = a ^ b; // 1100b (0x0C) std::cout << "a = " << a << ", b = " << b << ", c = " << c << std::endl; Output a = 5, b = 9, c = 12 Why A bit wise XOR (...
unsigned char a = 234; // 1110 1010b (0xEA) unsigned char b = ~a; // 0001 0101b (0x15) std::cout << "a = " << static_cast<int>(a) << ", b = " << static_cast<int>(b) << std::endl; Output a = 234, b = 21 Why A b...
<div tabindex="0">Some button</div> Note: Try to use a native HTML button or an a tag where appropriate.
<button tabindex="-1">This button will not be reachable by tab</button> The element will be removed from the tabbing order but will still be focusable.
<div tabindex="2">Second</div> <div tabindex="1">First</div> Positive values will insert the element at the tabbing order position of its respective value. Elements without preference (i.e. tabindex="0" or native elements such as button and a...
#include <stdlib.h> #include <stdio.h> int main(void) { result = EXIT_SUCCESS; char file_name[] = "outbut.bin"; char str[] = "This is a binary file example"; FILE * fp = fopen(file_name, "wb"); if (fp == NULL) /* If an erro...
Immutability is common in functional programming and rare in object oriented programming. Create, for example, an address type with mutable state: public class Address () { public string Line1 { get; set; } public string Line2 { get; set; } public string City { get; set; } } ...
As seen previously, a closure is nothing but an instance of the Closure class, and different methods can be invoked on them. One of them is bindTo, which, given a closure, will return a new one that is bound to a given object. For example: <?php $myClosure = function() { echo $this->p...
Let's consider this example: <?php $myClosure = function() { echo $this->property; }; class MyClass { public $property; public function __construct($propertyValue) { $this->property = $propertyValue; } } $myInstance = new MyClass('Hello world...
Since PHP7, it is possible to bind a closure just for one call, thanks to the call method. For instance: <?php class MyClass { private $property; public function __construct($propertyValue) { $this->property = $propertyValue; } } $myClosure = function() ...
trait HelloWorld { public function sayHello() { echo 'Hello World!'; } } // Change visibility of sayHello class MyClass1 { use HelloWorld { sayHello as protected; } } // Alias method with changed visibility // sayHello visibility not changed class MyClass2 { u...
# Fetch and install package to setup access to the official APT repository wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb sudo dpkg -i erlang-solutions_1.0_all.deb # Update package index sudo apt-get update # Install Erlang and Elixir sudo apt-get install esl-erlan...

Page 7 of 29