I'm trying to put buttons that have operators on them, like / * +, etc. I want to store the operator in such a way that I can use it in an expression, like 1 var 2 = 8
I would like to avoid having to use a different method for each operator, so an operator var would be my best option, I think. Objective-C for iPhone
...
Can i set session variables based on the variable input into the function. Such as:
function check($value){
$_SESSION['$value'];
//session checks
}
...
I have a .php file that is rendering as a web page. Is there any way I could change a variable on the fly as the page renders?
Currently the page renders like this...
I love to eat oranges.
I love to eat oranges.
I love to eat oranges.
But I want it to render like this...
I love to eat oranges.
I love to eat apples.
I love to eat ch...
I made a function to create cows variable, then later I made another function to butcher them. The two functions are methods in a class. When I use the create cow function it works, and I get the value of cows. However when I access the butcher function the value of cows is zero.
It's like there are two different variables; I didn't thi...
I have a question about best practices for Ruby variable scope using class_eval.
In the below code snippet, in the class_eval block, the local variables first and second are undefined.
def parent_method(opts={})
first = opts[:percent]
second = (10 * first).to_i
SecondClass.class_eval do
def second_method; return {:...
Hi, I need to call a variable that is a customer’s shipping address attribute, in Onepage checkout, step 3 shipping method
In file
app/design/frontend/default/default/template/deliverydate/onepage/deliverydate.phtml
I already made successful tests in calling this variable with :
$numero_point_relais = $this->getCustomer()...
Hi
I have this:
function boo($show_one = false){
if(!show_one) return 1; else return 2;
}
how can I call boo like this:
boo(SHOW_ALL);
instead of boo(false).
I see some native php function have parameters like that which make the code more easy to read
...
I would like to know from people with experience where the best place to declare, initialize and release objects is.
Should all objects including NSStrings always be declared in the header file?
Are variables like an int declared in the header file?
If I declare an object or use an object in a method, should it be released in that met...
I'm trying to do something like this:
NSAppleScript *sendCharlieImput = [[NSAppleScript alloc] initWithSource:@"tell application \"terminal\" to do script " charlieImputSelf " in front window"];
[sendCharlieImput executeAndReturnError:nil];
The variable charlieImputSelf is going to be put into the terminal window as a command. BUT I n...
So I got a lot of responses from this site that global variables are bad and kill puppies.
What if I use such variables like this:
function get_stuff(){
global $stuff;
if(!stuff) $stuff = 'candy';
return $stuff;
}
function screen_output(){
$stuff = get_stuff;
echo $stuff;
}
does this make the code better than using 'global...
Hi,
I am trying to split up my code in classes. but there is a issue what really bothers me. when i create a class for functions i am giving its own stage. like this
dragf:Dragfunctions = new Dragfunctions(this)
and in the class i use this
var stage:Object;
public function Dragfunctions(stage:Object)
{
this.sta...
$pname = "postback_".$data;
$_SESSION["$pname"] = $data;
It is not working. How to use it?
...
I have a text box that receives data from XML. Has activated the service. Everything works fine if i use "taurus" instead myVar in {}.
Now I want to change the field and depending on the button is pressed to receive different data. But nothing comes out.
public var myVar:String = "taurus";
pr...
Hi!
I am trying to get Clojure to read a file, put the first line in a variable, and the rest in another variable.
I cannot seem to find out how to do this and would love if anyone could give me a heads up,
...
Hello,
i found several similar questions, but it did not help me... so i have this problem:
var xxx = "victoria";
var yyy = "i";
alert(xxx.match(yyy/g).length);
I dont know how to pass variable in match command. Please help. Thank you.
...
I have a quick question that is not particular technical, but I sometimes wonder what's better ...
Do you use singular or plural in names of arrays, maps, sets, etc.? Example:
Singular
1 std::map<string,double> age;
2 age["diego maradonna"] = 49;
Plural
1 std::map<string,double> ages;
2 ages["diego maradonna"] = 49;
In the pl...
Here's the code:
- (IBAction) charlieImputText:(id)sender {
//getting value from text field when entered
charlieImputSelf = [sender stringValue];
if (charlieImputSelf != @"") {
(send field if not empty)
}
}
This sends it even when the field is empty; therefore, this does not work as I want it to.
Sorry...
Is it possible to do something like this?
if (myVariable == 100 for more than 1 second) {
}
So if myVariable equals 100 for more than 1 second do something.
Thanks!
Elijah
...
I have the following code and when I run it, passing 1000 bytes to the parameter in the function, the structure MEMORY_BASIC_INFORMATION has none of its variables used, they all stay the value 0. I wondered if that is supposed to be?
public unsafe static bool CheckForSufficientStack(long bytes)
{
MEMORY_BASIC_INFORMATION stackInfo ...
Hello,
I am making some view functions to calculate the rank of one user in a community.
My problem is that i want to display the rank afferent to each user, in its profile, and i don't know how, since i don;t have a request and a render_to_response (cause i guessed they are not needed)
my code:
def calculate_questions_vote(request):
...