Tutorial by Examples

Contains process ID of the current hosting process. PS C:\> $pid 26080
$true and $false are two variables that represent logical TRUE and FALSE. Note that you have to specify the dollar sign as the first character (which is different from C#). $boolExpr = "abc".Length -eq 3 # length of "abc" is 3, hence $boolExpr will be True if($boolExpr -eq $tr...
$null is used to represent absent or undefined value. $null can be used as an empty placeholder for empty value in arrays: PS C:\> $array = 1, "string", $null PS C:\> $array.Count 3 When we use the same array as the source for ForEach-Object, it will process all three items (i...
Variable called Output Field Separator contains string value that is used when converting an array to a string. By default $OFS = " " (a space), but it can be changed: PS C:\> $array = 1,2,3 PS C:\> "$array" # default OFS will be used 1 2 3 PS C:\> $OFS = ",.&qu...
Contains the object/item currently being processed by the pipeline. PS C:\> 1..5 | % { Write-Host "The current item is $_" } The current item is 1 The current item is 2 The current item is 3 The current item is 4 The current item is 5 $PSItem and $_ are identical and can be use...

$?

Contains status of the last operation. When there is no error, it is set to True: PS C:\> Write-Host "Hello" Hello PS C:\> $? True If there is some error, it is set to False: PS C:\> wrt-host wrt-host : The term 'wrt-host' is not recognized as the name of a cmdlet, functi...
Array of most recent error objects. The first one in the array is the most recent one: PS C:\> throw "Error" # resulting output will be in red font Error At line:1 char:1 + throw "Error" + ~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (Error:String) [], R...
Here are simplified steps (based on the official documentation) required to create a Firebase project and connect it with an Android app. Add Firebase to your app Create a Firebase project in the Firebase console and click Create New Project. Click Add Firebase to your Android app and fol...
From dataframe: mtrdd <- createDataFrame(sqlContext, mtcars) From csv: For csv's, you need to add the csv package to the environment before initiating the Spark context: Sys.setenv('SPARKR_SUBMIT_ARGS'='"--packages" "com.databricks:spark-csv_2.10:1.4.0" "sparkr-shel...
The Phalcon Incubator can be used by the community to experiment with new features or expand onto the existing Phalcon adapters, prototypes or functionalities. Anything in the Incubator can be potentially corporated into the framework. Github repository: https://github.com/phalcon/incubator
Installation via Composer The easiest way to install the Incubator is by using Composer. Install Composer and create a new composer.json file in the root of your project. |-- app |-- public | `-- index.php |-- vendor |-- composer.json Add the following content to the composer.json file. ...
Loading the Incubator into your project Add the following lines of code to your loader file $loader = new Phalcon\Loader(); $loader->registerNamespaces([ 'Phalcon' => '/path/to/your/vendor/phalcon/incubator/Library/Phalcon/', // any other namespaces you have loaded // ... ...
This is an example of a simple GET API call wrapped in a promise to take advantage of its asynchronous functionality. var get = function(path) { return new Promise(function(resolve, reject) { let request = new XMLHttpRequest(); request.open('GET', path); request.onload = resolve; ...
SQL Server 2008 R2 SET TRANSACTION ISOLATION LEVEL READ COMMITTED This isolation level is the 2nd most permissive. It prevents dirty reads. The behavior of READ COMMITTED depends on the setting of the READ_COMMITTED_SNAPSHOT: If set to OFF (the default setting) the transaction uses shared l...
Dirty reads (or uncommitted reads) are reads of rows which are being modified by an open transaction. This behavior can be replicated by using 2 separate queries: one to open a transaction and write some data to a table without committing, the other to select the data to be written (but not yet com...
Use list() to quick assign a list of variable values into an array. See also compact() // Assigns to $a, $b and $c the values of their respective array elements in $array with keys numbered from zero list($a, $b, $c) = $array; With PHP 7.1 (currently in beta) you will be able to use s...
To create a custom standalone Gradle plug-in using java (you can also use Groovy) you have to create a structure like this: plugin |-- build.gradle |-- settings.gradle |-- src |-- main | |-- java | |-- resources | |-- META-INF | |-- gradle-plugins ...
set var=10 set /a var=%var%+10 echo %var% The final value of var is 20. The second line is not working within a command block used for example on an IF condition or on a FOR loop as delayed expansion would be needed instead of standard environment variable expansion. Here is another, better w...
Foreign keys enables you to define relationship between two tables. One (parent) table need to have primary key that uniquely identifies rows in the table. Other (child) table can have value of the primary key from the parent in one of the columns. FOREIGN KEY REFERENCES constraint ensures that valu...
Let's assume that we have one row in Company table with companyId 1. We can insert row in employee table that has companyId 1: insert into Employee values (17, 'John', 1) However, we cannot insert employee that has non-existing CompanyId: insert into Employee values (17, 'John', 111111) Msg ...

Page 745 of 1336