Tutorial by Examples: er

The result of casting a pointer to an integer using reinterpret_cast is implementation-defined, but "... is intended to be unsurprising to those who know the addressing structure of the underlying machine." int x = 42; int* p = &x; long addr = reinterpret_cast<long>(p); std::...
To enable - type: :set number or :set nu. To disable - type: :set nonumber or :set nonu. To enable enumerating relative to the cursor location - type: :set relativenumber. To disable enumerating relative to the cursor location - type: :set norelativenumber. Note: To change whether the curren...
Using dotnet new will scaffold a new console application. To scaffold other types of projects, use the -t or --type flag: dotnet new -t web dotnet restore dotnet run The available templates vary by language. C# Templates console (default) - A console application. web - An ASP.NET Core app...
By default, dotnet new creates C# projects. You can use the -l or --lang flag to scaffold projects in other languages: dotnet new -l f# dotnet restore dotnet run Currently, dotnet new supports C# and F#.
The Composite pattern is a design pattern that allows to treat a group of objects as a single instance of an object. It is one of the Gang of Four's structural design patterns. Example below demonstrate how Composite can be used to log to multiple places using single Log invocation. This approach a...
MySQL provides the following arithmetic operators OperatorNameExample+AdditionSELECT 3+5; -> 8 SELECT 3.5+2.5; -> 6.0 SELECT 3.5+2; -> 5.5-SubtractionSELECT 3-5; -> -2*MultiplicationSELECT 3 * 5; -> 15/DivisionSELECT 20 / 4; -> 5 SELECT 355 / 113; -> 3.1416 SELECT 10.0 / 0; -...
To raise a number x to a power y, use either the POW() or POWER() functions SELECT POW(2,2); => 4 SELECT POW(4,2); => 16
Use the SQRT() function. If the number is negative, NULL will be returned SELECT SQRT(16); -> 4 SELECT SQRT(-3); -> NULL
Generate a random number To generate a pseudorandom floating point number between 0 and 1, use the RAND() function Suppose you have the following query SELECT i, RAND() FROM t; This will return something like this iRAND()10.619143887068220.9384516830914230.83482678498591 Random Number in a r...
Mixins are a sort of class that is used to "mix in" extra properties and methods into a class. This is usually fine because many times the mixin classes don't override each other's, or the base class' methods. But if you do override methods or properties in your mixins this can lead to une...
5.1 This Example demonstrates how to automatically assign a value to each entry in an enum list. This will prevent two enums from having the same value by mistake. NOTE: Object.freeze browser support var testEnum = function() { // Initializes the enumerations var enumList = [ &q...
You can place an SKCameraNode into an SKScene to define which part of the scene is shown in the SKView. Think of the SKScene as a 2D world with a camera floating above it: the SKView will show what the camera 'sees'. E.g. the camera could be attached to the main character's sprite to follow the act...
The following function can be used to get some basic information about the current browser and return it in JSON format. function getBrowserInfo() { var json = "[{", /* The array containing the browser info */ info = [ navigator.userA...
MySQL offers a number of different numeric types. These can be broken down into GroupTypesInteger TypesINTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINTFixed Point TypesDECIMAL, NUMERICFloating Point TypesFLOAT, DOUBLEBit Value TypeBIT
Minimal unsigned value is always 0. TypeStorage(Bytes)Minimum Value(Signed)Maximum Value(Signed)Maximum Value(Unsigned)TINYINT1-27-12827-112728-1255SMALLINT2-215-32,768215-132,767216-165,535MEDIUMINT3-223-8,388,608223-18,388,607224-116,777,215INT4-231-2,147,483,648231-12,147,483,647232-14,294,967,2...
It's best for readability (and your sanity) to avoid escaping the escapes. That's where raw strings literals come in. (Note that some languages allow delimiters, which are preferred over strings usually. But that's another section.) They usually work the same way as this answer describes: [A] ba...
Character escaping is what allows certain characters (reserved by the regex engine for manipulating searches) to be literally searched for and found in the input string. Escaping depends on context, therefore this example does not cover string or delimiter escaping. Backslashes Saying that backsla...
Many languages allow regex to be enclosed or delimited between a couple of specific characters, usually the forward slash /. Delimiters have an impact on escaping: if the delimiter is / and the regex needs to look for / literals, then the forward slash must be escaped before it can be a literal (\/...
The easiest and quickest way to encode a Haskell data type to JSON with Aeson is using generics. {-# LANGUAGE DeriveGeneric #-} import GHC.Generics import Data.Text import Data.Aeson import Data.ByteString.Lazy First let us create a data type Person: data Person = Person { firstName :...
You should not save props into state. It is considered an anti-pattern. For example: export default class MyComponent extends React.Component { constructor() { super(); this.state = { url: '' } this.onChange = this.onChange.bind(this); ...

Page 194 of 417