Hi all,
I encountered a problem with the scope variables have when IPython is invoked at the end of a python script.
All functions I call in the script itself can modify variables, which will subsequently be used by other functions.
If I call the same functions in ipython, the scripted ones can access the changed variables but variables...
Hi everybody,
Here's my code:
class Manual extends controller {
function Manual(){
parent::Controller();
$myVar = 'blablabla';
}
function doStuff(){
echo $myVar; // Doesn't work.
}
}
I've tried various methods to make it work, but I've can't get my head around it. What can I do?
Thanks
...
I am trying to get better at extending the classes of Extjs, and my evolvement have lead me to this problem:
I have extended an Ext.Panel and I want my extension to have a bottom toolbar with one button as default.
myPanel = Ext.extend(Ext.Panel, {
method: function () {
return 'response!';
},
bbar: new Ext.Toolbar(...
Hello fellow geeks,
I have a problem with Struts2's ScopeInterceptor: after the action that is set to be the end of a workflow is executed the interceptor doesn't clear the session for the element that was set at the beginning.
This is how I have set up my classes and struts.xml:
struts.xml
<package name="build" extends="base-package...
I want to make all beans request scoped by default, however the Spring documentation says that the default scope is Singleton. (sections 3.4.1 and 3.4.2 http://static.springsource.org/spring/docs/2.5.x/reference/beans.html)
I want to declare the default scope to be request scoped.
This is the closest thing I have found so far -- it's ...
when i use jquery to create an element(a div, for example) in a callback function, it doesn't allow me to manipulate the newly created element outside the callback function, how can I get around this?
here is the example:
$.get('menu.xml',function(data){
//create a new element with an ID called "#newElement"
})
//I can't select the ...
I'm trying to find a way to minimize the number of Selector look-ups. My issue is that I have a variable defined with base $(document).ready() that needs to be updated inside functions nested inside $(document).ready()
Consider this example (EDIT: I updated it to be more explanatory)
<script>
//var $current_page = $home_page; **<--I ...
I'm using mootools:
I can't figure out how to use a variable when using an addEvent.
I want to use a for next loop to set values in a loop:
for (x=0;x<num;x++){
var onclickText = 'function (){onclick="addPageMoveEvent('+x+'"); }';
$('pageNum'+x).addEvent('click', onclickText);
}
>
I've search forums but not found any help.
Any help...
I have a question about best practices for Ruby variable scope using class_eval.
In the below code snippet, in the class_eval block, the local variables first and second are undefined.
def parent_method(opts={})
first = opts[:percent]
second = (10 * first).to_i
SecondClass.class_eval do
def second_method; return {:...
Ruby's eval() can be like
def showblock(&block)
puts eval("i * 3", block)
end
where block is the block passed into the function.
Instead of a block, a binding object can be passed in as well. Is the binding object the same as what is called the "scope chain" that is mentioned a lot when Javascript closure is discussed?
...
hello
(I modified the original question to be more meaningful)
With respect to return statement, are Raii object destroyed before/after/between return statement?
for example
size_t advance() {
boost::lock_guard<boost::mutex> lock(mutex_);
return value_++; // is lock destroyed after increment?
}
thank you
...
Hi everyone,
For a project that will let developers add their own Javascript applications, I need to limit scope of Javascript to a certain div. For example, each developer will have access to their own div.
<div id="md5_of_a_salt_and_app_id">
<script>
/* This area should not be able to modify window element
* or ...
I have the following anonymous function:
(function() {
var a = 1;
var b = 2;
function f1() {
}
function f2() {
}
// this => window object!
// externalFunction(this);
})();
function externalFunction(pointer) {
// pointer.f1(); => fail!
}
I need to call external function from this anonymous function and pass it's pointer to...
Just having an conversation with collegue at work how to declare a variables.
For me I already decided which style I prefer, but maybe I wrong.
"C" style - all variable at the begining of function.
If you want to know data type of variable, just look at the begining of function.
bool Foo()
{
PARAM* pParam = NULL;
bool rc;
...
I have a tree-like model where in all situations but one, I want to scope the results to only return the roots.
class Licence < ActiveRecord::Base
default_scope :conditions => { :parent_licence_id, nil }
belongs_to :parent_licence, :class_name => 'Licence'
has_many :nested_licences, :class_name => 'Licence',
:foreign_k...
Hi,
I am stumped by a problem which i'd assume is a common Jquery occurence, but i've no idea how to fix!
I have 5 variables -
var pubtimed
var toolstimed
var newstimed
var mylinkstimed
var partnerstimed
Which are used to store on and off states.
I then have a script that checks cookies for recent states and updates the va...
// i = inner, o = outer, f=function, a=attribute
var singleton = function() {
var iF = function() {
return this.oA; // returns undefined
}
return {
oF: function() {
this.oA = true;
return iF();
},
oA: false
};
}();
singleton.oF();
If singleton were a class (as in a class-based language), shouldn't I be able to acce...
In the code below, I need to set "Variable1" to an arbitrary value so I don't get into scope issues further below. What is the best arbitrary value for a variable of type var, or is there a better way to avoid the scope issue I'm having?
var Variable1;
if(Something == 0)
{
//DB = DatabaseObject
Variable1 =
from a in DB...
Example:
var o = {};
for(var i = 0; i < 5; i++) {
o[i] = function () {
console.log(i);
};
}
o[3]();
When I call o3, it will always display 5 on the console, even if I call o0, o4, or any one of those. It will always display 5 because that's the last value i had. How do I make it display the value of i when the anonymous fun...
Is there really a slowdown issue when using custom scopes in searching for contents in Sharepoint 2007? How do you resolve this?
I experience the slowdown every after 3 or 4 tries (so the first tries work just fine). I'm using a custom masterpage but the same issue is encountered in OOB portals (using default masterpage).
...