Redis has a Windows port provided by 'Microsoft Open Technologies'.
You can use the msi installer found on:
https://github.com/MSOpenTech/redis/releases
After installation completes you can see 'Redis' is a Windows service (and it's status should be "Started")
To write an 'Hello world'...
If you want to use the shorthand you can make use of conditional logic with the following shorthand. Only the string 'false' will evaluate to true (2.0).
#Done in Powershell 2.0
$boolean = $false;
$string = "false";
$emptyString = "";
If($boolean){
# this does not ru...
Use the quotestar register to copy/paste between Vim and system clipboard
"*yy copies the current line into the system clipboard
"*p pastes the content of the system clipboard into Vim
Method Overriding and Overloading are two forms of polymorphism supported by Java.
Method Overloading
Method overloading (also known as static Polymorphism) is a way you can have two (or more) methods (functions) with same name in a single class. Yes its as simple as that.
public class Shape{
...
To list the dependency tree:
gem dependency
To list which gems depend on a specific gem (bundler for example)
gem dependency bundler --reverse-dependencies
One of the best features of async/await syntax is that standard try-catch coding style is possible, just like you were writing synchronous code.
const myFunc = async (req, res) => {
try {
const result = await somePromise();
} catch (err) {
// handle errors here
}
});
Here'...
Here is how to create a custom calendar. The example given is a french calendar -- so it provides many examples.
from pandas.tseries.holiday import AbstractHolidayCalendar, Holiday, EasterMonday, Easter
from pandas.tseries.offsets import Day, CustomBusinessDay
class FrBusinessCalendar(AbstractH...
Here is how to use the custom calendar.
Get the holidays between two dates
import pandas as pd
from datetime import date
# Creating some boundaries
year = 2016
start = date(year, 1, 1)
end = start + pd.offsets.MonthEnd(12)
# Creating a custom calendar
cal = FrBusinessCalendar()
# Getti...
Let's discuss with an example. From n items, in how many ways you can choose r items? You know it is denoted by . Now think of a single item.
If you don't select the item, after that you have to take r items from remaining n-1 items, which is given by .
If you select the item, after that you hav...
Email clients use different rendering engines to render HTML emails:
Apple Mail, Outlook for Mac, Android Mail and iOS Mail use WebKit
Outlook 2000/02/03 use Internet Explorer 6
Outlook 2007/10/13 use Microsoft Word
Web clients use their browser’s respective engine (e.g. Safari uses WebKit, Ch...
Tables for Layout
The structure of an HTML email file is similar to that of a web page:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello!</title>
</head>
<body>
&...
Open a raster that covers the globe and extract a subset of the raster.
import gdal
# Path to a tiff file covering the globe
# http://visibleearth.nasa.gov/view.php?id=57752
tif_name = "/path_name/land_shallow_topo_21600.tif"
# Open raster in read only mode
ds = gdal.Open(tif_n...
Viridis (named after the chromis viridis fish) is a recently developed color scheme for the Python library matplotlib (the video presentation by the link explains how the color scheme was developed and what are its main advantages). It is seamlessly ported to R.
There are 4 variants of color scheme...
Quite often there is a need to glimpse the chosen color palette. One elegant solution is the following self defined function:
color_glimpse <- function(colors_string){
n <- length(colors_string)
hist(1:n,breaks=0:n,col=colors_string)
}
An example of use
color_glimpse(...
Before we get our hands dirty with code, I feel it is necessary to understand how data is stored in firebase. Unlike relational databases, firebase stores data in JSON format. Think of each row in a relational database as a JSON object (which is basically unordered key-value pair). So the column nam...
In [1]: df = pd.DataFrame({'A': [1, 2, 3], 'B': [1.0, 2.0, 3.0], 'C': ['a', 'b', 'c'],
'D': [True, False, True]})
In [2]: df
Out[2]:
A B C D
0 1 1.0 a True
1 2 2.0 b False
2 3 3.0 c True
Getting a python list from a series:
In [3]: df['...