Tutorial by Examples

Most of the guidance for creating good examples for Q&A carries over into the documentation. Make it minimal and get to the point. Complications and digressions are counterproductive. Include both working code and prose explaining it. Neither one is sufficient on its own. Don't re...
Prompts If you want your code to be copy-pastable, remove prompts such as R>, >, or + at the beginning of each new line. Some Docs authors prefer to not make copy-pasting easy, and that is okay. Console output Console output should be clearly distinguished from code. Common approaches inclu...
The methods object.wait(), object.notify() and object.notifyAll() are meant to be used in a very specific way. (see http://stackoverflow.com/documentation/java/5409/wait-notify#t=20160811161648303307 ) The "Lost Notification" problem One common beginner mistake is to unconditionally cal...
// 1. Base example not using language support for covariance, dynamic type checking. class Top { public: virtual Top* clone() const = 0; virtual ~Top() = default; // Necessary for `delete` via Top*. }; class D : public Top { public: Top* clone() const override ...
// 2. Covariant result version of the base example, static type checking. class Top { public: virtual Top* clone() const = 0; virtual ~Top() = default; // Necessary for `delete` via Top*. }; class D : public Top { public: D* /* ← Covariant return */ clone() const over...
// 3. Covariant smart pointer result (automated cleanup). #include <memory> using std::unique_ptr; template< class Type > auto up( Type* p ) { return unique_ptr<Type>( p ); } class Top { private: virtual Top* virtual_clone() const = 0; public: unique_ptr&l...
Worse ViewController: // ... myMethod: function () { this.getView().lookup('myhappyfield').setValue(100); } //... View: //... items: [ { xtype: 'textfield', reference: 'myhappyfield' } ] //... Better ViewController: // ... myMethod: function () { ...
Overrides: Override file: Ext.define('MyApp.override.CornField', override: 'Ext.form.field.Text', initComponent: function () { this.callParent(arguments); this.setValue('Corn!'); } ); Use in app: { xtype: 'textfield' } Extensions: Override file: Ext...
Converts the specified string representation of a date and time to its DateTime equivalent using the specified format, culture-specific format information, and style. The format of the string representation must match the specified format exactly. The method returns a value that indicates whether th...
Return the length of the string in bytes. Since some characters may be encoded using more than one byte, if you want the length in characters see CHAR_LENGTH() Syntax: LENGTH(str) LENGTH('foobar') -- 6 LENGTH('fööbar') -- 8 -- contrast with CHAR_LENGTH(...) = 6
Return the number of characters in the string Syntax: CHAR_LENGTH(str) CHAR_LENGTH('foobar') -- 6 CHAR_LENGTH('fööbar') -- 6 -- contrast with LENGTH(...) = 8
Convert the argument to hexadecimal. This is used for strings. HEX('fööbar') -- 66F6F6626172 -- in "CHARACTER SET latin1" because "F6" is hex for ö HEX('fööbar') -- 66C3B6C3B6626172 -- in "CHARACTER SET utf8 or utf8mb4" because "C3B6" is hex for ö
Resource with same path and name may exist in more than one JAR file on the classpath. Common cases are resources following a convention or that are part of a packaging specification. Examples for such resources are META-INF/MANIFEST.MF META-INF/beans.xml (CDI Spec) ServiceLoader properties con...
Detailed instructions on getting instagram set up or installed.
const md = Rx.Observable.fromEvent(document, 'mousedown').map(true); // `md` will emit `true` whenever the mouse is pressed const mu = Rx.Observable.fromEvent(document, 'mouseup').map(false); // `mu` will emit `false` whenever the mouse is depressed
const source = Rx.Observable.range(1, 3) .map(x => x * x); const subscription = source.subscribe( x => console.log(`Next: ${x}`), err => console.log(`Error: ${err}`), () => console.log(`Completed`) ); // => Next: 1 // => Next: 4 // => Next: 9 // => Compl...
const source = Rx.Observable.range(1, 3) .map((x, idx, obs) => `Element ${x} was at position ${idx}`); const subscription = source.subscribe( x => console.log(`Next: ${x}`), err => console.log(`Error: ${err}`), () => console.log(`Completed`) ); // => Next: Element 1...
In order to get the official I18N Plugin into your CLI Project we need to install it by following the next steps. First you want to install the plugin via npm: npm install aurelia-i18n Since Aurelia-I18N is backed by i18next, you should install it and a backend plugin of your choice. As an exampl...
Often when building a Docker image, the Dockerfile contains instructions that runs programs to fetch resources from the Internet (wget for example to pull a program binary build on GitHub for example). It is possible to instruct Docker to pass set set environment variables so that such programs per...
The standard library module urllib.request can be used to download web content: from urllib.request import urlopen response = urlopen('http://stackoverflow.com/questions?sort=votes') data = response.read() # The received bytes should usually be decoded according the response's characte...

Page 755 of 1336