Refers to a spaces where variables and other items may be accessed from any scope.
Questions tagged [globals]
335 questions
8
votes
1 answer
Python Multiprocess diff between Windows and Linux
I have a script called jobrunner.py that calls class methods in main.py. See below...
# jobrunner.py
from multiprocessing import Process
import main
from main import BBOX
def _a(arg):
f = main.a()
print f.run()
def _b(arg):
p =…
![](../../users/profiles/759422.webp)
aeupinhere
- 2,485
- 6
- 28
- 39
8
votes
2 answers
Is there a good way to share the seed of random between modules (in python)?
I have a project with different main files (for different simulations).
When I run one of the mainfiles, it should set a seed to random (and numpy.random), and all the modules in the project should use that seed.
I don't find a good way to do this.…
![](../../users/profiles/3707237.webp)
rgalhama
- 274
- 1
- 3
- 12
7
votes
7 answers
Use a class in the context of a different module
I want to modify some classes in the standard library to use a different set of globals the ones that other classes in that module use.
Example
This example is an example only:
# module_a.py
my_global = []
class A:
def __init__(self):
…
![](../../users/profiles/149482.webp)
Matt Joiner
- 100,604
- 94
- 332
- 495
7
votes
2 answers
Help understanding javascript global abatement techniques
From the DailyJS "Let's build a JavaScript Framework" I'm not quite sure on the following code, obviously used as a global abatement technique.
My understanding so far balks at (function(){}) . I understand setting the turing var up, setting…
![](../../users/profiles/583721.webp)
Richard Holland
- 2,543
- 1
- 19
- 35
7
votes
3 answers
How to pass global debug flag variable throughout my code; should I use argparse?
Let's say I have a main program (test.py) and a little utilities program (test_utils.py) that has helper functions called by the main program.
I would like to turn on debug statements in the code by passing a debug_flag boolean, which is read in via…
![](../../users/profiles/722950.webp)
Craig
- 1,581
- 4
- 21
- 44
7
votes
1 answer
Polymer globals attributes something strange
in my test, i have 3 elements imported from the main html file :
my-app
…
![](../../users/profiles/2909737.webp)
user2909737
- 577
- 5
- 5
7
votes
1 answer
Is it possible to use HTML5 form labels without leaking globals?
The standard HTML 5 form label wants an ID to link the label to the input.
As most JS…
![](../../users/profiles/123671.webp)
mikemaccana
- 81,787
- 73
- 317
- 396
6
votes
3 answers
how to define functions in redis \ lua?
I'm using Node.js, and the 'redis-scripto' module, and I'm trying to define a function in Lua:
var redis = require("redis");
var redisClient = redis.createClient("6379","127.0.0.1");
var Scripto = require('redis-scripto');
var…
![](../../users/profiles/3027111.webp)
Aviram Netanel
- 10,273
- 7
- 36
- 63
5
votes
3 answers
Why should I overload a C++ operator as a global function (STL does) and what are the caveats?
Why would I want to overload a C++ operator() as global and not member function. For example, the == operator.
Why is this done? for example in STL libraries.
![](../../users/profiles/504239.webp)
unixman83
- 8,261
- 10
- 62
- 98
5
votes
2 answers
Does my Factory object introduces a global state?
So, here's the deal. I've managed to make a framework without using globals or static classes/functions.
I am using a form of dependency injection using a Factory. Since the framework will be used for various things, I'm creating a more generic…
![](../../users/profiles/514891.webp)
rickchristie
- 1,420
- 1
- 14
- 28
5
votes
4 answers
secure php host name information - $_SERVER['HTTP_HOST'] alternative
I have a public facing debug script that I would only like to run on certain dev boxes, I was hoping to do this programatically inside this script, by detecting the server ip or name-
So I have a question about the security of $_SERVER and…
![](../../users/profiles/271932.webp)
awongh
- 1,149
- 10
- 20
5
votes
0 answers
How to include globals.h in Android NDK
I need the correct syntax for
#include
to access the DvmGlobals struct.
How can I include Globals.h in my c++ file?
I tried several ways and always get the "unresolved inclusion" error.
I cannot find Globals.h on my NDK directory.
![](../../users/profiles/953967.webp)
gastonceron
- 163
- 10
5
votes
1 answer
are runtime linking library globals shared among plugins loaded with dlopen?
I've a C++ program that links at runtime with, lets say, mylib.so. then, the same program uses dlopen()/dlsym() to load a function from myplugin.so, dynamic library that in turn has dependencies to mylib.so.
My question is: will the program AND the…
![](../../users/profiles/158099.webp)
conejoroy
- 1,919
- 3
- 21
- 25
5
votes
0 answers
Save/restore IPython kernel globals
I am currently working on creating an interactive python terminal, using the IPython kernel.
I have been successful at setting up a working interpreter (over web using websockets), using the KernelManager class…
![](../../users/profiles/3093240.webp)
eirikrye
- 191
- 1
- 6
5
votes
2 answers
What is the most efficient way of handling global variables in PHP?
It seems some people hate global variables, but if you can explain how to code without them, I'm all ears.
Otherwise, I have a few options and I'm curious which is the best long-term. Consider that I have a variable that won't change for the…
![](../../users/profiles/3177186.webp)
not_a_generic_user
- 1,318
- 2
- 12
- 21