global-variables

Global access to MemoryStream

I want to serialize an object(Form) to the MemoryStream and ulteriorly be able to deserialize it. Is it possible to keep (read and write into) a global "memoryStreamContainer" when application is running? ...

Which languages do not have Global Vars?

Due to a wave of criticism to use Global Vars in my Java post, I want to use a language without global vars. One suggestion per answer, thank you. ...

I've Heard Global Variables Are Bad, What Alternative Solution Should I Use?

I've read all over the place that global variables are bad and alternatives should be used. In Javascript specifically, what solution should I choose. I'm thinking of a function, that when fed two arguments (function globalVariables(Variable,Value)) looks if Variable exists in a local array and if it does set it's value to Value, else, ...

Where to store global variables like file paths in java ?

In my application I use some icons. Where should I store the path of the directory containing those icons ? The icons are used in different classes so it doesn't really make sense to store them in one of those classes in particular. I read that global variables are evil, but is it acceptable to use a class (eg Commons) containing onl...

Javascript redeclared global variable overrides old value

I ran into an interesting issue the other day and was wondering if someone could shed light on why this is happening. Here is what I am doing (for the purposes of this example I have dumbed down the example somewhat): I am creating a globally scoped variable using the square bracket notation and assigning it a value. Later I declare a ...

Redeclared javascript global variable overrides old value in IE

(creating a separate question after comments on this: http://stackoverflow.com/questions/2634410/javascript-redeclared-global-variable-overrides-old-value) I am creating a globally scoped variable using the square bracket notation and assigning it a value inside an external js file. In another js file I declare a var with the same name...

access variables of other functions

hi, in python, how can i access the variables of one function into another function, is it possible, i tried the global variable method but that doesn't work for me. can someone help me, how to access the variables from one function to another function. ...

How can request handlers communicate in Django?

If you make a long-running http request to a Django application, can you send a second request to communicate with it? Can you share data between requests? Pylons has a concept of application globals. Top level variables in node.js are all application globals. How can I do this in Django? ...

Returning a variable in a public void...

Hello, I'm abit new to programming Android App's, however I have come across a problem, I can't find a way to make global variables -unlike other coding like php or VB.NET, are global variables possible? If not can someone find a way (and if possible implement the way into the code I will provide below) to get a value from the variable '...

C++ wrapper for C library

Hi, Recently I found a C library that I want to use in my C++ project. This code is configured with global variables and writes it's output to memory pointed by static pointers. When I execute my project I would like 2 instances of the C program to run: one with configuration A and one with configuration B. I can't afford to run my prog...

Assign C++ instance method to a global-function-pointer ?

Greetings, My project structure is as follows: \- base (C static library) callbacks.h callbacks.c paint_node.c . . * libBase.a \-app (C++ application) main.cpp In C library 'base' , I have declared global-function-pointer as: in singleheader file callbacks.h #ifndef CALLBACKS_H_ #define CALLBA...

Global variables in jQuery

I have been working on this script: <script type="text/javascript" src="/js/jquery.js"></script> <script type="text/javascript"> $(function(){ compentecy = $('#competency_id'); $('#add_competency').bind('click', function(e){ e.preventDefault(); $.post('/script.php', {competency_id: compentecy.val(), syllabus_id: ...

Global and local variables in my script

I'm just starting out learning javascript, and tried to write a little script that would make a grid of divs on a page. Here's the script: var tileWidth=50; var tileHeight=100; var leftPos=10; var topPos=10; var columns=10; var rows=10; var spacing=5; $('document').ready(function() { placeTiles(); }); function makeRow() { for (var ...

AS3: Accessing global variables

i'm confused with the term "global" in AS3. within my main controller class, i've defined a variable (myNum) which i would like to access throughout all class .as files within the same package. //Controller class package myApp { public var myNum:int = 24; //try to access myNum in mySprite class public class Main extends Sprite {...

Does WordPress clear $GLOBALS ?

Hey What I want to do is to include one of my PHP scripts in a Word Press theme. The problem is that after I include the script file I can't access, inside functions in the theme file, variables declared in the script file . I have created a new file in the theme folder and added the same code as in header.php and if I open that file i...

How do I declare a global variable in VBA?

I wrote the following code: Function find_results_idle() Public iRaw As Integer Public iColumn As Integer iRaw = 1 iColumn = 1 And I get the error message: "invalid attribute in Sub or Function" Do you know what I did wrong? I tried to use Global instead of Public, but got the same problem. I tried to declare ...

How build a global function to have the recent background-Positions for continue animation after changing a page

Try to find a global function, to get and to put the backgroundPosition-values, but I feel a bit confused. Here is the function: function global_backgroundPosition_Menu(num){ $('#Navigation_1') .css({ backgroundPosition: num + "px 0" }) } /////////////////// An here I want to ca...

How can I list global variables in MATLAB?

How can I see a list of what global variables are defined in MATLAB? (I am using R2009a). I have hunted unfruitfully for this on Google and SO, so apologies if it has been asked before. ...

Is it bad practice to have state in a static class?

I would like to do something like this: public class Foo { // Probably really a Guid, but I'm using a string here for simplicity's sake. string Id { get; set; } int Data { get; set; } public Foo (int data) { ... } ... } public static class FooManager { Dictionary<string, Foo> foos = new Dictionary...

Get all Javascript Variables?

Is there a way for javascript to detect all assigned variables? For example, if one js file creates a bunch of vars (globally scoped), can a subsequent file get all the vars without knowing what they're named and which might exist? Thanks in advance :) EDIT, Question Part 2: How do I get the values of these variables? Here is what I h...