Tutorial by Examples: l

The following Go file can be compiled into a continuous external collector that will query a MSSQL server database that uses the StackExchange.Exceptional schema. It will query multiple servers/databases for all exceptions since UTC 00:00 to convert the raw entries into a counter. It also uses the b...
The following demo features an <output> element's use of the [for] and [form] attributes. Keep in mind, <output> needs JavaScript in order to function. Inline JavaScript is commonly used in forms as this example demonstrates. Although the <input> elements are type="number&quot...
<output name="out1" form="form1" for="inp1 inp2"></output>
NSLog(@"Log Message!"); NSLog(@"NSString value: %@", stringValue); NSLog(@"Integer value: %d", intValue); The first argument of NSLog is an NSString containing the log message format. The rest of the parameters are used as values to substitute in place of the forma...
NSLog(@"NSLog message"); printf("printf message\n"); Output: 2016-07-16 08:58:04.681 test[46259:1244773] NSLog message printf message NSLog outputs the date, time, process name, process ID, and thread ID in addition to the log message. printf just outputs the message. N...
NSLog(@"NSLog message"); The message that gets printed by calling NSLog has the following format when viewed in Console.app: DateTimeProgram nameProcess IDThread IDMessage2016-07-1608:58:04.681test[46259:1244773]NSLog message
In classes, super.foo() will look in superclasses only. If you want to call a default implementation from a superinterface, you need to qualify super with the interface name: Fooable.super.foo(). public interface Fooable { default int foo() {return 3;} } public class A extends Object impl...
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...
To restore a file to a previous version you can use reset. git reset <sha1-of-commit> <file-name> If you have already made local changes to the file (that you do not require!) you can also use the --hard option
To recover a deleted branch you need to find the commit which was the head of your deleted branch by running git reflog You can then recreate the branch by running git checkout -b <branch-name> <sha1-of-commit> You will not be able to recover deleted branches if git's garbage col...
SELECT 'Hello World' FOR XML PATH('example') <example>Hello World</example>
string s = "Foo"; string paddedLeft = s.PadLeft(5); // paddedLeft = " Foo" (pads with spaces by default) string paddedRight = s.PadRight(6, '+'); // paddedRight = "Foo+++" string noPadded = s.PadLeft(2); // noPadded = "Foo" (original string...
var wsHost = "ws://my-sites-url.com/path/to/web-socket-handler"; var ws = new WebSocket(wsHost);
You can use a relative path to link to pages on the same website. <a href="/example">Text Here</a> The above example would go to the file example at the root directory (/) of the server. If this link was on http://example.com, the following two links would bring the user...
5.1 The reduce() method applies a function against an accumulator and each value of the array (from left-to-right) to reduce it to a single value. Array Sum This method can be used to condense all values of an array into a single value: [1, 2, 3, 4].reduce(function(a, b) { return a + b; }); ...
5.1 .some and .every allow a logical connective of Array values. While .some combines the return values with OR, .every combines them with AND. Examples for .some [false, false].some(function(value) { return value; }); // Result: false [false, true].some(function(value) { return value...
A lambda expression evaluated in a class' member function is implicitly a friend of that class: class Foo { private: int i; public: Foo(int val) : i(val) {} // definition of a member function void Test() { auto lamb = [](Foo &foo, int val) ...
Some regex flavors (Perl, PCRE, Oniguruma, Boost) only support fixed-length lookbehinds, but offer the \K feature, which can be used to simulate variable-length lookbehind at the start of a pattern. Upon encountering a \K, the matched text up to this point is discarded, and only the text matching th...
A newline can be included in a single-string or double-quoted string. Note that backslash-newline does not result in a newline, the line break is ignored. newline1=' ' newline2=" " newline3=$'\n' empty=\ echo "Line${newline1}break" echo "Line${newline2}break" ...

Page 58 of 861