Questions tagged [global]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
9 views

NextJS, global css styles not applying to the elements

I've made a blog using nextJS loading markdown files as posts on the main page. I'm using css modules plus the global.css file. However some of the properties of the global.css file seem to no be ...
Aymeric's user avatar
0 votes
0 answers
14 views

Using SentenceTransformer embedder as global variable in pythonanywhere

I want to create a SentenceTransformer embedder as a global variable so that I can use in flask methods. As I know from https://pytorch.org/tutorials/intermediate/flask_rest_api_tutorial.html, model ...
sty2004's user avatar
-2 votes
0 answers
19 views

Ansible global handling error and execute shell command

I have master playbook which consist of many other playbooks (roles). I'd like to handle installation failure (on any step of this installation) and execute shell command. Is it possible to do it in ...
John Smith's user avatar
1 vote
2 answers
67 views

vimscript for managing windows need some review

Could someone check my vimscript below. I tried to make a key mapping that does: 1. Closes tagbar and/or nerdtree if exist 2. Do <C-W>H or <C-W>J or <C-W>K or <C-W>L 3. Recover ...
Jumogehn's user avatar
  • 1,124
0 votes
0 answers
11 views

get all globally declared variables and functions in globalThis in node.js [duplicate]

Is there a way to get all the variables, const, function declarations in the global or globalThis object of a nodejs file.
Gary's user avatar
  • 2,313
0 votes
0 answers
7 views

How to get Global list into HTML dropdown

I am trying to create a dropdown in the google sheets sidebar that is linked to the list in the globals.gs so it is not hard coded in the html. anyone have any suggestions on how to this or where to ...
Sam Nichols's user avatar
1 vote
1 answer
25 views

How to define globals for this timeit call?

This Python 3.11 script benchmarks function f: import numpy as np, timeit as ti def f(a): return np.median(a) a = np.random.rand(10_000) m = None fun = f'm = f(a)' t = 1000 * np.array(ti.repeat(...
Paul Jurczak's user avatar
  • 7,148
4 votes
2 answers
138 views

Should I use global variables in recursion

I created a function in C to find the shortest path out of a triangle maze using recursion. I use 2 global variables in the function, which I want to get rid of because I know that global variables ...
demon's user avatar
  • 57
1 vote
0 answers
56 views

Need more understanding of PHP Float CONSTANTS

So, I just came across these PHP float Constants: PHP_FLOAT_DIG and PHP_FLOAT_EPSILON, and I don't understand both constants (even after studying the official documentation https://www.php.net/manual/...
divad's user avatar
  • 117
0 votes
1 answer
88 views

Python not using global variable in function even when global command is used

I am trying to change the value of a global variable in a function, however this is not happening even when "global" is specified before attempting to use/alter the variable. Here is an ...
Toz H.'s user avatar
  • 3
0 votes
0 answers
23 views

"Global is not defined" Sporadic Error in Angular 16 Application npm package

I seem to get a sporadic global is not defined error in my angular application when the app initialises. The vast majority of the time the error doesn't throw, however sometimes it will and of course ...
OrangeJuice1-'s user avatar
0 votes
0 answers
24 views

Can I add a global query parameter to all methods on all Viewset endpoints in Django Rest Framework?

For some purpose I need to add a query parameter to all DRF API viewset method calls and I need to be able to supply from Swagger. In FastAPI it is easily done with a dependency injection on global ...
Niels's user avatar
  • 537
0 votes
0 answers
31 views

How am I able to change tkinter widgets variable inside a function without the global keyword? [duplicate]

import tkinter def why(): global label_text label_text = ("How I am able to access 'label' and 'root' which are global variables, without global keyword?\n" "...
GreenIsLearningProgramming's user avatar
-1 votes
0 answers
61 views

Why do Python functions treat lists as global variables without the global keyword [duplicate]

Why does python allow me to change the values of lists inside functions without either passing the list or declaring it as a global variable. For example, if I enter the following: def change_list(): ...
user22853097's user avatar
-2 votes
1 answer
85 views

local variables outside a function in python [duplicate]

i have a code that goes like this def inputs(): q_number = int(1) number_of_q = int(0) q = {} x = {} y = {} xxxx = 1 for i in range(4): C = float(qq[xxxx].get()) ...
Meat_Mr8h's user avatar
0 votes
1 answer
13 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 ...
Andrey's user avatar
  • 6,114
0 votes
1 answer
56 views

python won't update globals from imported function

I wrote a script to parse arguments from the command line. It has a function called getFlags which parses sys.argv and a command string from the user to create a dictionary called myVars with the ...
jeffpkamp's user avatar
  • 2,784
0 votes
0 answers
28 views

react nextjs export env variable to client

I have a next.js react application which I build into a docker container and deploy on different servers. Each server has slightly different settings which I setup with environment variables. So far ...
Emanuele Paolini's user avatar
0 votes
1 answer
12 views

mujs how to make property or method accessible by two names. For example alert and window.alert

In js properties of global object are accessible as window.method() or method(). For example window.alert('blabla'); and alert('blabla'); How to implement it in mujs? Now it is: js_newobject(J); { ...
user2772439's user avatar
0 votes
2 answers
31 views

How to write a procedure in TCL that will use either a global dictionary or another one

I have a procedure that use a global dictionary. it is a global one because I need the procedure to be able to read inside the dictionary and update it. I need to be able to use either this global ...
iostrym's user avatar
  • 79
1 vote
1 answer
120 views

Python global variables in shared modules [duplicate]

I am trying to understand the behavior of variables shared across modules. My impression was a global variable in one module could be accessed in another, and sometimes this seems to be what happens, ...
John Elion's user avatar
  • 1,347
1 vote
1 answer
135 views

Python global variable on __main__

since multiprocessing need to be put inside __main__ in windows, i found out that my global variable is not passed to my function. from multiprocessing import Pool, Value def Proses(lines): ...
J. Doe's user avatar
  • 25
0 votes
0 answers
34 views

C# Simulate mouse inputs

I'm developing an application that will help a handicapped person interact with the PC by simulating mouse inputs. I've already achieved some progress but I have a challenge on Mouse Left Drag. I'd ...
Kamweti C's user avatar
0 votes
0 answers
30 views

Do C compilers generally optimize out initialized global data?

I am decompiling Super Smash Bros. for the Nintendo 64. It released in 1999 and was built with a rather inefficient compiler (IDO 7.1) that is missing certain features, for one. My goals include ...
PKFreeZZy's user avatar
0 votes
0 answers
24 views

How do i put a variable from one javascript function to display via another javascript function on an html site [duplicate]

Im trying to make it so that when i click 'submit', my data gets stored in variables and then when i click 'show' the data gets displayed this is my js code: var Usrname = ""; var Passwrd = &...
lukas Tori's user avatar
-1 votes
1 answer
45 views

How to have a key (string) not freed for global and mutable HashTable in a DLL with Rust?

I'm trying to implement a cross-platform DLL/SharedObject written in Rust. I have a global and mutable HashTable initialized in this library. When i add a key and value in this HashTable, the key (a &...
MauriceLambert's user avatar
0 votes
0 answers
6 views

Rendered font does not exist in my react project

I have an issue with my react project. I have had some problems with importing fonts, played around and now the only font that is working is the one that does not even exist in my project, because I ...
IceWallowCome's user avatar
0 votes
0 answers
17 views

Unable to use global variable with createElement inside loop [duplicate]

I am unable to create a global variable for a document.createElement('br') object and reuse it inside loops. In the example, I show where can: Example 0: Call document.createElement('br') each time ...
Adam Sassano's user avatar
0 votes
1 answer
51 views

Import of global variable failed C++

I have dll with a code: Dll.h: #ifndef EXPORT #define EXPORT __declspec(dllexport) #endif #ifndef IMPORT #define IMPORT __declspec(dllimport) #endif #include <iostream> #ifndef MY_GLOBALS_H #...
Ales100's user avatar
  • 155
1 vote
1 answer
38 views

How do I efficiently access functions by index in Julia?

I havea set of functions that I want to use on some data. Currently, I am storing these functions in a global array to be able to index them. const global _rot01(x)::Tuple{Int64, Int64, Int64} = ( x[1]...
TheOneAndOnlyMrX's user avatar
-2 votes
2 answers
48 views

Global variables defined in Header. Other function call can see its changes

I have one .h file and two .cpp files: global_var.h fun.cpp main.cpp The details are shown below: global_var.h: extern int a; void fun(); fun.cpp #include <iostream> #...
pvasbob's user avatar
0 votes
1 answer
17 views

How to add link/href to html from global constants file

I have a global constants file where I added a links node to it but I'm not sure how to translate that node from the constants file into the html file or possibly ts file of the html file. constants ...
developer8492's user avatar
-1 votes
1 answer
32 views

How can I delete an object and capture the deletion of the object event?

There are two things I am trying to do: delete an object whether a const or let - right way to do it in node.js capture the delete or assignation of null or undefined to cInst or dInst object in the ...
Gary's user avatar
  • 2,313
0 votes
0 answers
54 views

How to run my ASP.NET Core 6 project using any 6.x.x .NET installed version

I'm mantaining a bundle of projects with ASP.NET Core 6, about 100 of them and increasing, and I usually have to open it, run it, check stuff, modify stuff, etc. Projects were created by the same ...
Windgate's user avatar
  • 364
0 votes
2 answers
61 views

How to do this the right way? Declaring static object in function

The way I did it works, but feels like unbelievably bad programming. void draw_display() { static DISPLAY mydisplay = DISPLAY(parameters); mydisplay.set_orientation(0); do something with ...
Jnx's user avatar
  • 3
0 votes
0 answers
57 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 ...
pesho hristov's user avatar
0 votes
0 answers
10 views

Why is global variable PARTIALLY not updating in child component within Navigator - React Native

The HomeScreen component is within a TabNavigator within the MainContainer. Prior to rendering the TabNavigator, the global.userObject should be retrieved from the database and then one of its ...
user21956843's user avatar
0 votes
0 answers
36 views

how to run a jest test in a custom context?

Goal: I have a set of global variables that I want to override in my tests without editing the global space. For that, I want to create some testContext, call Object.defineProperty(**testContext**, &...
sim's user avatar
  • 1
1 vote
3 answers
131 views

Scope of a structure in C language

Could someone explain in simple terms what is meant by this? The scope of a structure begins at its appearance in a type specifier, and persists to the end of the translation unit (for declarations ...
alessio solari's user avatar
0 votes
0 answers
14 views

How to set domain in service now

I am trying to make an API call in an MSP instance in ServiceNow. While trying to retrieve some records like groups and domains I am getting only the records that are stored globally. Is there any way ...
kunal mathkar's user avatar
0 votes
0 answers
138 views

Nuxt3: Load global data from API / CMS, make it available to all components (layout, pages,..) and refetch on action

I have written a small website with Nuxt 3 and tried to load data (like global settings and/or labels) from Storyblok that are language specific. I do this within the app.vue and that works fine for ...
Philipp Lupulescu's user avatar
0 votes
1 answer
41 views

Continuing code after an unhandledrejection event

https://developer.mozilla.org/en-US/docs/Web/API/Window/unhandledrejection_event The unhandledrejection event is sent to the global scope of a script when a JavaScript Promise that has no rejection ...
jwa's user avatar
  • 157
1 vote
1 answer
198 views

How can I make my bot works in multiple servers?

I know that this question has been asked for discord.py, but couldn't find a discord.js one Currently I'm working on a small Discord Bot, and I would like to make it with possible that it can be used ...
ViorisE's user avatar
  • 45
0 votes
0 answers
41 views

Are static class methods and variables visible form different modules (libs, dlls, exes)?

The case is quite simple - we had a discussion based on experiencing some linker issues, where colleagues of mine were stating, that we are unable to access the static methods and variables that are ...
CJ_Notned's user avatar
  • 248
-2 votes
2 answers
62 views

Isn't this a proper global variable usage in python? It keeps on giving syntax error. What really is a global keyword usage [duplicate]

q=8 def example(q): global q q=q+2 print(q) example() File "<ipython-input-35-0e5cbb9ebefd>", line 2 global q ^ SyntaxError: name 'q' is parameter and global ...
Kulangara Silpa Prabhu's user avatar
0 votes
0 answers
29 views

subtracting and appending global variables to a new dataframe in a for loop

I am trying to make a function that can find the minimum value from a squared distance calculation. I have a large DataFrame (df) that contains a years worth of hourly forecast values for a series of ...
Tom's user avatar
  • 109
0 votes
0 answers
23 views

How to Subtract Values from Matching Columns in Two Different Pandas DataFrames to find minimum distance using globals

I want to subtract values from matching columns between many data frames in order to find the smallest distance. Best explained with an example I have the following Dataframes: Pool_Hour_1 = pd....
Tom's user avatar
  • 109
0 votes
1 answer
86 views

Accessing a boolean field outside of a namespace

I am reading the book of the art of assembly language to learn assembly language. In the topic of namespaces, it is mentioned that to access the names outside of a namespace, we can use e @global: ...
ahs's user avatar
  • 33
0 votes
0 answers
23 views

making an Object Accessible globally without making a Global Variable

I have some Object's which need to be accessed by some other Classes. i do not want to create a Global Variable. Dependency injection does not seem to be the right way of dealing with this, since one ...
Dennis's user avatar
  • 15
0 votes
1 answer
143 views

What is THE way to handle globaly shared Data/objects

After reading thousands of posts about how bad Global variables are, I got back to where I started from. Here is a contrived example which I hope can explain my situation and my question: TCity: has ...
Dennis's user avatar
  • 15

1
2 3 4 5
94