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
7
votes
2 answers

PHP join two variable names

I have a php script that gets a $_POST to decide which array to return. Ex: $n = $_POST['n']; // 1, 2 or 3 $a1 = array ('something', 'something else', 'another thing'); $a2 = array ('something 2', 'something else 2', 'another thing 2'); $a3 =…
medk
  • 9,233
  • 18
  • 57
  • 79
6
votes
3 answers

Why I can set! builtin dynamic (?) Clojure vars?

Why I can do this: > (set! *unchecked-math* true) true > (set! *warn-on-reflection* false) false but can't do this: > (def ^:dynamic *x*) #'user/*x* > (set! *x* 1) ;; no luck, exception!
OlegTheCat
  • 4,443
  • 16
  • 24
6
votes
2 answers

Create a dynamic variable reference in Typescript

Thanks ahead of time, to anyone who helps. :) This may seem a simple answer to those who are experienced, but I have scoured the internet as well as a couple of reference books, and not found a straight forward answer to this question, so hopefully…
wdlee
  • 73
  • 1
  • 1
  • 5
6
votes
4 answers

PHP: How to use dynamic variable name with a class' setter

I have a class with a private member "description" but that proposes a setter : class Foo { private $description; public function setDescription($description) { $this->description = $description; } } I have the name of the member in a…
Barth
  • 15,135
  • 20
  • 70
  • 105
5
votes
2 answers

Calling dynamic variable in PowerShell

I am trying to create a new variable that would use other variable with dynamic name as its value. Here's what I am trying to do: I have a System.Array with two values: $Years = 2015, 2016 Another variable, $Transactions has a list of various…
user6744606
5
votes
1 answer

Using getText() with more than one parameter in Struts 2 and JSP

I am working on the Struts2 framework with JSP. I have in my *.properties file: hover_remove=Remove access to {0} at {1}` I have in my JSP, within a submit tag: title="%{getText('hover_remove', new String[]{{appLabel}, {locationLabel}})}" which…
user3179271
  • 53
  • 1
  • 3
5
votes
2 answers

How do you insert the same random variable into multiple soapui testcase requests?

I may be going about this in the completely wrong way, but how do I pass a dynamic variable to a bunch of requests within the same testsuite in SoapUI? My first test step is a Groovy script. I need to generate a random account name, and then use it…
user83598
  • 161
  • 1
  • 3
  • 10
5
votes
1 answer

binding & pmap interaction change?

There are several somewhat old blog posts out there advising caution when mixing dynamic variables, binding, and pmap, e.g. here, where we get the following code snippet: user=> (def *foo* 5) #'user/*foo* user=> (defn adder [param] …
ben w
  • 2,490
  • 14
  • 19
5
votes
1 answer

ColdFusion - How to check if upload filefield is empty - esp with dynamic field name?

I am giving the form a dynamic number of file upload fields. So on the form side, I'm looping through this dynamic number (say 3, as index 'm'), and naming each filefield input 'ResumeFile#m#'. On the action page, I'm getting an error if one of…
Kirsten
  • 27
  • 1
  • 13
4
votes
2 answers

How to use string in Ruby variable name?

I have a string that I want to use as part of a variable name. Specifically, in Rails route paths: <%= foo_path %> <%= bar_path %> I want the first part of the route name to be dynamic. So something like @lol = "foo" <%= [@lol]_path %> # <-- This…
Tim
  • 6,079
  • 8
  • 35
  • 41
4
votes
4 answers

Dynamic variable declaration in C

I'm a ruby developer and its been long time since I've coded in C. I want to use a datatype in C which behaves like a symbol. Is this possible? Program asks user for name User replies - "foobar" Program declares an integer with the same name…
Prakhar
  • 3,486
  • 17
  • 44
  • 61
4
votes
2 answers

Robotframework, How to define a dynamic variable name

I want to Define variable having dynamic name. For example ${${FILE}{VAR}} Create List // ${FILE} = TEST, ${VAR} = VAR Then I want to get variable named '${TESTVAR}'. Here is my Summarized code... *** Settings *** Library …
Jin Su Yu
  • 43
  • 1
  • 3
4
votes
3 answers

How to access variable dynamically inside an anonymous function/closure?

To keep the global namespace clean, my JavaScript code is wrapped like this: (function() { /* my code */ })(); Now I have some variables declared in this scope which I want to access using a variable variable name (e.g. the name is 'something'…
ThiefMaster
  • 310,957
  • 84
  • 592
  • 636
4
votes
2 answers

How to create dynamic fields in Google App Engine expando class?

I have a db expando class called widget. I'm passing in a json string and converting it to a dict and then adding it to the datastore. My question is how can I loop through my dict to create dynamic fields. widget =…
4
votes
1 answer

Struts2: Evaluate string literal for property value

I am trying to do something similar to this question but the answers don't fix my problem. I'm using Struts2 version 2.3.28.1. I'm trying to access data in the session using a tag and a dynamic value string literal. If I…
Flanfl
  • 516
  • 8
  • 29
1
2
3
17 18