Tutorial by Examples: ti

A factory function is simply a function that returns an object. Factory functions do not require the use of the new keyword, but can still be used to initialize an object, like a constructor. Often, factory functions are used as API wrappers, like in the cases of jQuery and moment.js, so users do ...
Files and directories (another name for folders) are at the heart of Linux, so being able to create, view, move, and delete them from the command line is very important and quite powerful. These file manipulation commands allow you to perform the same tasks that a graphical file explorer would perfo...
By recursion let rec sumTotal list = match list with | [] -> 0 // empty list -> return 0 | head :: tail -> head + sumTotal tail The above example says: "Look at the list, is it empty? return 0. Otherwise it is a non-empty list. So it could be [1], [1; 2], [1; 2; 3] ...
You can open several content managers at the same time: with open(input_path) as input_file, open(output_path, 'w') as output_file: # do something with both files. # e.g. copy the contents of input_file into output_file for line in input_file: output_file.write(line...
Free version of SSH protocol implementation, OpenSSH is available in all the Linux distributions. It consists of the server and client packages. Installation On Debian-based Linux, you can install openssh using # apt-get install openssh-server openssh-client On RHEL/CentOS you need to use yum:...
fn foo<'a>(x: &'a u32) { // ... } This specifies that foo has lifetime 'a, and the parameter x must have a lifetime of at least 'a. Function lifetimes are usually omitted through lifetime elision: fn foo(x: &u32) { // ... } In the case that a function takes multiple ...
Using iris dataset: import sklearn.datasets iris_dataset = sklearn.datasets.load_iris() X, y = iris_dataset['data'], iris_dataset['target'] Data is split into train and test sets. To do this we use the train_test_split utility function to split both X and y (data and target vectors) randomly w...
Finding patterns in data often proceeds in a chain of data-processing steps, e.g., feature selection, normalization, and classification. In sklearn, a pipeline of stages is used for this. For example, the following code shows a pipeline consisting of two stages. The first scales the features, and t...
Different operations with data are done using special classes. Most of the classes belong to one of the following groups: classification algorithms (derived from sklearn.base.ClassifierMixin) to solve classification problems regression algorithms (derived from sklearn.base.RegressorMixin) to so...
You can download Mercurial from the project's website, and there are graphical utilities for Windows, Linux and OSX if you'd prefer that to a command line interface. Most Unix package managers include Mercurial, for example on Debian/Ubuntu: $ apt-get install mercurial You can verify Mercurial i...
Install-Package NUnit This package includes all assemblies needed to create unit tests. Tests can be executed using one of the following methods: Visual Studio Unit Test Window Console runner Third party runner that supports NUnit 3 Visual Studio Unit Test Window To execute tests using ...
A callback is a method that gets called at specific moments of an object's lifecycle (right before or after creation, deletion, update, validation, saving or loading from the database). For instance, say you have a listing that expires within 30 days of creation. One way to do that is like this: ...
setTimeout Executes a function, after waiting a specified number of milliseconds. used to delay the execution of a function. Syntax : setTimeout(function, milliseconds) or window.setTimeout(function, milliseconds) Example : This example outputs "hello" to the console after 1 secon...
import pandas as pd df = pd.DataFrame({'Sex': ['M', 'M', 'F', 'M', 'F', 'F', 'M', 'M', 'F', 'F'], 'Age': [20, 19, 17, 35, 22, 22, 12, 15, 17, 22], 'Heart Disease': ['Y', 'N', 'Y', 'N', 'N', 'Y', 'N', 'Y', 'N', 'Y']}) df Age Heart Disease Sex 0 20 ...
The unary negation (-) precedes its operand and negates it, after trying to convert it to number. Syntax: -expression Returns: a Number. Description The unary negation (-) can convert the same types / values as the unary plus (+) operator can. Values that can't be converted will evaluat...
DynamoDB is a fully managed service provided by AWS. It does not need to be installed or configured. AWS is responsible for all administrative burdens of operating, scalling and backup/restore of the distributed database.
All DATEs have a time component; however, it is customary to store dates which do not need to include time information with the hours/minutes/seconds set to zero (i.e. midnight). Use an ANSI DATE literal (using ISO 8601 Date format): SELECT DATE '2000-01-01' FROM DUAL; Convert it from a string ...
Convert it from a string literal using TO_DATE(): SELECT TO_DATE( '2000-01-01 12:00:00', 'YYYY-MM-DD HH24:MI:SS' ) FROM DUAL; Or use a TIMESTAMP literal: CREATE TABLE date_table( date_value DATE ); INSERT INTO date_table ( date_value ) VALUES ( TIMESTAMP '2000-01-01 12:00:00' ); Oracl...
Use TO_CHAR( date [, format_model [, nls_params]] ): (Note: if a format model is not provided then the NLS_DATE_FORMAT session parameter will be used as the default format model; this can be different for every session so should not be relied on. It is good practice to always specify the format mod...
When Oracle implicitly converts from a DATE to a string or vice-versa (or when TO_CHAR() or TO_DATE() are explicitly called without a format model) the NLS_DATE_FORMAT session parameter will be used as the format model in the conversion. If the literal does not match the format model then an excepti...

Page 100 of 505