Tutorial by Examples: er

Below is example of service decorator, overriding null date returned by service. angular.module('app', []) .config(function($provide) { $provide.decorator('myService', function($delegate) { $delegate.getDate = function() { // override with actual date object return new Date(...
The standard Ada programming language is defined in the Ada Reference Manual. Interim version changes and release notes are discussed in the corresponding rationale documents. Implementations typically document their compliance with the standard in the form of a user guide and/or reference manual, f...
Map has three methods which returns iterators: .keys(), .values() and .entries(). .entries() is the default Map iterator, and contains [key, value] pairs. const map = new Map([[1, 2], [3, 4]]); for (const [key, value] of map) { console.log(`key: ${key}, value: ${value}`); // logs: // ke...
To get the numbers of elements of a Map, use the .size property: const map = new Map([[1, 2], [3, 4]]); console.log(map.size); // 2
To enable resource shrinking, set the shrinkResources property to true in your build.gradle file. android { ... buildTypes { release { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'p...
All libraries come with resources that are not necessary useful to your application. For example Google Play Services comes with translations for languages your own application don’t even support. You can configure the build.gradle file to specify which resource you want to keep. For example: de...
Using requestAnimationFrame may on some systems update at more frames per second than the 60fps. 60fps is the default rate if the rendering can keep up. Some systems will run at 120fps maybe more. If you use the following method you should only use frame rates that are integer divisions of 60 so th...
Building project dependencies can sometimes be a tedious task. Instead of publishing a package version to NPM and installing the dependency to test the changes, use npm link. npm link creates a symlink so the latest code can be tested in a local environment. This makes testing global tools and proje...
R provides two additional looping constructs, while and repeat, which are typically used in situations where the number of iterations required is indeterminate. The while loop The general form of a while loop is as follows, while (condition) { ## do something ## in loop body } whe...
Iterating over connected serial ports using System.IO.Ports; string[] ports = SerialPort.GetPortNames(); for (int i = 0; i < ports.Length; i++) { Console.WriteLine(ports[i]); } Instantiating a System.IO.SerialPort object using System.IO.Ports; SerialPort port = new SerialPort(); ...
This example is about replacing a List element while ensuring that the replacement element is at the same position as the element that is replaced. This can be done using these methods: set(int index, T type) int indexOf(T type) Consider an ArrayList containing the elements "Program sta...
A conversion that involves calling an explicit constructor or conversion function can't be done implicitly. We can request that the conversion be done explicitly using static_cast. The meaning is the same as that of a direct initialization, except that the result is a temporary. class C { std:...
static_cast can perform any implicit conversion. This use of static_cast can occasionally be useful, such as in the following examples: When passing arguments to an ellipsis, the "expected" argument type is not statically known, so no implicit conversion will occur. const double x = ...
For a class Person like: public class Person { public string Name { get; set; } public int Age { get; set; } public string Clothes { get; set; } } var person1 = new Person { Name = "Jon", Age = 20, Clothes = "some clothes" }; var person2 = new Person { Name ...
There are two basic classes of exact numeric data types - Integer, and Fixed Precision and Scale. Integer Data Types bit tinyint smallint int bigint Integers are numeric values that never contain a fractional portion, and always use a fixed amount of storage. The range and storage sizes o...
float [(n)] real These data types are used to store floating point numbers. Since these types are intended to hold approximate numeric values only, these should not be used in cases where any rounding error is unacceptable. However, if you need to handle very large numbers, or numbers with an ...
cursor timestamp hierarchyid uniqueidentifier sql_variant xml table Spatial Types
This example shows how to render text along an arc. It includes how you can add functionality to the CanvasRenderingContext2D by extending its prototype. This examples is derived from the stackoverflow answer Circular Text. Example rendering Example code The example adds 3 new text renderi...

Page 231 of 417