Variable scope in JS is confusing the hell out of me. In follwing code, if i use the setClient public method to set a clientID i can then access the value from inside the track method using the getClient method. I cannot however access the value of the private member 'version' this way (or any other private member).. i had assumed that v...
I was curious what is the scope of variables declared inside a class constructor which are not data members of that class?
For example, if a constructor needs an iterating int i, will this variable be destroyed after the constructor finishes, or is it then global for the program?
Thanks!
...
Hi all,
I have the following simple script.
<script>
SPC = {
a : [10],
b : 10,
t: function()
{
y = this.a;
z = this.b;
y[0]++;
z++;
alert('this.a[0] = ' + this.a[0] + '\nthis.b = ' + this.b)
}
}
SPC.t();
SPC.t();
</script>
Running it in your browser will display two alert ...
Here is the deal. I have a Master-Detail Grid scenario. The Master GridView is loaded when the page is loaded. I am using a DataView of same DataTable which loads the Master to load the Detail GridView, by filtering what I need to show in the DetailGridView. Everything works fine when I view the first row of the MasterGridView. When I tr...
Hi
I'm writing a basic class using prototype.js in which some class vars are set when the class is initialised - the problem is that these variables aren't available to other methods within the class.
var Session = Class.create({
initialize: function(){
// define defaults
this.source = '';
},
shout: function(){
alert(this.source);
}...
Is it possible to include one function inside another? To learn functions, I'm trying to create a combat sequence using PHP. The sequence would look like this:
Dice would roll, assigning numbers to variables;
Hero1 attack results are printed;
Dice would roll, assigning numbers to variables;
Hereo2 attack results are printed;
Dice woul...
It's a crazy question because it seems simple. I cannot find anywhere that blatantly states the answer.
If I type:
void doThis(){
System.out.println("Hello Stackoverflow.");
}
what is the default scope of doThis()?
Public? Protected? Private?
Thanks in advance.
...
I have the following JavaScript (I'm using jQuery):
function language(language)
{
var text = new Object();
$.ajax({
type: "GET",
url: "includes/xml/languages/" + language + ".xml",
dataType: "xml",
success: function(xml){
$(xml).find('text').each(function(){
text[$(this).attr('id')] = $(this).te...
Is there a function and/or object and/or extension in PHP that will let you view all the variabled defined in the current scope? Something like
var_export($GLOBALS)
but only showing variables in the current symbol table.
...
I've got a simple function that takes a List parameter. While working with it, it copies it and reverses the copy using .NET's List(Of T).Reverse method.
Private Function FindThing(ByVal Things As List(Of Thing)) As Thing
Dim ReverseOrderThings As List(Of Thing) = Things
ReverseOrderThings.Reverse()
For Each t As Thing In R...
Let's say I have a stored procedure with this in its body:
EXEC 'INSERT INTO ' + quotename(@table) ' blah...'
SELECT IDENT_CURRENT('' + @table + '')
Is IDENT_CURRENT() guaranteed to get the identity of that row INSERTed in the EXEC? IDENT_CURRENT() "returns the last identity value generated for a specific table in any session and any ...
I'm writing a very simple mailing system for a Rails app. I'm using RESTful authentication.
It's a fairly conventional setup, where I'm sending the same email when a user signs up and when a user forgets their password.
I'm just having one problem that I can't seem to wrap my head around.
I'd like to use the same email template for both...
I'm creating a site on which there are many page components that refer to objects that are used elsewhere in the page. Some of these components are used in other pages as well, thus my desire to use includes rather than cut-and-paste.
The problem is that if I have identical "jsp:useBean" statements in multiple components of the page,...
In Java
static final int VCount = 21, TCount = 28, NCount = VCount * TCount;
in Objective-C
static int VCount = 21, TCount = 28, NCount = ???;
How can I express the NCount int because it refers to variables?
...
Tutorials usually don't deal with scope in Actionsript. Can you point me to some documentation and/or explain what should I know about it. I want to avoid problems arising from certain classes are not visible at cretain places.
...
I get confused when I see examples of self invoked anonymous functions in Javascript such as this:
(function () { return val;}) ();
Is there a difference between this syntax and the following:
function() { return val;} ();
If someone can give me a concrete difference, it would help put to rest a question that's been bugging me for ag...
Current situation:
I have the current version of my MVC Framework which uses classes as controllers.
I have some "vintage" modules from my old MVC Framework which uses simple, flat includes as controllers.
Much simplified that means:
New Version:
<?PHP
class blaController extends baseController {
private $intVar;
function ...
In my Rails application I have a User model (more or less built by RESTful Authentication), and several other models belonging to the user.
So let's say, for example:
user has_many :posts
post belongs_to :user
Anywhere in the users resource I can access the user variables as I would expect.
@user.name, @user.email, @user.login, etc. a...
Is there any way to keep global variables visible only from inside a library while inaccessible from programs that access that library in C?
It's not that it is vital to keep the variable protected, but I would rather it if programs couldn't import it as it is nothing of their business.
I don't care about solutions involving macros.
...
We have a product that has both a winforms and a web client, and are providing the users a way to launch into another company asset (a web application). We need to make sure that the user only ever has one instance of the other web application open in a browser (or at least that we've opened for them). We accomplished this (sort of) by d...