Tutorial by Examples: a

The modules of a multi-module project are aggregated from a hierarchical structure. The root pom packing should look like: <packaging>pom</packaging> The following will be the directory structure of the project: |-- sample-app \ `-- pom.xml |-- sample-module-1 | `--...
In [15]: df = pd.DataFrame({"A":[1,1,2,3,1,1],"B":[5,4,3,4,6,7]}) In [21]: df Out[21]: A B 0 1 5 1 1 4 2 2 3 3 3 4 4 1 6 5 1 7 To get unique values in column A and B. In [22]: df["A"].unique() Out[22]: array([1, 2, 3]) In [23]: df[&qu...
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.
You can take advantage of Apache Maven's powerful features in Eclipse by installing the M2Eclipse feature. Follow these steps to install Maven in Eclipse: Open Eclipse and select Help → Install New Software… In the opened dialog, select the Add... button to add a new repository. Fill ...
For checking whether some object is of a certain class, the (binary) instanceof operator can be used since PHP version 5. The first (left) parameter is the object to test. If this variable is not an object, instanceof always returns false. If a constant expression is used, an error is thrown. The ...
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...
You can use buffers to work with multiple files. When you open a file using :e path/to/file it opens in a new buffer (the command means edit the file). New buffer that holds a temporary copy of the file. You can go to previous buffer with :bp[rev] and next buffer with :bn[ext]. You can go to a...
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...
You can use the .Net Math class to do calculations ([System.Math]) If you want to know which methods are available you can use: [System.Math] | Get-Member -Static -MemberType Methods Here are some examples how to use the Math class: PS C:\> [System.Math]::Floor(9.42) 9 PS C:\> [System....
{ echo "contents of home directory" ls ~ } > output.txt
Other examples couldn't clearly explain to me how to trigger the conditional logic. This example also shows that underlying commands will also listen to the -Confirm flag! <# Restart-Win32Computer #> function Restart-Win32Computer { [CmdletBinding(SupportsShouldProcess=$true,Conf...
The ternary operator can be thought of as an inline if statement. It consists of three parts. The operator, and two outcomes. The syntax is as follows: $value = <operator> ? <true value> : <false value> If the operator is evaluated as true, the value in the first block will be ...
It is possible to effectively apply a function (cb) which returns a promise to each element of an array, with each element waiting to be processed until the previous element is processed. function promiseForEach(arr, cb) { var i = 0; var nextPromise = function () { if (i >= arr.leng...
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...
Schedulers are an RxJava abstraction about processing unit. A scheduler can be backed by a Executor service, but you can implement your own scheduler implementation. A Scheduler should meet this requirement : Should process undelayed task sequencially (FIFO order) Task can be delayed A Sched...
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&quot...
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...
Clojure uses prefix notation, that is: The operator comes before its operands. For example, a simple sum of two numbers would be: (+ 1 2) ;; => 3 Macros allow you to manipulate the Clojure language to a certain degree. For example, you could implement a macro that let you write code in infi...

Page 234 of 1099