Archives

Archives / 2016 / July
  • Levels of measurements in statistics

    Hello everybody.

    Today I want to drop a short summary of different levels of measurrements in statistics.

    It's represented in following table:

     

     

    Difference

    Order

    Similar intervals

    Meaningful zero point

    Categorical

    Nominal

    +

    -

    -

    -

    Ordinal

    +

    +

    -

    -

    Quantitative

    Interval

    +

    +

    +

    -

    Ratio

    +

    +

    +

    +

     

    more

  • How to make pause in powershell script execution

    Hello everybody,

    today I want to make short note about how to make pause untill user press a key in PowerShell execution.

    Here it is:

      Write-Host "Press any key to continue ..."

     $x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")

    Presented code will make a pause. more

  • PowerShell built in variables

    Hello everybody,

    today I want to write few words about PowerShell variables.

    So, let's start from the simplest or with statement what is true and what is false. 

    In PS it's really not philosophical question

    $false

    $true

    The first one stands for false, and the second one for true. It is intended for logical operations in PS.

    Very usefull is Users Home directory:

    $Home

    Current directory:

    $pwd

    Information about users environment:

    $host

    If you ever need to discover which version of power shell, that you execute, you can use 

    $PSVersionTable

    Let's say that you write some kind of loop, and wonder where current item goes in, you have relieve, for this purpose you can use 

    $_ … more

  • PowerShell comparison

    Hello everybody,

    today I want to share another trick from PowerShell activities. 

    So, imagine, that you see following PowerShell code:

    "048" -eq 48

    48 -eq "048"

    What do you expect to see? True, True or True, False ....

    Here is the output:

    PS C:\sources> "048" -eq 48

    48 -eq "048"

    False

    True

    PowerShell has interesting behaviour in this case. It takes value on the right, and converts it to the value on the left. 

    For the first case PS will make following comparison:

    convert 48 to string, which will be "48". Compares "48" with "048" and produce False.

    more

  • Some power shell notes

    Hello everybody,

    today I want to share few words about powershell usage. 

    So, recently I've got some tasks which is related to usage of powershell scripts in order to automate some execution.

    One of discoveries in PowerShell for me was pipelining with usage of Where-Object. Consider following example:

    Get-ChildItem | Where-Object {$_.Name.Length -gt 10 }

    It has two parts: Get-ChildItem and Where-Object.

    Get-ChildItem will get all items in directory, and pipeline them into WhereObject, which in turn will produce as output those, which has Name longer then 10 characters. 

    Another interesting part of pipelines is that you can pipeline objects from one to another. Consider code … more