Questions tagged [dynamic-variables]

In programming, a dynamic variable is a variable whose address is determined when the program is run. In contrast, a static variable has memory reserved for it at compilation time.

262 questions
2
votes
1 answer

How to dynamically or pre-generate ansible variables from an existing file in a specific format for AWS ECS

I have a simple playbook which creates ECS Taskdefinition. example: #variable file, vars.yml --- containers: - name: nash-test essential: true image: nash-test memory: 256 portMappings: - containerPort: 8080 hostPort: 80 protocol:…
2
votes
1 answer

How dynamic variables implemented for Node.JS in C++

First, i'm a beginner in C/C++, be mercyful. In Node.JS, all variables are dynamic and we can cast the variable any type. So, Node.JS writed with C++ and in C++ or C there is no dynamic variables. So how dynamic variables implemented? In JS: var…
Ibrahim Ipek
  • 479
  • 4
  • 13
2
votes
5 answers

Is it a good idea to dynamically create variables?

I recently found out how to dynamically create variables in python through this method: vars()['my_variable'] = 'Some Value' Thus creating the variable my_variable. My question is, is this a good idea? Or should I always declare the variables…
Mark Skelton
  • 3,663
  • 4
  • 27
  • 47
2
votes
2 answers

Batch - Evaluating dynamic variables with parameter in name

I am writing a batch library that must not be local, so that external batch files may call upon the functions from a single defined location. This requires that the calling batch file must pass in a "unique" identifier for the variables named…
Ryan
  • 23
  • 2
2
votes
1 answer

Dynamic variable assignment in pure shell without using eval

Is there a way to assign arbitrary values to dynamically named variables in pure shell (i.e. sh, not bash) without using eval? I would like to know if there was a way to avoid using eval as it can allow for arbitrary code execution. let seems only…
rhlee
  • 3,857
  • 5
  • 33
  • 38
2
votes
2 answers

Dynamically Assign Variables in Matlab

I have the following function as part of a large codebase, which I inherited: function = save_function(fpath, a,b,c) save(fpath, 'a', 'b', 'c') end This function is called at the end of one script, before another script is to be executed. This…
inspectorG4dget
  • 110,290
  • 27
  • 149
  • 241
2
votes
2 answers

Sending dynamic variables to SASS

I am currently working in a new project that allows users to change the appearance of the website base on their likes. They could change background colors and stuff, which get saved on a database for later use or they could be stored in a cookie.…
lomas09
  • 1,114
  • 4
  • 12
  • 28
2
votes
3 answers

Dictionary use instead of dynamic variable names in Python

I have a long text file having truck configurations. In each line some properties of a truck is listed as a string. Each property has its own fixed width space in the string, such as: 2 chracters = number of axles 2 characters = weight of the first…
marillion
  • 10,618
  • 19
  • 48
  • 63
2
votes
1 answer

Perl variable value as another variable name

I have a perl script (abc.pl) and 2 config files (one var.pl and one config.txt) Now in var.pl $admin_userid = "admin"; $guest_userid = "guest"; in config.txt - this has the value of user - can be either admin or guest user=admin/guest in…
Avinash Sonee
  • 1,701
  • 2
  • 15
  • 17
1
vote
2 answers

PHP: Is it possible to dynamically change the name of a variable?

I have code which selects data from my database and then sets these selected values to a variable. However I need to run the query many times. I am wondering if I could use a while/for loop to run the query the x number of times and use a switch…
NeverPhased
  • 1,546
  • 3
  • 17
  • 31
1
vote
1 answer

How to assign a value to a variable with a dynamically created name?

I know this is a no-no...and yes, I still want to do it or at least know how to do it. I would like to set the value of a variable in Perl for which the name is dynamically created (I am looping through different arrays of strings). I know I could…
gj.
  • 13
  • 4
1
vote
1 answer

Globalization of dynamic variables in wso2 Integration Studio

I've so far been using variables by saving them in a local entry file, and then using $ctx to call them and use them in my proxy. I want to know if there's a way in wso2 Integration studio wherein I can create multiple global variables (eg; to save…
1
vote
1 answer

What is the simplest way to compute the average of one variable grouped by a second variable, iterating over all second variables dplyr?

I have a data frame with a large number of variables, one of them, the probability of death to be predicted by all others. As a preliminary step I want to compute the PoD by counting the death rate in bins of each variable. let's say df <- (age =…
sSoGah
  • 15
  • 2
1
vote
1 answer

Create a reactive variable depending on active Tab on R Shiny

I have this simple app and I would like to be able to "catch" the active tab. For example, if I'm on "tab1", my selectInput at the top would be c("a","b","c") but it would change if I am on the other tab I want to create a variable active_tab that…
K.Hua
  • 769
  • 4
  • 20
1
vote
2 answers

How to create a dynamic Javascript Variable from a PHP String

How can I create a dynamic Javascript variable using a PHP String? This approach doesn't work. How should I fix it to make it work?