parameter-passing Questions

17

Solved

I'm trying to pass some parameter to a function used as callback, how can I do that? This is my try: function tryMe(param1, param2) { alert(param1 + " and " + param2); } function callbackTest...
Homebrew asked 11/8, 2010 at 13:5

9

Most scripts that parse /proc/cmdline break it up into words and then filter out arguments with a case statement, example: CMDLINE="quiet union=aufs wlan=FOO" for x in $CMDLINE do »···case $x in »...
Cuneal asked 14/6, 2009 at 18:38

10

Solved

I want my script to be able to take an optional input, e.g. currently my script is #!/bin/bash somecommand foo but I would like it to say: #!/bin/bash somecommand [ if $1 exists, $1, else, f...
Bubaline asked 17/2, 2012 at 17:32

2

Solved

I have a Stored Procedure that inserts, updates or deletes tablerows. It was working fine while all parameters were used as input. However, I need to return the ID of last inserted row. For that I ...
Justify asked 19/7, 2020 at 14:26

21

Solved

I have a function that creates an array and I want to return the array to the caller: create_array() { local my_list=("a", "b", "c") echo "${my_list[@]}" } my_algorithm() { local result=$(crea...
Avila asked 14/5, 2012 at 11:49

10

Solved

I have a main form (let's call it frmHireQuote) that is a child of a main MDI form (frmMainMDI), that shows another form (frmImportContact) via ShowDialog() when a button is clicked. When the user...
Tortoise asked 8/3, 2011 at 14:3

9

Solved

I have a homework assignment that I'm stumped on. I'm trying to write a program that outputs the fibonacci sequence up the nth number. Here's what I have so far: def fib(): n = int(input("Please...
Bristol asked 4/4, 2013 at 19:59

6

Solved

I've been looking at passing arrays, or lists, as Python tends to call them, into a function. I read something about using *args, such as: def someFunc(*args) for x in args print x But not su...
Godinez asked 18/10, 2010 at 16:8

3

For reasons that should not impact the current question I need to run a script, with the definition and parameters outside the command, inside a different PowerShell instance, without using PSSessi...
Folkway asked 31/10, 2016 at 12:55

7

Just studying for an exam and I can't find the answer to this question in our notes. Any help would be great. Many languages permit subroutines/functions to be passed as parameters. List two ad...
Jamestown asked 12/12, 2010 at 0:50

11

Solved

I would like my Bash script to print an error message if the required argument count is not met. I tried the following code: #!/bin/bash echo Script name: $0 echo $# arguments if [$# -ne 1]; t...
Helot asked 2/9, 2013 at 8:28

2

Solved

I want to create a std::array of pointers without declaring the type to which the pointers point to as const, so that I can change the values pointed to by the pointers of the array through derefer...
Peculate asked 21/3, 2023 at 0:28

2

Solved

I have a problem. I have an XML file that contains information about 100 courses. I have an XSL file that nicely displays the list of 100 courses. But what if I want to only display 1 course. C...
Affright asked 14/7, 2010 at 22:48

19

Solved

Often I will have a JavaScript file that I want to use which requires certain variables be defined in my web page. So the code is something like this: <script type="text/javascript" src="file....
Tack asked 3/2, 2010 at 9:13

8

Solved

There's a PowerShell script named itunesForward.ps1 that makes iTunes fast forward 30 seconds: $iTunes = New-Object -ComObject iTunes.Application if ($iTunes.playerstate -eq 1) { $iTunes.PlayerPo...

9

Solved

I want to pass parameters from PHP Command Line Interface, and then read in the values using PHP script, something like this: <?php $name1 = $argv[1]; echo $name1; ?> I pass the variabl...
Lundt asked 15/6, 2012 at 10:20

3

Solved

The following command works fine on Ubuntu bash: kubectl patch deployment wapi-backend-d1 --patch '{"spec": {"template": {"metadata": {"labels": {"date": "test"}}}}}' The same command does not w...
Drayton asked 9/4, 2019 at 23:13

2

Solved

I am using SQLAlchemy connection.execute(sql) to transform select results to array of maps. Have following code def __sql_to_data(sql): result = [] connection = engine.connect() try: rows = c...
Criseyde asked 11/10, 2013 at 9:8

9

Solved

is it possible to pass all elements of an array to a ParamArray? For example I'd like to pass a ParamArray to another ParamArray: Sub test() p1 "test", "banane", "birne" End Sub Sub p1(ParamArr...
Popeyed asked 26/12, 2013 at 10:24

2

I have a Dockerfile with the following lines: FROM python COPY sysargs.py / CMD python sysargs.py --date Ref::date And my python file sysargs.py looks like this: import sys print('The command lin...
Pteridophyte asked 29/10, 2020 at 6:31

7

Solved

Why can't my parameter be void example(int Array[][]){ /*statements*/} Why do I need to specify the column size of the array? Say for example, 3 void example(int Array[][3]){/*statements*/} M...

4

I am storing function body in string with function name. function fnRandom(lim){ var data=[]; for(var i=0;i<lim;i++) { data=data.concat(Math.floor((Math.random() * 100) + 1)); } return dat...
Chaille asked 6/3, 2018 at 7:0

2

I'm wondering if it's possible in C++ to declare a function parameter that must be a string literal? My goal is to receive an object that I can keep only the pointer to and know it won't be free()e...
Infinitive asked 9/9, 2021 at 20:20

4

Solved

I am using Liquibase and would like to execute the same script in two different variants (production and tests): <changeSet author="..." id="..."> <insert tableName="..."> <colum...
Our asked 11/11, 2015 at 7:53

5

I have a command that returns a hash table. Like this one, for example: function Get-TestArgs() { return @{a=1;b=2;c=3} } And I'd like to use its return value as the arguments for my other funct...
Farmann asked 28/6, 2016 at 16:53

© 2022 - 2024 — McMap. All rights reserved.