Edited, memorised or added to reading queue

on 09-Aug-2019 (Fri)

Do you want BuboFlash to help you learning these things? Click here to log in or create user.

Flashcard 4300406131980

Tags
#cooking #english
Question
swallow (drink or food) quickly or in large mouthfuls, often audibly.
Answer

gulp

/ɡʌlp/

verb

verb: gulp; 3rd person present: gulps; past tense: gulped; past participle: gulped; gerund or present participle: gulping


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

pdf

cannot see any pdfs







Flashcard 4324937829644

Question

Write a Powershell Script to get this output ?

1 is not even

4 3 is not even

8 5 is not even

12 7 is not even

16 9 is not even

20

Answer

Examples

The following example uses the return keyword to exit a function at a specific point if a conditional is met. Odd numbers are not multiplied because the return statement exits before that statement can execute.

function MultiplyEven
{ param($number) if ($number % 2) { return "$number is not even" } $number * 2
} 1..10 | ForEach-Object {MultiplyEven -Number $_}
1 is not even
4
3 is not even
8
5 is not even
12
7 is not even
16
9 is not even
20

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
about_Return | Microsoft Docs
r the return keyword is as follows: return [<expression>] The return keyword can appear alone, or it can be followed by a value or expression, as follows: return return $a return (2 + $a) <span>Examples The following example uses the return keyword to exit a function at a specific point if a conditional is met. Odd numbers are not multiplied because the return statement exits before that statement can execute. function MultiplyEven { param($number) if ($number % 2) { return "$number is not even" } $number * 2 } 1..10 | ForEach-Object {MultiplyEven -Number $_} 1 is not even 4 3 is not even 8 5 is not even 12 7 is not even 16 9 is not even 20 In PowerShell, values can be returned even if the return keyword is not used. The results of each statement are returned. For example, the following statements return the value of the $







Flashcard 4324940188940

Question

What does this code return ?

function calculation {

param ($value)

"Please wait. Working on calculation..."

$value += 73

return $value

}

$a = calculation 14

Answer

PS> $a

Please wait. Working on calculation...

87


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
about_Return | Microsoft Docs
$a return The following statement also returns the value of $a: return $a The following example includes a statement intended to let the user know that the function is performing a calculation: <span>function calculation { param ($value) "Please wait. Working on calculation..." $value += 73 return $value } $a = calculation 14 The "Please wait. Working on calculation..." string is not displayed. Instead, it is assigned to the $a variable, as in the following example: PS> $a Please wait. Working on calculat







Flashcard 4324944121100

Question
How is the syntax for a function defined ?
Answer

Syntax

The following is the syntax for a function:

function [<scope:>]<name> [([type]$parameter1[,[type]$parameter2])]
{ param([type]$parameter1 [,[type]$parameter2]) dynamicparam {<statement list>} begin {<statement list>} process {<statement list>} end {<statement list>}
}

A function includes the following items:

  • A Function keyword
  • A scope (optional)
  • A name that you select
  • Any number of named parameters (optional)
  • One or more PowerShell commands enclosed in braces {}

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
about_Functions | Microsoft Docs
e Filter keyword. Functions can also act like cmdlets. You can create a function that works just like a cmdlet without using C# programming. For more information, see about_Functions_Advanced . <span>Syntax The following is the syntax for a function: function [<scope:>]<name> [([type]$parameter1[,[type]$parameter2])] { param([type]$parameter1 [,[type]$parameter2]) dynamicparam {<statement list>} begin {<statement list>} process {<statement list>} end {<statement list>} } A function includes the following items: A Function keyword A scope (optional) A name that you select Any number of named parameters (optional) One or more PowerShell commands enclosed in braces {} For more information about the Dynamicparam keyword and dynamic parameters in functions, see about_Functions_Advanced_Parameters . Simple Functions Functions do not have to be complicat







Flashcard 4324946480396

Question
How start a function with Run as Administrator option ?
Answer

For example, the following function starts PowerShell with the Run as Administrator option.

function Start-PSAdmin {Start-Process PowerShell -Verb RunAs}

To use the function, type: Start-PSAdmin


statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
about_Functions | Microsoft Docs
ctions_Advanced_Parameters . Simple Functions Functions do not have to be complicated to be useful. The simplest functions have the following format: function <function-name> {statements} <span>For example, the following function starts PowerShell with the Run as Administrator option. function Start-PSAdmin {Start-Process PowerShell -Verb RunAs} To use the function, type: Start-PSAdmin To add statements to the function, type each statement on a separate line, or use a semi-colon ; to separate the statements. For example, the following function finds all .jpg files in







Flashcard 4324949101836

Question
How to find all .jpg files after a start date ?
Answer

To add statements to the function, type each statement on a separate line, or use a semi-colon ; to separate the statements.

For example, the following function finds all .jpg files in the current user's directories that were changed after the start date.

function Get-NewPix
{ $start = Get-Date -Month 1 -Day 1 -Year 2010 $allpix = Get-ChildItem -Path $env:UserProfile\*.jpg -Recurse $allpix | Where-Object {$_.LastWriteTime -gt $Start}
}

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
about_Functions | Microsoft Docs
or example, the following function starts PowerShell with the Run as Administrator option. function Start-PSAdmin {Start-Process PowerShell -Verb RunAs} To use the function, type: Start-PSAdmin <span>To add statements to the function, type each statement on a separate line, or use a semi-colon ; to separate the statements. For example, the following function finds all .jpg files in the current user's directories that were changed after the start date. function Get-NewPix { $start = Get-Date -Month 1 -Day 1 -Year 2010 $allpix = Get-ChildItem -Path $env:UserProfile\*.jpg -Recurse $allpix | Where-Object {$_.LastWriteTime -gt $Start} } You can create a toolbox of useful small functions. Add these functions to your PowerShell profile, as described in about_Profiles and later in this topic. Function Names You can assign







Flashcard 4324950936844

Question
How to write a function to display all files samller than a size parameter (directories should be excluded)?
Answer

The following example is a function called Get-SmallFiles. This function has a $size parameter. The function displays all the files that are smaller than the value of the $size parameter, and it excludes directories:

function Get-SmallFiles { Param($Size) Get-ChildItem $HOME | Where-Object { $_.Length -lt $Size -and !$_.PSIsContainer }
}

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
about_Functions | Microsoft Docs
two methods. When you run the function, the value you supply for a parameter is assigned to a variable that contains the parameter name. The value of that variable can be used in the function. <span>The following example is a function called Get-SmallFiles. This function has a $size parameter. The function displays all the files that are smaller than the value of the $size parameter, and it excludes directories: function Get-SmallFiles { Param($Size) Get-ChildItem $HOME | Where-Object { $_.Length -lt $Size -and !$_.PSIsContainer } } In the function, you can use the $size variable, which is the name defined for the parameter. To use this function, type the following command: Get-SmallFiles -Size 50 You can also ente







Flashcard 4324952771852

Question
How to add the file extension .txt to a file ?
Answer

The following Get-Extension function adds the .txt file name extension to a file name that you supply:

function Get-Extension { $name = $args[0] + ".txt" $name
}
Get-Extension myTextFile
myTextFile.txt

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill
about_Functions | Microsoft Docs
the function name. Positional parameter values are assigned to the $args array variable. The value that follows the function name is assigned to the first position in the $args array, $args[0]. <span>The following Get-Extension function adds the .txt file name extension to a file name that you supply: function Get-Extension { $name = $args[0] + ".txt" $name } Get-Extension myTextFile myTextFile.txt Switch Parameters A switch is a parameter that does not require a value. Instead, you type the function name followed by the name of the switch parameter. To define a switch parameter,