variables

jQuery get biggest number from list

var one = 1415; var two = 2343; var three = 11; How to get the biggest number from these variables? (the shortest way wanted) ...

php variable in regex?

I have a variable $word and I'd like to match it in my select statement somethig like this: "select * from table where column regex '[0-9]$word'" but this doesnt work, so how can i put a variable in a regular exprssion? Thank you ...

Parse Javascript variable with Python

How can I convert a Javascript variable (not JSON format) into a python variable? Example Javascript variable: { title: "TITLE", name: "NAME", active: false, info: { key1: "value1", dict1: { sub_key1: "sub_value1", sub_key2: "sub_value2", }, dict2: { su...

pass array as parameter to PHP file

I am trying to create a bunch of static HTML pages from a single PHP template. I want to pass an array (a row in a MySql DB) to the .php template file, so that I can use the contents as variables and get the HTML page back. What's the best way to do this? A POST request? A function? I loop through the MySQL query results in the following...

Variable in a Variable iPhone?

Hi For my iPhone app in objective-c is it possible, and if so how can I make a variable inside a variable? For example, I have one named Var1 and then I can combine it with Var2. Lets say Var2 is a number, so it displays Var1 like Var11, the second one being Var2. Make sense? Anyway if Im not making sense, could you let me know how a v...

Java instance variable declare and Initailize in two statements

Hi I'm having problem with initialization in java, following code give me compile error called : expected instanceInt = 100; but already I have declared it. If these things relate with stack and heap stuff please explain with simple terms and I'm newbie to java and I have no advanced knolwedge on those area public class Init { int...

Global static variables in Python

def Input(): c = raw_input ('Enter data1,data2: ') data = c.split(',') return data I need to use list data in other functions, but I don't want to enter raw_input everytime. How I can make data like a global static in c++ and put it everywhere where it needed? ...

?Sending a String created inside a method to another class

I have code which has one activity which passes information to a second activity. I can use this information to pass to a third activity with additional information from the result of the second activity. I want to use gestures as a method of going back to a previous activity, but if I go back from the third to the second activity I n...

function vs variable declaration in C++

This code works: std::ifstream f(mapFilename.c_str()); std::string s = std::string(std::istreambuf_iterator<char>(f), std::istreambuf_iterator<char>()); ParseGameState(s); Whereby mapFilename is an std::string and void ParseGameState(const std::string&);. And this does not: std::ifstream f(mapFilename.c_str()); std::string s(std::is...

What is the meaning of $this

I've seen some scripts contain $this in a PHP script that has OOP, I never knew the meaning of it... like $this->refresh(); Perhaps explain to me what $this refers to be...? But I do know that you cannot use it as a dynamic variable like $this_is_a_variable but why can't use it as a dynamic variable? ...

I get an undefined error in firebug , even if I can see the value exists!...why??

i'm loading in jquery a google map json and i receive correctly the json object called 'data' sometimes — i can't identify exactly when or why and that's why i came here — even if i receive the regular values, BUT firebug console reads it is undefined! for example, I have this line below in my js: console.log(data.Placemark[i].Addre...

what are the tradeoffs of using accessor methods vs public variables in php

I'm looking for advice/experience on using public variables vs private variables with accessor methods in php. eg $obj->foo = 'a'; echo $obj->foo; vs $obj->setFoo('a'); echo $obj->getFoo(); What I like about public variables is the shorter syntax - just seems less work to use. I understand that it could make refactoring more diffic...

PHP $_Post variables print but still give index errors?

Hey, I've got what has become an extremely frustrating problem with $_Post variables. I'll give examples of code rather than the actual segments to save time and confusion. On one page I'm doing this: <? echo "<form name='form' action='page.php' method='post'> <input type='hidden' name='slot' value=".$i."> </form>"; ...

Converting an object to a set of variables

How would you go about converting: $Object->one; $Object->two; to: $one; $two; ...

Restricting variable access

I need to have a variable that only one function can write (let's call that function a) and that only one other function can read (let's call that function b). Is that possible? ...

How do I assign javascript variable to php variable? With out submitting the form

hi friends can some one tell me How do I assign javascript variable to php variable? I am actually getting a value through javascript and I want the javascript values to be assigned to php variables. With out submitting the form. ...

set attribute of xml node to a variable

I am trying to get the value of an attribute of an XML node and set it as a variable using JQuery. Is this possible? <DataContainer> <Customers> <Customer customerId="7366" customerName="Boardwalk Audi" url="" address="5930 West Plano Pkwy" city="Plano" state="Texas" zipCode="75093" latitude="33.01...

PHP bizarre math

Hi, I'm very new to PHP...and I'm getting unexpected values for variable calculations: $var1 = $var2 * (((1 + $var3)^$var4)^$var5); I've verified that $var2 is 3, $var3 is 0.1, $var4 is 1, $var5 is 1.1 so, $var1 = 3*(((1+0.1)^1)^1.1) = 3.3316 but in PHP, $var1 = 3 if I change $var4 to 2, $var1 = 3*(((1+0.1)^1)^1.1) = 3.6999 but i...

double problem in xcode or me doing something wrong

Hi I would guess it's the simplest thing but it's really confusing me. I'm sure I've successfully used doubles before but now I'm having trouble. I just made a new 'test' project to see if I can get it working, but all I'm trying to do is set a double value. So in the View Controller's viewDidLoad i've typed: double z = 2938.09; NSL...

mysql_escape_string question

Hi, Just a quick query really, In my PHP file, I have variables coming from my HTML form, like so: $companyName = mysql_escape_string($_POST['compName']); $AddLine1 = mysql_escape_string($_POST['add']); $AddLine2 = mysql_escape_string($_POST['add1']); $AddLine3 = mysql_escape_string($_POST['add2']); Throughout this scrip...