Tutorial by Examples: c

NSArray *aryFName = @[ @"Alice", @"Bob", @"Charlie", @"Quentin" ]; NSArray *aryLName = @[ @"Smith", @"Jones", @"Smith", @"Alberts" ]; NSArray *aryAge = @[ @24, @27, @33, @31 ]; //Create a Custom class with prope...
A struct is a sequence of named elements, called fields, each of which has a name and a type. Empty struct has no fields, like this anonymous empty struct: var s struct{} Or like this named empty struct type: type T struct{} The interesting thing about the empty struct is that, its size is z...
For example you want to use surfaceView in ng2-nativescript. As we don't have surfaceView in nativescript we should use placeholder. first we should import the requirements: import {Component} from "@angular/core"; import placeholder = require("ui/placeholder"); let applicat...
app.component.ts: import {Component,OnInit} from "@angular/core"; import placeholder = require("ui/placeholder"); let application= require("application"); @Component({ selector: "my-app", templateUrl: "app.component.html", }) export...
If the SQL statement is constructed like this: SQL = "SELECT * FROM Users WHERE username = '" + user + "' AND password ='" + pw + "'"; db.execute(SQL); Then a hacker could retrieve your data by giving a password like pw' or '1'='1; the resulting SQL statement will ...
Define the function using the vararg keyword. fun printNumbers(vararg numbers: Int) { for (number in numbers) { println(number) } } Now you can pass as many parameters (of the correct type) into the function as you want. printNumbers(0, 1) // Prints "0&qu...
Arrays can be passed into vararg functions using the Spread Operator, *. Assuming the following function exists... fun printNumbers(vararg numbers: Int) { for (number in numbers) { println(number) } } You can pass an array into the function like so... val numbers = intArray...
Without replacement With combn, each vector appears in a column: combn(LETTERS, 3) # Showing only first 10. [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] "A" "A" "A" "A" "A" "A" "A" "A" &quo...
Below are examples of generating 5 random numbers using various probability distributions. Uniform distribution between 0 and 10 runif(5, min=0, max=10) [1] 2.1724399 8.9209930 6.1969249 9.3303321 2.4054102 Normal distribution with 0 mean and standard deviation of 1 rnorm(5, mean=0, sd=1) [1...
Without replacement choose(length(LETTERS), 5) [1] 65780 With replacement length(letters)^5 [1] 11881376
You can set the behavior of the FAB in XML. For example: <android.support.design.widget.FloatingActionButton app:layout_behavior=".MyBehavior" /> Or you can set programmatically using: CoordinatorLayout.LayoutParams p = (CoordinatorLayout.LayoutParams) fab.getLayoutPara...
Items are added to a Collection by calling its .Add method: Syntax: .Add(item, [key], [before, after]) ParameterDescriptionitemThe item to store in the Collection. This can be essentially any value that a variable can be assigned to, including primitive types, arrays, objects, and Nothing.keyO...
Items are removed from a Collection by calling its .Remove method: Syntax: .Remove(index) ParameterDescriptionindexThe item to remove from the Collection. If the value passed is a numeric type or Variant with a numeric sub-type, it will be interpreted as a numeric index. If the value passed i...
The number of items in a Collection can be obtained by calling its .Count function: Syntax: .Count() Sample Usage: Public Sub Example() Dim foo As New Collection With foo .Add "One" .Add "Two" .Add "Three" .Add...
Items can be retrieved from a Collection by calling the .Item function. Syntax: .Item(index) ParameterDescriptionindexThe item to retrieve from the Collection. If the value passed is a numeric type or Variant with a numeric sub-type, it will be interpreted as a numeric index. If the value pas...
Keys Unlike a Scripting.Dictionary, a Collection does not have a method for determining if a given key exists or a way to retrieve keys that are present in the Collection. The only method to determine if a key is present is to use the error handler: Public Function KeyExistsInCollection(ByVal key...
The easiest way to clear all of the items from a Collection is to simply replace it with a new Collection and let the old one go out of scope: Public Sub Example() Dim foo As New Collection With foo .Add "One" .Add "Two" .Add "Thre...
Using variables in a string You can concatenate strings using variables inside a double-quoted string. This does not work with properties. $string1 = "Power" $string2 = "Shell" "Greetings from $string1$string2" Using the + operator You can also join strings usin...
When used inside a double-quoted string, the escape character (backtick `) reperesents a special character. `0 #Null `a #Alert/Beep `b #Backspace `f #Form feed (used for printer output) `n #New line `r #Carriage return `t #Horizontal tab `v #Vertical tab (used for pri...
The -Command parameter is used to specify commands to be executed on launch. It supports multiple data inputs. -Command <string> You can specify commands to executed on launch as a string. Multiple semicolon ;-separated statements may be executed. >PowerShell.exe -Command "(Get-Date...

Page 501 of 826