Tutorial by Examples: c

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...
The figure contains all the plot elements. The main way to create a figure in matplotlib is to use pyplot. import matplotlib.pyplot as plt fig = plt.figure() You can optionally supply a number, which you can use to access a previously-created figure. If a number is not supplied, the last-create...
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: ...
First match: $ a='I am a string' $ echo "${a/a/A}" I Am a string All matches: $ echo "${a//a/A}" I Am A string Match at the beginning: $ echo "${a/#I/y}" y am a string Match at the end: $ echo "${a/%g/N}" I am a strinN Replace a pattern wi...
Project Object Model is the basic unit of Maven and defines the project structure, dependencies, etc. The following are very minimal to create a POM: project root modelVersion – should be set to 4.0.0 groupId – the ID of the project's group artifactId – the ID of the artifact (project) versi...
Inheritance is the biggest asset of the POM, where the following can be managed from super POM to child POM. dependencies developers and contributors plugin lists (including reports) plugin executions with matching ids plugin configuration The following enables the inheritance <paren...
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...
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
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...
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 ...
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...

Page 176 of 826