The Repeat command, executed with the dot or period key (.), is more useful than it first appears. Once learned, you will find yourself using it often.
Command:Description.Repeat the last change10.Repeat the last change 10 times
So then, for a very simple example, if you make a change to line 1 by...
You define a keyword argument in a method by specifying the name in the method definition:
def say(message: "Hello World")
puts message
end
say
# => "Hello World"
say message: "Today is Monday"
# => "Today is Monday"
You can define multip...
2.1
Required keyword arguments were introduced in Ruby 2.1, as an improvement to keyword arguments.
To define a keyword argument as required, simply declare the argument without a default value.
def say(message:)
puts message
end
say
# => ArgumentError: missing keyword: message
say ...
You can define a method to accept an arbitrary number of keyword arguments using the double splat (**) operator:
def say(**args)
puts args
end
say foo: "1", bar: "2"
# {:foo=>"1", :bar=>"2"}
The arguments are captured in a Hash. You can manip...
C++17
A storage class specifier that hints to the compiler that a variable will be heavily used. The word "register" is related to the fact that a compiler might choose to store such a variable in a CPU register so that it can be accessed in fewer clock cycles. It was deprecated starting ...
A keyword that is part of certain integer type names.
When used alone, int is implied, so that signed, signed int, and int are the same type.
When combined with char, yields the type signed char, which is a different type from char, even if char is also signed. signed char has a range that inclu...
A type specifier that requests the unsigned version of an integer type.
When used alone, int is implied, so unsigned is the same type as unsigned int.
The type unsigned char is different from the type char, even if char is unsigned. It can hold integers up to at least 255.
unsigned can also be ...
This is very similar to using an Application subclass and overriding the attachBaseContext() method.
However, using this method, you don't need to override attachBaseContext() as this is already done in the MultiDexApplication superclass.
Extend MultiDexApplication instead of Application:
package...
Unlike a parallel for-loop (parfor), which takes the iterations of a loop and distributes them among multiple threads, a single program, multiple data (spmd) statement takes a series of commands and distributes them to all the threads, so that each thread performs the command and stores the results....
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....
Given a DataFrame with MultiIndex columns
# build an example DataFrame
midx = pd.MultiIndex(levels=[['zero', 'one'], ['x','y']], labels=[[1,1,0,],[1,0,1,]])
df = pd.DataFrame(np.random.randn(2,3), columns=midx)
In [2]: df
Out[2]:
one zero
y x ...
Start with a standard DataFrame
df = pd.DataFrame(np.random.randn(2,3), columns=['a','b','c'])
In [91]: df
Out[91]:
a b c
0 -0.911752 -1.405419 -0.978419
1 0.603888 -1.187064 -0.035883
Now to change to MultiIndex, create a MultiIndex object and assign it to df....
You can use the archivesBaseName to set the name of apk.
For example:
defaultConfig {
....
project.ext.set("archivesBaseName", "MyName-" + defaultConfig.versionName);
}
You will obtain this output.
MyName-X.X.X-release.apk
If you need to copy a database from one server to another, you have two options:
Option 1:
Store the dump file in the source server
Copy the dump file to your destination server
Load the dump file into your destination server
On the source server:
mysqldump [options] > dump.sql
On th...
To remove all elements from a Map, use the .clear() method:
map.clear();
Example:
const map = new Map([[1, 2], [3, 4]]);
console.log(map.size); // 2
map.clear();
console.log(map.size); // 0
console.log(map.get(1)); // undefined
To remove an element from a map use the .delete() method.
map.delete(key);
Example:
const map = new Map([[1, 2], [3, 4]]);
console.log(map.get(3)); // 4
map.delete(3);
console.log(map.get(3)); // undefined
This method returns true if the element existed and has been removed, otherwise fal...
To check if a key exists in a Map, use the .has() method:
map.has(key);
Example:
const map = new Map([[1, 2], [3, 4]]);
console.log(map.has(1)); // true
console.log(map.has(2)); // false
Map has three methods which returns iterators: .keys(), .values() and .entries(). .entries() is the default Map iterator, and contains [key, value] pairs.
const map = new Map([[1, 2], [3, 4]]);
for (const [key, value] of map) {
console.log(`key: ${key}, value: ${value}`);
// logs:
// ke...