Tutorial by Examples: ci

class Car { public position: number = 0; protected speed: number = 42; move() { this.position += this.speed; } } class SelfDrivingCar extends Car { move() { // start moving around :-) super.move(); super.move(); } } ...
C# allows user-defined types to control assignment and casting through the use of the explicit and implicit keywords. The signature of the method takes the form: public static <implicit/explicit> operator <ResultingType>(<SourceType> myType) The method cannot take any more argu...
There is also an option to dynamically request components. You can do it using the $injector service: myModule.controller('myController', ['$injector', function($injector) { var myService = $injector.get('myService'); }]); Note: while this method could be used to prevent the circular depen...
If you want to calculate with BigDecimal you have to use the returned value because BigDecimal objects are immutable: BigDecimal a = new BigDecimal("42.23"); BigDecimal b = new BigDecimal("10.001"); a.add(b); // a will still be 42.23 BigDecimal c = a.add(b); // c will be ...
You can specify different application IDs or package names for each buildType or productFlavor using the applicationIdSuffix configuration attribute: Example of suffixing the applicationId for each buildType: defaultConfig { applicationId "com.package.android" minSdkVersion 17 ...
This section provides code and benchmarks for ten unique example implementations which iterate over the entries of a Map<Integer, Integer> and generate the sum of the Integer values. All of the examples have an algorithmic complexity of Θ(n), however, the benchmarks are still useful for provid...
Let's say we have the following structure: struct MY_STRUCT { int my_int; float my_float; }; We can define MY_STRUCT to omit the struct keyword so we don't have to type struct MY_STRUCT each time we use it. This, however, is optional. typedef struct MY_STRUCT MY_STRUCT; If we th...
Left association If the preceedence of two operators is equal, the associativity determines the grouping (see also the Remarks section): $a = 5 * 3 % 2; // $a now is (5 * 3) % 2 => (15 % 2) => 1 * and % have equal precedence and left associativity. Because the multiplication occurs first ...
from django.db import models, IntegerField from django.contrib.postgres.fields import ArrayField class IceCream(models.Model): scoops = ArrayField(IntegerField() # we'll use numbers to ID the scoops , size=6) # our parlor only lets you have 6 scoops When you us...
An implicit conversion allows the compiler to automatically convert an object of one type to another type. This allows the code to treat an object as an object of another type. case class Foo(i: Int) // without the implicit Foo(40) + 2 // compilation-error (type mismatch) // defines how t...
In $e:expr, the expr is called the fragment specifier. It tells the parser what kind of tokens the parameter $e is expecting. Rust provides a variety of fragment specifiers to, allowing the input to be very flexible. SpecifierDescriptionExamplesidentIdentifierx, foopathQualified namestd::collection...
docker inspect supports Go Templates via the --format option. This allows for better integration in scripts, without resorting to pipes/sed/grep traditional tools. Print a container internal IP: docker inspect --format '{{ .NetworkSettings.IPAddress }}' 7786807d8084 This is useful for direct ne...
Python 2.x2.7 To import a module through a function call, use the importlib module (included in Python starting in version 2.7): import importlib random = importlib.import_module("random") The importlib.import_module() function will also import the submodule of a package directly: c...
Pass dynamic inventory to ansible-playbook: ansible-playbook -i inventory/dyn.py -l targethost my_playbook.yml python inventory/dyn.py should print out something like this: { "_meta": { "hostvars": { "10.1.0.10": { "ansible_user": ...
sed -i s/"what to replace"/"with what to replace"/g $file We use -i to select in-place editing on the $file file. In some systems it is required to add suffix after -i flag which will be used to create backup of original file. You can add empty string like -i '' to omit the b...
Python minimally evaluates Boolean expressions. >>> def true_func(): ... print("true_func()") ... return True ... >>> def false_func(): ... print("false_func()") ... return False ... >>> true_func() or false_func() true_func(...
If the values in a container have certain operators already overloaded, std::sort can be used with specialized functors to sort in either ascending or descending order: C++11 #include <vector> #include <algorithm> #include <functional> std::vector<int> v = {5,1,2,4,3};...
git commit -m 'Fix UI bug' --date 2016-07-01 The --date parameter sets the author date. This date will appear in the standard output of git log, for example. To force the commit date too: GIT_COMMITTER_DATE=2016-07-01 git commit -m 'Fix UI bug' --date 2016-07-01 The date parameter accepts t...
pd.read_excel('path_to_file.xls', sheetname='Sheet1') There are many parsing options for read_excel (similar to the options in read_csv. pd.read_excel('path_to_file.xls', sheetname='Sheet1', header=[0, 1, 2], skiprows=3, index_col=0) # etc.
// lambda expressions can have explicitly annotated return types let floor_func = |x: f64| -> i64 { x.floor() as i64 };

Page 7 of 42