Tutorial by Examples: e

The Data.Map module in the containers package provides a Map structure that has both strict and lazy implementations. When using Data.Map, one usually imports it qualified to avoid clashes with functions already defined in Prelude: import qualified Data.Map as Map So we'd then prepend Map funct...
C++11 A unary operator that determines whether the evaluation of its operand can propagate an exception. Note that the bodies of called functions are not examined, so noexcept can yield false negatives. The operand is not evaluated. #include <iostream> #include <stdexcept> void f...
In Normal Mode, commands can be entered by direct key combinations (typing u to undo the last change, for example). These commands often have equivalents in 'ex' mode, accessed by typing a colon :, which drops you into a single-line buffer at the bottom of the Vim window. In 'ex' mode, after typing...
Undo Command:Descriptionuu,undoUndo the most recent change5uUndo the five most recent changes (use any number) Please be aware that in Vim, the 'most recent change' varies according to the mode you are in. If you enter Insert Mode (i) and type out an entire paragraph before dropping back to Normal...
The Repeat command, executed with the dot or period key (.), is more useful than it first appears. Once learned, you will find yourself using it often. Command:Description.Repeat the last change10.Repeat the last change 10 times So then, for a very simple example, if you make a change to line 1 by...
In Vim, these operations are handled differently from what you might be used to in almost any other modern editor or word processor (Ctrl-C, Ctrl-X, Ctrl-V). To understand, you need to know a little about registers and motions. Note: this section will not cover Visual Mode copying and cutting or ra...
C++11 C++11 introduced the [[noreturn]] attribute. It can be used for a function to indicate that the function does not return to the caller by either executing a return statement, or by reaching the end if it's body (it is important to note that this does not apply to void functions, since they d...
sqlite> SELECT TYPEOF(NULL); null sqlite> SELECT TYPEOF(42); integer sqlite> SELECT TYPEOF(3.141592653589793); real sqlite> SELECT TYPEOF('Hello, world!'); text sqlite> SELECT TYPEOF(X'0123456789ABCDEF'); blob
For booleans, SQLite uses integers 0 and 1: sqlite> SELECT 2 + 2 = 4; 1 sqlite> SELECT 'a' = 'b'; 0 sqlite> SELECT typeof('a' = 'b'); integer > CREATE TABLE Users ( Name, IsAdmin ); > INSERT INTO Users VALUES ('root', 1); > INSERT INTO Users VALUES ('john', 0); > S...
SQLite uses dynamic typing and ignores declared column types: > CREATE TABLE Test ( Col1 INTEGER, Col2 VARCHAR(2), -- length is ignored, too Col3 BLOB, Col4, -- no type required Col5 FLUFFY BUNNIES -- use whatever you want ); > ...
You define a keyword argument in a method by specifying the name in the method definition: def say(message: "Hello World") puts message end say # => "Hello World" say message: "Today is Monday" # => "Today is Monday" You can define multip...
2.1 Required keyword arguments were introduced in Ruby 2.1, as an improvement to keyword arguments. To define a keyword argument as required, simply declare the argument without a default value. def say(message:) puts message end say # => ArgumentError: missing keyword: message say ...
You can define a method to accept an arbitrary number of keyword arguments using the double splat (**) operator: def say(**args) puts args end say foo: "1", bar: "2" # {:foo=>"1", :bar=>"2"} The arguments are captured in a Hash. You can manip...
C++17 A storage class specifier that hints to the compiler that a variable will be heavily used. The word "register" is related to the fact that a compiler might choose to store such a variable in a CPU register so that it can be accessed in fewer clock cycles. It was deprecated starting ...
Returns control from a function to its caller. If return has an operand, the operand is converted to the function's return type, and the converted value is returned to the caller. int f() { return 42; } int x = f(); // x is 42 int g() { return 3.14; } int y = g(); // y is 3 If re...
A keyword that is part of certain integer type names. When used alone, int is implied, so that signed, signed int, and int are the same type. When combined with char, yields the type signed char, which is a different type from char, even if char is also signed. signed char has a range that inclu...
A type specifier that requests the unsigned version of an integer type. When used alone, int is implied, so unsigned is the same type as unsigned int. The type unsigned char is different from the type char, even if char is unsigned. It can hold integers up to at least 255. unsigned can also be ...
By "class", we mean a type that was defined using the class or struct keyword (but not enum struct or enum class). Even an empty class still occupies at least one byte of storage; it will therefore consist purely of padding. This ensures that if p points to an object of an empty class...
SQLite has no separate data type for date or time values. ISO8601 strings The built-in keywords CURRENT_DATE, CURRENT_TIME, and CURRENT_TIMESTAMP return strings in ISO8601 format: > SELECT CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP; CURRENT_DATE CURRENT_TIME CURRENT_TIMESTAMP --------...
This is very similar to using an Application subclass and overriding the attachBaseContext() method. However, using this method, you don't need to override attachBaseContext() as this is already done in the MultiDexApplication superclass. Extend MultiDexApplication instead of Application: package...

Page 643 of 1191