Tutorial by Examples: l

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: ...
Shortest match: $ a='I am a string' $ echo "${a#*a}" m a string Longest match: $ echo "${a##*a}" string
Shortest match: $ a='I am a string' $ echo "${a%a*}" I am Longest match: $ echo "${a%%a*}" I
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...
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...
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.
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 ...
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...
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 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 ...
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...
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 178 of 861