Found 989 Articles for Software & Coding

Explain AllowEmptyString() and AllowEmptyCollection() in PowerShell Advanced Function.

Chirag Nagrekar
Updated on 04-May-2020 07:04:15

3K+ Views

AllowEmptyString() attribute works with the string variable and AllowEmptyCollection() work with the array of different data types (Collection).Consider the example below. Here, we are using a mandatory variable $name which is a string and $stringarray which is a string array.function print_String{    [cmdletbinding()]    param(       [parameter(Mandatory=$True)]       [string]$name,    )    Write-Output "Writing a single string"    $name }If we get the output of the above variable it will generate an error below.PS C:\WINDOWS\system32> print_String cmdlet print_String at command pipeline position 1 Supply values for the following parameters: name: print_String : Cannot bind argument to ... Read More

Explain the Mandatory Attribute in PowerShell Advanced Function.

Chirag Nagrekar
Updated on 04-May-2020 07:01:04

347 Views

We have an example of PowerShell advanced function below and we will try to understand how mandatory parameter works.function math_Operation{    [cmdletbinding()]    param([int]$val1, [int]$val2)    Write-Host "Multiply : $($val1*$val2)"    Write-Host "Addition : $($val1+$val2)"    Write-Host "Subtraction : $($val1-$val2)"    Write-Host "Divide : $($val1+$val2)" }When you execute the above example and don’t supply values then the script won’t ask you for the values, by default it will take the values and execute the program. See the execution below.PS C:\WINDOWS\system32> math_Operation Multiply : 0 Addition : 0 Subtraction : 0 Divide : 0Even if you have mentioned two variables ($val1, ... Read More

Explain the PowerShell Advanced Function.

Chirag Nagrekar
Updated on 04-May-2020 06:56:58

531 Views

Before starting the Advance PowerShell function, assuming we know about the PowerShell function. You can check the explanation on the PowerShell function below.https://www.tutorialspoint.com/explain-the-powershell-functionHere, we will take the math function example that calculates the different types of operations. We already have a code with the simple function as shown below.function math_Operation{    param([int]$val1, [int]$val2)    Write-Host "Multiply : $($val1*$val2)"    Write-Host "Addition : $($val1+$val2)"    Write-Host "Subtraction : $($val1-$val2)"    Write-Host "Divide : $($val1+$val2)" }The above example is of the simple function. When you run the above code and run the function from the terminal and you can notice you will ... Read More

How to pass the parameters in the PowerShell function?

Chirag Nagrekar
Updated on 17-Apr-2020 12:36:16

17K+ Views

You can pass the parameters in the PowerShell function and to catch those parameters, you need to use the arguments. Generally, when you use variables outside the function, you really don’t need to pass the argument because the variable is itself a Public and can be accessible inside the function. But in some cases we need to pass the parameters to the function and below is the example explains how you can write the code for it.The single parameter passed in function, function writeName($str){    Write-Output "Hi! there .. $str" } $name = Read-Host "Enter Name" writeName($name)Here, we are passing ... Read More

Explain variable / Array scope in PowerShell function.

Chirag Nagrekar
Updated on 17-Apr-2020 12:34:31

216 Views

Generally, when the variable is declared as a Public variable or outside the function in the script (not in any other variable or condition), you don’t need to pass that value to function because the function retains the value of the variable when the variable is initialized before the function is called.Examplefunction PrintOut{    Write-Output "your Name is : $name" } $name = Read-Host "Enter your Name" PrintOutIn the above example, $name variable is declared outside the function called PrintOut. So as the variable can be read inside the function, you can directly use the variable by its name.OutputEnter your ... Read More

Explain the PowerShell Function.

Chirag Nagrekar
Updated on 17-Apr-2020 12:32:23

767 Views

Function in a PowerShell is to reduce the redundancy of the repeated codes this means codes which are repeating, bind them into a function and call the function whenever necessary, so you don’t need to write codes multiple times.ExampleLet assume, you want to perform arithmetic operations (multiply, sum, divide and subtraction) of two values 5 and 4 in one go, so you will write different operations for two values or you will assign values to the variable called $val1 and $val2 and perform various operations on them as shown below in the example.$val1 = 5 $val2 = 4 $val1 ... Read More

Difference between Product and Process in Software development

Kiran Kumar Panigrahi
Updated on 11-Jan-2023 15:47:45

9K+ Views

Product and Process are the two crucial terms in software development. The elementary difference between the two is that a "process" is a sequence of steps to be followed to create an appropriate product, while a "product" is the final outcome of the software development cycle. Read this tutorial to learn more about Product and Process in the context of software development and how they are different from each other. What is a Product? The product is the final outcome of the software development process. It is the software application or system that is being built or maintained. A product ... Read More

Difference between AI and Soft Computing

Kiran Kumar Panigrahi
Updated on 24-Nov-2022 12:35:44

3K+ Views

Both AI (Artificial Intelligence) and Soft Computing use data driven, flexible and nonsystematic tools to solve the problems. The most basic difference between AI and soft computer is that the AI is used to develop intelligent systems, whereas soft computing is used to solve real problems. In this article, we will discuss the important differences between AI and Soft Computing. But before that, let's start with some basics so that it becomes easier to understand the differences between them. What is AI? AI or Artificial Intelligence is a science which deals with making machine intelligence. According to John ... Read More

Difference between Relational Algebra and Relational Calculus

Mahesh Parahar
Updated on 16-May-2020 14:13:49

16K+ Views

Relational AlgebraRelational algebra is a procedural query language, which takes instances of relations as input and yields instances of relations as output. It uses operators to perform queries. An operator can be either unary or binary. They accept relations as their input and yield relations as their output. Relational algebra is performed recursively on a relation and intermediate results are also considered relations.The fundamental operations of relational algebra are as follows -SelectProjectUnionSet differentCartesian productRenameRelational CalculusIn contrast to Relational Algebra, Relational Calculus is a non-procedural query language, that is, it tells what to do but never explains how to do it.Relational ... Read More

Difference between Waterfall Model and RAD Model

Kiran Kumar Panigrahi
Updated on 02-Dec-2022 06:03:58

4K+ Views

The most basic difference between the waterfall model and the RAD model is that the waterfall model is a linearly-sequential life cycle model of software development in which software testing is done after the completion of all coding phases. On the other hand, RAD (Rapid Application Development) is an incremental model of software development. Read through this article to find out more about the waterfall model and the RAD model and how they are different from each other. What is Waterfall Model? Waterfall Model is the classical model of software development where each phase of software development is completed in ... Read More

Advertisements