Tutorial by Examples

1. Install Node.js and NPM: Gulp requires Node.js and NPM, Node's package manager. Most installers include NPM with Node.js. Refer to the installation documentation or confirm it is already installed by running the following command in your terminal, npm -v // will return NPM version or error say...
A simple switch statement: switch a + b { case c: // do something case d: // do something else default: // do something entirely different } The above example is equivalent to: if a + b == c { // do something } else if a + b == d { // do something else } else { ...
A simple if statement: if a == b { // do something } Note that there are no parentheses surrounding the condition and that the opening curly brace { must be on the same line. The following will not compile: if a == b { // do something } An if statement making use of else: if...
There are a variety of undocumented methods on UIColorwhich expose alternate colors or functionality. These can be found in the UIColor private header file. I will document the use of two private methods, styleString() and _systemDestructiveTintColor(). styleString Since iOS 2.0 there is a priva...
The order of keys in Python dictionaries is arbitrary: they are not governed by the order in which you add them. For example: >>> d = {'foo': 5, 'bar': 6} >>> print(d) {'foo': 5, 'bar': 6} >>> d['baz'] = 7 >>> print(a) {'baz': 7, 'foo': 5, 'bar': 6} >&g...
Table Setup CREATE TABLE dbo.Employees ( EmployeeID INT NOT NULL PRIMARY KEY, FirstName NVARCHAR(50) NOT NULL, LastName NVARCHAR(50) NOT NULL, ManagerID INT NULL ) GO INSERT INTO Employees VALUES (101, 'Ken', 'Sánchez', NULL) INSERT INTO Employees VALUES (102, 'Keith', ...
This example comes from the official document. Suppose you have a python application using redis as backend. After writing Dockerfile, create a docker-compose.yml file like this: version: '2' services: web: build: . ports: - "5000:5000" volumes: - .:/code ...
You can add wildcards in string resources and populate them at runtime: Edit strings.xml <string name="my_string">This is %1$s</string> Format string as needed String fun = "fun"; context.getString(R.string.my_string, fun);
For full description of patterns, see SimpleDateFormat reference Date now = new Date(); long timestamp = now.getTime(); SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy", Locale.US); String dateStr = sdf.format(timestamp);
The return statement can be used to exit function and subroutine. Unlike many other programming languages it is not used to set the return value. real function f(x) real, intent(in) :: x integer :: i f = x do i = 1, 10 f = sqrt(f) - 1.0 if (f < 0) then f = -1...
Functions can modify the parameters passed to them if they are marked with the inout keyword. When passing an inout parameter to a function, the caller must add a & to the variable being passed. func updateFruit(fruit: inout Int) { fruit -= 1 } var apples = 30 // Prints "There's 3...
string[] names= { "mark", "steve", "adam" }; Ascending: Query Syntax var sortedNames = from name in names orderby name select name; Method Syntax var sortedNames = names.OrderBy(name => name); sortedNames contains the names in following ord...
Floating point numbers of type real cannot have any real value. They can represent real numbers up to certain amount of decimal digits. FORTRAN 77 guaranteed two floating point types and more recent standards guarantee at least two real types. Real variables may be declared as real x double prec...
This example shows how to create a simple notification that starts an application when the user clicks it. Specify the notification's content: NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_launcher) // notification icon .se...
Switch statement make use of partial matching. let coordinates: (x: Int, y: Int, z: Int) = (3, 2, 5) switch (coordinates) { case (0, 0, 0): // 1 print("Origin") case (_, 0, 0): // 2 print("On the x-axis.") case (0, _, 0): // 3 print("On the y-axis.") ca...
iex(1)> a = 10 10 iex(2)> b = 20 20 iex(3)> a + b 30 You can get a specific row passing the index of the row: iex(4)> v(3) 30 You can also specify an index relative to the current row: iex(5)> v(-1) # Retrieves value of row (5-1) -> 4 30 iex(6)> v(-5) # Retrieves...
The while operator iterates over a block of code until the conditional query equals false or the code is interrupted with a goto, return, break or throw statement. Syntax for while keyword: while( condition ) { code block; } Example: int i = 0; while (i++ < 5) { Console.WriteLine...
There are a couple ways you can reverse a string to make it backwards. StringBuilder/StringBuffer: String code = "code"; System.out.println(code); StringBuilder sb = new StringBuilder(code); code = sb.reverse().toString(); System.out.println(code); Char array: S...
All these are shell commands. docker-machine env to get the current default docker-machine configuration eval $(docker-machine env) to get the current docker-machine configuration and set the current shell environment up to use this docker-machine with . If your shell is set up to use a proxy, yo...
All these are shell commands If you need to log onto a running docker-machine directly, you can do that: docker-machine ssh to ssh into the default docker-machine docker-machine ssh machinename to ssh into a non-default docker-machine If you just want to run a single command, you can do so...

Page 166 of 1336