Tutorial by Examples: ci

Modules can have a special variable named __all__ to restrict what variables are imported when using from mymodule import *. Given the following module: # mymodule.py __all__ = ['imported_by_star'] imported_by_star = 42 not_imported_by_star = 21 Only imported_by_star is imported when usi...
When working with multi-module projects, it is helpful to centralize dependencies in a single location rather than having them spread across many build files, especially for common libraries such as the Android support libraries and the Firebase libraries. One recommended way is to separate the Gra...
INSERT INTO `table_name` (`field_one`, `field_two`) VALUES ('value_one', 'value_two'); In this trivial example, table_name is where the data are to be added, field_one and field_two are fields to set data against, and value_one and value_two are the data to do against field_one and field_two resp...
If a code module does not contain Option Explicit at the top of the module, then the compiler will automatically (that is, "implicitly") create variables for you when you use them. They will default to variable type Variant. Public Sub ExampleDeclaration() someVariable = 10 ...
The method nextInt(int bound) of Random accepts an upper exclusive boundary, i.e. a number that the returned random value must be less than. However, only the nextInt method accepts a bound; nextLong, nextDouble etc. do not. Random random = new Random(); random.nextInt(1000); // 0 - 999 int num...
A Kotlin interface contains declarations of abstract methods, and default method implementations although they cannot store state. interface MyInterface { fun bar() } This interface can now be implemented by a class as follows: class Child : MyInterface { override fun bar() { ...
Different flavors of application builds can contain different resources. To create a flavor-specific resource make a directory with the lower-case name of your flavor in the src directory and add your resources in the same way you would normally. For example, if you had a flavour Development and w...
What is recursion: In general, recursion is when a function invokes itself, either directly or indirectly. For example: // This method calls itself "infinitely" public void useless() { useless(); // method calls itself (directly) } Conditions for applying recursion to a probl...
The null coalescing operator makes it easy to ensure that a method that may return null will fall back to a default value. Without the null coalescing operator: string name = GetName(); if (name == null) name = "Unknown!"; With the null coalescing operator: string name = GetN...
Running the latest Liferay CE is straightforward: Go to https://www.liferay.com/downloads. Choose a bundle among the ones listed. For beginners, the Tomcat bundle is a good choice. Click in "Download." Unzip the download package whenever you find fit. The unzipped directory will...
Substitutability is a principle in object-oriented programming introduced by Barbara Liskov in a 1987 conference keynote stating that, if class B is a subclass of class A, then wherever A is expected, B can be used instead: class A {...} class B extends A {...} public void method(A obj) {...} ...
NSAttributedString (and its mutable sibling NSMutableAttributedString) allows you to create strings that are complex in their appearance to the user. A common application is to use this to display a string and adding custom kerning / letter-spacing. This would be achieved as follows (where label ...
JavaScript will try to automatically convert variables to more appropriate types upon use. It's usually advised to do conversions explicitly (see other examples), but it's still worth knowing what conversions take place implicitly. "1" + 5 === "15" // 5 got converted to string. ...
Let's say we have an interface for logging: interface Logger { function log($message); } Now say we have two concrete implementations of the Logger interface: the FileLogger and the ConsoleLogger. class FileLogger implements Logger { public function log($message) { // Append...
While static constructors are always called before the first usage of a type it's sometimes useful to be able to force them to be called and the RuntimeHelpers class provide an helper for it: using System.Runtime.CompilerServices; // ... RuntimeHelpers.RunClassConstructor(typeof(Foo).TypeHand...
As shown in Declaring Namespaces, we can define a class in a namespace as follows: namespace MyProject\Shapes; class Rectangle { ... } To reference this class the full path (including the namespace) needs to be used: $rectangle = new MyProject\Shapes\Rectangle(); This can be shortened by ...
The current stable version of scikit-learn requires: Python (>= 2.6 or >= 3.3), NumPy (>= 1.6.1), SciPy (>= 0.9). For most installation pip python package manager can install python and all of its dependencies: pip install scikit-learn However for linux systems it is recomm...
Strings in JavaScript can be enclosed in Single quotes 'hello', Double quotes "Hello" and (from ES2015, ES6) in Template Literals (backticks) `hello`. var hello = "Hello"; var world = 'world'; var helloW = `Hello World`; // ES2015 / ES6 Strings can be created...
We can name our loops and break the specific one when necessary. outerloop: for (var i = 0;i<3;i++){ innerloup: for (var j = 0;j <3; j++){ console.log(i); console.log(j); if (j == 1){ break outerloop; } } } Output: 0 0...
If you need to remove one or more elements from a slice, or if you need to work with a sub slice of another existing one; you can use the following method. Following examples uses slice of int, but that works with all type of slice. So for that, we need a slice, from witch we will remove some ...

Page 4 of 42