Questions tagged [global]

Refers to a space where variables and other items may be accessed from any scope.

4669 questions
1
vote
1 answer

name 'net_input' is not defined even though it is in global

I declared net_input as a global variable but still I am getting NameError: name 'net_input' is not defined global net_input noise = net_input.detach().clone() Error line is: net_input_saved = net_input.detach().clone() Error NameError: name…
anu priya
  • 45
  • 1
  • 1
  • 7
1
vote
2 answers

Can't access global variable from other files in Node JS

I'm trying to access my config.js file in all modules of my project but I can't even though the config file is defined as global. Here's my packaging: in the server.js I have defined: global.config = require('./app/config'); I can access the…
1
vote
1 answer

react native built-in global objects does not exist at testing usinfg jest

react native built-in global objects like WebSocket does not exist in runnig jest's test i'm testin my RN app using jest . trying to access RN built-in global WebSocket Object in test files give me undefined. whereas access the object in running app…
1
vote
1 answer

global: not setting variables in functions in PowerShell

So I have a personal project I'm working on where I want to set the value of $Name to the name of the script without the path or file extensions. I thought I could do this as a global variable since it needs to called a few times. I've used the…
Excallypurr
  • 319
  • 1
  • 16
1
vote
1 answer

in R, how to make each dataframe generated in foreach loops available in global environment

In R, how to make each dataframe generated in foreach loop available as individual dataframes in global environment I was only able to save them into a list (x), but the list is of 3 layers; there are over 40,000 dataframes, and unpacking them is…
1
vote
2 answers

global struct and multiple threads in c

can someone explain me the compilation error in this code: #include "common.h" typedef struct nodeData { int procid; unsigned short localport; DWORD LIFETIME; DWORD HELLOTIMEOUT; DWORD MAXTIME; } nodeData; int listenerThread()…
Michael
  • 22,196
  • 33
  • 132
  • 187
1
vote
1 answer

Getting names of python variables (from parent namespace)

I need to get the name of a variable in python. For example: task = EmailTask() I need to get the "task" mapped to the actual object. The use case for this is as follows: I am building an ETL tool which will have a lot of reusable generic tasks…
1
vote
0 answers

Docker Swarm Deploy ignores placement constraints

So I have an issue with compose version 3.6 and deploying swarm services. What I'm trying to achieve is to only deploy either service A or B depending on the label value applied to the node. What's happening is both services are getting deployed (or…
Carl Wainwright
  • 328
  • 5
  • 18
1
vote
2 answers

jQuery Dialog cannot see Global Variables

I'm loading HTML in dialog when button is clicked on $("button").live('click', function() { var $div = $('
'); $div.load('test.html #formModal').dialog({ width: 900, height: 500 }) }) The HTML of…
Pinkie
  • 10,126
  • 22
  • 78
  • 124
1
vote
1 answer

Javascript Global array empty on all pages

On one page of my site, timers are created. I need to be able to access those timers on other pages to see the time left. But I can't get the global array to work properly. In the head of the site I create the all_timers array if it is empty. Then…
user3052443
  • 758
  • 1
  • 7
  • 22
1
vote
2 answers

Globally silence the stdout for one whole module

I have a script working with multiple modules that include loggers (lets assume modules A and B). When executing, functions of A will automatically create a logger, but to keep things tidy I would like messages from module B only to be displayed in…
John Titor
  • 461
  • 3
  • 13
1
vote
4 answers

Python alternative to global variables

In this example test_function1 has 4 varibles that need to be used in test_funtion2.I would not like using global variables becouse the actual code i'm writing is more complex and it would break it. def test_function1(): a = input("Type aaa:") …
user11629539
1
vote
1 answer

Catch error messages globally for an iPhone (Objective C) application

We use try, catch and finally to catch errors in iPhone and handle them in the controller. Can we create a global error handling code such that in case of any error, control passes to that method and we can handle all error related activities like…
1
vote
1 answer

How can I read pre-fetched server side data with a typescript client?

I'm using the below function to return initial server-rendered markup and data in case of lack of javascript support: export const serverRender = async () => { const { port, host } = config; const resp = await …
StarLlama
  • 380
  • 2
  • 12
1
vote
3 answers

Can we use global symbols in Typescript Declaration files?

I'm trying to implement something like this but I'm not sure it's possible. I think Typescript only allows unique symbols, not global ones. Is this correct? Is there a better way to achieve using global symbols? // sample.d.ts const mySymbol =…
1 2 3
99
100