12,071 questions
Advice
0
votes
1
replies
41
views
NSubstitute - Accept any argument that has been built with a specific parameter
I am trying to mock a repository that inherits from the BaseRepository class in the Ardalis.Specification.EntityFrameworkCore library. This base class exposes the ListAsync method which takes in a ...
3
votes
0
answers
184
views
Getting the list of arguments passed into the current function, while allowing keyword argument default values [closed]
I'm writing a function whose inner logic needs to know which optional keyword arguments the function was called with.
I also need to be able to specify default values for keyword arguments.
If an ...
-3
votes
1
answer
101
views
Does anyone have a nice concise way of parsing bash function arguments and options? [closed]
Here's my current preferred method that I normally put at the top of functions:
#!/usr/bin/env bash
unset opts args
for arg; do [[ ${arg:0:1} == "-" ]] && opts+=("$arg") || ...
2
votes
1
answer
226
views
How do i pass Program Arguments From Apache Flink 2.0.0 Web Gui to my Job properly?
I need to submit a new Apache Flink Job from the Web GUI instanced in a docker container in Session Mode and i need to pass some arguments to the main function of my job written in Java.
I'm trying to ...
2
votes
1
answer
196
views
Is there a way to store "$@" into a variable in pure POSIX shell?
When I do something like ARGS="$@", the shell just concatenates the arguments stored in "$@". Is there a way to store "$@" into a variable in pure POSIX shell to be able ...
-3
votes
1
answer
122
views
#define COLUMNS as a function argument in C
It is more question than a problem.
I make my header file with a function declaration like this:
void fw_iteracja_wsk_rows_a(float (*tab)[COLUMNS], int ROWS);
How can I adjust/change the COLUMNS ...
2
votes
1
answer
122
views
Is it ok to send a value to the lvalue argument using std::move?
I have a function of the form void foo(std::string str);
I want to use it in two scenarios:
send a copy of the original value to it:
std::string myString = "any data that I want to keep in its ...
0
votes
1
answer
91
views
Optional {locale} in routes messes up controller arguments (Laravel 11)
I have a project in laravel 11 and there are some issues with my config.
The site should support optional locale param to differentiate between default and custom language:
DE: https://example.com/...
1
vote
2
answers
88
views
Executing an R file with Rscript without specifying entire path with Powershell on Windows
I have an R script that takes arguments that I want to be able to execute without having to type the entire path to the script location. For examples sake, lets say this is the script:
# arguments ...
1
vote
1
answer
71
views
How to automatically detect and decurry a curried function at Runtime?
I am working with curried functions in TypeScript, and I want to figure out a way to automatically detect if a function is curried and, if it is, decurry it into a non-curried function.
Problem:
A ...
2
votes
1
answer
90
views
how could I pass variable arguments and use them one by one in a loop
Here is a rudent prototype that I want to implement:
void save_keys(const string& savepth, const vector<string>& keys) {
size_t n_samples = keys.size();
stringstream ss;
for ...
1
vote
1
answer
54
views
Creating Custom Function in R - have two connected arguments in the function where at least one of the arguments is required
I am trying to create a function in R that creates a geometric sequence based on the inputs of 'start' (the starting value), 'by' (the common ratio) and two arguments that depending on which one is ...
1
vote
1
answer
85
views
Why does range() in Python require positional arguments when called, but keyword arguments in a match statement?
All examples tested using Python 3.13.2 on Windows 10.
When calling range(), I must use positional arguments, or otherwise I get an exception.
>>> range(2, 5)
range(2, 5)
>>> range(...
0
votes
1
answer
51
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 ...
0
votes
1
answer
172
views
Python Prophet TypeError: arg must be a list, tuple, 1-d array, or Series
I am trying to use Prophet to forecast Lululemon's stock prices. However, I am encountering the following error when fitting the model:
TypeError Traceback (most recent ...
0
votes
0
answers
21
views
What input to NamedParameterUtils.parseSqlStatement reach the "endMatch = false;" line inside called function skipCommentsAndQuotes?
I'm writing my own lib on top of some Spring functionalities.
Sadly NamedParameterUtils.parseSqlStatement and related classes do not expose anything useful (almost everything is declared private, and ...
0
votes
1
answer
59
views
How to get a function call argument string name, inside the same function. Using that as "extra parameter", avoiding adding an extra parameter [duplicate]
Having any Python function as:
def function1(param1, param2):
#...
return 0
How would be possible to get a param string name (variable name) used in the function call? ideally getting this ...
0
votes
1
answer
110
views
How do I use a multivaluearg in cmake so it prints as one string in an echo command?
I have a function which takes a list of arguments that I want to pass to a function in a target. Only when I try to use that multivalueargs, it places the second and further arguments on the following ...
0
votes
1
answer
315
views
How to call snowflake procedure with arguments from adf
i have a master table as EMP_NAME with few values in it and column name as EMPNAME. I want to pass these values as argument to a snowflake procedure which will create tables with employee name in ...
0
votes
4
answers
85
views
Nesting JavaScript strings inside an HTML onclick attribute
This code explains my problem best:
<html>
<head>
<script>
function showDiv (divId, dat){
document.getElementById(divId).innerHTML = dat ;
document.getElementById(...
0
votes
2
answers
60
views
How to pass variable number of references in container or similar structure as argument to function
I want to pass variable number of references to objects to a C++ function. Say, I have class ParameterBase and instances of classes derived from this base class. I want a function, which checks that ...
2
votes
0
answers
85
views
`getopt` with atoi causes segmentation fault
#include <stdio.h>
#include <getopt.h>
#include <stdlib.h>
#define PORT 12344
int main(int argc, char** argv) {
int opt;
int server_fd, client_fd, epoll_fd;
int ...
1
vote
1
answer
61
views
Haskell function with data pattern match and second argument gives Equations have different numbers of arguments
In Haskell I have the following data structure
data Circ = IN String
| NOT Circ
| AND Circ Circ
| OR Circ Circ
| XOR Circ Circ
I can pattern match functions on this like so:
size :: ...
0
votes
0
answers
46
views
How to share arguments in different classes?
Suppose I have a python class with arguments in the __init__ method with types specified.
class A:
def __init__(self, arg_1:int, ..., arg_n:int):
pass
Suppose I inherit from it as such:
...
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(...