Tutorial by Examples: com

Single-line comments in Lua start with -- and continue until the end of line: -- this is single line comment -- need another line -- huh? Block comments start with --[[ and end with ]]: --[[ This is block comment. So, it can go on... and on... and on.... ]] Block comme...
Razor has its own comment syntax which begins with @* and ends with *@. Inline Comment: <h1>Comments can be @*hi!*@ inline</h1> Multi-line Comment: @* Comments can spread over multiple lines *@ HTML Comment You can also use the normal HTML comment syntax starting with &...
SQL TermsMongoDB TermsDatabaseDatabaseTableCollectionEntity / RowDocumentColumnKey / FieldTable JoinEmbedded DocumentsPrimary KeyPrimary Key (Default key _id provided by mongodb itself)
- (void)reachabilityChanged:(NSNotification *)note { Reachability* reachability = [note object]; NetworkStatus netStatus = [reachability currentReachabilityStatus]; if (netStatus == NotReachable) { NSLog(@"Network unavailable"); } }
- (void)reachabilityChanged:(NSNotification *)note { Reachability* reachability = [note object]; NetworkStatus netStatus = [reachability currentReachabilityStatus]; switch (netStatus) { case NotReachable: NSLog(@"Network unavailable"); br...
Many IDEs provide support for generating HTML from Javadocs automatically; some build tools (Maven and Gradle, for example) also have plugins that can handle the HTML creation. However, these tools are not required to generate the Javadoc HTML; this can be done using the command line javadoc tool. ...
// Java: String joined = things.stream() .map(Object::toString) .collect(Collectors.joining(", ")); // Kotlin: val joined = things.joinToString() // ", " is used as separator, by default
// Java: int total = employees.stream() .collect(Collectors.summingInt(Employee::getSalary))); // Kotlin: val total = employees.sumBy { it.salary }
// Java: Map<Department, Integer> totalByDept = employees.stream() .collect(Collectors.groupingBy(Employee::getDepartment, Collectors.summingInt(Employee::getSalary))); // Kotlin: val totalByDept = employees.groupBy { it.dept }.mapValues { it.v...
If you want to graph two series on one graph, you can use the Merge function. This can also be combined with the Series function to manipulate the Y axis (like forcing it to start at zero). template graph.template { subject = ... body = `{{template "header" .}} <stro...
In case you have reverted back to a past commit and lost a newer commit you can recover the lost commit by running git reflog Then find your lost commit, and reset back to it by doing git reset HEAD --hard <sha1-of-commit>
In case you have accidentally commited a delete on a file and later realized that you need it back. First find the commit id of the commit that deleted your file. git log --diff-filter=D --summary Will give you a sorted summary of commits which deleted files. Then proceed to restore the file b...
Variable substitutions should only be used inside double quotes. calculation='2 * 3' echo "$calculation" # prints 2 * 3 echo $calculation # prints 2, the list of files in the current directory, and 3 echo "$(($calculation))" # prints 6 Outside of doubl...
if [[ $file1 -ef $file2 ]]; then echo "$file1 and $file2 are the same file" fi “Same file” means that modifying one of the files in place affects the other. Two files can be the same even if they have different names, for example if they are hard links, or if they are symbolic links...
Numerical comparisons use the -eq operators and friends if [[ $num1 -eq $num2 ]]; then echo "$num1 == $num2" fi if [[ $num1 -le $num2 ]]; then echo "$num1 <= $num2" fi There are six numeric operators: -eq equal -ne not equal -le less or equal -lt less than ...
String comparison uses the == operator between quoted strings. The != operator negates the comparison. if [[ "$string1" == "$string2" ]]; then echo "\$string1 and \$string2 are identical" fi if [[ "$string1" != "$string2" ]]; then echo &quot...
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...
In a normal string, the backslash character is the escape character, which instructs the compiler to look at the next character(s) to determine the actual character in the string. (Full list of character escapes) In verbatim strings, there are no character escapes (except for "" which is ...
Compiler warnings can be generated using the #warning directive, and errors can likewise be generated using the #error directive. #if SOME_SYMBOL #error This is a compiler Error. #elif SOME_OTHER_SYMBOL #warning This is a compiler Warning. #endif
Line #line controls the line number and filename reported by the compiler when outputting warnings and errors. void Test() { #line 42 "Answer" #line filename "SomeFile.cs" int life; // compiler warning CS0168 in "SomeFile.cs" at Line 42 #line defa...

Page 4 of 65