global

Javascript global variable not working properly?

独自空忆成欢 提交于 2019-12-11 20:56:15
问题 My jQuery code: $(document).ready(function() { chrome.extension.sendRequest({get: "height"}, function(response) { height = response.value; }); $("#id").css("height", height+"px"); }); You don't have to be concerned about the chrome.extension.sendRequest() , basically it communicates with a background page to fetch the value for "height" from localStorage and stores the value in global variable height . The problem lies in $("#id") not being assigned the height value. However if I were to

Python global dict across different file script

萝らか妹 提交于 2019-12-11 20:32:55
问题 Hello. I am trying to use a global dict created in main.py , which is called in functions.py . In my main.py I have: import sys,os,... import functions.py #import my second file matrix = {} matrix_do_something search_the_matrix(value) #which is defined in functions.py #FILE: functions.py def search_the_matrix(value): global matrix if value in matrix: return True else: return False and I get this error: NameError: global name 'matrix' is not defined I have read a solution on stackoverflow,

Accessing Event Procedures of Form Controls with VBA in Excel

落花浮王杯 提交于 2019-12-11 19:48:50
问题 Is there any way to define event procedures for form controls such as the case with ActiveX objects? I have a GUI which currently adds/removes ActiveX command buttons by the user but ran into Error 91 when trying to add an item to a global collection with each button added. My best guess is because of this much hated phenomenon. With the current state of the project, my best option is to switch to using form control buttons if I am able to define their event procedures. If not, I may need to

General Android Advice: Global Variables

醉酒当歌 提交于 2019-12-11 18:23:01
问题 I was wondering what is the best way to handle global variables for android apps. For example, I'm just trying to create a basic login/register system. I've created a user class (that has various attributes like username, password, etc..), so that when we go to the register activity, the User class constructor is called to create a unique user object once all the fields are filled out. I was then thinking of simply having a global arrayList of type User so that I could just loop through all

MediaWiki fails executing JavaScript which gets executed fine in browser console

纵然是瞬间 提交于 2019-12-11 17:59:20
问题 The following global JavaScript code is the only JavaScript code I use in my entire all-core, Hebrew, MediaWiki 1.33.0 website: /* כל הסקריפטים הנכתבים כאן ייטענו עבור כל המשתמשים בכל טעינת עמוד. */ const list = document.querySelector("#footnotes_list"); document.querySelectorAll(".footnote>sup").forEach((footnote, i) => { const li = document.createElement("li"); li.append(...footnote.childNodes); // move content list.appendChild(li); footnote.textContent = i+1; }); Related templates The

How to create writable global variable in node.js typescript

烈酒焚心 提交于 2019-12-11 17:43:34
问题 I have declared a global variable import * as io from "socket.io"; declare let SocketServer: io.Server and tried to write in another file but this variable is read-only. So how to make it writable? Update // global.d.ts import * as io from "socket.io"; declare global { let server_socket: io.Server let user_socket: io.Socket } // server.ts import * as io from "socket.io"; console.log(server_socket) 回答1: In TypeScript, declare blocks are used to describe your global variables. In other words,

Realex payment, response cant be Handled .Net

微笑、不失礼 提交于 2019-12-11 17:02:10
问题 i trying to implement a hpp full redirect to realex payment, i have 2 controllers one that send the request to the realex payment server and the second to which the response is sent back. i get the response in json as such {"RESULT":"00","AUTHCODE":"12345","MESSAGE":"[ test system ] AUTHORISED","PASREF":"15441812060166886","AVSPOSTCODERESULT":"M","AVSADDRESSRESULT":"M","CVNRESULT":"M","ACCOUNT":"internet","MERCHANT_ID":"MyID","ORDER_ID":"UYCRWpJtlE-B1n62SE7EKg","TIMESTAMP":"20181207111253",

Need help figuriing out correct syntax to update objects in global scope

人走茶凉 提交于 2019-12-11 16:48:30
问题 I have this code: int do_transact(ifstream & inFile, list<shared_ptr<Bike>> bikelist, status s) { int id, i = 0, size = bikelist.size(); float days; string str, str2; char name[50]; list<shared_ptr<Bike>>::iterator it = bikelist.begin(); if (s == NO_STATUS) //performs rental { inFile >> id; inFile >> days; inFile >> str; inFile >> str2; strcpy_s(name, str.c_str()); while (i < size) { if (id == (*it)->id_num) // rents bike { cout << "vvvvvv PERFORMING RENTAL vvvvvv" << endl << endl; cout <<

Shiny: observe change in global variable

你说的曾经没有我的故事 提交于 2019-12-11 14:18:45
问题 I am making a very simple game in Shiny. Basically every player plays in their own session, but they share 1 global variable to keep track of the scores of each player. I think I'm succeeding having sessions update the global 'scores' variable, but for some (probably dumb) reason I cannot get the global variable to act as a reactive value (i.e. automatically triggering updateActionButton). Minimal code below: working example: score <- c(100) ui <- fluidPage( titlePanel("Hello Shiny!"),

PHP login session wont work on first page load in a NEW window with no cache

纵然是瞬间 提交于 2019-12-11 13:06:35
问题 I am working on creating a website from scratch and am currently stuck with session stuff.. I know generally how sessions work and how to store things into $_SESSION after session_start() but my main problem is this. After clearing the cache and opening a new window, submitting a login request the FIRST time wont submit correctly and the page reloads and nothing has changed, but AFTER the first time, it works fine... my login.php handles either a) the post request, or b) the login via url