Search Results

Search found 15797 results on 632 pages for 'session variables'.

Page 53/632 | < Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >

  • How to handle optional variables of an object in Java?

    - by Arvanem
    Hi folks, For my trading program, I have a Merchant class. A given Merchant object may or may not have a particular special quality or bundle of special qualities. For example, one Merchant object may have the Stockbroker quality, another Merchant may have the Financial Services and Stockbroker qualities, and another Merchant may have no special qualities at all. My initial thought was to create a HashMap and a Qualities class as follows: Map<Qualities, Boolean> merchantQualities = new HashMap<Qualities, Boolean>(); The only problem is, there are at least 50 possible special qualities for Merchants, such that it would be extremely tiresome to subclass all the qualities from the Quality class. Is there a better way of coding for these optional special qualities and representing them in the Merchants class than a HashMap and subclassing a Qualities class?

    Read the article

  • Wrong sessionID being used in callback, but only on one particular computer

    - by user210119
    I am writing a Python/Django web application that uses OAuth (for the TwitterAPI, not that it should matter). I am storing a session ID in my login function, and then after using OAuth to get the user's token, I try to retrieve the sessionID in my callback function. The callback function then always fails(throws an exception) because it can't find the OAuth token in the session. Through the debugger, I am able to determine that the session ID that the server is using is incorrect - it does not match the session ID that was stored in the login function. It's therefore unsurprising that the Oauth tokens were not there. The session that appears in the callback was the same one each time (until I tried deleting it - see "things I've tried below"), and it started out as an old session, with some data in it that is from a different django app running on the same server that I hadn't touched in a couple weeks. Here's the kicker: everything I described is an issue only on our production server, and only when connecting to it from my computer. Let me clarify: this only happens with my particular laptop. I can connect to the app just fine from someone else's computer. Other people cannot connect with their accounts on my computer. Furthmore, I can connect just fine to the app when it is running on my localhost using the built-in django webserver, just not to the production server. My setup: my server and local box are running= Django 1.2.0 and Python 2.6.5. My local box is running Snow Leopard and the Django webserver, the server is running Ubuntu, Apache2, and mod-wsgi. For sessions, I am using Django's default session backend (DB). Things I have tried, all to no avail: logging in with a different account, including new accounts that have never OAuthed to this app before Clearing cookies, using incognito mode, using a different web browser on my same computer. Each time, upon inspecting my cookies, the sessionID matched the sessionID in the login function and was different from the sessionID in the callback. deleting the session in the database that appears in the callback function, (the one that appeared to be old data). The callback function still fails, and the sessionID it appears to be using is now a new one using a different session backend (DB-cache, flat file, etc...) restarting the server, my computer, etc. My first question on StackOverflow, so bear with me if I didn't quite follow local conventions. I am just at a loss as to what to even look for - what are the things that could possibly be causing sessions to not work on my particular computer, and (so far!) only my particular computer?

    Read the article

  • Using a JMS Session from different threads

    - by Evan
    From the javadoc for Session it states: A Session object is a single-threaded context for producing and consuming messages. So I understand that you shouldn't use a Session object from two different threads at the same time. What I'm unclear on is if you could use the Session object (or children such as a Queue) from a different thread than the one it created. In the case I'm working on, I'm considering putting my Session objects into a pool of available sessions that any thread could borrow from, use, and return to the pool when it is finished with it. Is this kosher? (Using ActiveMQ BTW, if that impacts the answer at all.)

    Read the article

  • tomcat 6 - Cluster / BackupManager

    - by Kevin
    Hi, I have a question regarding Clustering (session replication/failover) in tomcat 6 using BackupManager. Reason I chose BackupManager, is because it replicates the session to only one other server. I am going to run through the example below to try and explain my question. I have 6 nodes setup in a tomcat 6 cluster with BackupManager. The front end is one Apache server using mod_jk with sticky session enabled Each node has 1 session each. node1 has a session from client1 node2 has a session from client2 .. .. Now lets say node1 goes down ; assuming node2 is the backup, node2 now has two sessions (for client2 and client1) The next time client1 makes a request, what exactly happens ? Does Apache "know" that node1 is down and does it send the request directly to node2 ? =OR= does it try each of the 6 instances and find out the hard way who the backup is ?

    Read the article

  • Django: accessing session variables from within a template?

    - by AP257
    Hi all If I set a session variable in Django, like: request.session["name"] = "name" Is there a way I can access it from within a template, or do I have to retrieve it from within a view, and then pass it to a template? Asking because I have around 10 little session variables that I'd like to access within a template, and passing all 10 from the view to the template could get a bit messy. (I have to use session variables because it's a HttpResponseRedirect, but storing the variables in a database is overkill for my purposes.) So - any way to grab session variables directly within a template?

    Read the article

  • Issue using Session in MVC Actions with [authorice]

    - by Pablo Gonzalez
    Hi all, first of all sorry for my poor English! When I use the [Authorice` attribute i can't get Session data that i stored before. For example: public ViewResult Index() { // do some stuffs Session["Test"] = "Hi stackoverflow!"; } And then i try to get it in another action, but with the [Authorize] attibute [Authorize] public ViewResult Test() { // do some stuffs if(Session["Test"] == null) { //do some stuffs } } Session["Test"] is always null, but if i remove the attribute it's work, may anyone help me?, thanks a lot!!! P.S: I instance Session["Test"] in Session_Start

    Read the article

  • Approach for authentication and storing user details.

    - by cappuccino
    Hey folks, I am using the Zend Framework but my question is broadly about sessions / databases / auth (PHP MySQL). Currently this is my approach to authentication: 1) User signs in, the details are checked in database. - Standard stuff really. 2) If the details are correct only the user's unique ID is stored in the session and a security token (user unique ID + IP + Browser info + salt). The session in written to the filesystem. I've been reading around and many are saying that storing stuff in sessions is not a good idea, and that you should really only write a unique ID which refers back to the user's details and a security token to prevent session hijacking. So this is the approach i've taken, i use to write the user's details in session, but i've moved that out. Wanted to know your opinions on this. I'm keeping sessions in the filesystem since i don't run on multiple servers, and since i'm only writting a tiny tiny bit of data to sessions, i thought that performance would be greater keeping sessions in the filesystem to reduce load on the database. Once the session is written on authentication, it really is only read-only from then on. 3) The rest of the user's details (like subscription details, permissions, account info etc) are cached in the filesystem (this can always be easily moved to memory if i wanted even more performance). So rather than keeping the user's details in session, the user's details are cached in the file system. I'm using Zend_Cache and the unique cache id is something like md5(/cache/auth/2892), the number is the unique id of the user. I guess the benefit of this method is that once the user is logged in, there is essentially not database queries being run to get the user's details. Just wonder if this approach is better than keeping the whole lot in session... 4) As the user moves throughout the site the only thing that is checked is the ID in the session and the security token. So, overall the first question is 1) is the filesystem more efficient than a database for this purpose 2) have i taken enough security precautions 3) is separating user detail's from the session into a cached file a pointless task? Thanks.

    Read the article

  • How to store local variables in jQuery click functions?

    - by Geuis
    I'm trying to figure out how to store external variable values in the functions created during jQuery's click() event. Here's a sample of the code I'm working with now. for(var i=0; i<3; i++){ $('#tmpid'+i).click(function(){ var gid = i; alert(gid); }); } <div id="tmpid0">1al</div> <div id="tmpid1">asd</div> <div id="tmpid2">qwe</div> So what's happening is that the events are attaching properly, but the value of 'gid' is always the last incremented value of 'i'. I'm not sure how to setup the private variable in this situation.

    Read the article

  • How do I create Variables in XSLT that are not document fragments?

    - by chiborg
    Consider the following XSLT template <xsl:template match="/"> <xsl:variable name="var1"> <elem>1</elem> <elem>2</elem> <elem>3</elem> </xsl:variable> <xsl:text>var1 has </xsl:text> <xsl:value-of select="count($var1)"/> <xsl:text>elements. </xsl:text> <xsl:variable name="var2" select="$var1/elem[. != '2']"/> <xsl:text>var2 has </xsl:text> <xsl:value-of select="count($var2)"/> <xsl:text>elements. </xsl:text> </xsl:template> The output of this template is var1 has 1 elements var2 has 2 elements The first line outputs 1 (and not, as I first expected 3) because var1 is a document fragment that contains the <elem> elements as childen. Now for my questions: How can I create a variable that does not contain a document fragment? I could do it like I did with var2, only leaving out the predicate. But maybe there is a way without using a second variable. Or, as an alternative: How can I preserve the document fragment in a variable while filtering out some elements?

    Read the article

  • Updating a session variable on a page that uses enablesessionstate=readonly attribute doesn't fail f

    - by chandmk
    Asp.Net allows you you set the session state to readonly at individual page level or in the web.config for all pages. But it doesn't prevent you from creating a brand new session variable on that page or modify an existing session variable. But when you try to use that session variable it is either not available or its value is not modified. Why wouldn't the asp.net framework throw a run time error, if not compile time error, when a write attempt is made to a session on the pages where that is not allowed?

    Read the article

  • Can I view a list of public variables of some Adobe Air app or web flash file from another app?

    - by Parris
    I was thinking about creating making AIM pluggin that checks pandora one (desktop) or pandora website periodically to see what is currently playing and update a user's status. I suppose the main question is there a clever way to access a "public" variable from some open Adobe Air process? I KNOW this sounds like some crazy security flaw, but it may also be a feature. I am pretty sure javascript can potentially handle it. Thanks!

    Read the article

  • Is it more efficient (Performance) to store the CFC in application variables OR instance the CFC on the page call?

    - by Mitchell Guimont
    Hello, I'm working on a ColdFusion dynamic website. For this website, there are a lot of CFCs and a lot of functions within each CFC. Would it be more efficient to store an instance of the CFC in an application variable, then to instance each CFC separately on each page load. For each page, at most 2 separate CFCs get called. I'm also interested in how performance will be effected when requests increase (Stress). Thanks!

    Read the article

  • How are a session identifiers generated?

    - by Asaf R
    Most web applications depend on some kind of session with the user (for instance, to retain login status). The session id is kept as a cookie in the user's browser and sent with every request. To make it hard to guess the next user's session these session-ids need to be sparse and somewhat random. The also have to be unique. The question is - how to efficiently generate session ids that are sparse and unique? This question has a good answer for unique random numbers, but it seems not scalable for a large range of numbers, simply because the array will end up taking a lot of memory.

    Read the article

  • How to find the right object in a Rails controller based on two variables?

    - by sscirrus
    Hi everyone, I have a three-table system: Companies, Customers, and Matches. The matches include, for example, private notes that each party makes about the other and some options they can set regarding the other. I have two sets of views centered around Companies and Customers for each party to look at the other and modify their notes and settings. # Customers Controller def show @customer = Customer.find(params[:customer]) @matchings = @candidate.matchings.find... @company = Company.find(params[:company]) end Obviously the @matchings is incomplete. Given that @matchings has fields customer_id and company_id, how do I find the right matching record? Thank you!

    Read the article

  • What are some ways to identify a logged in user on the web?

    - by farinspace
    Here is the scenario: There are 5 websites (different domain names) that need to share a session. I am using a bit of code on each site which returns a "blank.gif" image and at the same time sets the session (syncing it up to the current session). Each of the sites calls a session-img from each of the other sites. Also, all sites have access to the same database (where the session is stored). This works great on FF and Chrome, but not on IE (or Safari PC)... I need to come up with an alternative method to keep a session active? The app is a small custom CMS, so really only 2-3 people will be using it. I can probably identify user logins by IP and then continue to check for the IP accross all sites... Is there something more granular such as a computer uuid that i can check for?

    Read the article

  • Way around ASP.NET session being shared across multiple tab windows

    - by ace
    I'm storing some value in an asp.net session on the first page. On the next page, this session value is being read. However if multiple tabs are opened and there are multiple page 1-page 2 navigation going on, the value stored in session gets mixed up since the session is shared between the browser tabs. I'm wondering what are the options around this : Query String: Passing value between the pages using query string, I don't want to take this approach since there can be multiple anchor tags on page 1 linking to page 2 and I can not rewrite the URLs of each tag since they are dynamic. Cookies??? In-memory cookies are shared across browser tabs too, same as the session cookie, rite ? Any other option?

    Read the article

  • Why are my JavaScript variables not persisting across functions?

    - by Eric Belair
    I have the following JavaScript in my HTML page referencing an HTML form on the page: <script type="text/javascript"> <!-- var myForm = document.myForm; function validateForm() { if (myForm.myInput == "") alert("Please input some text."); return false; } myForm.submit(); } function showFormInput() { myForm.reset(); document.getElementById('myInput').style.display = 'inline'; } //--> </script> ... <form name="myForm" id="myForm" action="..." method="post"> <input id="myInput" name="myInput" type="text" value="" style="display:none;" /> </form> Both functions are throwing an exception when trying to access the variable myForm, saying that "myForm is null or not an object". Why is this occurring?

    Read the article

  • Ruby on Rails How do I access variables of a model inside itself like in this example?

    - by banditKing
    I have a Model like so: # == Schema Information # # Table name: s3_files # # id :integer not null, primary key # owner :string(255) # notes :text # created_at :datetime not null # updated_at :datetime not null # last_accessed_by_user :string(255) # last_accessed_time_stamp :datetime # upload_file_name :string(255) # upload_content_type :string(255) # upload_file_size :integer # upload_updated_at :datetime # class S3File < ActiveRecord::Base #PaperClip methods attr_accessible :upload attr_accessor :owner Paperclip.interpolates :prefix do |attachment, style| I WOULD LIKE TO ACCESS VARIABLE= owner HERE- HOW TO DO THAT? end has_attached_file( :upload, :path => ":prefix/:basename.:extension", :storage => :s3, :s3_credentials => {:access_key_id => "ZXXX", :secret_access_key => "XXX"}, :bucket => "XXX" ) #Used to connect to users through the join table has_many :user_resource_relationships has_many :users, :through => :user_resource_relationships end Im setting this variable in the controller like so: # POST /s3_files # POST /s3_files.json def create @s3_file = S3File.new(params[:s3_file]) @s3_file.owner = current_user.email respond_to do |format| if @s3_file.save format.html { redirect_to @s3_file, notice: 'S3 file was successfully created.' } format.json { render json: @s3_file, status: :created, location: @s3_file } else format.html { render action: "new" } format.json { render json: @s3_file.errors, status: :unprocessable_entity } end end end Thanks, any help would be appreciated.

    Read the article

  • JSP::Confused with the session objects

    - by Legend
    I just started exploring Java Servlets and JSP and am a little confused about the sessions object. Inside a servlet I have this: public class SampleServlet extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { HttpSession session = request.getSession(true); session.setAttribute("_session", "_value"); response.sendRedirect("page2.jsp"); } } Now, inside page2.jsp, there is a session object as well, but when I do this <% out.print(session.getAttribute("_session")) %> it gives me an error. Can someone tell me the right way of doing this? As to what I am trying to do, I want to share some session variables.

    Read the article

  • Initializing a value through a Session variable

    - by William Calleja
    I need to Initialize a value in a Javascript by using a c# literal that makes reference to a Session Variable. I am using the following code <script type="text/javascript" language="javascript" > var myIndex = <%= !((Session["myIndex"]).Equals(null)||(Session["myIndex"]).Equals("")) ? Session["backgroundIndex"] : "1" %>; However the code above is giving me a classic Object reference not set to an instance of an object. error. Why? Shouldn't (Session["myIndex"]).Equals(null) capture this particular error?

    Read the article

  • Is it good practice to export variables in Perl?

    - by gvkv
    I'm finding it very convenient to pass configuration and other data that is read or calculated once but then used many times throughout a program by using Perl's use mechanism. I'm doing this by exporting a hash into the caller's namespace. For example: package Myconfiguration; my %config; sub import { my $callpkg = caller(0); my $expsym = $_[1]; configure() unless %config; *{"$callpkg\::$expsym"} = \%config; } and then in other modules: use MyConfiguration (loc_config_sym); if ( $loc_config_sym{paramater} ) { # ... do stuff ... } However, I'm not sure about this as a best practice. Is it better to add a method that returns a hash ref with the data? Something else?

    Read the article

  • Declaration and initialization of local variables - what is most C++ like?

    - by tuergeist
    Hi, I did not find any suitable questions answered yet, so I'd like to know what is "better" C++ style in the mean of performance and/or memory. Both codes are inside a method. The question is: When to declare long prio? And what are the implications? Code 1 while (!myfile.eof()) { getline(myfile, line); long prio = strtol(line); // prio is declared here // put prio in map... // some other things } Code 2 long prio; // prio is declared here while (!myfile.eof()) { getline(myfile, line); prio = strtol(line); // put prio in map... // some other things }

    Read the article

< Previous Page | 49 50 51 52 53 54 55 56 57 58 59 60  | Next Page >