I have two questions.
In C++, a static member function has direct access to a public non-static data member defined in the same class?
False
In C++, a non-static member function has direct access to a private static data member defined in the same class?
True
My note say false for the first question and true for the second one. I jus...
I am writing a program to calculate the shortest path between two nodes. In my program I have one custom class called NodeList, which contains an ArrayList of strings (representing nodes) along with a distance. I am using Dijkstra's algorithm which involves opening up the shortest edge from each node. So, I use this loop to tabulate the ...
Hi ,
I have two scripts parent.sh and child.sh. There is a variable in parent.sh which needs to be accessed by the child process. I have achieved this by exporting the variable in the parent script and the variable is available to the child process?
Is there any way that child can modify the value of the export variable defined in par...
Have any ways to keep a variables (object) in a page scope? I need pass some object from master page to all ascx files. Normally, i passing by using a method or structure with parameters. But now im asking another way to do this. Store it in session is a bad idea because my object should exists in a page scope only.
...
I have an array of variables.
And I want one variable to equal the previous one.
For example:
var myVars = {
var1: "test",
var2: var1
};
alert(myVars.var2);
//output: var1 is not defined
Any thoughts? I'm sure this is some sort of variable scope limitation.
I would like to hear otherwise.
Thanks in advance.
...
This should be obvious, but I'm getting a bit confused about PHP variable scope.
I have a variable inside a Constructor, which I want to use later in a function in the same class. My current method is this:
<?php
class Log(){
function Log(){
$_ENV['access'] = true;
}
function test(){
$access = $ENV['access'];
...
Okay, I'm trying to write a program that will scan a bunch of words to match against a set of letters. I want all words displayed that contain the letters entered by the user and I want these words displayed while the program is still searching. Therefore, I have to split the search onto its own thread, separate from the UI thread. Ea...
I have to use a Variable(Query Resultset) in ColdFusion, which will get the results from Other Application DB, and stores in Coldfusion Application.
The main idea is that I need to call the other Application DB only at Server startup time and cache the results in local. And I need to read the variable in other pages in my Application. ...
I've built a working page with lots of javascript. The javascript is placed in between the <head></head> tags without a problem, but I really want to move it an external file.
I though I would be able to simply cut and paste all the code minus <script></script> tags but incuding $(document).ready(function() { }); it into a .js file and...
The company I work at bought us (or rather me) the jQuery Cookbook by O'Reilly which I am reading from front to back. Now I am at 5.13 which talks about Name Lookups. It claims that given the right circumstances, code which is optimized regarding Name Lookups can have an up to 70% performance boost. In one very situational example, it cl...
This is a contrived example:
function test()
{
global $a;
$a=2;
}
test();
//here $a will report undefined variable
echo $a;
I meet this problem now by somehow,but I can't reproduce it in an easy way!
EDIT
I mean operations like include or alike by when
...
Ok, here's the deal where I'm really stuck.
I use my cms with design patterns.
Where's the last final output(in design template's main file: 'design.php'):
<div>{CONTENT_HEADER}</div>
<div style='float:left;width:25%'>{CONTENT_LEFT}</div>
<div style='float:left;width:50%'>{CONTENT_CENTER}</div>
<div style='float:left;width:25%'>{CONTEN...
I seem to have an array scope issue. I have a global variable;
var itemConnect:Array = new Array();
Which is initialized at the start. I then have a function to populate it as a 2-d array:
// Draw connections
function initConnections() {
for (var i:Number = 0; i < anotherArray.length; i++) {
for (var j:Number = 0; j < anotherArray...
Is there a way to set up a global variable inside of a module? When I tried to do it the most obvious way as appears below, the Python interpreter said the variable __DBNAME__ did not exist.
...
__DBNAME__ = None
def initDB(name):
if not __DBNAME__:
__DBNAME__ = name
else:
raise RuntimeError("Database name has a...
As the title suggests I am wondering what the relationship between these two programming concepts are. Does a certain type system (static / dynamic) lend itself to a certain type of scoping (lexical / dynamic), or are these independent language choices?
...
Can anyone get the function and class scoping feature to work, as documented in
Scoping Classes with Packages ?
I create a directory C:\Windows\Temp+undergrad
I put a file foo.m in there tat defines a function foo.
I make sure C:\Windows\Temp is on the matlab path
In matlab, type 'what undergrad' should result in a list of functions an...
Like others before me I'm struggling with scope in Javascript. (That and trying to read the darn stuff). I have checked some of the previous threads on this question but I cant seem to get them to apply correctly to my issuue.
In the example below, I want to manipulate the values in the tagsArr array, once the array has been fully popula...
if(true)
{
string var = "VAR";
}
string var = "New VAR!";
This will result in:
Error 1 A local variable named 'var'
cannot be declared in this scope
because it would give a different
meaning to 'var', which is already
used in a 'child' scope to denote
something else.
Nothing earth shattering really, but isn't thi...
I guess my problem is quite common, so there must be an easy solution. Consider the following xml snippet:
<categories>
<category name="cat1" />
<category name="cat2" />
<category name="cat3" />
<category name="cat4" />
</categories>
<data>
<catval name="cat2">foo</catval>
<catval name="cat4">bar</catval>
...
Background: I'm doing COM programming of National Instruments' TestStand in Python. TestStand complains if objects aren't "released" properly (it pops up an "objects not released properly" debug dialog box). The way to release the TestStand COM objects in Python is to ensure all variables no longer contain the object—e.g. del() them, or ...