variables

PHP array as variable name

How to send an indexes name for php array vairable. the array is $array = array('Somthing'=>array('More'=>array('id'=> 34))); and now I want to display this thing but with a variable name I don't know how to explain so I write what I want to have. $index_name = '[Something][More][id]'; $array{$index_name}; Is it possible in any...

Python: automated change in variable contents

Hi, I have a Python function which receives numerous variables, and builds an SQL query out of them: def myfunc(name=None, abbr=None, grade=None, ...) These values should build an SQL query. For that purpose, Those who equal None should be changed to NULL, and those who store useful values should be embraced with 's: name="'"+name+"...

How can I save a "setting" in a C# application?

A user wants me to create an app that does something everything he presses the X key. Now he asked me to make it so he can change what key he has to press. Maybe he wants X key today, maybe C key tomorrow. How can I easily do this in C#? What is the best way? ...

Is "var" in C# analagous to "size_t" in C?

I have gotten used to using size_t in my C++ code by way of C due to a professor's insistence and I was curious if 'var' in C# is the same sort of thing? ...

set a variable in mutliple places in a master page

I am trying to grab a string of text from the .vb file of my master page. I need to render this text out as part of the class definitions. E.g. <div id="######ContentArea"> I need to replace the ###### with a string I have created in the .vb file. How do you do this? Or is there an easier way = NEWBIE here! ...

What is a bound variable?

There is a cffunction (in a cfc document) which authenticates a user. It references a stored procedure and has a cfprocparam which is of type "out". On the Adobe CFML reference it says that means that "the parameter is used to receive data from the database system only. Passes the parameter as a bound variable." What is a bound variable...

php quotes sent along with variable help...

I am sending this to a function, and I want double-quotes around the value of the variable below, example $var = "New York" (note the quotes) $fq.=" + area:$state"; So when I echo $state I want double quotes around it, how can I do this? Thanks ...

PHP/Session/IE: Constant are saved, variable not

I have a very strange problem. Situation: Session handling over MySQL, PHP 5.2.4, wildcard cookies, FF/Opera/Safari/Chrome works, IE7/8 not. When I save a variable into the session, the value is lost. The DB shows after the write action only "N" instead of "123456". Example: $bar = 123456; $_SESSION['foo'] = $bar; But when I save a...

Dynamically assigned table variables?

Writing a function in Lua, which creates two tables. I want the tables to be assigned to the value name with an x added, and one with a y added. For example if name was line, it would create two tables linex and liney, but I can't figure out how to do it. The following obviously doesn't work (and is just for display purposes) but how wou...

How to use a variable name in a mySQL statement?

I'm using R to call a mySQL statement, where I define the variable outside the statement e.g. foo = 23; dbGetQuery(con, "select surname from names WHERE age = '.foo.' ;") But this returns an empty set, I've googled around and tried'.&foo.' ".foo." '".&&foo."' and many different combinations, but none of them work, I think this s...

assigning an alphanumeric value to a variable in batch

Hi All, I want to assign the alpha numeric value to one variable in Batch scripting. I tried following one but getting error. setlocal set test = \765514e2aad02ca658cc56cdb7884947 *E:\\test1 echo %test% endlocal Error: C:\Users\bgannu>setlocal C:\Users\bgannu>set test = \765514e2aad02ca658cc56cdb7884947 *E:\\test1 C:\Users\bgannu>...

How to declare local "variables" as final in Objective-C?

In Java, I can declare local "variables" as final, e.g. void myMethod() { final String foo = "Hello World!"; foo = "Bye-bye..."; // compile error!! return; } When I try to change its value, a get an error from the compiler. I want to declare some of my local "variables" final to avoid changing their value by accident. Is ...

Initialization of function static variables

I have one static variable declared inside a function, which is not initialized to zero explicitly. Are all uninitialized static variables inside functions set to zero by default, just as static variables at the global (file) level are? ...

scanf() resetting first result depending of variable declaration order

Why does this not work as expected? int main() { unsigned char louise, peter; printf("Age of Louise: "); scanf("%u", &louise); printf("Age of Peter: "); scanf("%u", &peter); printf("Louise: %u\n", louise); printf("Peter: %u\n", peter); return 0; } Outputs: Age of Louise: 12 Age of Peter: 13 Louise:...

jQuery setting class to a variable

Hi, I am trying to set class to a variable. My code is: var vtxt = $(this).attr("id"); $("('" + vtxt + "')").addClass("on"); It does not work this way. I've tried several things with no luck. What is the right format for adding a setting class to a variable? Thank you ...

C++: Why does VS2005 interpret direct-initialization of local instance as a function, when the class constructor has a polymorphic parameter?

Hi there, I have the following C++ code in Visual Studio 2005... class Base {}; class Derived : public Base {}; class Other { public: Other(const Base& obj) {} void test() {} }; int _tmain(int argc, _TCHAR* argv[]) { Other other(Derived()); other.test(); return 0; } ... Compilation fails and gives: test.cpp(19) : error C2228:...

Make javascript reference variable a value variable?

I have a javascript function that goes something like this: function doSomething(me) { var isMeChecked = me.checked; for (i=0;i<=10;i++) { me.checked = !isMeChecked; alert (me.checked); } } I assumed that isMeChecked would remain constant after the first load, but it apparently is a ...

Storing/Comparing u_char passed to function

I have a simple function that passes a variable "var" as a u_char array. I have no difficulty printing that array. printf("%2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x", var[0], var [1], var[2], var[3], var[4], var[5]); Prints the mac address out just the way I like it. I cannot for the life of me figure out the proper way to store this...

memory, file size, and variables?

Does creating a lot of private variables that may never be used increase file size and or memory usage of your application? ...

How might I count the number of int members defined for a Java class?

I have a class that stores a large number of int member variables, each defined as follows: public final static int int1 = int1value; public final static int int2 = int2value; ... public final static int int106 = int106value; There is a second class that needs to do a loop based on the number of ints in the first class. How would I go...