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...
C++11
A keyword denoting a null pointer constant. It can be converted to any pointer or pointer-to-member type, yielding a null pointer of the resulting type.
Widget* p = new Widget();
delete p;
p = nullptr; // set the pointer to null after deletion
Note that nullptr is not itself a pointer. ...
C++11
C++11 introduced the [[noreturn]] attribute.
It can be used for a function to indicate that the function does not return to the caller by either executing a return statement, or by reaching the end if it's body (it is important to note that this does not apply to void functions, since they d...
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 ...
Returns control from a function to its caller.
If return has an operand, the operand is converted to the function's return type, and the converted value is returned to the caller.
int f() {
return 42;
}
int x = f(); // x is 42
int g() {
return 3.14;
}
int y = g(); // y is 3
If re...
Automapper can be installed from nuget running the following command in Package Manager Console:
Install-Package AutoMapper
Then it can be included in different files within the project it has been installed to by using directives:
using AutoMapper;
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....
Dependencies can be added for specific product flavors in a similar fashion as build configurations.
android {
...
productFlavors {
flavor1 {
//...
}
flavor2 {
//...
}
}
}
dependencies {
flavor1Compile 'com.and...
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
-- File counter.vhd
-- The entity is the interface part. It has a name and a set of input / output
-- ports. Ports have a name, a direction and a type. The bit type has only two
-- values: '0' and '1'. It is one of the standard types.
entity counter is
port(
clock: in bit; -- We ...
There are many ways to print the classical "Hello world!" message in VHDL. The simplest of all is probably something like:
-- File hello_world.vhd
entity hello_world is
end entity hello_world;
architecture arc of hello_world is
begin
assert false report "Hello world!&quo...
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...