variables

PHP variable variables

Hi my question is about PHP variable variables. Basically I want to store courseworks marks of n courseworks into n variables, such as cw1 and cw2 etc. Using variable variables how can I come with cw1, cw2 etc. ...

Global variables and scope - C++

I am having small problem in making a global variable works. I am using Visual Studio 2008 and standard C++. I have two projects, one is a static library and second one is a test program which uses this library. I have a global variable in global.h like #ifndef GLOBAL_H #define GLOBAL_H #include <string> extern std::string globalWo...

Should I keep instance variables in Java always initialized or not?

I recently started a new project and I'm trying to keep my instance variables always initialized to some value, so none of them is at any time null. Small example below: public class ItemManager { ItemMaster itemMaster; List<ItemComponentManager> components; ItemManager() { itemMaster = new ItemMaster(); components = new...

What's the best way to store class variables in PHP?

I currently have my PHP class variables set up like this: class someThing { private $cat; private $dog; private $mouse; private $hamster; private $zebra; private $lion; //getters, setters and other methods } But I've also seen people using a single array to store all the variables: class someThing { ...

What does variable names beginning with _ mean ?

When writing my first asp.net MVC application using C#, I see that there are some variables whose name start with an underscore character(_). What does this mean? Is there any specific meaning for this? ...

Mysql Real Escape String and normal string

"I am using flash as3, php and mysql" What is the difference between: $username = $_POST['username']; $password = md5( $_POST['password']); and $username = mysql_real_escape_string( $_POST['username']); $password = mysql_real_escape_string(md5( $_POST['password'])); I am sending and retrieving variables from flash AS3 to ...

reevaluate makefile variables

Is there a way to reevaluate a variable's definition upon each use? For example: MAP_FILES = $(shell find $(TMP) -name "*.map") all: generate_map_files work_with_map_files generate_map_files: ./map-builder work\_with\_map_files: $(MAP_FILES) ./map-user %.map: ./map-edit $@ So, MAP_FILES will be evaluated when the makefile...

Any program or trick to find the definition of a variable?

Hello, Many times when I am watching others code I just want to find where and how a variable is defined. Normally what I do now is look for the type of the variable until I find the definition, that is very time consuming. And I guess that there are some tools that can help me in this rutinary situation. Any suggestion in some tools or...

"BigInt" in C?

What is the easiest way to handle huge numbers in C? I need to store values in the Area 1000^900... Does anybody know of an easy way to do that? Any help would really be appreciated! ...

The difference between declaring a variable as "var $foo" or "$foo" in PHP?

The title explains it all. What's the difference? var $foo; $bar; What's the main difference between this two variables? I've noticed that "var $foo" is mostly used to declare class attributes, but why is it so? Thanks in advance for all your answers. ...

How to reach iteratively few variables which names differ only by number in C++?

I need a method helping me, to reach variables named like "comboBox1", "comboBox2" etc each by each in a loop. I'd like to change code like: //proceed comboBox1 //proceed comboBox2 //proceed comboBox3 //proceed comboBox4 //proceed comboBox5 //proceed comboBox6 Into: for (int i = 1; i < numberOfBoxes; i++) { //proceed comboBox(i) ...

Is it good practice to create once-used variables?

A colleague of mine refactored this code: private void btnGeneral_Click(object sender, RoutedEventArgs e) { Button button = (Button)e.OriginalSource; Type type = this.GetType(); Assembly assembly = type.Assembly; string userControlFullName = String.Format("{0}.{1}", type.Namespace, button.Name); UserControl userContr...

Are there any declaration keywords in Python?

Are there any declaration keywords in python, like local, global, private, public etc. I know it's type free but how do you know if this statement: x = 5; Creates a new variable. or Sets an existing one. ...

How to detect when a variable changes value

How can I easily detect when a variable changes value? I would like the execution of the program to break on the debugger whenever a specified variable changes value. Right now I'm using Eclipse's debugger. ...

Initialize variables from stored procedure results

Hello Group, I am still fairly green in SQL, and I have a question. I am creating a lookup using reporting services that finds an account based on lat/long. My question is how can I get results from a stored procedure to initialize variables in the following sp? Example: --This sp will go out and get the minlat, maxlat, minlong, maxlo...

How to pass values by ref in Python?

Basically I am using the C++ API of an app, but there is no reference for its python access. One variable is passed by ref, like so: GetPoint ( Point &p, Object obj ) so how can I translate to Python? Is there a pass by ref symbol? ...

Using strings to access custom methods dynamically

I am creating a two-dimensional list that has consecutive numbers at the end of "day", for use as dataProvider for a DataGrid i have been accessing them via the command dg1.selectedItem.day1 dg1.selectedItem.day2 dg1.selectedItem.day3 etc... is there any way to take the string ("day"+i) and convert it into a (what is it? variable name?)...

Change basic (immutable) types inside a function in Python?

I am using a C++ SDK where there is a function like (it has a python wrapper, but not docs): getPos ( int uvId, float & u, float & v ) const How do I specify in Python so that the passed variables are changed? I tried this example to see if I could modify floats inside a function, but it didn't work, so printed 12.0: def change ( a ...

Persisting variable value in Python

for i in range(0,3): j = 0 print 'incrementing ' j += 1 print j prints incrementing 1 incrementing 1 incrementing 1 How can I persist the value of 'j' so that it prints: 1 2 3 ...

Why isn't it a must to declare a variable in Javascript before using it?

In Javascript we don't have to declare a variable with 'var' keyword before using it. We can straight away do things like myCount = 12; or myStr = "Hello"; (where myCount, myStr are not declared before). Any such usage, declares and initializes the variables in the 'global' scope. What could be the reasons for providing this feature? A...