Tutorial by Examples

The default box model (content-box) can be counter-intuitive, since the width / height for an element will not represent its actual width or height on screen as soon as you start adding padding and border styles to the element. The following example demonstrates this potential issue with content-...
A less known builtin feature is Controller Action injection using the FromServicesAttribute. [HttpGet] public async Task<IActionResult> GetAllAsync([FromServices]IProductService products) { return Ok(await products.GetAllAsync()); } An important note is that the [FromServices] c...
form1.component.ts: import { Component } from '@angular/core'; // Defines example component and associated template @Component({ selector: 'example', template: ` <div *ngFor="let f of fruit"> {{f}} </div> <select required> <option ...
Element and attribute names live in namespaces that are URIs. Namespaces are bound to prefixes that are used in the actual element and attribute names, which are called QNames. This document binds a namespace to the prefix prefix and defines a default namespace, bound with the absence of prefix. &...
Comments in XML look like so: <!-- This is a comment --> They can appear in element content or top-level: <?xml version="1.0"?> <!-- a comment at the top-level --> <document> <!-- a comment inside the document --> </document> Comments canno...
Given a Person struct struct Person { let name: String let birthYear: Int? } and an Array of Person(s) let persons = [ Person(name: "Walter White", birthYear: 1959), Person(name: "Jesse Pinkman", birthYear: 1984), Person(name: "Skyler White&quo...
This is a normal function call: console.log("Hello World!"); When you call a normal function, it does its job and then returns control back to the caller. However, sometimes a function needs to return control back to the caller in order to do its job: [1,2,3].map(function double(x) {...
The ng-mouseenter and ng-mouseleave directives are useful to run events and apply CSS styling when you hover into or out of your DOM elements. The ng-mouseenter directive runs an expression one a mouse enter event (when the user enters his mouse pointer over the DOM element this directive resides i...
This directive is useful to limit input events based on certain existing conditions. The ng-disabled directive accepts and expression that should evaluate to either a truthy or a falsy values. ng-disabled is used to conditionally apply the disabled attribute on an input element. HTML <input t...
The ng-dblclick directive is useful when you want to bind a double-click event into your DOM elements. This directive accepts an expression HTML <input type="number" ng-model="num = num + 1" ng-init="num=0"> <button ng-dblclick="num++">Double...
A deadlock occurs when every member of some group of two or more threads must wait for one of the other members to do something (e.g., to release a lock) before it can proceed. Without intervention, the threads will wait forever. A pseudocode example of a deadlock-prone design is: thread_1 { ...
HTTP describes how an HTTP client, such as a web browser, sends an HTTP request via a network to an HTTP server, which then sends an HTTP response back to the client. The HTTP request is typically either a request for an online resource, such as a web page or image, but may also include additiona...
Custom Renderers let developers customize the appearance and behavior of Xamarin.Forms controls on each platform. Developers could use features of native controls. For example, we need to disable scroll in ListView. On iOS ListView is scrollable even if all items are placed on the screen and user s...
Cheatsheet DODON'TControl flow with control statementsControl flow with exceptionsKeep track of ignored (absorbed) exception by loggingIgnore exceptionRepeat exception by using throwRe-throw exception - throw new ArgumentNullException() or throw exThrow predefined system exceptionsThrow custom exce...
ng-app Sets the AngularJS section. ng-init Sets a default variable value. ng-bind Alternative to {{ }} template. ng-bind-template Binds multiple expressions to the view. ng-non-bindable States that the data isn't bindable. ng-bind-html Binds inner HTML property of an HTML element....
Retrofit2 comes with support for multiple pluggable execution mechanisms, one of them is RxJava. To use retrofit with RxJava you first need to add the Retrofit RxJava adapter to your project: compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0' then you need to add the adapter when building yo...
RxJava is handy when making serial request. If you want to use the result from one request to make another you can use the flatMap operator: api.getRepo(repoId).flatMap(repo -> api.getUser(repo.getOwnerId()) .subscribe(/*do something with the result*/);
You can use the zip operator to make request in parallel and combine the results eg: Observable.zip(api.getRepo(repoId1), api.getRepo(repoId2), (repo1, repo2) -> { //here you can combine the results }).subscribe(/*do something with the result*/);
C++11 introduced core language and standard library support for moving an object. The idea is that when an object o is a temporary and one wants a logical copy, then its safe to just pilfer o's resources, such as a dynamically allocated buffer, leaving o logically empty but still destructible and co...

Num

The most general class for number types, more precisely for rings, i.e. numbers that can be added and subtracted and multiplied in the usual sense, but not necessarily divided. This class contains both integral types (Int, Integer, Word32 etc.) and fractional types (Double, Rational, also complex n...

Page 381 of 1336