All Questions
Tagged with global global-variables
290
questions
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()...
-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 :
...
-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 ...
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 ...
-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 ...
0
votes
0
answers
39
views
Add persistent global function across pages via window, or localstorage, etc
I am trying to hide an icon on a page I can't edit directly. I need to add a function that has in it document.getElementById('icon').style.display = 'none';. I don't need help with the function.
So ...
0
votes
1
answer
24
views
How to distinguish the class member from global variable with the same name in Dart?
I am trying the following code:
String user() {
return "";
}
class Foo {
String user;
Foo() : user = user(); // <= error here
}
void main() {}
But it doesn't work because of name ...
0
votes
0
answers
144
views
How can I make the bowser library globally available on a web page?
I'm working on a SPA where under some condition I have to log some browser and operating system data. So I loaded the script for the bowser library - when the condition is met - but unfortunately I ...
-1
votes
1
answer
67
views
C# best implementation so i can have a globally accessible class anywhere in the code but having the values specific to a request
What is my ask
I am uploading a word(docx) file , remove certain sensitive information from word file (like email, client name, phone number etc) and save it as a new word document.
What I am doing:
I ...
0
votes
2
answers
110
views
Python - how to access values assigned to variables in one function from a different function that returns multiple variable values
New to Python and trying to move away from using the global keyword as part of passing variable values between functions.
I understand that return returns a tuple - but I'd like to be able to ...
-1
votes
1
answer
109
views
I made a list a global variable in my python function, but when I print its value outside of the function, it's blank
I currently have a class that defines three functions that extract the date and device name from images in a specified directory. 1 The function then copies the images to new file directories based on ...
1
vote
1
answer
626
views
Is it possible to define custom bazel macro or rule and load it in workspace for all packages?
I wrote a custom bazel macro, in order to shorten code in my BUILD files. I want it to be available in all BUILD files, and I don't want to call load statement each time.
So I want to use it just like ...
1
vote
2
answers
929
views
Why and where to use a global variable and a static global variable in C?
I have read about global and local variables and static keyword, but i dont know which is the difference between something like this:
int x; //Global variable
int main(){
//Code...
}
And this:
...
0
votes
0
answers
19
views
Function accesses global variable depending on useage in function [duplicate]
I only just came across this and it's managed to confuse me. I tried to use the same idea as Function2 but it didn't work, what confused me was it was managing to access other global variables even ...
0
votes
0
answers
43
views
Why is the actual memory usage in task manager different from the theoretical memory usage for C?
#include <stdio.h>
#include <unistd.h>
typedef struct kk {
char k[1000000];
} uuuu;
uuuu k[1000];
int main() {
sleep(100);
return 0;
}
The theoretical memory usage for this program ...