Tutorial by Examples

Iterators are Positions Iterators are a means of navigating and operating on a sequence of elements and are a generalized extension of pointers. Conceptually it is important to remember that iterators are positions, not elements. For example, take the following sequence: A B C The sequence co...
A common pitfall is confusing the equality comparison operators is and ==. a == b compares the value of a and b. a is b will compare the identities of a and b. To illustrate: a = 'Python is fun!' b = 'Python is fun!' a == b # returns True a is b # returns False a = [1, 2, 3, 4, 5] b = a ...
Bold Text To bold text, use the <strong> or <b> tags: <strong>Bold Text Here</strong> or <b>Bold Text Here</b> What’s the difference? Semantics. <strong> is used to indicate that the text is fundamentally or semantically important to the surrounding...
The <mark> element is new in HTML5 and is used to mark or highlight text in a document "due to its relevance in another context".1 The most common example would be in the results of a search were the user has entered a search query and results are shown highlighting the desired quer...
To mark text as inserted, use the <ins> tag: <ins>New Text</ins> To mark text as deleted, use the <del> tag: <del>Deleted Text</del> To strike through text, use the <s> tag: <s>Struck-through text here</s>
To offset text either upward or downward you can use the tags <sup> and <sub>. To create superscript: <sup>superscript here</sup> To create subscript: <sub>subscript here</sub>
Standard Collections Java Collections framework A simple way to construct a List from individual data values is to use java.utils.Arrays method Arrays.asList: List<String> data = Arrays.asList("ab", "bc", "cd", "ab", "bc", "cd"); ...
If you are using the PASSWORD_DEFAULT method to let the system choose the best algorithm to hash your passwords with, as the default increases in strength you may wish to rehash old passwords as users log in <?php // first determine if a supplied password is valid if (password_verify($plaintex...
Create password hashes using password_hash() to use the current industry best-practice standard hash or key derivation. At time of writing, the standard is bcrypt, which means, that PASSWORD_DEFAULT contains the same value as PASSWORD_BCRYPT. $options = [ 'cost' => 12, ]; $hashedPasswor...
password_verify() is the built-in function provided (as of PHP 5.5) to verify the validity of a password against a known hash. <?php if (password_verify($plaintextPassword, $hashedPassword)) { echo 'Valid Password'; } else { echo 'Invalid Password.'; } ?> All supported hashi...
Spoilers are used to hide text or images that would otherwise negatively impact another user's experience. They can be created using >! >!This is hidden until your cursor hovers on top of it This is hidden until your cursor hovers on top of it Note: This is not part of standard markup...
Markdown tables are physically represented using dash - for to separate the header row from the content ones and pipe | for columns. ColumnColumnCellCell is produced by Column | Column ------ | ------ Cell | Cell You can also populate a table in any way you want - LetterDigitCharactera4...
What follows is an excerpt from a REPL session with Common Lisp in which a "Hello, World!" function is defined and executed. See the remarks at the bottom of this page for a more thorough description of a REPL. CL-USER> (defun hello () (format t "Hello, World!~%")...
Unlike classes, which are passed by reference, structures are passed through copying: first = "Hello" second = first first += " World!" // first == "Hello World!" // second == "Hello" String is a structure, therefore it's copied on assignment. Structu...
Add the following to a file named build.xml in your project directory: <?xml version="1.0" encoding="UTF-8"?> <project name="HelloWorld" default="main"> <target name="main" description="this is target main"> ...
Add the following target in your build.xml <!-- Bootstrap ivy --> <target name="ivy.bootstrap" description="Download Apache Ivy"> <!-- Define the version to use --> <property name="ivy.version">2.4.0</property> <!-- ...
Declare a new variable with var, followed by a name, type, and value: var num: Int = 10 Variables can have their values changed: num = 20 // num now equals 20 Unless they're defined with let: let num: Int = 10 // num cannot change Swift infers the type of variable, so you don't always ha...
Properties can be added to a class or struct (technically enums too, see "Computed Properties" example). These add values that associate with instances of classes/structs: class Dog { var name = "" } In the above case, instances of Dog have a property named name of type...
Lazy stored properties have values that are not calculated until first accessed. This is useful for memory saving when the variable's calculation is computationally expensive. You declare a lazy property with lazy: lazy var veryExpensiveVariable = expensiveMethod() Often it is assigned to a retu...
Different from stored properties, computed properties are built with a getter and a setter, performing necessary code when accessed and set. Computed properties must define a type: var pi = 3.14 class Circle { var radius = 0.0 var circumference: Double { get { ret...

Page 64 of 1336