global-variables

Making Controls public/Global in Netbeans with Java.

So I have multiple forms for my current project and I have made classes that interact and do some utility work behind these forms. However I am unable to access controls on other forms. Say I have a text control on Form A and I want to use a class that receives/manipulates data from a completely different Form B. My classes and Form ...

Is there a better way of recreating $_SERVER['QUERY_STRING']

I want to be able to return all of the parameters that are being passed into a specific page using PHP. $_SERVER['QUERY_STRING']; Seems to perform this task adequately, however I have heard many warn against the use of $_SERVER variables due to their sometimes inconsistent nature. So I was wondering if there are any best practice gui...

[iphone] use NSString in other method?!

It's really embarrassing but i stuck on it for two hours of trial and error. I declared an NSString in the interface as: NSString *testString; Then i made a property and synthesized it. I allocate it in viewDidLoad with: testString = [[NSString alloc] initWithFormat:@"thats my value: %i", row]; If i want to get the value of the st...

Is there a better way to create this game loop? (C++/Windows)

I'm working on a Windows game, and I have this: bool game_cont; LRESULT WINAPI WinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_QUIT: case WM_CLOSE: case WM_DESTROY: game_cont = false; break; } return DefWindowProc(hWnd, msg, wParam, lParam); } int WINAPI WinMain(/*lots of paramete...

Static initialization and destruction of a static library's globals not happening with g++

Hi! Until some time ago, I thought a .a static library was just a collection of .o object files, just archiving them and not making them handled differently. But linking with a .o object and linking with a .a static library containing this .o object are apparently not the same. And I don't understand why... Let's consider the following ...

Global variables in Visual C#

How do I declare global variables in Visual C#? ...

jQuery - make global variable available to multiple plugins

I have a set of jQuery plugins I'm creating for a website. All of these plugin have the common functionality that they make $.getJSON() calls. The URL passed in these calls varies based on Dev, QA and production environments. I would like to store the URL in a central place so it can be easily changed. Where should the URL be stored?...

Create a global static variable in SQL Server?

Is there a way to create a global variable in SQL Server so it's saved even the server is shut down, so I can use it in functions? Example from what I need: DECLARE @@DefaultValue bit This variable should never be deleted unless I explicityl do so. ...

How to Avoid Global Variables in Javascript

We all know that global variables are anything but best practice. But there are several instances when it is difficult to code without them. What techniques do you use to avoid the use of global variables? For example, given the following scenario, how would you not use a global variable? Javascript: var uploadCount = 0; window.onl...

Creating variables using $GLOBALS

Hi there, I am currently working on a php framework, which is in some cases structured like the ZendFramework. It has MVC etc. I did not found any equal matching to my problem. My "problem" is I have a variable number of classes (models, controller), e.g. http_handler. Now I have that much classes I can not set them all manualy into va...

PHP: How to pass existing database connection to static class methods?

I have a set of static class methods. I also have an existing database connection in a script stored in an object variable $DB. How do I call those static class methods and let them use that $DB object without having to pass them this variable every time as a parameter on the class method? For instance, right now I'm having to use a glo...

Is it possible for $_SERVER['SCRIPT_FILENAME'] to not be set?

Hey everyone, some background info: In the config file for my website, I set the mysql database name, username and password based on the contents of $_SERVER['HTTP_HOST']. Because it is possible for this variable to not be set in the case of old (HTTP 1.0) requests and cron jobs, I include a file that spoofs the $_SERVER['HTTP_HOST'] va...

haskell global var

The task is to create dynamically linked library, which encapsulates database hard work. Due to some design limitations I have a defined interface, which consist of numerous functions. Each function takes a parameters and use them in database query. Database connection should be inside dll and application don't want to bother is there a...

Global state in asp.net mvc application

Problem: Our web console shows a list of all computers on which our application is installed. Each machine has some identification information that can be associated with it. Simple strings like department name, team name etc. We need to make it such that the user can change the name of these identification fields and add/remove as many ...

Problem with storing COM pointers in global singleton object

Background The application I am working with has several COM DLLs. One of the COM DLLs has a global singleton object, which stores pointers to COM interfaces in other DLLs. Because it is a global singleton object, I have employed the lazy initialization idiom because it is possible that the interface I am trying to get a pointer to ex...

What's the difference between Pointers and Global Variables in C?

I'm reading The C Book to try and get a better foundation in C. While I think I'm generally getting the concept of pointers, one thing sticks out to me is that it seems like it's generalizing whatever it's pointing to into a global variable (e.g. the ability to use pointers to return values from void functions), which naturally carries...

Make all variables global, PHP

Is there a way to make all variables global? ...

Find package global variables from data dictionary

I have a package: CREATE PACKAGE my_pkg IS g_var NUMBER; END; / Is there any way I can query SYS views, to find that this package has this global variable? I'm interested in explicit variable name and data type. P.S. Parsing user_source does not count. Edit: I would like to do that without introducing getter/setter functions. ...

Android global variable

How can I create global variable keep remain values around the life cycle of the application regardless which activity running.. ...

Why does a global variable captured in a $.get() callback closure always hold the same value?

I'm having a bit of trouble capturing the value of a global variable in my $.get() callback: Relevant markup <div class="block" id="blog"></div> <div class="block" id="music"></div> <div class="block" id="video"></div> Relevant code $('div.block').each(function() { $this_id = $(this).attr('id'); alert($this_id); // outputs: blog...