optional-parameters Questions
4
Solved
I am trying to build a "type", for the Timecode convention used in Film/Animation.
I want to accommodate use cases where a user may want to initialise the object with a Timecode string go...
Recusancy asked 5/9, 2023 at 19:30
15
Solved
// opt_options is optional
function foo(a, b, opt_options) {
// opt_c, opt_d, and opt_e are read from 'opt_options', only c and d have defaults
var opt_c = 'default_for_c';
var opt_d = 'default_...
Editorial asked 7/3, 2012 at 13:31
8
As a simple example, take a class Ellipse that can return its properties such as area A, circumference C, major/minor axis a/b, eccentricity eetc. In order to get that, one obviously has to provide...
Washwoman asked 19/2, 2015 at 11:7
7
Solved
This code is not valid:
private void Foo(string optionalString = string.Empty)
{
// do foo.
}
But this code is:
private void Foo(string optionalString = "")
{
// do foo.
}
Why? Because stri...
Revenant asked 31/8, 2010 at 5:41
6
Solved
I am developing a framework, where in I am a calling stored procedure with dynamically created parameters. I am building parameter collection at the runtime.
The problem occurs when I am passing ...
Zsolway asked 3/3, 2013 at 22:10
14
Solved
C#, for example, allows using named parameters like so:
calculateBMI(70, height: 175);
I find this quite useful. How can I get a similar effect in JavaScript?
I've tried doing things like
myFuncti...
Mccrea asked 3/8, 2012 at 12:51
8
Solved
I have a Python function which takes several arguments. Some of these arguments could be omitted in some scenarios.
def some_function (self, a, b, c, d = None, e = None, f = None, g = None, h = No...
Athodyd asked 2/3, 2012 at 20:30
3
Solved
I am trying to write a VBA sub that allows optional parameters with default values. I tried the sample code from Microsoft Docs - Optional Parameters (Visual Basic) but it leads to the sub not show...
Reseau asked 8/5, 2020 at 7:24
10
Solved
Both of these generate an error saying they must be a compile-time constant:
void Foo(TimeSpan span = TimeSpan.FromSeconds(2.0))
void Foo(TimeSpan span = new TimeSpan(2000))
First of all, can so...
Epigrammatist asked 30/1, 2010 at 17:50
2
Solved
I created a formula to sort positive values.
=SORT(FILTER(A2:A, A2:A>0),1,1)
And turnd it to a named function with this formula definition, and named it SORT_POSITIVE
=SORT(FILTER(range, range&...
Nadeau asked 26/9, 2022 at 8:11
3
Solved
Edit: whilst back 2013 Jon Skeet's accepted answer was 100% correct. For anyone coming across this question now (2023) I would direct you to check Sergey.quixoticaxis.Ivanov's answer below as from ...
Piotr asked 10/1, 2013 at 1:12
4
Solved
Is it considered a bad practice to use optional parameters when using dependency injection frameworks with Constructor injection?
Example:
public class ProductsController
{
public ProductsContro...
Tohubohu asked 20/4, 2012 at 20:31
3
Solved
[HttpGet]
[Route("students")]
[SwaggerOperation(Tags = new[] { "Student" })]
[SwaggerResponse(HttpStatusCode.OK, Type = typeof(ResponseModel<IList<Student>>))]
[SwaggerResponseExample(H...
Roz asked 16/10, 2017 at 7:13
13
Solved
I'm having a problem with optional function parameter in C++
What I'm trying to do is to write function with optional parameter which is passed by reference, so that I can use it in two ways (1) an...
Deathwatch asked 12/5, 2010 at 5:49
4
Solved
Is it possible to point to a specific settings file in order to override the default settings.xml being used by maven for a single command?
Example:
mvn clean install -Dparam # -> pass specific...
Laddie asked 13/8, 2014 at 4:7
6
Solved
I would like to write a wrapper method for a webservice, the service accepts 2 mandatory and 3 optional parameters.
To have a shorter example, I would like to get the following code working
def...
Sturdy asked 9/8, 2013 at 14:28
3
Solved
I have this model:
class Text(BaseModel):
id: str
text: str = None
class TextsRequest(BaseModel):
data: list[Text]
n_processes: Union[int, None]
So I want to be able to take requests like:
{...
Yaupon asked 1/8, 2022 at 19:58
4
Solved
I don't understand optional query parameters in FastAPI. How is it different from default query parameters with a default value of None?
What is the difference between arg1 and arg2 in the example ...
Calycle asked 25/2, 2022 at 15:33
4
I got this list of coins that i want to filter with that 3 optional parameters(Currency, quantity and year)
How can I set parameters in JPQL as optional? I dont want to do 9 "if else" for checking...
Marhtamari asked 28/5, 2018 at 15:7
3
I have the following code:
from fastapi import FastAPI
from pydantic import BaseModel
app = FastAPI()
class Request(BaseModel):
user_name: str
age: int
# other unknown arguments
@app.post(&...
Hepsiba asked 28/4, 2023 at 9:44
2
Solved
The API should serve an endpoint where a user can either provide a guid, a path or a code. This is what the url scheme should look like:
api/locations?code={str}&guid={str}&path={str}
The ...
Alaniz asked 18/4, 2023 at 11:51
1
I use the repository pattern. My repository methods receive an optional IClientSessionHandle parameter which defaults to null. A part of each method prepares the filters/updates/etc., then a call i...
Braw asked 14/1, 2020 at 21:29
5
Solved
Most sites say callee as a property of Function.arguments is deprecated. But some sites go further and say the whole of Functions.argument is deprecated E.g. https://web.archive.org/web/20130313045...
Derzon asked 14/11, 2011 at 11:59
21
OK I totally forgot how to skip arguments in PHP.
Lets say I have:
function getData($name, $limit = '50', $page = '1') {
...
}
How would I call this function so that the middle parameter...
Cravat asked 30/6, 2009 at 23:31
2
Solved
I understand optional parameters, and I quite like them, but I'd just like to know a bit more about using them with an inherited interface.
Exhibit A
interface IMyInterface
{
string Get();
stri...
Symbology asked 11/11, 2011 at 13:25
1 Next >
© 2022 - 2024 — McMap. All rights reserved.