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>
&...
Most Rx operators take an optional scheduler on which to schedule their future iterations. If not supplied they will use their default configured scheduler. Supplying a scheduler can be useful for testing purposes in which we like to talk about virtual time instead of real time for speed of test exe...
How to read a netCDF file (.nc) with python gdal ?
import gdal
# Path of netCDF file
netcdf_fname = "/filepath/PREVIMER_WW3-GLOBAL-30MIN.nc"
# Specify the layer name to read
layer_name = "hs"
# Open netcdf file.nc with gdal
ds = gdal.Open("NETCDF:{0}:{1}".f...
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['...
Magento is a very popular eCommerce application. It offers a great deal of customization and abilities from initial install. Here are a few suggestions for optimizing a Magento installation.
Enabling Output Compression
In your .htaccess file for Magento you will find a section of text starting wit...
In order to search for packages in the databse, searching both in packages' names and descriptions:
pacman -Ss string1 string2 ...
To install a single package or list of packages (including dependencies), issue the following command:
sudo pacman -S package_name1 package_name2 ...
source
Two-element tuples
(,) is an example of a type that has a Bifunctor instance.
instance Bifunctor (,) where
bimap f g (x, y) = (f x, g y)
bimap takes a pair of functions and applies them to the tuple's respective components.
bimap (+ 2) (++ "nie") (3, "john") --> (5,...
If mapping covariantly over only the first argument, or only the second argument, is desired, then first or second ought to be used (in lieu of bimap).
first :: Bifunctor f => (a -> c) -> f a b -> f c b
first f = bimap f id
second :: Bifunctor f => (b -> d) -> f a b -> f...
A LocalDate is a date without a timezone. Consider using them when you are only concerned with the year, month, and day of month and are not interested in an exact time. For example, when we write our date of birth (such as 1960-01-01) we don't care about the timezone in which it happened.
Description:
mov copies values of bits from source argument to destination argument.
Common source/destination are registers, usually the fastest way to manipulate values with[in] CPU.
Another important group of source_of/destination_for values is computer memory.
Finally some immediate values m...
Go to File > Settings > Keymap and select the Keymaps option from:
Mac OS X
Emacs
Visual Studio
Eclise
Netbeans
Jbuilder
and others, to map the shortcuts to the wanted tool ones.
instanceof requires that the variable is of type any.
This code (try it):
class Pet { }
class Dog extends Pet {
bark() {
console.log("woof");
}
}
class Cat extends Pet {
purr() {
console.log("meow");
}
}
function example(foo: any) {
...
This error message may be produced by the OpenSSH ssh client. It means that the TCP connection between the client and the server was abnormally closed by the server immediately after being accepted. Common reasons for this message include:
The SSH server process is malfunctioning--for example, it...
This error message may be produced by the OpenSSH ssh client. It means that the TCP connection between the client and the server was closed by the server immediately after being accepted. This message generally indicates the SSH server has been configured not to accept connections from the client fo...