variables

How can variables be used by a set of classes?

Hello All I have a question which I cannot seem to fathom out, as fairly newish to c++. I have a class, in which a set of variables are declared in the .h file and then initialised in the .cpp file. These same variables are used by a set of 3 other classes - and the compiler has them as out of scope. I am not sure how to link the classes...

Accessing inherited class variables in PHP

Hello, I have two classes. Looking to be able to grab a variable that is within a global object of a class. Class Order { public $number = "1234"; } Class Business { public $order; function __construct() { global $order; $order = new Order(); } } $b = new Business(); echo $b->order->number; In the cas...

Initializing null variables in .NET

What is the proper way to initialize a null variable in .NET? I've been told by one of my colleagues that hard defining of a variable to null is a slowdown. int var1; // good practice string s1; // good practice int var2 = 0; // bad practice string s2 = null; // bad practice Is that correct? ...

Is naming variables after their type a bad practice?

I'm programming C++ using the underscore naming style (as opposed to camel case) which is also used by the STL and boost. However, since both types and variables/functions are named all lower case, a member variable declaration as follows will lead to compiler errors (or at least trouble): position position; A member variable named po...

Using a for statement to create variables from array

I have a set of numbers that I need to pass from a function to a few other functions before it is actually used. I figured an array is a good way to do this, however I can't remember how to do what I want to do. The code looks like this int set1; // variables that hold settings int set2; int set3; cout << "Setting 1"; cin >> set1; cou...

Limits on Windows environment variable nesting?

So, is there a limit to how deeply environment variables can be nested in Windows? I do a lot of development work and I'm trying to set up my development environment vars, and a lot of them nest off each other, ie. GLEW=%THIRD_PARTY_ROOT%\GLEW GLEW_1_5_5=%GLEW%\glew-1.5.5 GLEW_BIN_PATH=%GLEW_ROOT%\bin GLEW_INCLUDE_PATH=%GLEW_ROOT%\incl...

How to pass data to plugins in Python?

I'm implementing a simple plugin framework for a little Python program and wonder whether there are general best practices for transferring data to plugins? I'm new to Python and this is what I have come up with so far after doing some reading: I will not use global variables, instead data is going to be passed to the plugin classes on ...

List is being emptied in the middle of a method! Help!

Hi, this has me puzzled - I am no expert on page life cycle but I do not see why this is happening. It may be a simple case of where I declare my list. Here is the code: public partial class feedback : System.Web.UI.Page { List<Module> allModules = new List<Module>(); protected void Page_Load(object sender, EventArgs e) { ...

What is the purpose of PHP having a symbol (the dollar sign) in front of each variable?

Possible Duplicate: Why PHP variables start with a $ sign symbol? I have looked at other programming languages and it seems that most of them do not have any symbol to show that something is a variable. Is there some reason why a PHP interpreter needs such a sign, when interpreters/compilers for other languages are capable of...

Variables addresses

Hello, I'm writing statistic system. It should make some output with given params. For example: float getSunActivity() { ... } int getEarthActivity() { ... } StatisticSystem::track("sun_activity", boost::any(getSunActivity())); StatisticSystem::track("earth_activity", boost::any(getEarthActivity())); class StatisticSystem { typedef...

Adding of two variables in xslt within choose statement

<xsl:choose> <xsl:when test="$cty='LOHNSTD'"> <xsl:variable name="sum" select="$sum + $amt"/> </xsl:when> <xsl:when test="$cty='REGPAY'"> <xsl:variable name="sum1"> <xsl:value-of select="$sum1 + $amt"/> </xsl:variable> </xsl:when> ...

call a java method from javascript

when a button is clicked a textbox value needs to be sent to a java class so it can be processed . I've tried applets but failed ..i really could use some help here coz i'm stuck help is much appreciated Thanks =] ...

form variable + submit button not concatenating with php

UPDATED: Examples added at end as requested: Got a seemingly unique problem with concatenating form variables + the name of the button used to submit. This works: $word="number"; $number=1; myalbum=$word.$number; echoing $myalbum gives "number1". No surprises there. BUT if I POST the form to a php script with the intention of writin...

How to check if a variable is set with bash?

How do I know if a variable is set in bash? For example, how to check if the user gave the 1st parameter to a function? function a { ?? if $1 is set } ...

Why won't this variable update?

In the document.ready() I have: $('#menu_indicator').append('<p>' + currPage + ' / ' + pageLimit + '</p>'); pageLimit is always one number that does not change throughout the whole code. I have it so that when a user clicks a button, it changes currPage to a different number. (this part is not in document.ready();) Why doesn't it up...

Hide variable application result from bash output

Hi Guys. I am trying to create a script that will run wget to a few sites and check if we receive a 200 OK from the site. My problem is that the result of wget application is shown in the stdout. Is there a way I can hide this. My current script is: RESULT=`wget -O wget.tmp http://mysite.com 2>&1` Later I will use regex to look for...

What is the behavior of integer division in C?

i.e. - int result; result = 125/100; or result = 43/100; Will result always be the floor of the division? What is the defined bahavior? If you could point me in the right direction, i would appreciate it. Thank You. ...

Ajax script in a div not reading variables from parent

Hi, here is what I have (please excuse the crappy art): ------------------------------------------ |Menu | |----------------------------| | | |Big Div | | | | | | | | ------------------------ | | | | |Smaller Reloading Div | | | | | | ...

PHP - Check variable or compare string?

Hi, I wonder which of these excerpts should take less resources, when we want to see if "word" is an element of an array: Excerpt 1 - Check variable: <?php function checkWord($word, $elements) { $array = array($word => true); foreach ($elements as $element) { if (isset($array[$element])) return true; } return f...

click a link pass a session variable to the next page

I have a page where I am using a PHP while loop to echo the names and addresses of our dealers. For the email link, I want the user to be able to click the link, which would then take him to a form that emails that person. I know that you can't mix Javascript and PHP, so how do I tell which link the user has clicked on so that I can pa...