global-variables

Symfony 1.4 and global variables

I've got a very old php application (1999) that has been worked on during the last ten years. At this point the app starts to show it's age so i'm in te progress of migrating to a "new" framework, symfony 1.4. But since the app is very large, i cannot do this at once. So i'm planning to wrap the old app into the new symfony app, and conv...

Possible to create an unscoped global in application.cfc?

I'm migrating an old app that uses application.cfm to use an application.cfc. The CFM sets a few globals such as <cfset dsn = "myDSN"> I've tried putting that line of code in onApplicationStart, onRequestStart, etc. but trying to print that value out in a test page results in an error. Setting a value in the application scope (e.g. ap...

PHP All Function Variables Global

Hi, I have a function called init on my website in an external file called functions.php. Index.php loads that page and calls function init: function init(){ error_reporting(0); $time_start = microtime(true); $con = mysql_connect("localhost","user123","password123"); mysql_select_db("db123"); } How can I get all of these ...

What is a proper way to store site-level global variables in a SharePoint site?

One thing that has driven me nuts about SharePoint2007 is the apparent inability to have defineable settings that apply specifically to a site or site collection itself, and not the content. I mean, you have some pre-defined settings like the Site Logo, the Site Name, and various other things, but there doesn't appear to be anywhere to a...

shared global variables in C

How can I create global variables that are shared in C? If I put it in a header file, then the linker complains that the variables are already defined. Is the only way to declare the variable in one of my C files and to manually put in externs at the top of all the other C files that want to use it? That sounds not ideal. ...

Python namespace in between builtins and global?

Hello, As I understand it python has the following outermost namespaces: Builtin - This namespace is global across the entire interpreter and all scripts running within an interpreter instance. Globals - This namespace is global across a module, ie across a single file. I am looking for a namespace in between these two, where I c...

How can i list and watch all global variables on watch windows of visual studio (for c++)?

When stopped at a breakpoint on main(), i can manually add name of a global variables to watch windows, but what i want is how to show a list of all global variables, because i'm using an external library, which contains many static things. Is it possible? Thanks in advance! ...

Global name not defined

I wrote a CPU monitoring program in Python. For some reason sometimes the the program will run without any problem. Then other times the program won't even start because of the following error. Traceback (most recent call last): File "", line 244, in run_nodebug File "C:\Python26\CPUR1.7.pyw", line 601, in app = simpleapp_tk(N...

python global variable not working in apache

I am facing issue with the global variable, when i run in the django development server it works fine, but in apache it doesn't work here is the code below: red= "/project3/test/" def showAddRecipe(request): #global objc if "userid" in request.session: objc["ErrorMsgURL"]= "" try: urlList= request....

Static Global variable in Obj-C?

// in ClassA.h static NSString *globalStr = @"HelloWorld"; @interface ClassA ... @end // in ClassB.h #include "ClassA.h" // in ClassB.m ... NSLog(@"The global string: %@", globalStr); ... In C++, "static" should mean the variable or function has a internal linkage. But it is used to share the variable in this case, e...

When are global static const variables being initialized?

Hello all, I tried to search the site for this question but didn't find this exactly, although this subject is being discussed a lot... I have this declaration in a cpp file, not within any function: static const char* gText = "xxxxxxxxxxx"; Although it has a fixed size, I get a warning from a static analysis tool (Klocwork) when I'm...

sharing "Global" variables across activities, problem when using a Webview... ?

hello everyone, I'm sharing some variables accross activities by using a class like this : public class Globals { static Boolean hint1_graph_type_switcher; static Boolean hint2_stockview_valuation; other variables ... } then I'm using these variables anywhere across my multiple activites with ... if (Globals.hint2_stockview_v...

Ruby on Rails - Global Variable?

Hello, I am a new Ruby on Rails user and had a question. I have an idea of what I want my Users DB to look like but was wondering whether or not I should add an additional value to it. Basically I need a variable to signal to all users that it is safe to proceed with a certain action. This variable would be persistent across all users a...

how to initialize a global const pointer?

I have a variable which is the head to a linked list. I want to make it const because it should never be changed, the variable is used throughout the program, so I thought I should make it a global const. The problem is that I couldn't initialize it after I declared it const. How can I get around this problem? typedef struct PT { ...

extern variables in static library, using Objective-C

Hello, I've built a static library, to be linked in my iPhone apps. This library uses some global variables and functions, like in C. My problem is, when using for example: extern void do_stuff (const int a) { return a*a; } extern const int a_variable; extern const int an_array[DEFINED_VALUE]; When I use this function, or access...

Setting global Button and EditText objects

I'm getting null pointer exceptions when I try to initialize Button and EditText objects in global scope, can't figure it out. I've commented out everything but the bare minimum for the app to display my layout, but this still causes a crash: private EditText addmoney = (EditText)findViewById(R.id.addmoney); R.id.addmoney definitely,...

$_SESSION['userid'] works in one function and not the next

Hi. I can't understand why this don't work. First i have a function like this where the user name shows up: if(isset($_POST['Commit'])){ if(empty($_POST['crime'])){ echo "You didn't select the type of crime you wish to do."; }else{ (...lots of code) $name = $_SESSION['username'];` Then I have another function where the username ...

Global Objects iphone

What is the easiest way to create a global object. I have tried declaring the object outside the method with no luck. @implementation UV_TouchpadViewController; NSMutableString *string = [NSMutableString stringWithFormat:@"text"]; ...

I have a require("config.php") with arrays, but still get Undefined variable error

Hi. I hava a function that looks something like this: require("config.php"); function displayGta() { (... lots of code...) $car = $car_park[3]; } and a config.php that look something like this: <?php $car_park = array ("Mercedes 540 K.", "Chevrolet Coupe.", "Chrysler Imperial.", "Ford Model T.", "Hudson Super.", "Packard ...

Qt C++: Global objects vs. reference chain

Hello, Currently I'm using singleton pattern for certain global objects in my application (Qt application for Symbian environment). However, because of some problems (http://stackoverflow.com/questions/3147375/c-checking-singleton-pointers/3147806#3147806) it looks like that I have to change the logic. I have 3 classes (logger, setting...