Questions tagged [global]
Refers to a space where variables and other items may be accessed from any scope.
global
4,722
questions
0
votes
1
answer
15
views
Modify the values in a (global) list of dictionary without reference
I'm new to python - being an educator trying to write to python script to score student's performance downloaded from an online polling platform. I've solved most problems until something like this: I'...
1
vote
1
answer
23
views
React Native trying to use same array globally
I am trying to learn React Native and am wondering if there is a way to store an array, say in a constant file or something, and reuse it in different components. States will be one, as an example. I ...
0
votes
1
answer
55
views
Why I didnot get Multiple definition Error?
#include <stdio.h>
#define MAX 5
static int data = 10;
int increment(void *);
int increment(void *ptr)
{
int *p = ptr;
static int data =15;
for (int loop=0; loop < MAX; loop++...
0
votes
0
answers
42
views
Global CSS cannot be imported from files other than Custom <App>
My React App works fine on my friends computer using global CSS, however, I've been having this issue since I opened on my VSCode.
⨯ ./styles/globals.css Global CSS cannot be imported from files other ...
2
votes
1
answer
34
views
xlwings not updating global variable correctly when using threading
Here is my logic that I am trying to understand.
import xlwings as xw
import threading
workbook = ""
def function1():
t1 = threading.Thread(target=function2)
t1.start()
t1.join()...
1
vote
2
answers
39
views
Defining global lists in Stata if elements consist of several words
I need to make some operations with many Excel files with long names of the type "Saratov Region.xls" (I mean that names of these files contain one or more blank spaces).
I tried to write ...
-1
votes
0
answers
11
views
What is the use of Project -> Settings -> Deployments -> Globals in jBPM?
In jBPM, under the Project settings, there is a section called Deployments. Inside this section, there is a tab called "Global". Is this for defining global variables? How is it used in ...
-2
votes
0
answers
50
views
i want to acsess the global variables from a function body in python [duplicate]
I have a very long program and I want to implement a method to access the global variables present in the main program ( main.py ) from within a function called from a library ( file.py ).
main.py :
...
0
votes
0
answers
24
views
How can i list root objects JavaScript [duplicate]
So I have several objects and classes in my script tag
const Main = {}
const App = {}
class Game {}
let state = 777
etc. I'd like to list them.
I've tried
Object.keys(Object.getOwnPropertyDescriptors(...
-1
votes
1
answer
74
views
var vs let for *globals*... what practical difference does "a property on the global object" make?
I have seen this (or similar):
At the top level, let, unlike var, does not create a property on the
global object.
many times.
My question is: what practical difference does this make ?
Or, to put ...
0
votes
0
answers
16
views
MSVC global variables initialization order
MSVC 2022 VERSION.
If i use MFC static lib,i can use #pragma init_seg(lib) to change global variables initialization order. make my local global variables earlier than the lib.
and Now I have to use ...
0
votes
0
answers
32
views
Create one nodemailer test account and hold it in a module global
I have a nodejs application. One of the modules is for the mail transporter. I'd like to create a mail test configuration one per launch and store it (in global) so it can be reused.
However, during ...
0
votes
0
answers
21
views
What to do after installing npm packages globally with sudo?
I installed a npm package globally on my Mac. I used sudo for it since I had permission issue.
I know this is totally not the way to do it, but at this time I wasn't aware of it. I read a lot things ...
1
vote
1
answer
117
views
How to use Rust OnceLock get_mut() method?
The Rust documentation has a OnceLock::get_mut method that returns a mutable reference. But the following code does not compile. What am I missing?
use std::sync::OnceLock;
#[derive(Clone)]
struct ...
0
votes
0
answers
35
views
Unable to mock Webpack-defined global variables in Jest testing
I was trying to test a function using Jest where I need to mock a Webpack-defined global to test all the cases. I was unable to do so.
// webpack.config.js
...
new webpack.DefinePlugin({
__ENV__: `'${...
0
votes
1
answer
17
views
Thymeleaf enums refactoring issues
I encountered difficulties while refactoring a template. I have many references to a limited number of enum values in one template. (in a code snippet i indicated only a short part for clarity)
<...
0
votes
0
answers
22
views
MKDocs - Global Variables Possible Within Page?
Regarding MKDocs, is it possible to set a global macro or variable from within a page? My intent is to have a start page with a drop down menu. The global variables would be set based on the user's ...
-1
votes
1
answer
34
views
difference between local and global dependencies in angular
What is the difference between downloading local and global dependencies? For example, if I run "npm i bootstrap" in the project folder, will I download it from the location?, and if I want ...
-1
votes
1
answer
90
views
Global file pointer in C
I'm having a problem with a global file pointer in C with Visual Studio 2022 in a solution involving a large number of files that are compiled and linked using the "Build" command.
Based on ...
1
vote
1
answer
47
views
Caching previous values in solve_ivp
I want to use the temperature at the previous timestep when evaluating the next timestep. I don't want to use global, because I think it slows down the code and it is not very clean.
I use scipy....
0
votes
0
answers
35
views
How to get position of a rectangle which I draw using Custom Paint in flutter
I am creating a waste management app where user can take image then this Image is shown in a screen where user can draw rectangles around trash. I am using Stack with Custom Paints for doing this. But ...
1
vote
1
answer
38
views
using eval() inside function with input of function as part of string
I have this code:
def system(into):
global sys
x = into
sis = [eval(i) for i in sys]
return sis
if __name__ == "__main__":
sys = ['x[0]+x[1]','2*x[0]-3*x[1]']
I would ...
-2
votes
2
answers
69
views
Shell script for finding global variables
How would one write a shell script that finds all the global variables in a given C program?
I don't need a long line like
global_vars=$(grep -E '^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_]*[[:space:]]+[a-zA-...
1
vote
1
answer
36
views
global variables get different values (web / terminal)
While learning php I came across the following problem.
I don’t understand why I get different values on my local site and in the terminal when I run the following code:
function scopeTest(): int
{...
0
votes
2
answers
40
views
How to solve this global is not defined problem?
This is the error image
I'm working on a project and suddenly caught this error , I don't know where the error came from and it didn't have any information, please help me
<script>
var ...
4
votes
2
answers
75
views
Python global variables in recursion get different result
I have this code, which prints 1:
s = 0
def dfs(n):
global s
if n > 10:
return 0
s += dfs(n + 1)
return n
dfs(0)
print(s)
If I modify dfs like this:
def dfs(n):
...
0
votes
1
answer
49
views
Why do different delivery methods have different results when applying PHP's global keyword?
PHP implements the static and global modifier for variables in terms of references. For example, a true global variable imported inside a function scope with the global statement actually creates a ...
1
vote
0
answers
34
views
Changing PHP code which uses PHPs $_REQUEST super global
New to php and have read up on $_REQUEST being strongly discouraged, due to the fact that it makes it nearly impossible to determine the source of the data, and also being a security risk as well.
Not ...
0
votes
1
answer
60
views
Global event monitoring with WPF
I would like to ask for help in this matter: in WPF, I would like to monitor the keydown, mousedown and mousewheel events even if the window is not currently active.I use c# with WPF. I tried many ...
-4
votes
1
answer
98
views
What functions can access a global variable that appears in the same file with them?
I asked ChatGPT and Google Bard a C++ question that "What functions can access a global variable that appears in the same file with them?"
They answered that "Any function within the ...