variables

Passing variables in python when using from a import *

How can I make this print "baz" when I run b.py? a.py def foo(): global bar print bar b.py from a import * bar = "baz" foo() ...

How to get the original variable name of variable passed to a function

Is it possible to get the original variable name of a variable passed to a function? E.g. foobar = "foo" def func(var): print var.origname So that: func(foobar) Returns: >>foobar EDIT: All I was trying to do was make a function like: def log(soup): f = open(varname+'.html', 'w') print >>f, soup.prettify() f.clo...

capturing CMD batch file parameter list; write to file for later processing

I have written a batch file that is launched as a post processing utility by a program. The batch file reads ~24 parameters supplied by the calling program, stores them into variables, and then writes them to various text files. Since the max input variable in CMD is %9, it's necessary to use the 'shift' command to repeatedly read and ...

Variables versus constants versus associative arrays in PHP

I'm working on a small project, and need to implement internationalization support somehow. I am thinking along the lines of using constants to define a lot of symbols for text in one file, which could be included subsequently. However, I'm not sure if using variables is faster, or if I can get away with using associative arrays without ...

PhpDoc. Parameterization of variables in Eclipse

Hi. I heared Eclipse doesn't support parameterization of variables like this: /** @var DBProxy */ $proxy; or /** @var Uri */ $uri = Registry::get('uri'); $uri->... But no completions available Is there any other solution? ...

Language-agnostic term for typed things that need memory

Is there an accepted general term that subsumes the concepts of variables, class instances and arrays? Basically "any typed thing that needs memory". In C++, such a thing is called an object, but I'm looking for a more language-agnostic term. § 1.8 The C++ object model 1 The constructs in a C++ program create, destroy, refer to,...

How can I return a sql select into a sql variable

Hi, I'm trying to put the results of a SELECT into a variable and loop through the results to manipulate that data, all in the same stored proceedure... Here's what I have so far: DECLARE @i int @Result = (SELECT * FROM UserImport) SET @i = 0 WHILE @i < (SELECT Count(@Result) As Count) BEGIN /* Do Stuff */ END I know I'm way off...

How are static variables with the same name in different functions identified by the System?

AFAIK, we can have two static variables with the same name in different functions? How are these managed by the compiler and symbol table? How are their identities managed seperately? ...

Why are my JavaScript variables not persisting across functions?

I have the following JavaScript in my HTML page referencing an HTML form on the page: <script type="text/javascript"> <!-- var myForm = document.myForm; function validateForm() { if (myForm.myInput == "") alert("Please input some text."); return false; } myForm.submit(); } function showFormInput() { ...

Find actual value of PHP variable

Hi all. I am having a real headache with reading in a tab delimited text file and inserting it into a MySQL Database. The tab delimited text file was generated (I think) from a MS SQL Database, and I have written a simple script to read in the file and insert it into an existing table in my MySQL database. However, there seems to be so...

PHP Classes: parent/child communication

Hi all, I'm having some trouble extending Classes in PHP. Have been Googling for a while. $a = new A(); $a->one(); $a->two(); // something like this, or... class A { public $test1; public function one() { echo "this is A-one"; $this->two(); $parent->two(); $parent->B->two(); // ...how do i do something...

Function name inside a variable

Hello. I have a simple question (i guess). I'm getting the name of the function inside a variable from database. After that, i want to run the specific function. How can i echo the function's name inside the php file? The code is something like this: $variable= get_specific_option; //execute function $variable_somesuffix(); The "somes...

Get all Javascript Variables?

Is there a way for javascript to detect all assigned variables? For example, if one js file creates a bunch of vars (globally scoped), can a subsequent file get all the vars without knowing what they're named and which might exist? Thanks in advance :) EDIT, Question Part 2: How do I get the values of these variables? Here is what I h...

Changing a Variable Out of Scope?

Is there any way to change a variable while out of scope? I know in general, you cannot, but I'm wondering if there are any tricks or overrides. For example, is there any way to make the following work: function blah(){ var a = 1 } a = 2; alert(blah()); EDIT (for clarification): The hypothetical scenario would be modifying a variabl...

PHP Array Key & value Question

Hi I writed a test code as below. <?php $url = 'http://localhost/events/result/cn_index.php?login'; print_r(parse_url($url)); echo parse_url($url, PHP_URL_PATH); ?> Output Array ( [scheme] => http [host] => localhost [path] => /events/result/cn_index.php [query] => login ) /events/result/cn_index.php Now I inserted the line be...

What is a reference variable in C++?

Can someone give me a brief definition of a reference variable in C++? ...

What's the best way to pass a PHP variable to Javascript?

I currently echo certain variables in hidden input fields and read them out with Javascript whenever I need them. Me and a colleague are now thinking of generating an extra Javascript file with PHP which only contains all variables for Javascript. This way the variables already exist and there is no extra code in the HTML. What are goo...

Pass variable and its contents from workspace to GUI function in MATLAB

I have a variable in the MATLAB workspace and I want to pass the variable name and its contents to a function in my GUI. How do I achieve this task? ...

Uiimport does not save variable to base workspace

I tried using uiimport to load a file to the base workspace.....It worked first time....but after trying again after a while...I wasnt seeing the variable in the base work space. I used the default variable name which is given by 'uiimport". This was the command I used: uiimport(filename) And two variables where created by default.....

Generate a List of All Variables used in a Visual Studio Project

Is it possible to generate a list of all the variables used in a visual studio project? ...