It is possible to define one's own general entities. The declaration occurs in the DTD subset, with a name and the associated replacement text.
It can then be used in the document using the entity reference syntax &...;, either in text, or in attribute values.
<?xml version="1.0"?...
Bash indirection permits to get the value of a variable whose name is contained in another variable. Variables example:
$ red="the color red"
$ green="the color green"
$ color=red
$ echo "${!color}"
the color red
$ color=green
$ echo "${!color}"
the ...
${parameter:-word}
If parameter is unset or null, the expansion of word is substituted.
Otherwise, the value of parameter is substituted.
$ unset var
$ echo "${var:-XX}" # Parameter is unset -> expansion XX occurs
XX
$ var="" # Parameter is null ...
1. URLByDeletingPathExtension:
If the receiver represents the root path, this property contains a copy of the original URL. If the URL has multiple path extensions, only the last one is removed.
2. URLByAppendingPathExtension:
Returns a new URL made by appending a path extension to the original U...
To create a JAR containing all of its dependencies, it is possible to use the built-in descriptor format jar-with-dependencies. The following example configures an execution of the Assembly Plugin bound to the package phase, using this built-in descriptor and declaring a main class of com.example:
...
An erlang module is a file with couple of functions grouped together. This file usually has .erl extension.
A "Hello World" module with name hello.erl is shown below
-module(hello).
-export([hello_world/0]).
hello_world() ->
io:format("Hello, World!~n", []).
In the...
Creates a image representing a linear gradient of colors.
linear-gradient( 0deg, red, yellow 50%, blue);
This creates a gradient going from bottom to top, with colors starting at red, then yellow at 50%, and finishing in blue.
An operator can be used to manipulate the flow of objects from Observable to Subscriber.
Observable<Integer> integerObservable = Observable.just(1, 2, 3); // creating a simple Integer observable
Subscriber<String> mSubscriber = new Subscriber<String>() {
@Override
publi...
Following example illustrate the simplest Hello World in groovy using script, place the following code snippet in a file, say helloWorld.groovy
println 'Hello World!'
How to execute:
In the command line, groovy helloWorld.groovy
Output:
Hello World!
Commands have one input (STDIN) and two kinds of outputs, standard output (STDOUT) and standard error (STDERR).
For example:
STDIN
root@server~# read
Type some text here
Standard input is used to provide input to a program.
(Here we're using the read builtin to read a line from STDIN.)
STDO...
If you want to see the generated bytecode for a Java program, you can use the provided javap command to view it.
Assuming that we have the following Java source file:
package com.stackoverflow.documentation;
import org.springframework.stereotype.Service;
import java.io.IOException;
import j...
The ember data models have a toJSON method that extracts the relevant data:
console.log(model.toJSON());
This method uses the JSONSerializer to create the JSON representation.
If you want to log the data in a more app-specific way, you can use serialize:
model.serialize();
which uses the se...
Ember has a static global method called runInDebug which can run a function meant for debugging.
Ember.runInDebug(() => {
// this code only runs in dev mode
});
In a production build, this method is defined as an empty function (NOP). Uses of this method in Ember itself are stripped from ...
import pandas as pd
df = pd.DataFrame({'gender': ["male", "female","female"],
'id': [1, 2, 3] })
>>> df
gender id
0 male 1
1 female 2
2 female 3
To encode the male to 0 and female to 1:
df.loc[df["gender"...
import pandas as pd
df = pd.DataFrame(np.random.randn(5, 5), columns=list('ABCDE'))
To generate various summary statistics. For numeric values the number of non-NA/null values (count), the mean (mean), the standard deviation std and values known as the five-number summary :
min: minimum (smal...
Supported by IE11+
View Result
Use these 3 lines to vertical align practically everything. Just make sure the div/image you apply the code to has a parent with a height.
CSS
div.vertical {
position: relative;
top: 50%;
transform: translateY(-50%);
}
HTML
<div class="vertica...
DefaultIfEmpty is used to return a Default Element if the Sequence contains no elements. This Element can be the Default of the Type or a user defined instance of that Type. Example:
var chars = new List<string>() { "a", "b", "c", "d" };
chars.Defaul...