1,449 questions
-2 votes
2 answers
226 views
Optional const by-reference argument in C++
In a C++ program, I have an API function with the following signature: Foo const & GetFoo() const; The Foo class doesn’t allow copying or moving of instances. The API can’t easily be changed. Now ...
1 vote
0 answers
43 views
Overloading Powerbuilder Native functions, optional parameters
We've been plagued for years by the GetFileOpenName and GetFileSaveName functions that open Windows dialog boxes. When the user closes them, the application's current directory has changed. Afterward, ...
1 vote
0 answers
23 views
How can I call different types of an agent in source block (or any other blocks in process modeling library?
I want to define an agent with two different types, A and B and then I want to separate each type and do some calculation of each type. for this aim, I defined an agent, called Product. Then I defined ...
0 votes
1 answer
161 views
typer.Option in python
I have a typer cli command like this: @app.command( no_args_is_help=True, help="Test command help text" ) def test(name:str = typer.Option( None, "--test", ...
4 votes
1 answer
70 views
Pass an optional argument to a custom function for use both directly and in an ellipsis construct
Sometimes I write functions that involve renaming/relabeling a lot of variables in different places, using a relabeller. The relabeller is used in multiple contexts, both directly in my code (e.g. for ...
1 vote
2 answers
105 views
Pass an optional argument to ggplot inside a custom function
I have a custom function that calls ggplot. I'd like to make one of the ggplot arguments optional - for example, changing the color of geom_point. I know two ways to do this, as shown below; one is to ...
0 votes
1 answer
55 views
Argument Not Optional is not working. How can I fix?
I am trying to iteratively generate project sheets row by row in an excel. Some columns have long descriptions so wrote an additional sub function to handle the long text strings. I believe an error ...
2 votes
1 answer
100 views
How to convert a class with all Optional fields to a class with no optional fields
I have a class with many many fields, all of which are Optional when deserialized from JSON. Is there a way to convert this to a class with matching all non-Optional types. My optional class @...
0 votes
2 answers
97 views
Writing custom ggplot function with optional facet plot arguments
I am trying to create a customized function that uses ggplot facet_wrap, in which the user can optionally provide labels. I've wrapped the facet_grid argument in an if/else clause depending on whether ...
1 vote
1 answer
114 views
What does the first colon mean in the ":b:" with getopt command line?
Show bash and getopt version in my OS: bash --version |grep [r]elease GNU bash, version 5.2.15(1)-release (x86_64-pc-linux-gnu) getopt --version getopt from util-linux 2.38.1 In the getopt's manual(...
0 votes
2 answers
69 views
Pass optional weight argument to model.frame
I'm trying to program a function that takes an optional weights argument and passes it to model.frame: test <- function(ff, weights, data) { mm <- model.frame(ff, data, weights=weights) y &...
-2 votes
2 answers
123 views
VBA Macro - Argument not optional
I'm new to the whole VBA thing, currently practicing making macros for Excel worksheets. I wanted to make a button that, when pressed, updates query from the table to an archive table and then updates ...
1 vote
0 answers
74 views
Unexpected Behavior When Using Optional Arguments in Function
I'm experiencing an issue with sending AT commands through a serial port in my code. The problem is that when I send the following commands: while (true) { thread_sleep_for(5000); ...
0 votes
1 answer
65 views
Confusion with Optional Parameters in ASP.NET Core Routing
I’m working with ASP.NET Core routing and have encountered some confusion with optional parameters. I have a route with an optional parameter id: app.Map("products/details/{id?}", async ...
0 votes
2 answers
45 views
How can I do comparison of a value Optional([:])
I am logging out (well, print()-ing) some variables, and too many times as output I have value: Optional([:]) I want to ignore this value, so I tried if a == Optional([:]) { // ignore } else { ...