Questions tagged [parameters]

Parameters are a type of variable used in a subroutine to refer to the data provided as input to the subroutine.

A parameter is an intrinsic property of a procedure, included in its definition. For example, in many languages, a minimal procedure to add two supplied integers together and calculate the sum total would need two parameters, one for each integer. In general, a procedure may be defined with any number of parameters, or no parameters at all. If a procedure has parameters, the part of its definition that specifies the parameters is called its parameter list.

There are two ways of passing parameters to a procedure (both of them may not be available in every programming language):

  • by value: the value of a variable (or constant, etc.) is passed to the procedure and the original variable cannot be affected by the code in the procedure.
  • by reference: the reference to a variable is passed to a procedure and the variable's value can be changed in the procedure.
22681 questions
102
votes
1 answer

Possible Locations for Sequence/Picture Parameter Set(s) for H.264 Stream

I'm working on a H.264 Decoder and I'm wondering where to find the SPS and PPS. My reference literature tells me that those are NAL Units encoded in the H.264-Stream, but when I look into an example-MP4-File with IsoViewer, it says that the SPS and…
bananenbär
  • 1,125
  • 3
  • 8
  • 7
101
votes
5 answers

scala tuple unpacking

I know this question has come up many times in different ways. But it is still not clear to me. Is there a way to achieve the following. def foo(a:Int, b:Int) = {} foo(a,b) //right way to invoke foo foo(getParams) // is there a way to get this…
scout
  • 2,336
  • 4
  • 21
  • 22
101
votes
5 answers

"this" in function parameter

Looking at some code examples for HtmlHelpers, and I see declarations that look like this: public static string HelperName(this HtmlHelper htmlHelper, ...more regular params ) I can't remember seeing this type of construct anywhere else - can…
chris
  • 36,094
  • 53
  • 157
  • 237
100
votes
13 answers

PHP - include a php file and also send query parameters

I have to show a page from my php script based on certain conditions. I have an if condition and am doing an "include" if the condition is satisfied. if(condition here){ include "myFile.php?id='$someVar'"; } Now the problem is the server has a…
lostInTransit
  • 70,519
  • 61
  • 198
  • 274
98
votes
7 answers

Characters allowed in GET parameter

Which characters are allowed in GET parameters without encoding or escaping them? I mean something like this: http://www.example.org/page.php?name=XYZ What can you have there instead of XYZ? I think only the following characters: a-z…
caw
  • 30,999
  • 61
  • 181
  • 291
98
votes
9 answers

Is mixing getopts with positional parameters possible?

I want to design a shell script as a wrapper for a couple of scripts. I would like to specify parameters for myshell.sh using getopts and pass the remaining parameters in the same order to the script specified. If myshell.sh is executed…
Bharat Sinha
  • 13,973
  • 6
  • 39
  • 63
91
votes
6 answers

Initializing fields in constructor - initializer list vs constructor body

I have been working in C++ for some time now, but I am unsure about the difference between the two options: public : Thing(int _foo, int _bar): member1(_foo), member2(_bar){} and public : Thing(int _foo, int _bar){ member1 = _foo; member2 =…
gardian06
  • 1,496
  • 3
  • 20
  • 34
91
votes
7 answers

Multiple fields with same key in query params (axios request)?

So the backend (not under my control) requires a query string like this: http://example.com/?foo=5&foo=2&foo=11 But axios uses a JS object to send the request params: axios.get('http://example.com/', { foo: 5 }); And obviously an object can't have…
Markus Meskanen
  • 19,939
  • 18
  • 80
  • 119
90
votes
5 answers

use decimal values as attribute params in c#?

I've been trying to use decimal values as params for a field attribute but I get a compiler error. I found this blog post link saying it wasn't possible in .NET to use then, does anybody know why they choose this or how can I use decimal params?
rjlopes
  • 2,430
  • 4
  • 21
  • 23
90
votes
5 answers

Can I pass an argument to a VBScript (vbs file launched with cscript)?

I have this script saved in "test.vbs": Set FSO = CreateObject("Scripting.FileSystemObject") Set File = FSO.OpenTextFile(workFolder &"\test.txt", 2, True) File.Write "testing" File.Close Set File = Nothing Set FSO = Nothing Set workFolder =…
Peter
  • 1,543
  • 3
  • 13
  • 9
87
votes
3 answers

Pass multiple optional parameters to a C# function

Is there a way to set up a C# function to accept any number of parameters? For example, could you set up a function such that the following all work - x = AddUp(2, 3) x = AddUp(5, 7, 8, 2) x = AddUp(43, 545, 23, 656, 23, 64, 234, 44)
Craig Schwarze
  • 11,367
  • 15
  • 60
  • 80
87
votes
6 answers

Java generics: multiple generic parameters?

I was wondering if it's possible to write a function that accepts multiple generic types as follows: public int void myfunction(Set a, Set b) { return 5; } Set setA = new HashSet(); Set setB = new…
atp
  • 30,132
  • 47
  • 125
  • 187
87
votes
2 answers

Spring MVC How take the parameter value of a GET HTTP Request in my controller method?

In this period I am studing the Spring MVC showcase example (downloadable from STS dasboard) and I have some simple question about the Request Mapping examples: 1) In my home.jsp page I have this link:
  • AndreaNobili
    • 40,955
    • 107
    • 324
    • 596
  • 85
    votes
    8 answers

    Default parameter for value must be a compile time constant?

    This is my method signature. While trying to pass end as an optional parameter it gives me this error. What should I do to resolve this? Why isn't DateTime.MinValue a constant? public static void DatesToPeriodConverter(DateTime start, DateTime end =…
    Ankit
    • 6,554
    • 6
    • 49
    • 71
    84
    votes
    8 answers

    The builder pattern and a large number of mandatory parameters

    To date I use the following implementation of the builder pattern (as opposed to the implementation described here): public class Widget { public static class Builder { public Builder(String name, double price) { ... } public…
    speedRS
    • 1,190
    • 2
    • 10
    • 17