Tutorial by Examples

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...
CardView is a member of the Android Support Library, and provides a layout for cards. To add CardView to your project, add the following line to your build.gradle dependencies. compile 'com.android.support:cardview-v7:25.1.1' A number of the latest version may be found here In your layout you ...
var parts = new[] { "Foo", "Bar", "Fizz", "Buzz"}; var joined = string.Join(", ", parts); //joined = "Foo, Bar, Fizz, Buzz"
SELECT 'Hello World' FOR XML PATH('example') <example>Hello World</example>
SQL Server 2008 WITH XMLNAMESPACES ( DEFAULT 'http://www.w3.org/2000/svg', 'http://www.w3.org/1999/xlink' AS xlink ) SELECT 'example.jpg' AS 'image/@xlink:href', '50px' AS 'image/@width', '50px' AS 'image/@height' FOR XML PATH('svg') <svg xmlns:xlink="http:...
SELECT 'XPath example' AS 'head/title', 'This example demonstrates ' AS 'body/p', 'https://www.w3.org/TR/xpath/' AS 'body/p/a/@href', 'XPath expressions' AS 'body/p/a' FOR XML PATH('html') <html> <head> <title>XPath example</title> &...
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);
var wsHost = "ws://my-sites-url.com/path/to/echo-web-socket-handler"; var ws = new WebSocket(wsHost); var value = "an example message"; //onmessage : Event Listener - Triggered when we receive message form server ws.onmessage = function(message) { if (message === value...
String can be formatted to accept a padding parameter that will specify how many character positions the inserted string will use : ${value, padding} NOTE: Positive padding values indicate left padding and negative padding values indicate right padding. Left Padding A left padding of 5 (a...
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...

Page 92 of 1336