Tutorial by Examples: o

Tuples can be used to return multiple values from a method without using out parameters. In the following example AddMultiply is used to return two values (sum, product). void Write() { var result = AddMultiply(25, 28); Console.WriteLine(result.Item1); Console.WriteLine(result.Item2...
Feather is an implementation of Apache Arrow designed to store data frames in a language agnostic manner while maintaining metadata (e.g. date classes), increasing interoperability between Python and R. Reading a feather file will produce a tibble, not a standard data.frame. library(feather) pat...
If you want to parse more complex command-line arguments, e.g. with optional parameters, than the best is to use google's GWT approach. All classes are public available at: https://gwt.googlesource.com/gwt/+/2.8.0-beta1/dev/core/src/com/google/gwt/util/tools/ToolBase.java An example for handling ...
The power of AppleScript lies in being able to automate many Mac applications. To find out what you can automate, you need to read an app's scripting dictionary. To do so, launch Script Editor, and select File > Open Dictionary… Once you choose an app, its dictionary will open up in a new win...
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...
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...
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...
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...
The received bytes have to be decoded with the correct character encoding to be interpreted as text: Python 3.x3.0 import urllib.request response = urllib.request.urlopen("http://stackoverflow.com/") data = response.read() encoding = response.info().get_content_charset() html = d...

Page 575 of 1038