dynamic-variables

Dynamic variable in C#?

Is it possible to use a dynamic variable (not sure about naming) in C#? In PHP, I can do $var_1 = "2"; $var_2 = "this is variable 2"; $test = ${"var_".$var_1}; echo $test; output: this is variable 2; Can we do this in C#? ...

Dynamic variable names in Smarty

I want to be access some variables I've assigned dynamically from PHP in Smarty, here is an example: $content_name = 'body' $smarty->assign('content_name',$content_name); $smarty->assign($content_name.'_title',$title); $smarty->assign($content_name.'_body',$body); // assigned values // $content_name = home // $home_title = $title // $h...

Is there an easy way to create dynamic variables with Javascript?

I've built a data-driven google map with different icons that get assigned to the map depending on the type of item located. So if I have 5 types of landmark, and each gets a different icon (store, library, hospital, etc.)-- what I'd like to do is generate the google icon objects dynamically. I was thinking something like this: types = ...

Using the value of a variable as another variables name in Ruby

Hi, I'm just starting out in learning Ruby and I've written a program that generates some numbers and assigns them to variables @one, @two, @three etc. The user can then specify a variable to change by inputting it's name (e.g one). I then need to do something like '@[valueofinout] = asd'. How would I do this, and is there a better way ...

Retrieve JavaBean names associated with JSP or build variable with dynamic name

I am usign a JavaBean in a jsp page. I would like to give it a dynamic name, because depending on the value of a variable (let's call it foo), I want it to have different contents, and I want to keep all of these different versions in memory. I want the beans to have session scope, because reevaluating the contents is expensive. Right ...

How to have variables with dynamic data types in Java?

Hi, I need to have a UserProfile class that it's just that, a user profile. This user profile has some vital user data of course, but it also needs to have lists of messages sent from the user friends. I need to save these messages in LinkedList, ArrayList, HashMap and TreeMap. But only one at a time and not duplicate the message for e...

Dynamic functions, variable inputs

Right now, lets say I have code much like this... $some_var=returnsUserInput(); function funcA($a) {...} function funcB($a,$b) {...} function funcC($a,$b,$c) {...} $list[functionA] = "funcA"; $list[functionB] = "funcB"; $list[functionC] = "funcC"; $temp_call = list[$some_var]; //Not sure how to do this below, just an example to show...