Tutorial by Examples: element

NSMutableArray *myColors; int i; int count; myColors = [NSMutableArray arrayWithObjects: @"Red", @"Green", @"Blue", @"Yellow", nil]; [myColors insertObject: @"Indigo" atIndex: 1]; [myColors insertObject: @"Violet" atIndex: 3];
Remove at specific index: [myColors removeObjectAtIndex: 3]; Remove the first instance of a specific object: [myColors removeObject: @"Red"]; Remove all instances of a specific object: [myColors removeObjectIdenticalTo: @"Red"]; Remove all objects: [myColors removeAl...
NSArray *myColors = @[@"Red", @"Green", @"Blue", @"Yellow"]; // Preceding is the preferred equivalent to [NSArray arrayWithObjects:...] Getting a single item The objectAtIndex: method provides a single object. The first object in an NSArray is index 0. Si...
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>
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...
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
MATLAB supports (and encourages) vectorized operations on vectors and matrices. For example, suppose we have A and B, two n-by-m matrices and we want C to be the element-wise product of the corresponding elements (i.e., C(i,j) = A(i,j)*B(i,j)). The un-vectorized way, using nested loops is as follo...
length counts the occurences of elements a in a foldable structure t a. ghci> length [7, 2, 9] -- t ~ [] 3 ghci> length (Right 'a') -- t ~ Either e 1 -- 'Either e a' may contain zero or one 'a' ghci> length (Left "foo") -- t ~ Either String 0 ghci> length (3, True) ...
VoiceOver navigates from top-left to bottom-right, irrespective of the view hierarchy. This is usually how content is arranged in left-to-right languages since sighted individuals tend to scan the screen in an “F-shaped pattern”. VoiceOver users will expect to navigate the same way as typical users....
Most UIKit classes, including UIView, adhere to UIAccessibilityProtocol and return correct values by default. It’s easy to take for granted that a UIView set to hidden is also absent from the accessibility hierarchy and won’t be navigated by VoiceOver. While this default behavior is usually sufficie...
Adding elements: [1, 2, 3] << 4 # => [1, 2, 3, 4] [1, 2, 3].push(4) # => [1, 2, 3, 4] [1, 2, 3].unshift(4) # => [4, 1, 2, 3] [1, 2, 3] << [4, 5] # => [1, 2, 3, [4, 5]] Removing elements: array = [1, 2, 3, 4] array.pop # => 4 array # => [1, 2, 3] ...
To access tuple elements use Item1-Item8 properties. Only the properties with index number less or equal to tuple size are going to be available (i.e. one cannot access Item3 property in Tuple<T1,T2>). var tuple = new Tuple<string, int, bool, MyClass>("foo", 123, true, new MyC...
String json = "{\"name\": \"John\", \"age\":21}"; JsonObject jsonObject = new JsonParser().parse(json).getAsJsonObject(); System.out.println(jsonObject.get("name").getAsString()); //John System.out.println(jsonObject.get("age").getAs...
As long as the element is a block, and it has an explicitly set width value, margins can be used to center block elements on a page horizontally. We add a width value that is lower than the width of the window and the auto property of margin then distributes the remaining space to the left and the ...
interface IFoo { } class Foo : IFoo { } class Bar : IFoo { } var item0 = new Foo(); var item1 = new Foo(); var item2 = new Bar(); var item3 = new Bar(); var collection = new IFoo[] { item0, item1, item2, item3 }; Using OfType var foos = collection.OfType<Foo>(); // result: IEnum...
Pseudo-elements are added to selectors but instead of describing a special state, they allow you to style certain parts of a document. The content attribute is required for pseudo-elements to render; however, the attribute can have an empty value (e.g. content: ""). div::after { conte...
traverse_ executes an Applicative action for every element in a Foldable structure. It ignores the action's result, keeping only the side-effects. (For a version which doesn't discard results, use Traversable.) -- using the Writer applicative functor (and the Sum monoid) ghci> runWriter $ trave...
For the sample XML (without namespaces): This XPath, /r/e will select this element: <e a="1"/>
When defining discriminated unions you can name elements of tuple types and use these names during pattern matching. type Shape = | Circle of diameter:int | Rectangle of width:int * height:int let shapeIsTenWide = function | Circle(diameter=10) | Rectangle(width=10) -> t...

Page 3 of 15