Tutorial by Examples: alt

The Object.freeze() method is available since version 5.1. For older versions, you can use the following code (note that it also works in versions 5.1 and later): var ColorsEnum = { WHITE: 0, GRAY: 1, BLACK: 2 } // Define a variable with a value from the enum var currentColor = Co...
You can convert a timestamp or interval value to a string with the to_char() function: SELECT to_char('2016-08-12 16:40:32'::timestamp, 'DD Mon YYYY HH:MI:SSPM'); This statement will produce the string "12 Aug 2016 04:40:32PM". The formatting string can be modified in many different wa...
Let's say we have type ENUM('fish','mammal','bird') An alternative is type TINYINT UNSIGNED plus CREATE TABLE AnimalTypes ( type TINYINT UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(20) NOT NULL COMMENT "('fish','mammal','bird')", PRIMARY KEY(type), INDEX(na...
Let's say we have type ENUM('fish','mammal','bird') An alternative is type VARCHAR(20) COMENT "fish, bird, etc" This is quite open-ended in that new types are trivially added. Comparison, and whether better or worse than ENUM: (same) INSERT: simply provide the string (worse?)...
#include <stdio.h> #include <threads.h> #include <stdlib.h> struct my_thread_data { double factor; }; int my_thread_func(void* a) { struct my_thread_data* d = a; // do something with d printf("we found %g\n", d->factor); // return an succes...
USE AdventureWorks2012; GO CREATE FULLTEXT CATALOG production_catalog; GO CREATE FULLTEXT INDEX ON Production.ProductReview ( ReviewerName Language 1033, EmailAddress Language 1033, Comments Language 1033 ) KEY INDEX PK_ProductR...
DATA: <TABLE NAME> TYPE <SORTED|STANDARD|HASHED> TABLE OF <TYPE NAME> WITH <UNIQUE|NON-UNIQUE> KEY <FIELDS FOR KEY>. Standard Table This table has all of the entries stored in a linear fashion and records are accessed in a linear way. For large table sizes, ...
<svg xmlns="http://www.w3.org/2000/svg"> <switch> <text systemLanguage="en-UK" x="10" y="10">UK English</text> <text systemLanguage="fr" x="10" y="10">Français</text> <text ...
C++11 There are a number of different type traits that compare more general types. Is Integral: Evaluates as true for all integer types int, char, long, unsigned int etc. std::cout << std::is_integral<int>::value << "\n"; // Prints true. std::cout << std::is_in...
The axis offsets for drawing the marker that are specified by refX and refY are applied before the rotation specified by the orient parameter. Below you can see the effects of various combinations of orient and refX, refY to illustrate this. <svg width="800px" height="600px"&...
The default for drawing markers is to use the stroke width of the calling element, but you can explicitly specify that markers be drawn using the unit system for the element the marker is being applied to by specifying markerUnits="userSpaceOnUse". Markers are drawn into a 3x3 markerUnits ...
Scala has a powerful type-inference mechanism built-in to the language. This mechanism is termed as 'Local Type Inference': val i = 1 + 2 // the type of i is Int val s = "I am a String" // the type of s is String def squared(x : Int) = x*x // the return type ...
Using Alternatives Many Linux distributions use the alternatives command for switching between different versions of a command. You can use this for switching between different versions of Java installed on a machine. In a command shell, set $JDK to the pathname of a newly installed JDK; e.g....
All libraries come with resources that are not necessary useful to your application. For example Google Play Services comes with translations for languages your own application don’t even support. You can configure the build.gradle file to specify which resource you want to keep. For example: de...
CREATE TABLE dbo.Employee ( [EmployeeID] int NOT NULL PRIMARY KEY CLUSTERED , [Name] nvarchar(100) NOT NULL , [Position] varchar(100) NOT NULL , [Department] varchar(100) NOT NULL , [Address] nvarchar(1024) NOT NULL , [AnnualSalary] decimal (10,2) NOT NULL ...
Will be available till the current connection persists for the user. Automatically deleted when the user disconnects. The name should start with # (#temp) CREATE TABLE #LocalTempTable( StudentID int, StudentName varchar(50), Student...
Will start with ## (##temp). Will be deleted only if user disconnects all connections. It behaves like a permanent table. CREATE TABLE ##NewGlobalTempTable( StudentID int, StudentName varchar(50), StudentAddress varchar(150)) Insert ...
Creating a temporal table with a default history table is a convenient option when you want to control naming and still rely on system to create history table with default configuration. In the example below, a new system-versioned memory-optimized temporal table linked to a new disk-based history t...
Functional tests are best described as tests for your user stories. If you've dealt with user stories before they normally follow the following pattern: As a [role], I want to [desire], so that [benefit/desired outcome] For the following examples we'll use this user story as an example: As a Du...
Let's create two simple tables: CREATE TABLE users (username text, email text); CREATE TABLE simple_users () INHERITS (users); Adding columns ALTER TABLE simple_users ADD COLUMN password text; simple_users ColumnTypeusernametextemailtextpasswordtext Adding the same column to the parent ta...

Page 3 of 6