12,072 questions
-1
votes
0
answers
42
views
Unrecognized arguments on Python with PyInstaller and argparse
I work on a script Python and I try to send args and use PyInstaller at same time.
This is an example:
#!/usr/bin/env python3
import argparse
import sys
print(sys.argv)
parser = argparse....
Advice
0
votes
1
replies
44
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 ...
2
votes
2
answers
210
views
Writing an addOrUpdate method that can update some parameters but leave others as-is
I'd like to write one function that either creates a new instance of a certain feature type, or modifies only the specified parameters of an existing instance (and leaves the other parameters as-is).
...
3
votes
0
answers
186
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 ...
1
vote
1
answer
67
views
Turning off JFR events with startup args
Im trying to understand if it is possible to turn off certain JFR events for sanitizing reasons using startup args.
I know it is possible to scrub the file after downloading it, and that works just ...
-3
votes
1
answer
103
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
2
answers
139
views
Testing that a function receives a string
I would like to build a function such as:
test <- function( fct = "default" ) {
# here test that fct is a string
# ...
}
in which it is tested that fct is a string of length one. ...
2
votes
1
answer
245
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 ...
5
votes
3
answers
397
views
How can you enable compiler warning on array argument decaying to pointer
I learned that in C++, array arguments decay to pointer arguments. As a result,
void PrintArray(int arr[4])
{
std::cout << arr[0] << std::endl;
std::cout << arr[1] << ...
2
votes
1
answer
198
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 ...
5
votes
2
answers
134
views
How do you specify a variable name for a function call using a character variable in R?
I am working in R trying to create a wrapper function that calls a specified internal function (which is some existing function) and does some things with it. My wrapper function will include an ...
-3
votes
1
answer
130
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 ...
0
votes
0
answers
65
views
Passing a dataframe column value as a function argument
I'm new to Python so this should be pretty basics but I can't seam to accomplish what I want.
Let's say I have the following data frame:
df = pd.DataFrame(index=[1,2,3])
df['Currency'] = ['USD','USD','...
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
0
answers
73
views
Hasura Documentation Pagination Example Seems Incorrect – Limit vs. Offset
I'm following the Hasura documentation on GraphQL Limit and Offset for pagination, and I noticed something that seems incorrect.
The docs state:
"If we have 50 todos, we could split them into 5 ...
0
votes
1
answer
95
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/...
7
votes
1
answer
429
views
C++ argument parsing is incorrect when the executable file path contains spaces
I am having problems with arguments in C++ console programs built under C++Builder 12 Community Edition.
If the executable is in a folder with spaces in its name, eg. "test dir", and I ...
1
vote
2
answers
96
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 ...
0
votes
1
answer
152
views
How to run Chromium browser with the following args --disable-web-security --user-data-dir=”...”
I want when executing the following command:
playwright codegen demo.playwright.dev/todomvc
I open the browser with the arguments of --disable-web-security --user-data-dir=“...”.
Can this be done? I ...
1
vote
1
answer
75
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 ...
1
vote
2
answers
51
views
Get argc value in a function inside $PROFILE script file
I have created the following function in my $PROFILE script file :
function host($name, $server, $type) {
$FUNCNAME = $MyInvocation.MyCommand.Name
$argc = $args.Count
if ( $argc -eq 0 ) {
...
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
65
views
Getting function arglist in SBCL Lisp
In SBCL when I describe a lambda I get a bunch of detail:
* (setf f (lambda (a b) (* a b)))
#<FUNCTION (LAMBDA (A B)) {535B3C3B}> ...
1
vote
1
answer
59
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
0
answers
193
views
Dependent optional arguments with clap
I have already a commands enum. I want to add optional arguments which would apply to all subcommands, if set.
use clap::Parser;
use clap::{ValueEnum, Subcommand};
#[derive(Subcommand)]
pub enum ...
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(...
-1
votes
3
answers
59
views
what is "size - 1" argument in this loop?
word = input("Enter a word: ")
print("Original String is: ", word)
size = len(word)
print("Prnting only even index chars")
for i in range(0, size - 1, 2):
print(&...
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 ...
0
votes
0
answers
17
views
EELSfitter class arguments
I tried to use EELSFitter (https://lhcfitnikhef.github.io/EELSfitter/build/html/index.html) package for EEL spectra processing.
I am interested in the Kramers-Kronig analysis (https://lhcfitnikhef....
0
votes
1
answer
180
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
26
views
Nginx rewrite with args
I'd like rewrite URL
https://example.com/mapa/viewer/index.php?code=XXX&m=YYY
to https://example.com/XXX&m=YYY
Intent- rewrite URL to content of embedded iframe to parent site, prevent loop
I ...
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 ...
2
votes
1
answer
64
views
How to get the argument passed to function with switch statement?
function test
{
[CmdletBinding()]
param
(
[Parameter(
Mandatory = $true,
ParameterSetName = "MyArgument"
)]
[ValidateSet("...
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
0
answers
21
views
I'm trying to create a list of hwids for my project, I add the hwids to the panel, and I hope it returns all the hwids but it doesn't happen
HTTP = require "ssl.https"
KEY = GetTotalHashHWID() .. ""
local HWID = HTTP.request("https://gitlab.com/at/a/-/raw/main/HWID%20FAST%20MENU%0TETS")
...
0
votes
1
answer
111
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 ...
2
votes
0
answers
173
views
Elementor Search: Filtering CPT by ACF Relationship Field Meta
I’m working with Elementor Pro and ACF and need help setting up the Elementor Search Widget to show results for my custom post type project based on its ACF relationship field partner.
So if I search ...
0
votes
1
answer
317
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 ...
3
votes
1
answer
116
views
In C#, can you declare multiple function arguments as a single type?
In Pascal, you can declare multiple function arguments as a single type:
procedure TMyClass.Foo(Bar1, Bar2, Bar3 : string; Bar4, Bar5, Bar6 : Integer);
I always enjoyed this because it prevented ...
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
1
answer
75
views
how to turn cli based argument function into function that takes parameters python
I'm using an example function from the google-api-python-client library that takes command line arguments and parses them using argparser. Here's the code this is based on (converted to python3) https:...
0
votes
2
answers
62
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 ...
0
votes
0
answers
92
views
Mutability of numpy arrays and Python lists as function arguments
I'd like advice on how numpy arrays and Python lists are passed into functions. Specifically, VBA and other languages I'm familiar with can be explicit in the function definition if an argument is ...
2
votes
0
answers
88
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
2
answers
205
views
How to skip default named arguments while setting a named variadic argument in a function call?
I have an existing method:
public function dbQuery(
string $query,
bool $flag1 = false,
int $flag2 = SOME_DEFAULT,
bool $flag3 = false
)
Now I want to adapt it so it is possible to ...
1
vote
1
answer
62
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 :: ...
1
vote
2
answers
123
views
Iterating operations over function arguments in python
I have a function which accepts 7 input, each of them could be a scalar (float), a list, or a numpy array. For subsequent calculations, I want to convert them all to numpy arrays.
import numpy as np
...
0
votes
0
answers
47
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
2
answers
232
views
Why does my variadic macro throw an error when nothing is passed?
Context
I'm trying to create a C program that takes multiple integers as input via the print(...) macro, without needing to pass the length of arguments manually from the main function. To achieve ...
1
vote
1
answer
116
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(...