Tutorial by Examples

Table cells can span multiple columns or rows using the colspan and rowspan attributes. These attributes can be applied to <th> and <td> elements. <table> <tr> <td>row 1 col 1</td> <td>row 1 col 2</td> <td>row 1 c...
The lang attribute is used to specify the language of element content and attribute text values: <p lang="en">The content of this element is in English.</p> <p lang="en" title="The value of this attribute is also in English.">The content of this el...
You can "overwrite" a language declaration: <p lang="en">This English sentence contains the German word <span lang="de">Hallo</span>.</p>
You can "overwrite" a parent element's language declaration by introducing any element apart from applet, base, basefont, br, frame, frameset, hr, iframe, meta, param, script (of HTML 4.0) with an own lang attribute: <p lang="en" title="An English paragraph"> ...
It’s a good practice to declare the primary language of the document in the html element: <html lang="en"> If no other lang attribute is specified in the document, it means that everything (i.e., element content and attribute text values) is in that language. If the document con...
The <section> element represents a generic section to thematically group content. Every section, typically, should be able to be identified with a heading element as a child of the section. You can use the <section> element within an <article> and vice-versa. Every section shou...
From Wikipedia: A test fixture is something used to consistently test some item, device, or piece of software. It can also enhance readability of tests by extracting common initialisation / finalisation code from the test methods themselves. Where common initialisation can be executed once in...
params allows a method parameter to receive a variable number of arguments, i.e. zero, one or multiple arguments are allowed for that parameter. static int AddAll(params int[] numbers) { int total = 0; foreach (int number in numbers) { total += number; } ret...
Object initializers are handy when you need to create an object and set a couple of properties right away, but the available constructors are not sufficient. Say you have a class public class Book { public string Title { get; set; } public string Author { get; set; } // the rest o...
Object initializers are the only way to initialize anonymous types, which are types generated by the compiler. var album = new { Band = "Beatles", Title = "Abbey Road" }; For that reason object initializers are widely used in LINQ select queries, since they provide a convenie...
The construct (?R) is equivalent to (?0) (or \g<0>) - it lets you recurse the whole pattern: <(?>[^<>]+|(?R))+> This will match properly balanced angle brackets with any text in-between the brackets, like <a<b>c<d>e>.
You can recurse into a subpattern using the following constructs (depending on the flavor), assuming n is a capturing group number, and name the name of a capturing group. (?n) \g<n> \g'0' (?&name) \g<name> \g'name' (?P>name) The following pattern: \[(?<angle>&...
The (?(DEFINE)...) construct lets you define subpatterns you may reference later through recursion. When encountered in the pattern it will not be matched against. This group should contain named subpattern definitions, which will be accessible only through recursion. You can define grammars this w...
Subpatterns can be referenced with their relative group number: (?-1) will recurse into the previous group (?+1) will recurse into the next group Also usable with the \g<N> syntax.
To pass data from the current view controller back to the previous view controller, you can use the delegate pattern. This example assumes that you have made a segue in the Interface Builder and that you set the segue identifier to showSecondViewController. The outlets and actions must also be ho...
Documentation comments are placed directly above the method or class they describe. They begin with three forward slashes ///, and allow meta information to be stored via XML. /// <summary> /// Bar method description /// </summary> public void Bar() { } Information in...
You can create a horizontal break to divide your text by placing three (or more) underscores ___ or asterisks *** or hyphens --- on their own line. You can create a horizontal break to divide your text by placing three (or more) underscores or asterisks or hyphens o...
import re precompiled_pattern = re.compile(r"(\d+)") matches = precompiled_pattern.search("The answer is 41!") matches.group(1) # Out: 41 matches = precompiled_pattern.search("Or was it 42?") matches.group(1) # Out: 42 Compiling a pattern allows it to be r...
Generators can be used to represent infinite sequences: def integers_starting_from(n): while True: yield n n += 1 natural_numbers = integers_starting_from(1) Infinite sequence of numbers as above can also be generated with the help of itertools.count. The above code cou...
The built-in function len returns the number of elements in a map m := map[string]int{} len(m) // 0 m["foo"] = 1 len(m) // 1 If a variable points to a nil map, then len returns 0. var m map[string]int len(m) // 0

Page 95 of 1336