variables

some kind off variable problem within php class

Hello, I have this in my class When the second function is called php errors with wrong datatype and only variables can be past by reference. I don't know what they mean by that This code comes from php.net If the same code is outside the class it executes fine What am I doing wrong here, if I am working within a class? $extensiesA...

MySQL Query Browser - using variables

I'm used to MSSQL's Query Analyzer. Needing to convert some SP's for a hobby project, I'm having trouble making the transition to the mysql query browser, particularly when it comes to using variables. I'm essentially trying to simulate a procedure before it's a procedure. So in Query Analyzer i'd write something like this... delca...

Use Variable of a function in another function without parameters?

i like to make my database insert more dynamicly with functions. Like this: private void setValues() { string test = "foo"; string test2 = "bar"; } private void WriteToDB() { dc dcOfMyDatabase = new dc(); DBTable myTable = DbTable() { field1 = test; // values of other function field2 = test2; // values o...

Can variable which is declared in same procedure body where tasks are be considered as shared for these tasks?

Variable is used in 1 task only, but the question is: can it be CALLED shared? ...

Python: Difference between 'global' & globals().update(var)

What is the difference between initializing a variable as global var or calling globals().update(var). Thanks ...

Initializing Generic Variables in Scala

How do I declare a generic variable in Scala without initializing it (or initializing to any value)? def foo[T] { var t: T = ???? // tried _, null t } ...

Determine if variable is defined in Python

How do you know whether a variable has been set at a particular place in the code at runtime? This is not always obvious because (1) the variable could be conditionally set, and (2) the variable could be conditionally deleted. I'm looking for something like defined() in Perl or isset() in PHP. if condition: a = 42 # is a defined he...

Variable passing to find function in rails 2

I am new to Rails. I have following construction. Mainmenu in my project has many submenus. In defining @submenu is everything ok, but in finding @mainmenu not. The output is: Couldn't find Mainmenu without an ID @submenu = Submenu.find(params[:submenu_id]) @mainmenu = Mainmenu.find(params[:id => @submenu.mainmenu_id]) How can i defin...

XSLT: Use result of expression inside a loop outside of that loop

I'm trying to transform certain parts of an XML file to another XML file. The source file: <CUSTOMERS> <CUSTOMER> <CUSTOMER_NUMBER>12345678</CUSTOMER_NUMBER> <CUSTOMER_ADDRESS> <CUSTOMER_ADDRESS_NAME>John Doe</CUSTOMER_ADDRESS_NAME> <CUSTOMER_ADDRESS_STREET>Street 1</CUSTOMER_ADDRESS_STREET> <CUSTOMER_ADDRESS...

Unexpected array behavior

The following modify method somehow modifies the whole @x array instead of just simply generating another element to be pushed later. How come? def modify i, s t = @x[-1] t[i] = t[i] + s t end @x = [ [10, 12] ] @x << modify(0, 1) puts @x Edited The following code have done the trick. Still I wonder if its possible to get rid o...

What is wrong with this PL/SQL? Bind Variable * is NOT DECLARED

Here is: declare v_str1 varchar2(80); begin v_str1 := 'test'; print :v_str1; end When I run it using SQLDeveloper just in a sql worksheet I get this: Bind Variable "v_str1" is NOT DECLARED anonymous block completed ...

Pythonic way to only do work first time a variable is called

Hello, my Python class has some variables that require work to calculate the first time they are called. Subsequent calls should just return the precomputed value. I don't want to waste time doing this work unless they are actually needed by the user. So is there a clean Pythonic way to implement this use case? My initial thought was ...

Passing PHP variables to an included file?

This should work, so I'm really perplexed about why it's not working. I'm checking to see if a user is logged in using a $session class method at the top of each admin page. However, I want to dynamically adjust the header file depending on whether a user is logged in, and on what role level that user has. So I check $session->is_logge...

How to store variables to disk so you can use them next time the PowerShell script runs?

Hi, I would like to store a variable to disk or registry so I can use it the next time I run the scheduled script? Preferably an one-liner or two... Cheers, Roy ...

Objective-C/iPhone Memory Management Static Variables

I have a static method that creates an instance of the class and puts it in the static variable. I am wondering what the proper way of memory management is in this situation. You can't put it in the dealloc-method, because although it can access the static variable any instance method that is created that get's released will also relea...

Loop doesnt work without alert() in ajax readystate()

Problem description: Hello ! My XMLHTTPRequest object, when ready, does a couple of things, as in, the responseText which i receive, is split up, and sent as a parameter to myFunction() Now, i need to call myFunction() 'n' number of times, with substrings of the response text as parameters. This Works: myAjaxObj.onreadystatechange=fun...

JQuery Contains Selector - Multiple Text Items

Hi, I am new to JQuery and maybe am missing the obvious, but how can I filter a table using the contains selector but have it look for multiple strings using an OR operator. In other words, I would like rows containing "Red" OR "Yellow" to be hidden. So far I have this which works by hiding all rows except the given date: $(function()...

cleaning $_POST variables

I'm trying to come up with a way to effectively easily clean all POST and GET variables with a single function. Here's the function itself: //clean the user's input function cleanInput($value, $link = '') { //if the variable is an array, recurse into it if(is_array($value)) { //for each element in the array... fore...

Python: static variable decorator

I'd like to create a decorator like below, but I can't seem to think of an implementation that works. I'm starting to think it's not possible, but thought I would ask you guys first. I realize there's various other ways to create static variables in Python, but I find those ways ugly. I'd really like to use the below syntax, if possible...

Is there a CPU that can change variables simultaneously?

if I write: a = 0; b = 0; c = 0; d = 0; e = 0; f = 0; I think (maybe am wrong) that the CPU will go line by line for example: CPU says: let me assign a to 0 then let me assign b to 0 then let me assign c to 0 then let me assign d to 0 etc... I was just wondering if there is a processor that can change variables simultaneously...? ...