Search Results

Search found 5565 results on 223 pages for 'global'.

Page 4/223 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to get global variable in JQuery functions

    - by Tahir Akram
    I want to access my global javascript variable in JQuery methods. But I am unable to get it when I go to attach a click even to a div. As following. How can I do that? I mean do I need to rely on hidden fields for some state management? var divCount = 3; $(function() { //divCount is accessible here $("#sortable").sortable({ revert: true }); $("#new").click(function(){ if (divCount<7){ //divCount is not accessible here. why? and how? var thisCount = ++divCount; $("#draggable_"+thisCount).addClass("draggable"); } }); });

    Read the article

  • Increment global variable on click in flash, actionscript 3

    - by msandbot
    Hi, Making a flash page that can cycle through these three images on mouseclick. For some reason the local changes to count are not reflected on the global one. I tried _global but the syntax was odd and gave me errors. How should I implement this? import flash.events.Event; var images:Array = ["images/image.jpg", "images/image2.jpg", "images/image3.jpg"]; var count:int = 0; forward.addEventListener(MouseEvent.CLICK, loadPhoto); function loadPhoto(evt:Event){ if(count>2){ count==0; } trace(count); imageFrame.source = images[count]; count++; }

    Read the article

  • Global variable call working only first time

    - by Ruthy
    Hello, I defined a global variable that is called from other view and it is working first time but not following ones, it keeps with value from first call! Suppose that is a cocoa fundamental problem and variable is not properly defined according its need. Thanks for any idea to solve it. declaration: @interface TableArchiveAppDelegate : NSObject <UIAppDelegate> { NSString *varName; } @property (nonatomic, copy) NSString *varName; then related lines on .m file: @synthesize varName; -(void)test{ varName = textField.text; } and request from another view: - (void)viewDidLoad { TableArchiveAppDelegate *mainDelegate = (TableArchiveAppDelegate *)[[UIApplication sharedApplication] delegate]; name.text = mainDelegate.varName; [super viewDidLoad]; }

    Read the article

  • Global Import Aliasing in .NET

    - by Josh Stodola
    Using import aliasing in a single class, we can reference class library namespaces by assigning our own custom alias like this: Imports 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. Is it possible to do this at the global level so that the alias is applied to the entire solution instead of the given file? Currently, we are working with web applications, so I was hoping we could add something to web.config, but I am also interested in whether or not this is possible with windows forms, console apps, and/or class libraries.

    Read the article

  • Global jQuery dialog variable not working properly

    - by Ben Dauphinee
    When I call the function, the dialog does work. If I move the dialog construction into the showtimes_list function, everything works fine. I thought that variables declared outside a function were global in context? var dialog_list = $("<div></div>").dialog({ autoOpen: false, modal: true, height: 300, width: 720, }); function showtimes_list(sid){ dialog_list.html(""); $.get("ajax_showtimes.php?sid="+sid, function(data){ dialog_list.html(data); } ); dialog_list.dialog("open"); }

    Read the article

  • PHP Global variable in class is reset

    - by Robert
    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>\n"; $isNew=0; $this->EditForm(); } I am trying to use the global variable $isNew to determine where a record is to be added or updated. However, whenever my SaveChanges() function is run, $isNew is always 0. $isNew is declared immediately after the class declaration, outside all of the functions. class Editor{ public $isNew;

    Read the article

  • Push a variable into global scope?

    - by Spot
    We use instantiate and put system critical objects in $GLOBALS for easy access from anywhere (e.g. DB, Cache, User, etc.). We use $GLOBALS so much that it would (yes, really) drop the amount of code quite a bit if I could reference it like $G = &$GLOBALS for a shorthand call. The problem is that, per my experience and several hours of Googling, I have not found any construct in PHP which allows you to 'flag' a var as global, making $GLOBALS first class, and everything else second class. Am I missing something? Is this possible?

    Read the article

  • define global in a python module from C api

    - by wiso
    Sorry for the trivial question, but I can't find this infomation from the manual. I am developping a module for python using C api; how can I create a variabile that is seen as global from python? For example if my module is module I want to create a variable g that do this job: import module print module.g in particular g is an integer. Solution from Alex Martelli PyObject *m = Py_InitModule("mymodule", mymoduleMethods); PyObject *v = PyLong_FromLong((long) 23); PyObject_SetAttrString(m, "L", v); Py_DECREF(v);

    Read the article

  • Javascript global variable not working properly?

    - by Fabian
    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 modify it such that it is now: $(document).click(function() { $("#id").css("height", height+"px"); }); it works. Any idea why?

    Read the article

  • odd behavior setting timeouts inside a function with global references in javascript

    - by Pablo
    Here is the the function and the globals: $note_instance = Array(); $note_count = 0; function create(text){ count = $note_count++; time = 5000; $note_instance[count] = $notifications.notify("create", text); setTimeout(function(){ $note_instance[count].close() }, time); } The function simply opens a notification, a sets a timeout to close it in 5 seconds. so if i call this create("Good Note 1"); create("Good Note 2"); create("Good Note 3"); Ecah note should close 5 seconds from their creation, however always and only the last note closes, in this case "Good Note 3". Each note object has its own entry in the the $note_instance global array so the timeouts should no be overwriting themselves. What am i missing here folks? Thanks in advance

    Read the article

  • Setting Global Variables in VBA

    - by dennis96411
    I'm currently making an "OS" in PowerPoint and I need to know how to set global variables for the settings. I made a module called "Settings" containing: Public Sub Settings() Option Explicit Public UserName, UserIcon, Background, BrowserHomePage As String Public SetupComplete As Boolean SetupComplete = False UserName = "Administrator" UserIcon = Nothing Background = Nothing BrowserHomePage = Nothing 'Set the variables UserName.Text = UserName End Sub Now on the "log in" screen, I have a text box named "UserName". I then made a button just to test out the variables. The button does this: Private Sub CommandButton1_Click() UserName.Value = UserName End Sub The text box has no value when I click the button. I'm super new at VBA, and would like to know how to do this. Also, if anyone knows how to automatically execute codes when starting the PowerPoint, that would be fantastic.

    Read the article

  • Java: global values inside a class?

    - by HH
    I want less methods. I want a common global TestClass from which I could use any of its value inside the class. import java.util.*; import java.io.*; public class TestClass { TestClass(String hello){ String hallo = hello; String halloSecond = "Saluto!"; } public static void main(String[] args) { TestClass test = new TestClass("Tjena!"); System.out.println("I want "Tjena!": " + test.hallo); TestClass testSecond = new TestClass("1"); System.out.println("I want Saluto!:" + test.halloSecond); System.out.println("I want Saluto!:" + testSecond.halloSecond); } }

    Read the article

  • Custom Global Hotkey

    - by UK
    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_OFF_HOTKEY, HIBYTE(LOWORD(wHotKey)) , wHotKey); main.cpp if ( messages.message == WM_HOTKEY && ( HIWORD ( messages.lParam ) == GLOBAL_HOTKEY) ) alert("Coming only for Single Key"); This code works well, Only If the user selects a single key and not working when he selects multiple key combined like CTRL+F8.

    Read the article

  • Custom Global Hotkey Win32 C - Problem

    - by UK
    Hello , 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_OFF_HOTKEY, HIBYTE(LOWORD(wHotKey)) , wHotKey); main.cpp if ( messages.message == WM_HOTKEY && ( HIWORD ( messages.lParam ) == GLOBAL_HOTKEY) ) alert("Coming only for Single Key"); This code works well, Only If the user selects a single key and not working when he selects multiple key combined like CTRL+F8. I know I am doing something wrong here. Really appreciate If someone guide me in a right path.

    Read the article

  • asp.net global resources problem

    - by Bystrik Jurina
    Hello. I have a weird problem with global resources in my asp.net mvc web application. I have some resources in separate project(not a web app project). Those resources have following settings: Build action: Embedded Resource, Copy To Output Directory: Do not copy, Custom Tool: ResXFileCodeGenerator. When I change an existing value in resource file, build solution in release mode and upload neccesary dll files back to server, the previous values in resources are still shown. However, when I add a new key into resource file, the value of this key is shown properly. I do not have this problem during debugging on localhost. Thanks

    Read the article

  • Global Import/using Aliasing in .NET

    - by Josh Stodola
    Using import aliasing in a single 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. Is it possible to do this at the global level so that the alias is applied to the entire solution instead of the given file? Currently, we are working with web applications, so I was hoping we could add something to web.config, but I am also interested in whether or not this is possible with windows forms, console apps, and/or class libraries.

    Read the article

  • iphone global variables accessed from different views

    - by Rob
    Okay, so ultimately I want a program where the user can input simple data such as their name, date of birth, address, etc. and then have that information stay through multiple views. I am having the user input their information as UITextFields but their are multiple views that they are using to input the data. Is there a way that when the user inputs data in a UITextField - then moves to another view - then returns to the original view - that the data will still be in that UITextField? I figure since there are placeholders that there must be a command to show previously written text in that field when the viewController is called. Also, for the life of me, I can't figure out how to keep these variables global. I have read in multiple areas that I should define them in the AppDelegate as a simple: NSString *userName; NSString *userDOB; But how do I assign the strings from the UITextFields in a different view to these variables and then re-assign them to the UITextFields when the user returns to the place where they originally input them? (I apologize if I am not explaining this coherently - I am a bit of a newb)

    Read the article

  • Python Django Global Variables

    - by Joe J
    Hi all, I'm looking for simple but recommended way in Django to store a variable in memory only. When Apache restarts or the Django development server restarts, the variable is reset back to 0. More specifically, I want to count how many times a particular action takes place on each model instance (database record), but for performance reasons, I don't want to store these counts in the database. I don't care if the counts disappear after a server restart. But as long as the server is up, I want these counts to be consistent between the Django shell and the web interface, and I want to be able to return how many times the action has taken place on each model instance. I don't want the variables to be associated with a user or session because I might want to return these counts without being logged in (and I want the counts to be consistent no matter what user is logged in). Am I describing a global variable? If so, how do I use one in Django? I've noticed the files like the urls.py, settings.py and models.py seems to be parsed only once per server startup (by contrast to the views.py which seems to be parsed eache time a request is made). Does this mean I should declare my variables in one of those files? Or should I store it in a model attribute somehow (as long as it sticks around for as long as the server is running)? This is probably an easy question, but I'm just not sure how it's done in Django. Any comments or advice is much appreciated. Thanks, Joe

    Read the article

  • How to make a Global Array?

    - by Wayfarer
    So, I read this post, and it's pretty much exactly what I was looking for. However... it doesn't work. I guess I'm not going to go with the singleton object, but rather making the array in either a Global.h file, or insert it into the _Prefix file. Both times I do that though, I get the error: Expected specifier-qualifier-list before 'static' and it doesn't work. So... I'm not sure how to get it to work, I can remove extern and it works, but I feel like I need that to make it a constant. The end goal is to have this Mutable Array be accessible from any object or any file in my project. Help would be appreciated! This is the code for my Globals.h file: #import <Foundation/Foundation.h> @interface Globals : NSObject { static extern NSMutableArray * myGlobalArray; } @end I don't think I need anything in the implementation file. If I were to put that in the prefix file, the error was the same.

    Read the article

  • ways to avoid global temp tables in oracle

    - by Omnipresent
    We just converted our sql server stored procedures to oracle procedures. Sql Server SP's were highly dependent on session tables (INSERT INTO #table1...) these tables got converted as global temporary tables in oracle. We ended up with aroun 500 GTT's for our 400 SP's Now we are finding out that working with GTT's in oracle is considered a last option because of performance and other issues. what other alternatives are there? Collections? Cursors? Our typical use of GTT's is like so: Insert into GTT INSERT INTO some_gtt_1 (column_a, column_b, column_c) (SELECT someA, someB, someC FROM TABLE_A WHERE condition_1 = 'YN756' AND type_cd = 'P' AND TO_NUMBER(TO_CHAR(m_date, 'MM')) = '12' AND (lname LIKE (v_LnameUpper || '%') OR lname LIKE (v_searchLnameLower || '%')) AND (e_flag = 'Y' OR it_flag = 'Y' OR fit_flag = 'Y')); Update the GTT UPDATE some_gtt_1 a SET column_a = (SELECT b.data_a FROM some_table_b b WHERE a.column_b = b.data_b AND a.column_c = 'C') WHERE column_a IS NULL OR column_a = ' '; and later on get the data out of the GTT. These are just sample queries, in actuality the queries are really complext with lot of joins and subqueries. I have a three part question: Can someone show how to transform the above sample queries to collections and/or cursors? Since with GTT's you can work natively with SQL...why go away from the GTTs? are they really that bad. What should be the guidelines on When to use and When to avoid GTT's

    Read the article

  • Global and local variables in my script

    - by Acorn
    I'm 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 i=0; i<columns; i++) { $('#canvas').append('<div class="tile" style="left:' + leftPos + 'px;top:' + topPos + 'px;"></div>'); var leftPos = leftPos + tileWidth + spacing; } } function placeTiles() { for (var i=0; i<rows; i++) { makeRow(); var topPos = topPos + tileHeight + spacing; } } At the moment, 100 <div>s get created, all with a top position of 10px and a left position of undefined (for the first <div> in the row) or NaN. What should I be doing differently? Why can't makerow() see my global leftPos variable (and all the other variables for that matter)? Thanks.

    Read the article

  • gcc does not resolve extern global variables, with or without -c option

    - by Moons
    Hello everyone! So i have this issue : i am declaring some extern global variables in my C program. If I don't use the -c option for gcc, i get undefined references errors. But with that -c option, the linking is not done, which means that i don't have an executable generated. So how do I solve this? Here is my makefile. As I am not good with writing makefiles, I took one from another project then I changed a few things. So maybe I'm missing something here. # Makefile calculPi INCL = -I$(INCL_DIR) DEFS = -D_DEBUG_ CXX_FLAGS =-g -c -lpthread -lm CXX = gcc $(CXX_FLAGS) $(INCL) $(DEFS) LINK_CXX = gcc OBJ = approx.o producteur.o sequentialApproximation.o main.o LINKOBJ = approx.o producteur.o sequentialApproximation.o main.o BIN = calculPi.exe RM = rm -fv all: calculPi.exe clean: ${RM} *\~ \#*\# $(OBJ) clean_all: clean ${RM} $(BIN) cleanall: clean ${RM} $(BIN) $(BIN): $(OBJ) $(CXX) $(LINKOBJ) -o "calculPi.exe" main.o: main.c $(CXX) main.c -o main.o $(CXX_FLAGS) approx.o: approx.c approx.h $(CXX) -c approx.c -o approx.o $(CXX_FLAGS); producteur.o: producteur.c producteur.h $(CXX) -c producteur.c -o producteur.o $(CXX_FLAGS); sequentialApproximation.o : sequentialApproximation.c sequentialApproximation.h $(CXX) -c sequentialApproximation.c -o sequentialApproximation.o $(CXX_FLAGS);

    Read the article

  • Javascript Anonymous Functions and Global Variables

    - by Jonathan Swift
    I thought I would try and be clever and create a Wait function of my own (I realise there are other ways to do this). So I wrote: var interval_id; var countdowntimer = 0; function Wait(wait_interval) { countdowntimer = wait_interval; interval_id = setInterval(function() { --countdowntimer <=0 ? clearInterval(interval_id) : null; }, 1000); do {} while (countdowntimer >= 0); } // Wait a bit: 5 secs Wait(5); This all works, except for the infinite looping. Upon inspection, if I take the While loop out, the anonymous function is entered 5 times, as expected. So clearly the global variable countdowntimer is decremented. However, if I check the value of countdowntimer, in the While loop, it never goes down. This is despite the fact that the anonymous function is being called whilst in the While loop! Clearly, somehow, there are two values of countdowntimer floating around, but why?

    Read the article

  • Beginner C++ - Trouble using global constants in a header file

    - by Francisco P.
    Hello! Yet another Scrabble project question... This is a simple one. It seems I am having trouble getting my global constants recognized: My board.h: http://pastebin.com/R10HrYVT Errors returned: 1>C:\Users\Francisco\Documents\FEUP\1A2S\PROG\projecto3\projecto3\Board.h(34): error: variable "TOTAL_ROWS" is not a type name 1> vector< vector<Cell> > _matrix(TOTAL_ROWS , vector<Cell>(TOTAL_COLUMNS)); 1> 1>main.cpp 1>compilation aborted for .\Game.cpp (code 2) 1>Board.cpp 1>.\Board.h(34): error: variable "TOTAL_ROWS" is not a type name 1> vector< vector<Cell> > _matrix(TOTAL_ROWS , vector<Cell>(TOTAL_COLUMNS)); 1> ^ 1> Why does this happen? Why is the compiler expecting types? Thanks for your time!

    Read the article

  • Clearing Session in Global Application_Error

    - by Zarigani
    Whenever an unhandled exception occurs on our site, I want to: Send a notification email Clear the user's session Send the user to a error page ("Sorry, a problem occurred...") The first and last I've had working for a long time but the second is causing me some issues. My Global.asax.vb includes: Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs) ' Send exception report Dim ex As System.Exception = Nothing If HttpContext.Current IsNot Nothing AndAlso HttpContext.Current.Server IsNot Nothing Then ex = HttpContext.Current.Server.GetLastError End If Dim eh As New ErrorHandling(ex) eh.SendError() ' Clear session If HttpContext.Current IsNot Nothing AndAlso HttpContext.Current.Session IsNot Nothing Then HttpContext.Current.Session.Clear() End If ' User will now be sent to the 500 error page (by the CustomError setting in web.config) End Sub When I run a debug, I can see the session being cleared, but then on the next page the session is back again! I eventually found a reference that suggests that changes to session will not be saved unless Server.ClearError is called. Unfortunately, if I add this (just below the line that sets "ex") then the CustomErrors redirect doesn't seem to kick in and I'm left with a blank page? Is there a way around this?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >