global

Static vs global

if i have a c file like below #include<stdio.h> #include<stdlib.h> static int i; int j; int main () { //some implementation } What is the difference between i & j? ...

Cross platform global hotkey application that I could package with my application?

So, I have cross platform application that I made, I need to fire it off on a global key command, which the sdk I am using is not able to do. I was wondering if there is any existing app that I could package with my app to act as the global hotkey manager for my application (license that would allow that). The problem is the cross-platfo...

PHP global keyword and $GLOBALS dont seem to work in version 5.3

Hi, I seem to have this problem after upgrading to PHP 5.3 from 5.2. The site runs off index.php which includes() various other utility functions then includes the correct page based on GET variable value. Now one thing I cannot understand is that in xdebug I dont see $GLOBALS. The other bit is - index.php: include_once('includes/glob...

In php is there a reason to use a static method on a class instead of an independent method?

We're having this discussion here. Which is better and why? 1) a php file that just includes a function... function bar(){} called like this bar(); 2) a php that contains a class with a static method. class foo{ static function bar(){} } called like this foo::bar(); Are there any performance reasons to do one or the other?...

Windows Controls or .NET objects as Global Variable in Visual C++

Hi, I'm Writing a C++ Class. I want to keep a global variable in System::Windows::Form::Control type or a .NET managed objects. I want to process somethink on this global variable. But Visual C++ is not allowed this. Returning Error is: "global or static variable may not have managed type" May be this error interest Garbage Collector...

Accessing Uza's global object from an loaded external swf

I am using the 1.2 version of Uza's Global singleton (http://www.uza.lt/codex/as3-global-object/). The container swf stores some data and a link to a function in the "global" object. Then another swf is loaded inside the container, it gets it's global instance with Global.getInstance();, and i suppose i can access the data and function...

How to control visibility of variables in Java?

I can imagine 3 type of visibility for variables (but I think there are more): Variable is used within a method and any changes of the value of this variable are not visible from outside of the method (so it is local for a particular method). A variable is local to the class meaning that it is unvisible from outisde of the class. Howev...

Make a final call to the Database when user leaves website (ASPX)?

I have a system set up to lock certain content in a database table so only one user can edit that content at a time. Easy enough and that part is working fine. But now I'm at a road block of how to send a request to "unlock" the content. I have the stored procedure to unlock the content, but how/where would I call it when the user just c...

Problem with Global Array in PHP

Hi guys,, need some help pls.. i have a PHP code here that lets a user send a message to multiple recipients using the "phonebook" (from database) as the main list. I used an array to temporarily hold all the desired recipients for the current user. So I have a two box, with each for displaying. The user will clicks the name from the p...

Global Import/using Aliasing in .NET

Using import aliasing in one file/class, we can reference class library namespaces by assigning our own custom alias like this: ' VB Imports Db = Company.Lib.Data.Objects // C# using Db = Company.Lib.Data.Objects; And then we are able to reference the classes inside of Company.Lib.Data.Objects by using the Db alias that we assigned....

C++: best way to implement globally scoped data

I'd like to make program-wide data in a C++ program, without running into pesky LNK2005 errors when all the source files #includes this "global variable repository" file. I have 2 ways to do it in C++, and I'm asking which way is better. The easiest way to do it in C# is just public static members. C#: public static class DataContain...

Making Global Struct in C++ Program

Hello world! I am trying to make global structure, which will be seen from any part of the source code. I need it for my big Qt project, where some global variables needed. Here it is: 3 files (global.h, dialog.h & main.cpp). For compilation I use Visual Studio (Visual C++). global.h #ifndef GLOBAL_H_ #define GLOBAL_H_ typedef struc...

PHP variable in variable

I have set an array in my config file that I use global in my functions. This works fine, but now I want to pass the name of this array as a @param in my function. // in config file: $album_type_arr = array("appartamento", "villa"); global $album_type_arr; // pull in from db_config echo $album_type_arr[0]; function buildmenu($name)...

I have a question about variable release in global class.

+ (void)findAndCopyOfDatabaseIfNeeded{ NSArray *path = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [path objectAtIndex:0]; NSFileManager *fileManager = [NSFileManager defaultManager]; NSString *databasePath = [documents...

Custom Global Hotkey

I am trying to get the user defined global hot key for my application. Here is my application code, user.rc CONTROL "", IDC_MHOTKEY, HOTKEY_CLASS, WS_TABSTOP, 91, 86, 68, 14 function.cpp WORD wHotKey = SendDlgItemMessage(hwnd, IDC_MHOTKEY, HKM_GETHOTKEY, 0, 0); GLOBAL_HOTKEY= wHotKey; RegisterHotKey ( NULL, TURN...

Javascript global variable not working properly?

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 ...

PHP Global variable in class is reset

I have a web form that manipulates records in a MySQL database. I have a method for displaying an edit interface for both creating new records and editing them if ($_POST['new_page']) { print "<h2>Create new page</h2>\n"; $isNew=1; $this->EditForm(); } else if($_POST['edit']){ print "<h2>Edit page</h2...

How do I create a Solution Wide Connection String

Hi. Does anyone know if it is possible to create a single connection string that will be accessible to all the projects in a solution (we have about 6). I can create a text file with this information, but we need design time support as well, and it is not practical to have a connection string in every App.Config and Web.config file i...

How do global variables get initialized by the elf loader

For global variables in C like int aglobal = 5; When does the 5 get transferred into aglobal by the loader and how does it know to put 5 in aglobal. Same situation with a static declaration in a function. Like int afunc() { static int astatic = 8; return astatic; } ...

google app engine persistent globals

Hi, I'm looking for a way to keep the equivalent of persistent global variables in app engine (python). What I'm doing is creating a global kind that I initialize once (i.e. when I reset all my database objects when I'm testing). I have things in there like global counters, or the next id to assign certain kinds I create. Is this a de...