Search Results

Search found 15137 results on 606 pages for 'global state'.

Page 10/606 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • R data frame select by global variable

    - by Matt
    I'm not sure how to do this without getting an error. Here is a simplified example of my problem. Say I have this data frame DF a b c d 1 2 3 4 2 3 4 5 3 4 5 6 Then I have a variable x <- min(c(1,2,3)) Now I want do do the following y <- DF[a == x] But when I try to refer to some variable like "x" I get an error because R is looking for a column "x" in my data frame. I get the "undefined columns selected" error How can I do what I am trying to do in R?

    Read the article

  • Has the `message-passing/shared-state' dilemma (concurrency & distribution) taken form of a `Holywar

    - by Bubba88
    I'm not too well-informed about the state of the discussion about which model is better, so I would like to ask a pretty straight question: Does it look like two opposing views having really heatened dispute? E.g. like prototype/class based OOP or dynamic vs. static typing (though these are really not much fitting examples, I just do not know how to express my question more clearly)

    Read the article

  • Global javascript variable not accessible in jquery change event

    - by Dan
    I have to be missing something simple, but I'm really not sure what. I'm not a JS veteran, so this may be an easy answer - sure hope so :). I have a button that, when clicked, gets JSON data. When a drop-down is changed, I check to see if there is data, if there is, I want to clear it out as the drop-down indicates what data to retrieve when the button is clicked The Code: var selected, $locDialog; var locations = []; $(function() { // Save the selected Name selected = $("#selected option:selected").val(); // Setup Dialog for Locations $locDialog = $('#location-dialog').dialog({ autoOpen: false }); // If user changes the selected // 1. Prompt for confirmation // 2. If users confirms, clear data $('#selected').change(function() { if (locations) { var confirmed = confirm("Oh Rly?"); if (confirmed) { // Clear data var locations; } } }); // When user clicks "Location" Button.. $('.loc-select button').click(function() { if (!locations) { $.getJSON("/Controller/JSONAction", { selectedId: selected, pageNum: 1, pageSize: 100 }, function(data) { locations = data; $.each(locations, function(index, loc) { var $tr = $('<tr/>') .append($('<td/>') .append('<input type="checkbox" name="TEST-'+index+'" value="'+loc.Id+'"/>')) .append('<td>' + loc.Name + '</td>'); $("#location-dialog table tbody").append($tr); }); }); } $locDialog.dialog('open'); return false; }); }); Here's the thing, Inside the .click(...) callback, I can see locations is []. Now, when I am in the .change(...) callback, I see locations is undefined. Any help/insight, as always, is appreciated!

    Read the article

  • Inline function and global variable issue in Javascript

    - by Natim
    I have some code here : http://bitbucket.org/natim/lo53_tp1/src/tip/part3/camions/medias/js/tracking.js That I use to draw some information about trucks direction. The problem come from a function defined in a for loop like this one : ... for(i = 0; i < nb_trucks; i++) { ... contentString = '<div id="content">'+ trucks[i]['name'] + '</div>'; current_window = new google.maps.InfoWindow({ content: contentString }); infosWindow.push(current_window); current_marker = new google.maps.Marker({ map: map, position: new google.maps.LatLng(trucks[i]['end']['lat'], trucks[i]['end']['lon']), draggable: false, title: trucks[i]['name'] }); markers.push(current_marker); google.maps.event.addListener(current_marker, 'click', function() { current_window.open(map, current_marker); }); } In this code, you can see the last block google.maps.event.addListener(current_marker, 'click', function() { current_window.open(map, current_marker); }); And my problem is that current_marker in the addListener parameters is different from the one inside the function. The current_window and the current_marker inside the function is overide at each loop turn. How can I get it right ? Thanks

    Read the article

  • Global variables in java

    - by zachary
    I want to make a class in java that is assessable to all other classes in my project. I created this in the default package and now it cannot be seen. What is the best way to do this in java?

    Read the article

  • Problem with Global Array in PHP

    - by Suezy
    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 phonebook lisy and clicks "Add" button to add on the temporary list on the other select box. The problem is, whenever I use the "onChange" function in javascript; the array accepts only one recipients, and when I try to add, it replaces the first one. :( Here is my code: $recipients = array(); // How do I place the array here? function reload_page(){ i=document.maillinglist.firstletter.selectedIndex; this.location='./group_msg.php?firstletter='+document.maillinglist.firstletter.options[i].value; } function add(){ } $conn = pg_connect("host=localhost user=sa dbname=messaging"); if(isset($_GET['firstletter'])){ $letter=$_GET['firstletter']; } else { $letter='a';} print ""; print "GROUP MESSAGE"; print ""; print ""; print ""; print ""; for($chr_loop=97;$chr_loop<=122;$chr_loop++){ $alphabet = chr($chr_loop); # Displays list of users arranged by letters - this works fine if($alphabet==$letter){ print "\t\t<option value='$alphabet' selected>-------------------- $alphabet --------------------</option>\n"; } else { print "\t\t<option value='$alphabet'>-------------------- $alphabet --------------------</option>\n";} } print ""; print "<td><select style='width:210px' name=\"non_members[]\" size=10 width=200>"; $sql = "select name from test_phonebook where name like '$letter%';"; $result = pg_query($conn, $sql); # Display users from phonebook using the letter chosen while($row = pg_fetch_assoc($result)){ $my_name = $row['name']; print "<option width=200 value=\"$my_name\">$my_name</option>"; } print "</td>"; print "</select>"; print "<td><input type=submit name=add value=\"->>\" onClick=\"add()\"><br><input type=submit name=del value=\"<<-\"></td>"; print "<td><select name=\"members[]\" style='width:210px' size=10>"; # Display temporary recipients - problem: ONLY DISPLAYS ONE VALUE while (list ($key, $val) = each ($recipients)) { echo "$key -> $val <br>"; print "<option width=200 value=\"$val\">$val</option>"; } print "</select></table></form>"; My aim here, is to place all recipients that the user desires to an array, without losing the previous value added.

    Read the article

  • Global variables that can be used in multiple jQuery functions

    - by YouBook
    Can you be able to contain variables that can be used in multiple functions in jQuery, example: var self = $(this); var box = self.parents('.box'); $('#title').click(function() { self.css('background', 'red'); box.slideDown('slow'); }).dblclick(function() { self.css('background', 'green'); box.slideUp('slow'); }); So that self and box can be used within these event functions so I don't have to keep doing this: $('#title').click(function() { var self = $(this); var box = self.parents('.box'); self.css('background', 'red'); }).dblclick(function() { var self = $(this); var box = self.parents('.box'); self.css('background', 'green'); }); But question is, is it possible, if so, how can you do that?

    Read the article

  • Javascript global object calls function?

    - by Troels
    Hello stackoverflow I have a very odd problem with javascript. My code is rather long so here is an example of the structure and the problem: var x = new function f() { this.id = ""; } function g(obj) { if (x.id == "") { ... obj.firstChild.setAttribute("onclick", "javascript:o();"); ... x.id = obj.id; } else if (x.id != obj.id) { ... x.id = ""; g(obj); } } function o() { ... if (something == something) { ... } else { ... x.id = ""; // if-statement of the g() function is called here? } } As you can see, the if-statement of the g() function is for some reason called or re-run upon x.id being changed. I simply cannot understand this, because they are not in the same scope, and changing a variable should under no circumstances trigger anything? Any help would be greatly appreciated.

    Read the article

  • Adding nodes to a global linked-list

    - by Zack
    I am attempting to construct my first linked list, and having read a basic introduction, have done the following. Firstly, declare a linked list node as: struct errorNode { uint8 error; struct errorNode* next; }; Secondly, define the first node globally as: struct errorNode errorList = {0, NULL}; This has been done to allow each of the libraries that make up my current project to insert errors into a common list. The function to do this is: void errorListWrite(uint8 error) { struct errorNode* newNode = malloc(sizeof(struct errorNode)); newNode->error = error; newNode->next = &errorList; errorList = *newNode; } Whilst this compiles without error, it does not function as expected. I thnk the problem is with the last two statements of the list write function, but I am unsure. A hint as to what I am doing wrong would be most appreciated.

    Read the article

  • jQuery global variable problem

    - by Emanuel
    var id = $(this).children().html(); // id is 5 $.ajax({ url: 'ajax.php?id=' + id, success: function(data) { id = data; // id is 1 } }); if(id == 1){ // id is again 5 ... } Why in the following example I can't reinitialize the id variable? What is wrong? Thanks.

    Read the article

  • Declare global variables for a batch of execution statements - sql server 2005

    - by Shrewd Demon
    hi, i have an SQL statement wherein i am trying to update the table on the client's machine. the sql statement is as follows: BEGIN TRANSACTION DECLARE @CreatedBy INT SELECT @CreatedBy = [User_Id] FROM Users WHERE UserName = 'Administrator' --//////////////////////////////////////////////////////////////////// --//////////////////////////////////////////////////////////////////// PRINT @CreatedBy --(Works fine here and shows me the output) PRINT N'Rebuilding [dbo].[Some_Master]' ALTER TABLE [dbo].[Some_Master] ADD [CreatedBy] [BIGINT] NULL, [Reason] [VARCHAR](200) NULL GO PRINT @CreatedBy --(does not work here and throws me an error) PRINT N'Updating data in [Some_Master] table' UPDATE Some_Master SET CreatedBy = @CreatedBy COMMIT TRANSACTION but i am getting the following error: Must declare the scalar variable "@CreatedBy". Now i have observed if i write the Print statement above the alter command it works fine and shows me its value, but if i try to print the value after the Alter command it throws me the error i specified above. I dont know why ?? please help! Thank you

    Read the article

  • Basic AI FSM - Handling state transition

    - by Galvanize
    I'm starting to study on how to implement game AI, and it seems to me that a very simple FSM for my Pong demo would be a nice way to start. My vision on implementing this would be to have a basic state interface and a class for each state, then the NPC would have an instance of the current state. The class should have an update method and directions on wich state to go next, depending on the event received. The question is: How do I handle this event? Should I have a regular addEventListener and a costum event system? Or should I check on update for the things that could change the current state? I'm feeling a bit lost, I feel I have a good grasp on the FSM concept but a good implementation seems tricky, thanks in advance.

    Read the article

  • Can various browsers be assumed to maintain predictible state accurately in multiplayer online gaming?

    - by Nikos
    With many games it is said that server will assume that clients keep track of the world accurately. Assuming this is true, for a browser based multiplier space invaders game you would only tell the client when new bullets or the players ship moves and everything that behaves in a predetermined manner in the js client. It would be expected that positions would be the same in the browsers. Do you think you could trust browsers to do this? I feel that timings could differ between rendering loops and cause positions to get out of sync and might just get the server to maintain all the positions to make sure.

    Read the article

  • Global menu not showing in Ubuntu 12.10 with Unity

    - by William
    I am on Ubuntu 12.10 with Unity shell. I am not quite sure what happened, but today I noticed that the menubar (containing 'File, Edit, etc...') is not appearing on the panel as it used to (i.e. the global application menu), but on the application window under the title bar. The only application that still uses global menu is Chromium. Any ideas what settings may have changed? Also, when I right click on the desktop and select "Change Desktop Background", System Settings opens, instead of the "Appearance" settings. Apparently, here is a related question, with no answer: Global menu and HUD suddenly broken EDIT: I noticed this behavior on three of my computers after an update (I do not remember exactly which packages were updated). Now when I try to run apt-get upgrade, I get: The following packages have been kept back: gnome-control-center gnome-control-center-data I guess something is going on with updates. Any info would be appreciated.

    Read the article

  • Coming Soon! Oracle Global Trade Management Solutions

    An exciting new solution offering, Oracle Global Trade Management helps companies manage the Has the complexity of worldwide trade compliance while also mitigating compliance risk and uncovering supply chain inefficiencies. Oracle Global Trade Management helps organizations lower operational costs and improve network efficiencies by created barriers and roadblocks in your business processes? Do you seek ways to mitigate compliance risk while at the same time find hidden cash in your supply chain? If these issues affect your company, tune in to hear how the new Oracle Global Trade Management solution automatinges and streamlininges cross-border transactions. as part of the Value Chain Execution suite and a native trade and transportation platform.

    Read the article

  • XSS to change ASP.NET session state

    - by Juri Bogdanov
    Hello! I am developing the application that stores current user and user's role to session state (System.Web.SessionState.HttpSessionState Page.Session). if (Session["username"] == null) Session.Add("username", User.Identity.Name); if (Session["isAdministrator"] == null) Session.Add("isAdministrator", User.IsInRole(domain + "\\Domain Admins")); After I check these session states in code behind for granting permissions to some excecution: if ((bool)Session["isAdministrator"] || computer.Administrators.Contains(Session["username"].ToString())) My question is next: how safe that mechanism is? Is it possible to change the session states using some JavaScript for example or some how else? Thanks :)

    Read the article

  • Changing expiry on ASP.NET's Session State cookie

    - by Charlie Somerville
    I'm using ASP.NET Session State to keep track of logged in users on my site. However, one problem I'm running into is that by default ASP.NET session cookies are set to expire when the browser closes. I've tried setting my own ASP.NET_SessionId cookie and modifying the cookie's expiry using something similar to the following code: Response.Cookies["ASP.NET_SessionId"].Expires = DateTime.Now.AddMonths(1); None of these approaches work, they all set a second cookie with the same name. Is there a way of changing the session cookie's expiry?

    Read the article

  • Keeping the application state - deploy/install apk

    - by Buffalo
    I'm trying to have my application minimized when paused and then when it's resumed, it should be restored to its previous state, not recreated. This works perfectly when deploying the application on a device/emulator from Eclipse. The problem occurs when I get the apk (either from bin\ or from Project - Android tools - Export signed application package) and install it on a device with a file browser (Astro): the application is destroyed when paused and then recreated. I can call moveTaskToBack(true); in my activity, yet it will still be recreated when launching it. All the discussions around this are based on achieving the opposite: closing the application when minimizing it. Is there any way of achieving what I want?

    Read the article

  • Custom session state provider needed for DB storage?

    - by subt13
    I know this question is related to many others, but please bear with me. I am trying an experiment to store all information in database tables instead of the ASP.NET session. In ASP.NET 4 one can create a custom provider for session. So, again should I implement a Custom Session-State Provider or should I just disable session (in Web.config)? Thanks! From the comments my question can be misunderstood. Hopefully this tidbit will help clarify: I don't want to store the session in the database. I want to store information in the database that you would typically store in the session. One reason why: I don't want to carry around a session on every page, especially if that page doesn't care about 90 percent of the information in the session

    Read the article

  • C++ SDL State Machine Segfault

    - by user1602079
    The code compiles and builds fine, but it immediately segfaults. I've looked at this for a while and have no idea why. Any help is appreciated. Thank you! Here's the code: main.cpp #include "SDL/SDL.h" #include "Globals.h" #include "Core.h" #include "GameStates.h" #include "Introduction.h" int main(int argc, char** args) { if(core.Initilize() == false) { SDL_Quit(); } while(core.desiredstate != core.Quit) { currentstate->EventHandling(); currentstate->Logic(); core.ChangeState(); currentstate->Render(); currentstate->Update(); } SDL_Quit(); } Core.h #ifndef CORE_H #define CORE_H #include "SDL/SDL.h" #include <string> class Core { public: SDL_Surface* Load(std::string filename); void ApplySurface(int X, int Y, SDL_Surface* source, SDL_Surface* destination); void SetState(int newstate); void ChangeState(); enum state { Intro, STATES_NULL, Quit }; int desiredstate, stateID; bool Initilize(); }; #endif Core.cpp #include "Core.h" #include "SDL/SDL.h" #include "Globals.h" #include "Introduction.h" #include <string> /* Initilizes SDL subsystems */ bool Core::Initilize() { //Inits subsystems, reutrns false upon error if(SDL_Init(SDL_INIT_EVERYTHING) == -1) { return false; } SDL_WM_SetCaption("Game", NULL); return true; } /* Loads surfaces and optimizes them */ SDL_Surface* Core::Load(std::string filename) { //The surface to be optimized SDL_Surface* original = SDL_LoadBMP(filename.c_str()); //The optimized surface SDL_Surface* optimized = NULL; //Optimizes the image if it loaded properly if(original != NULL) { optimized = SDL_DisplayFormat(original); SDL_FreeSurface(original); } else { //returns NULL upon error return NULL; } return optimized; } /* Blits surfaces */ void Core::ApplySurface(int X, int Y, SDL_Surface* source, SDL_Surface* destination) { //Stores the coordinates of the surface SDL_Rect offsets; offsets.x = X; offsets.y = Y; //Bits the surface if both surfaces are present if(source != NULL && destination != NULL) { SDL_BlitSurface(source, NULL, destination, &offsets); } } /* Sets desiredstate to newstate */ void Core::SetState(int newstate) { if(desiredstate != Quit) { desiredstate = newstate; } } /* Changes the game state */ void Core::ChangeState() { if(desiredstate != STATES_NULL && desiredstate != Quit) { delete currentstate; switch(desiredstate) { case Intro: currentstate = new Introduction(); break; } stateID = desiredstate; desiredstate = core.STATES_NULL; } } Globals.h #ifndef GLOBALS_H #define GLOBALS_H #include "SDL/SDL.h" #include "Core.h" #include "GameStates.h" extern SDL_Surface* screen; extern Core core; extern GameStates* currentstate; #endif Globals.cpp #include "Globals.h" #include "SDL/SDL.h" #include "GameStates.h" SDL_Surface* screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE); Core core; GameStates* currentstate = NULL; GameStates.h #ifndef GAMESTATES_H #define GAMESTATES_H class GameStates { public: virtual void EventHandling() = 0; virtual void Logic() = 0; virtual void Render() = 0; virtual void Update() = 0; }; #endif Introduction.h #ifndef INTRODUCTION_H #define INTRODUCTION_H #include "GameStates.h" #include "Globals.h" class Introduction : public GameStates { public: Introduction(); private: void EventHandling(); void Logic(); void Render(); void Update(); ~Introduction(); SDL_Surface* test; }; #endif Introduction.cpp #include "SDL/SDL.h" #include "Core.h" #include "Globals.h" #include "Introduction.h" /* Loads all the assets */ Introduction::Introduction() { test = core.Load("test.bmp"); } void Introduction::EventHandling() { SDL_Event event; while(SDL_PollEvent(&event)) { switch(event.type) { case SDL_QUIT: core.SetState(core.Quit); break; } } } void Introduction::Logic() { //to be coded } void Introduction::Render() { core.ApplySurface(30, 30, test, screen); } void Introduction::Update() { SDL_Flip(screen); } Introduction::~Introduction() { SDL_FreeSurface(test); } Sorry if the formatting is a bit off... Having to put four spaces for it to be put into a code block offset it a bit. I ran it through gdb and this is what I got: Program received signal SIGSEGV, Segmentation fault. 0x0000000000400e46 in main () Which isn't incredibly useful... Any help is appreciated. Thank you!

    Read the article

  • Session State ArrayList in Shopping Cart ASP.NET

    - by user330342
    Hi guys, I'm creating a shopping cart application and I'm having some issues with implementing a session state for my arraylist. in my page load i declared if (Session["Cart"] == null) { Session["Cart"] = new ArrayList(); } else { ArrayList cart = (ArrayList)Session["Cart"]; } to create the session if it doesn't exist yet. then i have an event handler for a button to add items to the arraylist protected void onClick_AddBooking(object sender, EventArgs e) { int ClassID = Convert.ToInt32(Request.QueryString.Get("Class_Id")); ArrayList cart1 = new ArrayList(); cart1 = Session["Cart"]; cart1.Add(ClassID); i'm guessing i just don't know how to handle session states yet, thus the confusion. I'm essentially storing the class_ID then when the student confirms i'll store that to the DB and associate that ID with the Class Details. Thanks in advance guys!

    Read the article

  • Class member variables, methods and their state

    - by codeMonkey
    How should class member variables be used in combination with class methods? Let's say I have a class 'C' with a member variable 'someData'. I call C.getData(), which does not return a value but instead puts data in C.someData. The class that instantiated 'C' first calls C.getData and then uses the data by accessing the member variable C.someData. I call C.getData() in the class that instantiated 'C' which is a function that returns data. I myself prefer the second way. But it also depends on the situation and it's a small difference. Is it 'bad' to have class methods that depend on the classes internal state? What are the best conventions?

    Read the article

  • Introducing the First Global Web Experience Management Content Management System

    - by kellsey.ruppel
    By Calvin Scharffs, VP of Marketing and Product Development, Lingotek Globalizing online content is more important than ever. The total spending power of online consumers around the world is nearly $50 trillion, a recent Common Sense Advisory report found. Three years ago, enterprises would have to translate content into 37 language to reach 98 percent of Internet users. This year, it takes 48 languages to reach the same amount of users.  For companies seeking to increase global market share, “translate frequently and fast” is the name of the game. Today’s content is dynamic and ever-changing, covering the gamut from social media sites to company forums to press releases. With high-quality translation and localization, enterprises can tailor content to consumers around the world.  Speed and Efficiency in Translation When it comes to the “frequently and fast” part of the equation, enterprises run into problems. Professional service providers provide translated content in files, which company workers then have to manually insert into their CMS. When companies update or edit source documents, they have to hunt down all the translated content and change each document individually.  Lingotek and Oracle have solved the problem by making the Lingotek Collaborative Translation Platform fully integrated and interoperable with Oracle WebCenter Sites Web Experience Management. Lingotek combines best-in-class machine translation solutions, real-time community/crowd translation and professional translation to enable companies to publish globalized content in an efficient and cost-effective manner. WebCenter Sites Web Experience Management simplifies the creation and management of different types of content across multiple channels, including social media.  Globalization Without Interrupting the Workflow The combination of the Lingotek platform with WebCenter Sites ensures that process of authoring, publishing, targeting, optimizing and personalizing global Web content is automated, saving companies the time and effort of manually entering content. Users can seamlessly integrate translation into their WebCenter Sites workflows, optimizing their translation and localization across web, social and mobile channels in multiple languages. The original structure and formatting of all translated content is maintained, saving workers the time and effort involved with inserting the text translation and reformatting.  In addition, Lingotek’s continuous publication model addresses the dynamic nature of content, automatically updating the status of translated documents within the WebCenter Sites Workflow whenever users edit or update source documents. This enables users to sync translations in real time. The translation, localization, updating and publishing of Web Experience Management content happens in a single, uninterrupted workflow.  The net result of Lingotek Inside for Oracle WebCenter Sites Web Experience Management is a system that more than meets the need for frequent and fast global translation. Workflows are accelerated. The globalization of content becomes faster and more streamlined. Enterprises save time, cost and effort in translation project management, and can address the needs of each of their global markets in a timely and cost-effective manner.  About Lingotek Lingotek is an Oracle Gold Partner and is going to be one of the first Oracle Validated Integrator (OVI) partners with WebCenter Sites. Lingotek is also an OVI partner with Oracle WebCenter Content.  Watch a video about how Lingotek Inside for Oracle WebCenter Sites works! Oracle WebCenter will be hosting a webinar, “Hitachi Data Systems Improves Global Web Experiences with Oracle WebCenter," tomorrow, September 13th. To attend the webinar, please register now! For more information about Lingotek for Oracle WebCenter, please visit http://www.lingotek.com/oracle.

    Read the article

  • Sharing session state between 2 ASP.NET applications using SQL Server

    - by Dave
    Hi I'm working on a site that has a requirement to share session between a cms application and an online store application on the same domain eg. mydomain.com and store.mydomain.com I've made some progress with it and it works on my local build between localhost/cms and localhost/store Basically I have done what is suggested in this article http://blogs.msdn.com/toddca/archive/2007/01/25/sharing-asp-net-session-state-across-applications.aspx and hacked the TempGetAppID Stored Procedure to return the same application id (1). This appears to work as it creates sessions with ids like 'abv5d2urx1asscfwuzw3wp4500000001', which is what I'd expect. My issue is that when I deploy it to our testing environment, it creates a new session when I navigate between the 2 sites. So when I start a session on the cms site, if I navigate to the store, it creates a new session. These are set up as 2 different websites in IIS7. In the web.config files for both sites, the and elements are both the same and are as follows (minus sensitive information) Has anyone got an ideas why this might not be working? I am sharing Forms Authentication across the 2 sites and that works fine. Any help or ideas would be greatly appreciated! Many thanks Dave

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >