Search Results

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

Page 136/632 | < Previous Page | 132 133 134 135 136 137 138 139 140 141 142 143  | Next Page >

  • Homework - C# - Creating an object instance with a button click

    - by Erica
    I'm new to learning Windows Programming with C#. My current assignment is to create a very simple bank account program: The user enters the accountholder name, account number and beginning balance, then presses a "Continue" button to work with that account by making deposits and withdrawals. I wrote a separate "BankAccount" class with the required data members and methods. I've put the code for the creation of the BankAccount object in the Continue button click event BankAccount currentAccount = new BankAccount(acctName, acctNum, beginningBalance); But that seems to make it local to that method only, and currentAccount is not recognized when I'm programming the click event for the "Record Transactions" (deposits and withdrawals) button. How and where should the creation of the BankAccount object be coded in order for it to be created when the "Continue" button is clicked and also recognized in the "Record Transactions" button click event? Please let me know if any clarification is needed, or if you need to see part or all of my code.

    Read the article

  • Variable within variable possible?

    - by JM4
    I am trying to create a loop statement for some of my code and am wondering how I can put a variable within another variable. For example: <?php $j=1; while ($j <= 9): { $f$jfname = $_SESSION['F$jFirstName']; $f$jmi = $_SESSION['F$jMI']; $f$jlname = $_SESSION['F$jLastName']; } $j++; endwhile; ?> Where the goal is to have the j variable increase during the loop and change the values as: $f1fname $f2fname $f3fname and so on. Any ideas?

    Read the article

  • Cross domain secure cookie usage?

    - by asdasda
    I have a website that came with a SSL site for HTTPS but its on a different server. Example being my website: http://example.com my SSL site: http://myhostingcompany.com/~myuseraccount/ So I can do transactions over HTTPS and we have user accounts and everything but it is located on a different domain. The cookie domain is set for that one. Is there a way I can check on my actual site to see if a cookie is set for the other one? And possibly grab its data and auth a user? I think this violates a major principle of security and can't be done for good reasons, but am i wrong? is this possible?

    Read the article

  • 2 bucks for !! java basic question

    - by Max
    How can I get a specific value from an object? I'm trying to get a value of an instance for eg. ListOfPpl newListOfPpl = new ListOfPpl(id, name, age); Object item = newListOfPpl; How can I get a value of name from an Object item?? Even if it is easy or does not interest you can anyone help me?? Edited: I was trying to build a binary tree contains the node of ListOfPpl, and need to sort it in the lexicographic. Here's my code for insertion on the node. Any clue?? public void insert(Object item){ Node current = root; Node follow = null; if(!isEmpty()){ root = new Node(item, null, null); return; }boolean left = false, right = false; while(current != null){ follow = current; left = false; right = false; //I need to compare and sort it if(item.compareTo(current.getFighter()) < 0){ current = current.getLeft(); left = true; }else { current = current.getRight(); right = true; } }if(left) follow.setLeft(new Node(item, null, null)); else follow.setRight(new Node(item, null, null)); }

    Read the article

  • jQuery pass url variable into load function

    - by Adi
    Hi, I'm trying to use load to reload a portion of the current page (long story why) but am having an issue with the variable syntax. Here is the snippet of code: var pathname = window.location.pathname; $('#menu').load("/cms.php #menu"); I woudl like to replace /cms.php with the variable, but am having issues with the corrent syntax. Any help/advice would be much appricated. A.

    Read the article

  • Global State and Singletons Dependency injection

    - by Manu
    this is a problem i face lot of times when i am designing a new app i'll use a sample problem to explain this think i am writing simple game.so i want to hold a list of players. i have few options.. 1.use a static field in some class private static ArrayList<Player> players = new ArrayList<Integer>(); public Player getPlayer(int i){ return players.get(i); } but this a global state 2.or i can use a singleton class PlayerList{ private PlayerList instance; private PlayerList(){...} public PlayerList getInstance() { if(instance==null){ ... } return instance; } } but this is bad because it's a singleton 3.Dependency injection class Game { private PlayerList playerList; public Game(PlayerList list) { this.list = list; } public PlayerList getPlayerList() { return playerList; } } this seems good but it's not, if any object outside Game need to look at PlayerList (which is the usual case) i have to use one of the above methods to make the Game class available globally. so I just add another layer to the problem. didn't actually solve anything. what is the optimum solution ? (currently i use Singleton approach)

    Read the article

  • python objects confusion

    - by james
    wow i thought i knew python untill tonight.. what is the correct way to do something like this.. heres my code a = ["one", "two", "three"] b = a #here i want a complete copy that when b is changed, has absolutely no effect on a b.append["four"] print a #a now has "four" in it.. so basically i want to know, instead of the b = a step, how would i correctly make a copy of a list or dictionary so that when b is changed a does not change along with it.. thanks guys

    Read the article

  • Ant loadfile override property

    - by lucks
    Hi, I'm trying to use the Ant task <loadfile> in a loop to parse the contents of a file. I have something like <loadfile srcFile="@{some.input}" property="my.property"> Since Ant properties are immutable, this doesn't work for me. I need 'my.property' to update on every iteration. Is there a way to achieve this? I know Ant-contrib has a <var> task but I'm not sure how to use <loadfile> with it. Any recommendations? Thanks.

    Read the article

  • C# - Must declare the scalar variable "@ms_id" - Error

    - by user1075106
    I'm writing an web-app that keeps track of deadlines. With this app you have to be able to update records that are being saved in an SQL DB. However I'm having some problem with my update in my aspx-file. <asp:GridView ID="gv_editMilestones" runat="server" DataSourceID="sql_ds_milestones" CellPadding="4" ForeColor="#333333" GridLines="None" Font-Size="Small" AutoGenerateColumns="False" DataKeyNames="id" Visible="false" onrowupdated="gv_editMilestones_RowUpdated" onrowupdating="gv_editMilestones_RowUpdating" onrowediting="gv_editMilestones_RowEditing"> <RowStyle BackColor="#F7F6F3" ForeColor="#333333" /> <Columns> <asp:CommandField ShowEditButton="True" /> <asp:BoundField DataField="id" HeaderText="id" SortExpression="id" ReadOnly="True" Visible="false"/> <asp:BoundField DataField="ms_id" HeaderText="ms_id" SortExpression="ms_id" ReadOnly="True"/> <asp:BoundField DataField="ms_description" HeaderText="ms_description" SortExpression="ms_description"/> <%-- <asp:BoundField DataField="ms_resp_team" HeaderText="ms_resp_team" SortExpression="ms_resp_team"/>--%> <asp:TemplateField HeaderText="ms_resp_team" SortExpression="ms_resp_team"> <ItemTemplate> <%# Eval("ms_resp_team") %> </ItemTemplate> <EditItemTemplate> <asp:DropDownList ID="DDL_ms_resp_team" runat="server" DataSourceID="sql_ds_ms_resp_team" DataTextField="team_name" DataValueField="id"> <%--SelectedValue='<%# Bind("ms_resp_team") %>'--%> </asp:DropDownList> </EditItemTemplate> </asp:TemplateField> <asp:BoundField DataField="ms_focal_point" HeaderText="ms_focal_point" SortExpression="ms_focal_point" /> <asp:BoundField DataField="ms_exp_date" HeaderText="ms_exp_date" SortExpression="ms_exp_date" DataFormatString="{0:d}"/> <asp:BoundField DataField="ms_deal" HeaderText="ms_deal" SortExpression="ms_deal" ReadOnly="True"/> <asp:CheckBoxField DataField="ms_active" HeaderText="ms_active" SortExpression="ms_active"/> </Columns> <FooterStyle BackColor="#CCCC99" /> <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" /> <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /> <AlternatingRowStyle BackColor="White" /> <EditRowStyle BackColor="#999999" /> </asp:GridView> <asp:SqlDataSource ID="sql_ds_milestones" runat="server" ConnectionString="<%$ ConnectionStrings:testServer %>" SelectCommand="SELECT [id] ,[ms_id] ,[ms_description] ,(SELECT [team_name] FROM [NSBP].[dbo].[tbl_teams] as teams WHERE milestones.[ms_resp_team] = teams.[id]) as 'ms_resp_team' ,[ms_focal_point] ,[ms_exp_date] ,(SELECT [deal] FROM [NSBP].[dbo].[tbl_deals] as deals WHERE milestones.[ms_deal] = deals.[id]) as 'ms_deal' ,[ms_active] FROM [NSBP].[dbo].[tbl_milestones] as milestones" UpdateCommand="UPDATE [NSBP].[dbo].[tbl_milestones] SET [ms_description] = @ms_description ,[ms_focal_point] = @ms_focal_point ,[ms_active] = @ms_active WHERE [ms_id] = @ms_id"> <UpdateParameters> <asp:Parameter Name="ms_description" Type="String" /> <%-- <asp:Parameter Name="ms_resp_team" Type="String" />--%> <asp:Parameter Name="ms_focal_point" Type="String" /> <asp:Parameter Name="ms_exp_date" Type="DateTime" /> <asp:Parameter Name="ms_active" Type="Boolean" /> <%-- <asp:Parameter Name="ms_id" Type="String" />--%> </UpdateParameters> </asp:SqlDataSource> You can see my complete GridView-structure + my datasource bound to this GridView. There is nothing written in my onrowupdating-function in my code-behind file. Thx in advance

    Read the article

  • Does the for foreach construct in java create a hard or soft copy?

    - by Doug
    Say I have the following piece of java code ArrayList<Double> myList = new Double[100]; for (Double x : myList) x = randomDouble(); Does this actually modify myList or just the dummy variable? I realize I should just try this code segment out, but I think this is the sort of thing I should be able to google or search for on this site, and several queries so far have turned up nothing useful.

    Read the article

  • Objective-C: Cannot Change Value of Instance Variable Inside a Function

    - by user262325
    Hello everyone, I cannot change the value of an instance variable inside a function. I have defined a class: // info.h #import <Foundation/Foundation.h> @interface NSMyObject : NSObject { NSInteger i; } -(void) setI:(NSInteger)v; @end #import "info.h" @implementation NSMyObject -(void) setI:(NSInteger)v ; { i=v; } - (void)dealloc { [super dealloc]; } @end I call a function 'myFunction' with parameter temObj which is a NSMyObject instance. myFunction(temObj);//temObj is NSMyObject In the function, I can change the value of the instance variable of parameter obj. -(void)myFunction:(NSMyObject*) obj; { [obj setI:0]; } ... expecting this to change the content of temObj. But when I check the results of operation on obj in function myFunction the value of temObj.i has not changed. Welcome any comment Thanks

    Read the article

  • maintain user login status in express.js

    - by chenliang
    when user login the app the username will be display in the header, this is my header.jade div#header_content input(type='text',name='search',id='globle_search') span#user_status if(req.isAuthenticated()) a(class='user_menu_btn',href='home', target='_blank' ) req.user.username a(class='user_menu_btn',href='logout') Logout else a(id='login_btn',href='login',class='user_status_btn') login run the app i get the error says ReferenceError: F:\shopping\views\includes\header.jade:4 req is not defined this is my index route: app.get('/',index.index); exports.index = function(req, res){ res.render('index', { title: 'Express' }); }; how to maintain login ststus in the heaedr? by the way am using passport to login user

    Read the article

  • In Ruby, how to write a method to display any object's instance variable names and its values

    - by Jian Lin
    Given any object in Ruby (on Rails), how can I write a method so that it will display that object's instance variable names and its values, like this: @x: 1 @y: 2 @link_to_point: #<Point:0x10031b298 @y=20, @x=38> I also want to be able to print <br> to the end of each instance variable's value so as to print them out nicely on a webpage. the difficulty now seems to be that not every instance variable has an accessor, so it can't be called with obj.send(var_name) (the var_name has the "@" removed, so "@x" becomes "x")

    Read the article

  • got undefined variable in php code

    - by Newbie New
    I got a error message when I run my php however the result is come out this is my code function cart() { foreach($_SESSION as $name => $value) { if ($value>0) { if (substr($name, 0, 5) == 'cart_'){ $id = substr($name, 5, (strlen($name)-5)); $get = mysql_query('SELECT id, name, price FROM products WHERE id=' .mysql_real_escape_string((int)$id)); while ($get_row = mysql_fetch_assoc($get)){ $sub = $get_row['price'] * $value; echo $get_row['name'].' x '.$value.' @ &pound'.number_format($get_row['price'], 2).' = &pound'.number_format($sub, 2).' <a href="cart.php?remove='.$id.'">[-]</a> <a href="cart.php?add='.$id.'">[+]</a> <a href="cart.php?delete='.$id.'">[Delete]</a><br />' ; } } $total += $sub; } } echo $total; } ?> I got a error message Notice: Undefined variable: total in C:\xampp\htdocs\shoppingcart\cart.php on line 54 which line 54 is echo $total; what's wrong with my code?? I think I have defined the code in $total += $sub; thanks for helping me :)

    Read the article

  • Alternative to singleton for unique resources

    - by user1320881
    I keep reading over and over again that one should avoid using singletons for various reasons. I'm wondering how to correctly handle a situation where a class represents a unique system resource. For example, a AudioOutput class using SDL. Since SDL_OpenAudio can only be open once at a time it makes no sense having more then one object of this type and it seems to me preventing accidentally making more then one object would actually be good. Just wondering what experienced programmers think about this, am i missing another option ?

    Read the article

  • Control user actions with jQuery

    - by SonOfOmer
    Hi everyone, I want to write javascript that will kill sestion on the web page if user did not make any action for some time taken from configuration. How can I know that user did not make any actions by using jQuery. Thanks a lot.

    Read the article

  • Java environmental variable woes, maven also

    - by Blankman
    So I re-installed java in a directory that doesn't have any spaces in it, as I was having issues with it before. Java JDK is installed in: E:\downloads\java\jdk I created a User variable: JAVA_HOME E:\downloads\java\jdk And my Path looks like: %JAVA_HOME%\bin;%M2%; Now opening a NEW cmd prompt: c:\java 'java' is not recognized... but echoing works: c:\echo %JAVA_HOME% E:\downloads\java\jdk and so does this: c:\%JAVA_HOME%\bin\java -version java version "1.6.0_17" I am trying to get this to work, so I can then get maven to work as maven is having the same type of issues (I created M2_HOME and M2 and none work). What exactly am I doing wrong? I am having the exact same issue on my laptop also, both are running windows 7. I must be missing something!

    Read the article

  • How can I draw a line with a variable of width?

    - by user1729944
    #include <iostream> #include <cmath> #include "graph1.h" using namespace std; int main() { int diameter = 0; int height = 0; double rate = 0; char repeat = 'y'; int obj_num = 0; displayGraphics(); obj_num = drawRect(0,0,50,400); setColor(obj_num,200,200,200); obj_num = drawRect(0,400,640,79); setColor(obj_num,71,35,35); obj_num = drawLine(50,50,150,50,5); setColor(obj_num,80,80,80); displayBMP("faucet.bmp",150,12); do { do { cout << "Enter the diamater of the cylinder <in inches > 0 but <= 300: "; cin >> diameter; if((diameter<0) || (diameter>300)) { cout << "Incorrect diamater entered; value must be between 1 and 300" << endl; } }while((diameter<0) || (diameter>300)); do { cout << "Enter the height of the cylinder <in inches > 0 but <= 325: "; cin >> height; if((height<0) || (height>325)) { cout << "Incorrect height entered; value must be between 1 and 325" << endl; } }while((height<0) || (height>325)); do { cout << "Enter the facet water's rate: <gallons/minute> "; cin >> rate; if((rate<0) || (rate>100)) { cout << "Incorrect rate entered; value must be between 1 and 100" << endl; } }while((rate<0) || (rate>100)); //I need to draw the lines here. The graphics window has a faucet that is supposed to fill //up a cylinder made out of 3 lines. I don't know how to make the lines vary from the users //input since lines are hard coded with points and all i am receiving is the width for the //bottom line and the height for the left and right lines. cout << "Repeat program? (y/n): "; cin >> repeat; clearGraphics(); }while ( (repeat == 'y') || (repeat == 'Y') ); return 0; } Here is a screenshot for reference:

    Read the article

  • Dynamic-linked DLL needs to share a global variable with its caller.

    - by Fabian Wickborn
    I have a static library libStatic that defines a global variable like this Header file libStatic/globals.h: extern int globvar; Code file libStatic/globals.cpp: int globvar = 42; The DLL libDynamic and the executable runner are using this global variable. Furtheron, libDynamic is linked at run-time into runner (via LoadLibrary(), GetProcAddress(), and the works...) I understand this will lead to globvar being created twice, once in the heap of runner and once in the heap of libDynamic, which is of course very undesirable. Is there a good away around this? How can I ensure that libDynamic and runner are using the same globvar?

    Read the article

  • Reason for unintuitive UnboundLocalError behaviour 2

    - by Jonathan
    Following up on Reason for unintuitive UnboundLocalError behaviour (I will assume you've read it). Consider the following Python script: def f(): # a+=1 # 1 aa=a aa+=1 # b+='b' # 2 bb=b bb+='b' c[0]+='c' # 3 c.append('c') cc=c cc.append('c') # 4 a=1 b='b' c=['c'] f() print a print b print c The result of the script is: 1 b ['cc', 'c', 'c'] The commented out lines (marked 1,2) are lines that would through an UnboundLocalError and the SO question I referenced explains why. However, the line marked 3 works! By default, lists are copied by reference in Python, therefore it's understandable that c changes when cc changes. But why should Python allow c to change in the first place, if it didn't allow changes to a and b directly from the method's scope? I don't see how the fact that by default lists are copied by reference in Python should make this design decision inconsistent. What am I missing folks?

    Read the article

  • User Inactivity Logout PHP

    - by user342391
    I want my users to be logged out automatically after X minutes of inactivity. I also want to have all sessions destroyed. How can this be done? How can I check for inactivity then perform a function to log them out???

    Read the article

< Previous Page | 132 133 134 135 136 137 138 139 140 141 142 143  | Next Page >