Working out the total memory consumed by a process

Hi,
I am writing a general snapshot utility that provides session statistics. The code is as follows:
set pagesize 9999
set linesize 140
set heading off
select SUBSTR(name,1,8) || ' sessions as on '||TO_CHAR(CURRENT_DATE, 'MON DD YYYY HH:MI AM') from v$database;
set heading on
column spid heading "OS PID" format a6
column process format a13 heading "Client ProcID"
column username  format a10
column sid       format 999
column serial#   format 99999
column STATUS    format a3 HEADING 'ACT'
column last      format 9,999.99
column TotGets   format 999,999,999,999 HEADING 'Logical I/O'
column phyRds    format 999,999 HEADING 'Physical I/O'
column total_memory format 999,999 HEADING 'MEM/KB'
SELECT
          substr(a.username,1,8) "lOGIN"
        , substr(a.sid,1,5) || '/'||substr(a.serial#,1,5) AS "SID/serial#"
        , TO_CHAR(a.logon_time, 'DD/MM HH:MI') "LOGGED IN SINCE"
        , substr(a.machine,1,10) HOST
        , substr(p.username,1,8)||'/'||substr(p.spid,1,5) "OS PID"
        , substr(a.osuser,1,8)||'/'||substr(a.process,1,5) "Client PID"
        , substr(a.program,1,15) PROGRAM
        --,ROUND((CURRENT_DATE-a.logon_time)*24) AS "Logged/Hours"
                select round(sum(ss.value)/1024) from v$sesstat ss, v$statname sn
                where ss.sid = a.sid and
                        sn.statistic# = ss.statistic# and
                        sn.name in ('session pga memory','session uga memory')
          ) AS total_memory
        , (b.block_gets + b.consistent_gets) TotGets
        , b.physical_reads phyRds
        , decode(a.status, 'ACTIVE', 'Y','INACTIVE', 'N') STATUS
        , CASE WHEN a.sid in (select sid from v$mystat where rownum = 1) THEN '<-- YOU' ELSE ' ' END "INFO"
FROM
         v$process p
        ,v$session a
        ,v$sess_io b
WHERE
a.paddr = p.addr
AND p.background IS NULL
--AND  a.sid NOT IN (select sid from v$mystat where rownum = 1)
AND a.sid = b.sid
AND a.username is not null
--AND (a.last_call_et < 3600 or a.status = 'ACTIVE')
--AND CURRENT_DATE - logon_time > 0
--AND a.sid NOT IN ( select sid from v$mystat where rownum=1)  -- exclude me
--AND (b.block_gets + b.consistent_gets) > 0
ORDER BY a.username;
exitIn above I am trying to display a row per process so I have to cut the width of the columns. However, for the total memory consumed I assumed that it is the sum of values from v$sessstat as follows:
                select round(sum(ss.value)/1024) from v$sesstat ss, v$statname sn
                where ss.sid = a.sid and
                        sn.statistic# = ss.statistic# and
                        sn.name in ('session pga memory','session uga memory')
          ) AS total_memoryI have looked around and I think many refer to the sum of 'session pga memory' + ''session uga memory' as something workable.
I therefore appreciate any comments on that and also anything that I can improve in this piece of code.
Regards,
Mich

I don't know why this thread appears with the Aug 19 2001. This issue was posted Sept 9 2004.

Similar Messages

  • How can I work out the Total Uptime between two points?

    I need to find the TOTAL uptime between a certain date and now (need to separate for an electricity bill). Can someone help me with a script or something?
    Thanks

    I'm confused as to what you are looking for if uptime is not it. 
    I need to find out how long it has been powered on from the 6th August 2014 to now. Any ideas?
    If the system has been rebooted in that time then you might be able to go back into the log files and as Mark Jalbert wrote look for the times the system was shutdown and then booted and get a rough figure that way. But of course this requires that the log files since August are still available.
    Of course what the system was booted there is no guarantee all external peripherals were also on and when the system was shutdown there is no guarantee that all the peripherals were turned off so at best you are getting a rough estimate.

  • When playing games on facebook, I often get the message "virtual memory too low, is being increased" Is there something I can do to clean out the "virtual memory" to avoid this?

    As mentioned in my question above, it happens usually during playing games. I wondered if there were someway to clean out the virtual memory, as opposed to it "increasing" continually and overloading my memory in general. You are speaking with a computer novice for the most part, so I am unfamiliar with a lot. I do do updates and general maintenance on the computer, but is that enough for this issue?

    Your plugins list shows outdated plugin(s) with known security and stability risks.
    * Shockwave Flash 10.0 r45
    Update the [[Flash]] plugin to the latest version.
    *http://www.adobe.com/software/flash/about/
    Physical memory is the memory that is installed on your computer as real memory. To be able to run programs that require more memory and more programs at the same time (via time sharing and task switching) it is also possible to move (swap) currently not needed code and data to disk to make room for other programs and data. The total memory available for programs is the Virtual Memory.
    You can check the Virtual Memory settings here: Control Panel > System > Advanced > Performance > Settings (Advanced tab)<br />
    Windows can manage more memory then is physical available and that memory is stored in a page file on your hard drive.
    If the size of that file is not large enough and all available memory is in use then you get the Virtual Memory is low warning.
    Make sure that you have at least 1 GB or the recommended setting for the Virtual Memory.
    If you have less than 1 GB physical memory installed on your computer then if possible add more memory.
    http://support.microsoft.com/kb/555223 - RAM, Virtual Memory, Pagefile and all that stuff

  • How to find out the total cost of a specific VM

    I've downloaded the usage statistics file from billing section and I could see the data categorized by different type of resources consumed by a virtual machine. Eg.
    Name ResourceGuid
    Unit Consumed
    "Virtual Machines" "1b4d8861-8cbc-40c8-88f9-e1b78509c3be"
    "GB" 0.000158
    "Networking" "9995d93a-7d35-4d3f-9c69-7a7fea447ef4"
    "Hours" 11.100002
    "Data Management" "964c283a-83a3-4dd4-8baf-59511998fe8b"
    "10,000s" 6.8899
    "Storage" "0e9d0c9b-ab6d-4312-9c7e-3794e22af9c4"
    "GB" 0.436496
    I'm looking for a way to retrieve the ResourceGuid of all the resources linked to a particular VM, to find out the total cost of it (VM + Networking + Data Management + Storage)
    Is it possible through Service Management API? Or any other means?

    Hi,
    This issue is related with billing, I would suggest you contact with azure support:
    http://www.windowsazure.com/en-us/support/contact/, it is the best choice for you. I find a releated voice, it discusses to display the total fee before created service, here is the link: http://feedback.azure.com/forums/170030-billing/suggestions/6478992-display-total-fee,
    please vote it.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to find out the total, subtotal in alv report

    hi dears,
    how to find out the total, subtotal in alv report?
    pls tell me logic ,
    i will be waiting for eply
    regards
    eswar

    Hi,
    <b>ALV Grid List with sub-totals</b>
    REPORT z_demo_alv_sort.
    * This program lists orders (VBAK) with sort and sub-total for        *
    * 'sold-to-party' (KUNNR) and 'Sales organization' (VKORG)            *
    TABLES : vbak.
    TYPE-POOLS: slis.                      " ALV Global types
    SELECT-OPTIONS :
      s_vkorg FOR vbak-vkorg,              " Sales organization
      s_kunnr FOR vbak-kunnr,              " Sold-to party
      s_vbeln FOR vbak-vbeln.              " Sales document
    SELECTION-SCREEN :
      SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.
    PARAMETERS p_max(2) TYPE n DEFAULT '20' OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    DATA:
      BEGIN OF gt_vbak OCCURS 0,
        vkorg LIKE vbak-vkorg,             " Sales organization
        kunnr LIKE vbak-kunnr,             " Sold-to party
        vbeln LIKE vbak-vbeln,             " Sales document
        netwr LIKE vbak-netwr,             " Net Value of the Sales Order
        waerk LIKE vbak-waerk,             " Document currency
      END OF gt_vbak.
    INITIALIZATION.
      v_1 = 'Maximum of records to read'.
    START-OF-SELECTION.
      PERFORM f_read_data.
      PERFORM f_display_data.
    *      Form  f_read_data
    FORM f_read_data.
      SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_vbak
               FROM vbak
                 UP TO p_max ROWS
              WHERE kunnr IN s_kunnr
                AND vbeln IN s_vbeln
                AND vkorg IN s_vkorg.
    ENDFORM.                               " F_READ_DATA
    *      Form  f_display_data
    FORM f_display_data.
      DEFINE m_fieldcat.
        add 1 to ls_fieldcat-col_pos.
        ls_fieldcat-fieldname   = &1.
        ls_fieldcat-ref_tabname = 'VBAK'.
        ls_fieldcat-do_sum      = &2.
        ls_fieldcat-cfieldname  = &3.
        append ls_fieldcat to lt_fieldcat.
      END-OF-DEFINITION.
      DEFINE m_sort.
        add 1 to ls_sort-spos.
        ls_sort-fieldname = &1.
        ls_sort-up        = 'X'.
        ls_sort-subtot    = &2.
        append ls_sort to lt_sort.
      END-OF-DEFINITION.
      DATA:
        ls_fieldcat TYPE slis_fieldcat_alv,
        lt_fieldcat TYPE slis_t_fieldcat_alv,
        lt_sort     TYPE slis_t_sortinfo_alv,
        ls_sort     TYPE slis_sortinfo_alv,
        ls_layout   TYPE slis_layout_alv.
      m_fieldcat 'VKORG' ''  ''.
      m_fieldcat 'KUNNR' ''  ''.
      m_fieldcat 'VBELN' ''  ''.
      m_fieldcat 'NETWR' 'X' 'WAERK'.
      m_fieldcat 'WAERK' ''  ''.
      m_sort 'VKORG' 'X'.                  " Sort by vkorg and subtotal
      m_sort 'KUNNR' 'X'.                  " Sort by kunnr and subtotal
      m_sort 'VBELN' ''.                   " Sort by vbeln
      ls_layout-cell_merge = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                is_layout   = ls_layout
                it_fieldcat = lt_fieldcat
                it_sort     = lt_sort
           TABLES
                t_outtab    = gt_vbak.
    ENDFORM.                               " F_DISPLAY_DATA
    ***************** END OF PROGRAM Z_DEMO_ALV_SORT **********************
    Regards
    Sudheer

  • How do you work out the number of days difference between two dates?

    I'm running Crystal v12.
    We use a date field in our SQL database that we use to store the client's year end date.
    As the year end date (date and month) doesn't change for a client, the year end date field in all of our reports is set to just show the DD/MM part. Over the years as new clients are set up we just enter the date and month - the year part is irrelevant although as in all date fields the year is automatically entered.
    Doing it this way means that we don't have to adjust the year end year part each year. We just use the DD/MM part.
    I need to create a formula that works out the number of days there have been (i.e. the difference) from the current date to the year end date. It MUST EXCLUDE the year however.
    For example:
    Year End Date = 30/04/03
    Current Date = 25/05/10
    Days Difference (EXCLUDING year) = 25
    Days Difference (including year) = 2582
    Year End Date = 31/03/09
    Current Date = 25/05/09
    Days Difference (EXCLUDING year) = 55
    Days Difference (including year) = 420
    If you include the year part then working out day difference is simply a case of creating a formula that subtracts the year end date from the current date (CurrentDate - {tblClient.YearEnd}.
    HOWEVER I need to exclude the year part.
    Can anyone tell me the formula or best way to do this?
    Thanks in advance.
    Edited by: BadBoy House on May 25, 2010 3:15 PM
    Edited by: BadBoy House on May 25, 2010 3:15 PM

    Hi
    You can try this
    datevar e := date(year(currentdate),month({tblClient.YearEnd}),day({tblClient.YearEnd}));
    numbervar num_days := datediff("d",currentdate,e)
    Create a datevar called e that uses the original month and day numbers for {tblClient.YearEnd} but uses the year of the current date
    Then just datediff on e to get the number of days between the two dates
    I hope i understand your problem and that this helps
    Best regards
    Patrick

  • How can I find out the total number of gigabytes of all my photos in Iphoto?

    How can I find out the total number of gigabytes of all my photos in Iphoto?

    In the Event mode open the Info window at the bottom left  (Command+i or click on the blue i button).  Then select all of the Events.  The number of photos and size will be shown in the Info window at the right.
    OT

  • Automatically working out the domain for a cookie

    Hi all
              We have a couple of web sites that we want to share cookies between
              we have one site www.mysite.com and another, registration.mysite.com
              If, when I add a cookie and hardcode the domain to '.mysite.com' everything
              works fine. However I would like to dynamically work out the domain because
              we deploy our sites within a number of countries and i dont want to hardcode
              the domain name (eg uk would be www.mysite.co.uk, so the domain would be
              .mysite.co.uk )
              If someone enters www.mysite.com/request.jsp i want to be able to extract
              .mysite.com out of the url and specify it as the domain when adding cookies.
              Does anyone know of any servlet related methods that can get the url that
              was requested - including the server name?
              request.getServerName() wont work because it returns the machine name (ie
              the name of your machine within a network). request.getRequestUrl() also
              wont work for the same reason.
              If anyone knows how i would extract the url the user typed in then that
              would be great
              Thanks
              matt
              

    Hi
    After Some googling I could find out this for you. I think it is a bug with IE.
    http://www.webmasterworld.com/forum21/11530.htm
    The idea is to use a virutal host.
    HTH
    VJ

  • [svn:bz-trunk] 20680: Tomcat 7 Login Module work, due to the Tomcat 7 Security framework change we need to work out the security integration piece for tomcat 7 .

    Revision: 20680
    Revision: 20680
    Author:   [email protected]
    Date:     2011-03-08 08:23:30 -0800 (Tue, 08 Mar 2011)
    Log Message:
    Tomcat 7 Login Module work, due to the Tomcat 7 Security framework change we need to work out the security integration piece for tomcat 7. So far the ValveBase and tomcat Realm had API changes which will impact on the Login integration with Tomcat 7
    Modified Paths:
        blazeds/trunk/modules/opt/build.xml
    Added Paths:
        blazeds/trunk/modules/opt/lib/catalina-708.jar
        blazeds/trunk/modules/opt/src/tomcat/flex/messaging/security/TomcatValve708.java

    Revision: 20680
    Revision: 20680
    Author:   [email protected]
    Date:     2011-03-08 08:23:30 -0800 (Tue, 08 Mar 2011)
    Log Message:
    Tomcat 7 Login Module work, due to the Tomcat 7 Security framework change we need to work out the security integration piece for tomcat 7. So far the ValveBase and tomcat Realm had API changes which will impact on the Login integration with Tomcat 7
    Modified Paths:
        blazeds/trunk/modules/opt/build.xml
    Added Paths:
        blazeds/trunk/modules/opt/lib/catalina-708.jar
        blazeds/trunk/modules/opt/src/tomcat/flex/messaging/security/TomcatValve708.java

  • Designing a banner stand: Is there a easy way to work out the recommend margins / bleed?

    So its my first time creating a banner stand and something of larger scale. I was wondering if there is a certain way to work out the recommended margins for the size of the document? Or should i simply do it by eye. The banner dimensions our 800m x 1200mm.
    Also any other tips for creating larger document would be appreciated.

    It sounds like the same product that we do a lot of here. There's no technical reasons for a particular margin, as they can be full bleed (print right to the edge), so it's a subjective design decision.Take into consideration the content and the context. It could be a something with little content, intended to draw people from a distance (larger margins), or it could be something with a lot of content that will be read from a short distance (smaller margins).
    I tend to do these as 1:1 scale, but bear in mind that InDesign's Optical Kerning will be too tight when you do this.

  • Java Time Work out the difference

    Hello. This is my first forum here. I am having difficulties in solving this code below:-
    If one data has a time of "14:00" - If this data went over the today's time so we would say it is too late. If this data is started before the today's time. It is done.
    Calendar TodayDate = Calendar.getInstance();
              SimpleDateFormat formatTime = new SimpleDateFormat("HH:mm");
              String timeNow = formatTime.format(TodayDate.getTime());
    System.out.print("Time Now is " +timeNow);
    String dataTime = "13:45";
    System.out.print("\nData Time is " +dataTime);
    if (dataTime > timeNow) {
    System.out.print("Too Late");
    if (dataTime < timeNow) {
    System.out.print("It is done");
    }Basically - the IF statement is wrong as it is String. Need help on how to change the String to Integer or Long (work out the milliseconds) Help would be appreciated

    why don't you use this ...
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Date.html#after(java.util.Date)
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/Date.html#before(java.util.Date)
    to convert you String '13:45' in millisecond, you should create a date so...

  • How can i work out the GMT time wherever i am ?

    Hi, i'm going crazy with the date/time classes, just can't seem to work it out.
    I need to know the current time as a GMT time.
    I need to know wherever the program is running, i myself am in Amsterdam GMT+02:00 , my server is located in Canada GMT-04:00 (?)
    I parse dates from websites all over the world so i get times in the form of strings of which i know the timezone. I need to store everything in a mysql database and i want the database to contain GMT times only.
    I've worked out how to get a string from its timezone into GMT but,
    how can i get the current time as GMT ?
    somehow i keep getting timeshifts i cannot explain.
    this is where i got to:
    TimeZone tz_gmt;
    tz_gmt = TimeZone.getTimeZone("GMT");
    SimpleDateFormat sdformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    sdformat.setTimeZone(tz_gmt);
    Timestamp tsGmtnow;
    tsGmtnow = Timestamp.valueOf(sdformat.format(new Date()));
    Which is fine if i run it in Amsterdam, it gives me the current date/time in GMT, but on the server in Canada it gives me GMT+4 hours. What am i missing ?

    found a workaround,
         TimeZone tz_gmt;
         tz_gmt = TimeZone.getTimeZone("GMT");
         TimeZone tz_can;
         tz_can = TimeZone.getTimeZone("GMT-04:00");
         TimeZone tz = TimeZone.getDefault();
         String Stz = tz.getID();
         SimpleDateFormat sdformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         Timestamp tsGmtnow;
    if ( "Europe/Berlin".compareTo(Stz) == 0) {
         // i'm in Europe, go from local time to GMT
         sdformat.setTimeZone(tz_gmt);
         tsGmtnow = Timestamp.valueOf(sdformat.format(new Date()));
    } else {
         // i'm in Canada, local time IS gmt
         sdformat.setTimeZone(tz_can);
         tsGmtnow = Timestamp.valueOf(sdformat.format(new Date()));
    out.println(tsGmtnow.toString());
    the default timezone returns either:
    Europe/Canada
    GMT-04:00
    somehow the GMT-04:00 get ignored by the formatter

  • Need a little help with a Jbutton not working out the way I planned

    The following code is to fulfill an assignment I am working on. The problem I am having is with the btnCalc. For some reason when the button is used, the results I get is from another button. I think the variables are set right for the program to function properly but I am really hung up on this. Do anyone have any suggestions?
    import java.awt.*;                     //Contains classes for creating GUI
    import java.awt.event.*;                //For listener events
    import javax.swing.*;                     // Imports the Main Swing Package
    import javax.swing.event.*;
    import javax.swing.text.*;           // Positions text box
    import java.text.NumberFormat;          // For number format such as currency
    import java.text.*;                     // Imports the Main Text Package
    import java.util.*;                     // Utility Package
    public class MPC extends JFrame implements ActionListener           //Creates Class for MPC
    //double dblLoanAmount, dblInterestRate, dblMonthlyPayment;
    TextField txtTotalMort;
         //JButton fixRates = new JButton("Choose Fixed Rates");
         JLabel lblTotalMort = new JLabel("How much is the loan?"); // Label for dblLoanAmount amount
         JTextField txtYears = new JTextField(10);
         JLabel lblPayment = new JLabel("Your monthly payment is "); // Label for Payment
         JTextField txtPayment = new JTextField(10);
         JLabel lblYears = new JLabel("How many years?");
                             // add(lblYears);
                   JTextField txtYearsInput = new JTextField(10);
                             //a dd(txtYears);
         JLabel lblInterestRate = new JLabel("What is the interest rate?");
                             //add(lblInterestRate);
                   JTextField txtInterestRate = new JTextField(10);
                             //add(txtInterestRate);
         //JLabel lblPayment = new JLabel("Your monthly payment is:");
                             //add(lblPayment);
                   //JTextField txtPayment = new JTextField(10);
                             //txtPayment.setEditable(false);
                                  //add(txtPayment);
         JButton btnCalc = new JButton("Calculate");
                             //add(btnCalc);
                             //btnCalc.addActionListener(this);
    JButton year7InterestRateBtn = new JButton("7 years at 5.35%");     // Mortgage Term and Interest Rate
    JButton year15InterestRateBtn = new JButton("15 years at 5.50%");
    JButton year30InterestRateBtn = new JButton("30 years at 5.75%");
    JButton reset = new JButton("Clear All");
    JTextArea boxSpace = new JTextArea(100,200);          // Morgtage table size
    JScrollPane scroll = new JScrollPane(boxSpace);     // ScrollPane
              public MPC()     // Method
         super("MPC");     // Frame Title
              JMenuBar mb = new JMenuBar();     // Menu Bar
    setJMenuBar(mb);
                        setSize(325, 500);          // Frame Size
                        JPanel pane = new JPanel();
                        pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS)); //Grid box configuration
                        Container grid = getContentPane();
                        grid.setLayout(new GridLayout(8,2,8,8));     // Grid Layout
                        pane.add(grid);                                        // Adds grid
                        pane.add(scroll);                                   // Adds scrollPane
                   grid.setBackground(Color.white);
                        Setting color of text and backgrounds
                   txtYears.setBackground(Color.white);
              txtYears.setForeground(Color.black);
                   txtYears.setFont(new Font("Arial", Font.PLAIN, 10));
                        txtPayment.setBackground(Color.white);
                   txtPayment.setForeground(Color.black);
              txtPayment.setFont(new Font("Arial", Font.PLAIN, 10));
                   boxSpace.setBackground(Color.white);
                   boxSpace.setForeground(Color.black);
                   boxSpace.setFont(new Font("Arial", Font.PLAIN, 10));
              grid.add(lblYears);
              grid.add(txtYearsInput);
              grid.add(lblInterestRate);
              grid.add (txtInterestRate);
              grid.add(lblTotalMort);          // Adds the Mortgage Amount Label
              grid.add(txtYears);               // Adds the Mortgage Amount Text Field
              grid.add(lblPayment);           // Adds the Payment Label
              grid.add(txtPayment);           // Adds the Monthly Payment Text Field
                   txtPayment.setEditable(false);          // Disables editing in this Text Field
              grid.add(btnCalc);
         grid.add(year7InterestRateBtn);               // Adds 1st Loan and Rate Button
              grid.add(year15InterestRateBtn);          // Adds 2nd Loan and Rate Button
              grid.add(year30InterestRateBtn);          // Adds the Exit Button
              grid.add(reset);                               // Adds the New Calc Button
              setContentPane(pane);                          // Enables the Content Pane
              setVisible(true);                               // Sets JPanel to be Visable
              reset.addActionListener(this);                          // Adds Action Listener to the New Calc Button
              txtYearsInput.addActionListener(this);
              txtInterestRate.addActionListener(this);
              btnCalc.addActionListener(this);
         year7InterestRateBtn.addActionListener(this);                              // Adds Action Listener to the 1st loan Button
              year15InterestRateBtn.addActionListener(this);                              // Adds Action Listener to the 2nd loan Button
              year30InterestRateBtn.addActionListener(this);                               // Adds Action Listener to the 3rd loan Button
              txtYears.addActionListener(this);                              // Adds Action Listener to the Mortgage Amount Text Field
              txtPayment.addActionListener(this);                              // Adds Action Listener to the Monthly payment Text Field
              public void actionPerformed(ActionEvent e)                               // Tests to Verify Which Button is Pressed
         Object command = e.getSource(); // Enables command to get data
         int intYears = 0;          // Declares intYears
                   double dblLoanAmount, dblInterestRate, interestRate, intRate;
         if (command == year7InterestRateBtn)                                   // Activates the 1st Loan Button
    intYears = 0;                                        // Sets 1st value of Array
         if (command == year15InterestRateBtn)                                   // Activates the 2nd Loan Button
         intYears = 1;                                        // Sets 2nd value of Array
              if (command == year30InterestRateBtn)                                   // Activates the 3rd Loan Button
                   intYears = 2;                                        // Sets 3rd value of Array
                   if (command == btnCalc)
                        //dblLoanAmount = Double.parseDouble(txtTotalMort.getText() ); // Loan amount
                        //interestRate = Double.parseDouble(txtInterestRate.getText() ); // /100 )/ 12; // Devides rate
                        intRate = (Double.parseDouble(txtInterestRate.getText() )/100 )/ 12;
                        //int intYearsMonths = Integer.parseInt(txtYearsInput.getText() );// * 12; //Multiplies loan length
                        int months = Integer.parseInt(txtYearsInput.getText() )* 12;
    dblLoanAmount = 0;                                   // Declares and Initializes dblLoanAmount
                   dblInterestRate = 0;                                        // Declares and Initializes dblInterestRate
              double [][] dblTrmLoanRate = {{7, 5.35}, {15, 5.50}, {30, 5.75},};           // Array Data for Calculation
    try
    dblLoanAmount = Double.parseDouble(txtYears.getText()); // Gets user input from txtYears Text Field
    catch (NumberFormatException nfe)                          // Checks for correct user input
                             JOptionPane.showMessageDialog(null, "You must enter a valid number.", "MPC", JOptionPane.INFORMATION_MESSAGE);
    return;
              interestRate = dblTrmLoanRate [intYears][1];
                   //dblInterestRate=interestRate;
                   intRate = (interestRate / 100) / 12;                         // Calculates Interst Rate
         double intYearsMonths = dblTrmLoanRate [intYears] [0];                    // Calculates Loan Term in Months
    int months = (int)intYearsMonths * 12;                          // Devides by months
    double interestRateMonthly = (intRate / 12); // Devides Rate
              double payment = dblLoanAmount * intRate / (1 - (Math.pow(1/(1 + intRate), months))); // Calculates monthly payment
         double dblRmnLoan = dblLoanAmount;                              //Left over balance
         double txtPaymentInterest = 0;                                   // Payment
         double txtPaymentPrincipal = 0;                                   // Payment of principal
    NumberFormat currency = NumberFormat.getCurrencyInstance(Locale.US); // Curreny format
         txtPayment.setText(currency.format(payment));
              boxSpace.setText("Month\tPrincipal\tInterest\tBalance Left\n");
              for (;months > 0 ; months -- )
              txtPaymentInterest = (dblRmnLoan * intRate);
                        txtPaymentPrincipal = (payment - txtPaymentInterest);          // Calculates monthly payment
                   dblRmnLoan = (dblRmnLoan - txtPaymentPrincipal);
                        boxSpace.setCaret (new DefaultCaret());                    // Scroll position
                        boxSpace.append(String.valueOf(months) + "\t" +               // Table data
                        currency.format(txtPaymentPrincipal) + "\t" +
                   currency.format(txtPaymentInterest) + "\t" +
                   currency.format(dblRmnLoan) + "\n");
    if(command == reset)
                             Clears fields
                        txtYearsInput.setText(null);
                        txtInterestRate.setText(null);
              txtYears.setText(null);
                        txtPayment.setText(null);
         boxSpace.setText(null);
                        public static void main(String[] args)                               //This is the signature of the entry point of all the desktop apps
              new MPC();
    }

    This portion to be exact. All the buttons work for me except this one. I need to calculate user input and also use the fixed data that can be found in the dblTrmLoanRate array. When I choos to use user input instead, the program either crashes or for some reason uses the year7InterestRateBtn instead.
                   if (command == btnCalc)
                        //dblLoanAmount = Double.parseDouble(txtTotalMort.getText() ); // Loan amount
                        //interestRate = Double.parseDouble(txtInterestRate.getText() ); // /100 )/ 12; // Devides rate
                        intRate = (Double.parseDouble(txtInterestRate.getText() )/100 )/ 12;
                        //int intYearsMonths = Integer.parseInt(txtYearsInput.getText() );// * 12; //Multiplies loan length
                        int months = Integer.parseInt(txtYearsInput.getText() )* 12;
    I was going to leave out the remed portion but thought it might help you with the navigation. I am sorry I did not use code tags, but I am going to go find out what those are and use them in the future.

  • Card reader not working out the box scr 3500?

    cac card reader not working out of box scr3500 help

    Welcome to discussions Kevin!
    I'm sorry to hear that first of all make sure that there is nothing sick on the eye of the camera it self, after that how is the lighting on the room that the computer will be set up? did the green light came on when you're trying to use iSight? i'm asking because the same thing happen to me but it was nothing but bad lighting in my office. If this doen't help call apple asap they should replace your computer with out a problem. Hope this helps good luck!
    Miguel

  • Working out the Concrete classes of an Interface

    Hi all I have an interface e.g. Animal with 3 concrete classes:
    Dog, Cat and Bird.
    Is there a way of working out that the Animial interace contains these 3 concrete classes in anyway?
    Thanks,

    notforgoogle wrote:
    Is there a way of working out that the Animial interace contains these 3 concrete classes in anyway?Not really, no.
    First of all, it doesn't "contain" them. The relationship between class and interface is one-way.
    You could whip up something that examines every class on your classpath, or a portion of it, and cheks whether it implements that interface. However, this will not work in general, since classes can be loaded from anywhere, and you may not always have the right or ability to list the classes present there, only to request specfic classes by name.

Maybe you are looking for

  • Is bad tv come with fc?

    im working at a friends and one of his computers has it installed and one doesnt. is it a third party effect/plug in? thanks, A

  • How to view sys_context value in SQL Developer?

    hello i can view the results via sqlplus with following statements: SELECT SYS_CONTEXT ('empno_ctx', 'empno_attrib') empno_attrib FROM DUAL; SELECT * FROM SESSION_CONTEXT; both retrieve correct values; now, since i work mainly in SQL Developer i want

  • Saving Song Data in iTunes - .XML

    Hey guys, before I reinstalled, I backed up my iTunes Library to an XML file. And, on the reinstall, I made my media hard drive m:/ instead of d:/ like it was previously. So, in the XML file all the references are to where the songs were stored on th

  • Copying to Hardrive from Mac and also using Windows - which FAT or NTFS?

    I and struggling with what do as best backup solution for both Docs, Music and most inportantly Photos.  I have just copied each event from iPhoto onto a memory stick which is formated as MS-DOS (FAT 32).  I have got Paragon NTFS for MAC OS X  9.5 so

  • My Flash Site looks very low in quality (I'm viewing in High Quality)

    Hi all, I am wondering why this Flash site I've designed is so rough looking (indecipherable text, pixellated edges etc.). Because I was working with content already created in Illustrator (10), I copied them over to Flash (CS3) as vectors and resize