You can use the following code for going back and forward.
if (!function_exists('mb_internal_encoding')) {
function mb_internal_encoding($encoding = NULL) {
return ($from_encoding === NULL) ? iconv_get_encoding() : iconv_set_encoding($encoding);
}
}
if (!function_exists('mb_c...
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...
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...
As ES6 introduced Symbols, which are both unique and immutable primitive values that may be used as the key of an Object property, instead of using strings as possible values for an enum, it's possible to use symbols.
// Simple symbol
const newSymbol = Symbol();
typeof newSymbol === 'symbol' // t...
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...
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
The ranges of the integer types are implementation-defined. The header <limits> provides the std::numeric_limits<T> template which provides the minimum and maximum values of all fundamental types. The values satisfy guarantees provided by the C standard through the <climits> and (&...
You can limit the number of rows to be returned by using the maxrows attribute.
<cfquery datasource="Entertainment" maxrows="50">
select *
from Movies
</cfquery>
LINQ provides a method that makes it easy to create a collection filled with sequential numbers. For example, you can declare an array which contains the integers between 1 and 100.
The Enumerable.Range method allows us to create sequence of integer numbers from a specified start position and a num...
Values passed as enum constructor arguments can be captured into variables by use of pattern matching.
Assume the following enum:
enum Color {
RGB(r : Int, g : Int, b : Int);
HSV(h : Int, s : Float, v : Float);
}
The red channel value can be captured as follows:
var color = Color.RG...
Enum constructors can be matched using pattern matching.
Assume the following enum:
enum Color {
Red;
Green;
Blue;
RGB(r : Int, g : Int, b : Int);
}
Colours with only a green channel value can be matched as follows:
var color = Color.RGB(0, 127, 0);
var isGreenOnly = swit...
The Fibonacci numbers are defined inductively as
F0 = 0
F1 = 1
Fn+2 = Fn + Fn+1
The sum of the first n+1 Fibonacci numbers is given by
F0 + F1 + F2 + ... + Fn = Fn+2 - 1.
This summation arises, among other places, in the analysis of Fibonacci heaps, where it's used to provide a lower b...
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# I want 7 days of 24 hours with 60 minutes each
periods = 7 * 24 * 60
tidx = pd.date_range('2016-07-01', periods=periods, freq='T')
# ^ ^
# | ...
public string GetCustomerNamesCsv()
{
List<CustomerData> customerDataRecords = GetCustomerData(); // Returns a large number of records, say, 10000+
StringBuilder customerNamesCsv = new StringBuilder();
foreach (CustomerData record in customerDataRecords)
{
custom...
You can define central config info's in
a separate gradle include file Centralizing dependencies via "dependencies.gradle" file
a stand alone properties file Versioning your builds via "version.properties" file
or do it with root gradle.properties file
the project structu...
Enums contains only constants and can be compared directly with ==. So, only reference check is needed, no need to use .equals method. Moreover, if .equals used incorrectly, may raise the NullPointerException while that's not the case with == check.
enum Day {
GOOD, AVERAGE, WORST;
}
publi...
The even? method can be used to determine if a number is even
4.even? # => true
5.even? # => false
The odd? method can be used to determine if a number is odd
4.odd? # => false
5.odd? # => true