FAQ Database Discussion Community


Is @SessionScoped a good practice? [duplicate]

jsf,scopes,session-scope
This question already has an answer here: How to choose the right bean scope? 2 answers I've read about all the differences between the types of scope (@SessionScoped, @ViewScoped, @ApplicationScope and @RequestScope), however, I'm still facing somehow a problem with my application. I have a page-1 with a grid...

C++ 11- scopes & global variables

c++11,scopes
How can I reach global variables from inner scopes, given the following code sample, how can I reach the global string X from the main function and from the most inner scope as well, also is the most inner scope is accessible once we quit it to the main scope...

eloquent javascript chapter regarding modules. On scopes and eval function

javascript,scopes
Eloquent javscript writes this in chapter 10 of the modules chapter: The most obvious way is the special operator eval, which will execute a string of code in the current scope. This is usually a bad idea because it breaks some of the sane properties that scopes normally have, such...

python itertools combinations logic

python,environment-variables,itertools,scopes
I'm looking at the code for the combinations on the python documentation for itertools (https://docs.python.org/2/library/itertools.html) def combinations(iterable, r): # combinations('ABCD', 2) --> AB AC AD BC BD CD # combinations(range(4), 3) --> 012 013 023 123 pool = tuple(iterable) n = len(pool) if r > n: return indices = range(r)...

One all-encompassing definition of JavaScript closure

javascript,closures,variable-scope,scopes,lexical
I have read 10s of SO references on closures, MDN references and other blog articles. They all seem to define closures in their own ways. For example, From MDN documentation: function makeFunc() { var name = "Mozilla"; function displayName() { alert(name); } return displayName; } var myFunc = makeFunc(); myFunc();...