Tutorial by Examples

>>> import sys >>> a = object() >>> sys.getrefcount(a) 2 >>> b = a >>> sys.getrefcount(a) 3 >>> del b >>> sys.getrefcount(a) 2
Install haveged (example sudo apt-get install haveged) to speed up the random byte process. Then: gpg --gen-key gpg --list-keys outputs: pub 2048R/NNNNNNNN 2016-01-01 uid Name <[email protected]> sub 2048R/xxxxxxxx 2016-01-01 Then publish: gpg --keyserver pgp.mi...
var myData = [ { name: "test1", value: "ok" }, { name: "test2", value: "nok" } ] // We have to select elements (here div.samples) // and assign data. The second parameter of data() is really important, // it will determine the "key" t...
Concatenation refers to the operation of appending one sequence to another. Concat Concatenates two sequences to form one sequence. Method Syntax // Concat var numbers1 = new int[] { 1, 2, 3 }; var numbers2 = new int[] { 4, 5, 6 }; var numbers = numbers1.Concat(numbers2); // number...
Filtering refers to the operations of restricting the result set to contain only those elements that satisfy a specified condition. Where Selects values that are based on a predicate function. Method Syntax // Where var numbers = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 }; var evens = number...
A join of two data sources is the association of objects in one data source with objects that share a common attribute in another data source. Join Joins two sequences based on key selector functions and extracts pairs of values. Method Syntax // Join class Customer { public int Id ...
Projection refers to the operations of transforming an object into a new form. Select Projects values that are based on a transform function. Method Syntax // Select var numbers = new int[] { 1, 2, 3, 4, 5 }; var strings = numbers.Select(n => n.ToString()); // strings = { "1...
A sorting operation orders the elements of a sequence based on one or more attributes. OrderBy Sorts values in ascending order. Method Syntax // OrderBy var numbers = new int[] { 5, 4, 8, 2, 7, 1, 9, 3, 6 }; var ordered = numbers.OrderBy(n => n); // ordered = { 1, 2, 3, 4, 5, 6, ...
Conversion operations change the type of input objects. AsEnumerable Returns the input typed as IEnumerable. Method Syntax // AsEnumerable int[] numbers = { 1, 2, 3, 4, 5 }; var nums = numbers.AsEnumerable(); // nums: static type is IEnumerable<int> Query Syntax // Not app...
Aggregation operations computes a single value from a collection of values. Aggregate Performs a custom aggregation operation on the values of a collection. Method Syntax // Aggregate var numbers = new int[] { 1, 2, 3, 4, 5 }; var product = numbers.Aggregate(1, (acc, n) => acc * n);...
Quantifier operations return a Boolean value that indicates whether some or all of the elements in a sequence satisfy a condition. All Determines whether all the elements in a sequence satisfy a condition. Method Syntax // All var numbers = new int[] { 1, 2, 3, 4, 5 }; bool areLessThan...
Grouping refers to the operations of putting data into groups so that the elements in each group share a common attribute. GroupBy Groups elements that share a common attribute. Method Syntax // GroupBy class Order { public string Customer { get; set; } public string Descriptio...
Partitioning refers to the operations of dividing an input sequence into two sections, without rearranging the elements, and then returning one of the sections. Skip Skips elements up to a specified position in a sequence. Method Syntax // Skip var numbers = new int[] { 1, 2, 3, 4, 5 }; ...
Generation refers to creating a new sequence of values. DefaultIfEmpty Replaces an empty collection with a default valued singleton collection. Method Syntax // DefaultIfEmpty var nums = new int[0]; var numbers = nums.DefaultIfEmpty(); // numbers = { 0 } Query Syntax // Not appl...
Set operations refer to query operations that produce a result set that is based on the presence or absence of equivalent elements within the same or separate collections (or sets). Distinct Removes duplicate values from a collection. Method Syntax // Distinct var numbers = new int[] { 1,...
Two sequences whose corresponding elements are equal and which have the same number of elements are considered equal. SequenceEqual Determines whether two sequences are equal by comparing elements in a pair-wise manner. Method Syntax // SequenceEqual var numbers1 = new int[] { 1, 2, 3, 4,...
Element operations return a single, specific element from a sequence. ElementAt Returns the element at a specified index in a collection. Method Syntax // ElementAt var strings = new string[] { "zero", "one", "two", "three" }; var str = strings.E...
Tuples in Python are values separated by commas. Enclosing parentheses for inputting tuples are optional, so the two assignments a = 1, 2, 3 # a is the tuple (1, 2, 3) and a = (1, 2, 3) # a is the tuple (1, 2, 3) are equivalent. The assignment a = 1, 2, 3 is also called packing because it...
In a normal mathematical coordinate system, the point x=0, y=0 is at the lower left corner of the graph. But in the SVG coordinate system, this (0,0) point is at the top left corner of the ‘canvas’, it is sort of similar to CSS when you specify the position to absolute/fix and use top and left to co...
<rect> represents rectangle, apart from aesthetic properties like stroke and fill, rectangle shall be defined by location and size. As for the location, it is determined by the x and y attributes. The location is relative to the rectangle’s parent. And if you don’t specify the x or y attribut...

Page 317 of 1336