Tutorial by Examples: and

UITextView has built in support to auto detect a variety of data. The data that is able to be auto-detected currently includes: enum { UIDataDetectorTypePhoneNumber = 1 << 0, UIDataDetectorTypeLink = 1 << 1, UIDataDetectorTypeAddress = 1 << 2, UID...
Variables can be incremented or decremented by 1 with ++ or --, respectively. They can either precede or succeed variables and slightly vary semantically, as shown below. $i = 1; echo $i; // Prints 1 // Pre-increment operator increments $i by one, then returns $i echo ++$i; // Prints 2 // P...
ElementAt will return the item at index n. If n is not within the range of the enumerable, throws an ArgumentOutOfRangeException. int[] numbers = { 1, 2, 3, 4, 5 }; numbers.ElementAt(2); // 3 numbers.ElementAt(10); // throws ArgumentOutOfRangeException ElementAtOrDefault will return the item...
Install haveged (example sudo apt-get install haveged) to speed up the random byte process. Then: gpg --gen-key gpg --list-keys outputs: pub 2048R/NNNNNNNN 2016-01-01 uid Name <[email protected]> sub 2048R/xxxxxxxx 2016-01-01 Then publish: gpg --keyserver pgp.mi...
Tuples in Python are values separated by commas. Enclosing parentheses for inputting tuples are optional, so the two assignments a = 1, 2, 3 # a is the tuple (1, 2, 3) and a = (1, 2, 3) # a is the tuple (1, 2, 3) are equivalent. The assignment a = 1, 2, 3 is also called packing because it...
Components in Vue are like widgets. They allow us to write reusable custom elements with desired behavior. They are nothing but objects which can contain any/all of the options that the root or any Vue instance can contain, including an HTML template to render. Components consist of: HTML marku...
The command prompt comes pre-installed on all Windows NT, Windows CE, OS/2 and eComStation operating systems, and exists as cmd.exe, typically located in C:\Windows\system32\cmd.exe On Windows 7 the fastest ways to open the command prompt are: Press , type "cmd" and then press Enter....
Preface You'll need node >= 4 and express 4 for this project. You can get the latest node distribution from their download page. Before this tutorial, you should initialize your node project by running $ npm init from the command line and filling in the information you want. Note that you c...
Redux is the most common state management library used with React-Native. The following example demonstrates how to use the fetch API and dispatch changes to your applications state reducer using redux-thunk. export const fetchRecipes = (action) => { return (dispatch, getState) => { f...
GridViews allow commands to be sent from a GridView row. This is useful for passing row-specific information into an event handler as command arguments. To subscribe to a command event: <asp:GridView ID="GridView1" ... OnRowCommand="GridView1_RowCommand"> Buttons are t...
User input Imagine you want a user to enter a number via input. You want to ensure that the input is a number. You can use try/except for this: Python 3.x3.0 while True: try: nb = int(input('Enter a number: ')) break except ValueError: print('This is not a num...
Func provides a holder for parameterised anonymous functions. The leading types are the inputs and the last type is always the return value. // square a number. Func<double, double> square = (x) => { return x * x; }; // get the square root. // note how the signature matches the built ...
Functions have two built-in methods that allow the programmer to supply arguments and the this variable differently: call and apply. This is useful, because functions that operate on one object (the object that they are a property of) can be repurposed to operate on another, compatible object. Addi...
int a = 6; // 0110b (0x06) int b = 10; // 1010b (0x0A) int c = a & b; // 0010b (0x02) std::cout << "a = " << a << ", b = " << b << ", c = " << c << std::endl; Output a = 6, b = 10, c = 2 Why A bit wise A...
Some API calls can succeed or fail in more than one way. The APIs commonly return additional information for both successful invocations as well as errors (e.g. CreateMutex). if ( CreateMutexW( NULL, TRUE, L"Global\\MyNamedMutex" ) == NULL ) { // Failure: get additional information. ...
ceil() The ceil() method rounds a number upwards to the nearest integer, and returns the result. Syntax: Math.ceil(n); Example: console.log(Math.ceil(0.60)); // 1 console.log(Math.ceil(0.40)); // 1 console.log(Math.ceil(5.1)); // 6 console.log(Math.ceil(-5.1)); // -5 console.log(Math....
1. Target a device by serial number Use the -s option followed by a device name to select on which device the adb command should run. The -s options should be first in line, before the command. adb -s <device> <command> Example: adb devices List of devices attached emulator-55...
HTML also provides the tables with the <thead>, <tbody>, <tfoot>, and <caption> elements. These additional elements are useful for adding semantic value to your tables and for providing a place for separate CSS styling. When printing out a table that doesn't fit onto one (pa...
Useful if your program is outputting web pages along the way. from http.server import HTTPServer, CGIHTTPRequestHandler import webbrowser import threading def start_server(path, port=8000): '''Start a simple webserver serving path on port''' os.chdir(path) httpd = HTTPServer((''...
Say you have implemented some logic to detect attempts to modify an object in the database while the client that submitted changes didn't have the latest modifications. If such case happens, you raise a custom exception ConfictError(detailed_message). Now you want to return an HTTP 409 (Confict) st...

Page 36 of 153