scope

Jquery post success variable scope

Hi, I'm trying to return the ajax success array from one function to another. For some reason I don't seem to be able to pass the data stored in a variable in the success part of the ajax function into the parent function to return. I looked at this post to try and figure things out, but not such luck: http://stackoverflow.com/questio...

PHP Scope Resolution Operator Question

I'm having trouble with the MyClass::function(); style of calling methods and can't figure out why. Here's an example (I'm using Kohana framework btw): class Test_Core { public $var1 = "lots of testing"; public function output() { $print_out = $this->var1; echo $print_out; } } I try to use the following to cal...

default_scope in rails 3

I know named_scope has been changed to scope in rails 3. How do I perform default_scope in rails 3, I've had a good google but found nothing for defaults scopes. ...

pthread and child process data sharing in C

hi everyone, my question is somewhat conceptual, how is parent process' data shared with child process created by a fork() call or with a thread created by pthread_create() for example, are global variables directly passed into child process and if so, does modification on that variable made by child process effect value of it in pare...

JDBC ODBC.. (Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException)

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { PreparedStatement p1; try { System.out.println("works"); String s1="insert into reg(num,name) values(?,?)"; p1 = conn.prepareStatement(s1); System.out.println("Works"); JOptionPane.showMessa...

Are local variables in Fortran 77 static or stack dynamic?

For my programming languages class one hw problem asks: Are local variables in FORTRAN static or stack dynamic? Are local variables that are INITIALIZED to a default value static or stack dynamic? Show me some code with an explanation to back up your answer. Hint: The easiest way to check this is to have your program test the histor...

Error loading Variables stage.loaderInfo - AS3

I have a Document class that loads variables from Facebook with the use of stage.loaderInfo var connect:FacebookConnectObject = new FacebookConnectObject( facebook, API_KEY, this.stage.loaderInfo ); But when I change the Document class (with another one responsible for the layout of my app), and try call the above from a movieclip tha...

Scope of "library" methods

Hello, I'm apparently laboring under a poor understanding of Python scoping. Perhaps you can help. Background: I'm using the if __name__ == "__main__" construct to perform "self-tests" in my module(s). Each self test makes calls to the various public methods and prints their results for visual checking as I develop the modules. T...

Autofac: Reference from a SingleInstance'd type to a HttpRequestScoped

I've got an application where a shared object needs a reference to a per-request object. Shared: Engine | Per Req: IExtensions() | Request If i try to inject the IExtensions directly into the constructor of Engine, even as Lazy(Of IExtension), I get a "No scope matching [Request] is ...

JavaScript: Reference a functions local scope as an object

When I call a function, a local scope is erected for that call. Is there any way to directly reference that scope as an object? Just like window is a reference for the global scope object. Example: function test(foo){ var bar=1 //Now, can I access the object containing foo, bar, arguments and anything //else within the loca...

PHP: prevent invocation of method X from from context != Y

This is a tricky one. I am "emulating" ZF Bootstrapping (surface appearance). Don't ask me why, call it academic interest. So I have a Bootstrap Abstract with a method "run" that iterates over itself to locate any methods prefixed with "init". The application looks for a user defined class which extends this class, in which the user ...

Force scope bar below UISearchBar

I have a UISearchBar and UISearchDisplayController, everything works great but my scope selector displays beside the text field instead of below it. I know that this is the expected action when the device is in landscape, but since I have the UISearchBar in the master view of a UISplitViewController it ends up looking like this http://cl...

Java: startingPath as "public static final" exception

[Updated, sorry about the change but now to the real problem] I cannot include try-catch-loop there for the exception from the method getCanonicalPath(). I tried to solve the problem earlier with method and then declaring the value there. The problem is that it is Final, I am unable to change it. So how to have startingPath as "public st...

Attaching a function to the parent window from an iframe and getting proper scope

I working on adding file uploading to my web application. I'm using an iframe to post my upload. When my php script processes the upload it writes some JavaScript to the iframe. This JavaScript is attempting to attach a function to the parent, this works, but when this function actually gets called it doesn't have the correct scope. Here...

Javascript: Access the right scope "under" apply(...)

This is a very old problem, but I cannot seem to get my head around the other solutions presented here. I have an object function ObjA() { var a = 1; this.methodA = function() { alert(a); } } which is instantiated like var myObjA = new ObjA(); Later on, I assign my methodA as a handler function in an external J...

C# Anonymous method variable scope problem with IEnumerable<T>

Hi. I'm trying to iterate through all components and for those who implements ISupportsOpen allow to open a project. The problem is when the anonymous method is called, then the component variable is always the same element (as coming from the outer scope from IEnumerable) foreach (ISupportsOpen component in something.Site.Container.Com...

R: disentangling scopes

Hi, My question is about avoiding namespace pollution when writing modules in R. Right now, in my R project, I have functions1.R with doFoo() and doBar(), functions2.R with other functions, and main.R with the main program in it, which first does source('functions1.R'); source('functions2.R'), and then calls the other functions. I've ...

C++ boost wave, scoped macro

hello. Is it possible to have scoped macros using custom defined macros through boost wave? I know it should a possible with C++0x however I am working with regular C++. If it is possible, can you provide link or reference how to accomplish this? Thanks ...

functions inside or outside jquery document ready

Up until now I just put all my jQuery goodness inside the $(document).ready() function, including simple functions used in certain user interactions. But functions that don´t require the DOM document to be loaded or are only called afterwards anyway, can be placed outside the $(document).ready() as well. Consider for example a very sim...

How to share a static variable between C++ source files?

Hello, I don't know if it is possible to do this, but I have tried several ways and nothing seems to work. Basically I need to access the same static member from several files which include the same class definition. // Filename: S.h class S { public: static int foo; static void change(int new_foo) { foo = new_foo; ...