variable-scope

set variable of parent form from child form in mdi

How would one switch a public bool to true from a child form in a mdi type program? I have a child form called logon that if everything checks out i want to set a "authenticated" bool to true in the form1 (main) form ...

Best way to access properties of my codebehind class from the markup in ASP.NET

This might be a really dumb question but I'm learning .NET, so I'm quite clueless... Let's say I have two files default.aspx and the associated default.aspx.cs. default.aspx.cs: protected void Page_Load(object sender, EventArgs e) { var myObject = new MyObject(); } Is there a way that in the default....

Jquery scope

I've just started learning Jquery but the examples aren't helping me much... Now whats happening with the following code is that I have 4 forms that I switch between using a link for each. But what I can't figure out is how to get variable "postOptionSelected" in the first function to pass to the other functions to display even more use...

coldfusion problem about onRequest method in Application.cfc

hi everyone, i was blocked by a coldfusion problem, any suggestions are appreciated. now lemme decribe my problem. i have an Application.cfc in my website root, the content in it is as follows: <cfcomponent output="false"> <cffunction name="onRequest" returnType="void"> <cfargument name="thePage" type="string" required="true...

Derived template-class access to base-class member-data

This question is a furtherance of the one asked in this thread. Using the following class definitions: template <class T> class Foo { public: Foo (const foo_arg_t foo_arg) : _foo_arg(foo_arg) { /* do something for foo */ } T Foo_T; // either a TypeA or a TypeB - TBD foo_arg_t _foo_arg; }; template <...

Are variables defined locally in a partial also visible to the invoking erb template?

If I declare local variables in a partial and then render the partial from another erb template, will the latter also have accces to those local variables? ...

When to use this in javascript OO?

In Javascript OO, when should I use the this keyword? Also, if I want to call a method of a class from another method of the same class, should I use this or just the name of the function? E.g is this correct? function Foo() { this.bar= function() { alert('bar'); } this.baz= function() { this.bar(); //should ...

Writing functions in R, keeping scoping in mind

I often write functions that need to see other objects in my environment. For example: > a <- 3 > b <- 3 > x <- 1:5 > fn1 <- function(x,a,b) a+b+x > fn2 <- function(x) a+b+x > fn1(x,a,b) [1] 7 8 9 10 11 > fn2(x) [1] 7 8 9 10 11 As expected, both these functions are identical because fn2 can "see" a and b when it executes. But ...

Pass in jQuery/plainJS variables/functions of a current scope to anonymous function called from current scope

How to pass current scope variables and functions to the anonymous function in plain Javascript or in jQuery (if it's specific for frameworks). For example: jQuery.extend({ someFunction: function(onSomeEvent) { var variable = 'some text' onSomeEvent.apply(this); // how to pass current scope variables/functions to this functi...

[Objective C] Object sharing in my iPhone App

Hi, I'm currently developping my first iPhone application and I would like to know what is the best way to share an object which is gonna be used in every controller. I was thinking of referencing the controller containing the needed data in other controllers and access this data thanks to properties, is that a good idea or is there a ...

JavaScript: Convert string to value of predefined variable

I have a JavaScript object that looks like the following: venue = function(map, dataSet) { // set some constants this.VENUE_ID = 0; this.VENUE_NAME = 1; this.VENUE_CITY = 2; this.filterBy = function(field, value) { ... var filterValue = 'parent.VENUE_' + field; } } Now, the problem is that I ne...

Custom javascript class and private variable scope issue

I am having some trouble with the classic javascript local variable scope topic, but dealing with a JSON variable. I have looked at other questions here regarding the same thing, but nothing has matched my case exactly, so here goes. I have a class that I have made from javascript that has 3 methods: func1, func2, and func3. I also ha...

Jquery $.post() variable scope

Hi I'm not massively experienced with JavaScript and I'm having trouble with variable scope and jquery. I have the following structure: function pass_variables() { username = "efcjoe" response = post_variables(username) alert(response) } function post_variables(username) { $.post( '/path/to/url/', { ...

C# foreach loop causes CS 0246 Type or namespace could not be found

I have a foreach loop that cycles through a list of types and creates an instance of each one. However, when I build, it gives a CS0246 error ("The type or namespace could not be found ... "). Here's a simplified version of the code: internal static class TypeManager { internal static void LoadTypes() { // Fill the lis...

Accessing a varable declared in a controller from a model

I'm using the facebooker gem which creates a variable called facebook_session in the controller scope (meaning when I can call facebook_session.user.name from the userscontroller section its okay). However when I'm rewriting the full_name function (located in my model) i can't access the facebook_session variable. ...

Update coordinate property of MKAnnotation on parent viewcontroller after Touch End event?

Hi, I have written an application with a draggable annotation which I have added on top of a MKMapView. I've added a CLLocationCoordinate2D variable called myloc in my main view controller to store the coordinate (lat,lng) values whenever I drag the annotation. My question is how do I update the myloc property value in the super parent ...

.Net reference forms application variable

I have a public variable "testStr" in my applications main form. I have a tabControl which adds tabs loaded with user controls. How can I reference "testStr" from these user controls? I would imagine its either Application.* or parentForm.* ... but everything I'm trying isnt working, not really sure how to do it and I'm a bit new to .net...

Type limitation in loop variables in Java, C and C++

Why Java, C and C++ (maybe other languages also) do not allow more than one type on for-loop variables? For example: for (int i = 0; i < 15; i++) in this case we have a loop variable i, which is the loop counter. But I may want to have another variable which scope is limited to the loop, not to each iteration. For example: for (int ...

Setting property value of parent viewcontroller class from child viewcontroller?

Does anyone know how to update a property value from the subview (child) view controller? I have a int property called statusid defined with gettor/settor in parent view controller. [self.view addSubview:detailsVC.view]; In the child subview, I trying calling [super statusid:updatedValue]; to update statusid to a new value, but this cre...

Local variable scope question

Why is the following code prints "xxY"? Shouldn't local variables live in the scope of whole function? Can I use such behavior or this will be changed in future C++ standard? I thought that according to C++ Standard 3.3.2 "A name declared in a block is local to that block. Its potential scope begins at its point of declaration and ends ...