variables

Posting variables in PHP

How do I post a variable in PHP without using a form, and accessing the variable from the next page. What I am really trying to do though, is post a variable like this: $username = "Sam"; $_POST[$username]; and then I am trying to access it from a page that I meta refresh to. Any ideas? ...

Javascript class variable scope using prototype

Hi I'm writing a basic class using prototype.js in which some class vars are set when the class is initialised - the problem is that these variables aren't available to other methods within the class. var Session = Class.create({ initialize: function(){ // define defaults this.source = ''; }, shout: function(){ alert(this.source); }...

Is it possible to perform checks on what may be an uninitialized variable?

I'm working on a recursive method... public BinaryTree<T> TreeMirror ( BinaryTree<T> tree ) { BinaryTree mirror = new BinaryTree(); mirror = clone(tree); ... TreeMirror(...) ... } I do not wish for the method to make mirror reference a different BinaryTree object in each recursive step, nor to repeat the mirror = clone(...

javascript: define a variable if it doesn't exist

hey everybody, i feel like im trying to do something super simple, but just being stupid about it. all i want to do is see if a variable has been set previously, and if it has NOT, set it with a default value....here is a sample: if(!embed_BackgroundColor) { var embed_BackgroundColor; embed_BackgroundColor = "#F4F4F4"; } so, ...

How do you use an exponent in c++ with a variable?

So I realize that #include is necessary, and that there is a pow(x,y) where x^y works...but when I attempted to use pow(2,(num-1)), it kicked back an error... errorC2668: 'pow' : ambiguous call to overloaded function the line of code I have for it is as follows perfect = (pow(2,(num-1))) * (pow(2,num)-1); Any recommendations? Thank...

About private instance variables in Objective-C

In xCode 3, I defined private instance variables in a class. When I directly access the private variables in the client codes, why does the compiler just show me a warning, not an error? The code can still run. The warning says this maybe a hard error in the future. What does the "hard error" mean? Thanks. ...

Using PHP variable variables in SQL quiery

Hi, sorry for this question to be a "can you fix it" one, but this little bit of code has been confusing me for a while now. I'm basically making a table with a bunch of rows and columns and in each one I have a slightly changing SQl query. To make it a bit easier instead of typing all that out I made this bit of script but it is starti...

c# - How do you get a variable's name as it was physically typed in its declaration?

The class below contains the field city. I need to dynamically determine the field's name as it is typed in the class declaration i.e. I need to get the string "city" from an instance of the object city. I have tried to do this by examining its Type in DoSomething() but can't find it when examining the contents of the Type in the debug...

In PHP, how do I add to a zero-padded numeric string and preserve the zero padding?

If I have a variable in PHP containing 0001 and I add 1 to it, the result is 2 instead of 0002. How do I solve this problem? ...

Is there a way to get all variables in Ruby?

Is there a way I can find all the variables in Ruby that begin with a particular string? For example, I have the following variables in my ruby program ret_d = 1 ret_d2 = 23 Now, is there a function that will return ["ret_d","ret_d2"]? The problem is that I do not have the set of all variables. Thanks. ...

Parsing a variable within SQL result

I'm currently building an affiliate program (a bit like CJ) with Paypal checkout. When people sign up as an affiliate (=to sell their own products from their own website) they receive 2 php lines that they have to insert into their shop. In the header: <?php include 'http://www.mydomain.com/tracker/tracker.php?xyz='.$_GET[xyz]; ?> In...

Updating database with php and ajax

hey, Below is my script that updates my characters position in my database: <script language="javascript" type="text/javascript"> function positionUpdate(){ var word = document.getElementById('test').value; var queryString = "?word=" + word; ajaxRequest.open("GET", "new_position.php" + queryString, true); ajaxRequest.send(null); alert(...

Can PHP be used without $ for variables?

Is it possible to name variables in a Java-like manner in PHP, such as by removing the need for a $ sign each time? If so, how can I enable the setting which does this? ...

Actionscript 3 : Creating variable objects and assigning class from parsed XML file.

I've set up an XML file with names of objects that will be contained in a fla/swf library. I wish to position the objects on the stage using an XML file that can be quickly modified without having to recompile the fla/swf file. Of course, positioning can only be accomplished when the objects are instantiaed and added to the stage. The pr...

print name of the variable in c#

i have a statement int A = 10,B=6,C=5; and i want to write a print function such that i pass the int variable to it and it prints me the variable name and the value. eg if i call print(A) it must return "A: 10", and print (B) then it must return "B:6" in short i want to know how can i access the name of the variable and print it to ...

Accessing User Password: Variable Scope in Rails

I'm writing a very simple mailing system for a Rails app. I'm using RESTful authentication. It's a fairly conventional setup, where I'm sending the same email when a user signs up and when a user forgets their password. I'm just having one problem that I can't seem to wrap my head around. I'd like to use the same email template for both...

Mozilla Firefox problem with Javascript and Flash communication

Hi, I have a script that displays a list of song names and when the user clicks a 'listen' button the filename is passed to a Flash player which loads and plays the mp3. This works fine for Safari and IE but not in Mozilla. Does anyone know of any issues around Mozilla and using Javascript to pass variables to flash and call functions in...

How can I make SQL Developer/SQL+ prompt only once for a substitution variable that occurs multiple times in a single statement?

I have a query roughly like this: select * from A_TABLE where A_COLUMN = '&aVariable' union select * from A_TABLE where B_COLUMN = '&aVariable'; But when I run it, SQL Developer prompts me for the variable twice, even though it's the same variable. If there's a way to make it prompt only once for a variable that is ...

Make array value variable (PHP)

Hi, Say I want to echo an array but I want to make the value in the array I echo variable, how would I do this? Below is kind of an explanation of what I won't to do but it isn't the correct syntax. $number = 0; echo myArray[$number]; ...

Vim: how to use variables in vimrc?

Hello, here what I am trying to do, a simple function to increment a global variable. It works fine. let g:high_ind = 1 fun! IncHighlightInd() let g:high_ind = (g:high_ind + 1) %10 return g:high_ind endf I want to use this variable in a map map <C-h> :call IncHighlightInd() <CR> :Highlight g:high_ind <CR> But g:high_ind is no...