Please help me in Calculating Sybase IQ Daily,WTD,MTD, YTD,QTD,SPLM,SPLY
Hi Team,
Need to Calculate No of Customers from a particular dimension table on these measures Daily,WTD,MTD, YTD,QTD,SPLM,SPLY
Can anybody help me with the Logic its extremely urgent.
Thanks all for your help
Regards,
Yedu
Is that part of an entire script, I don't see the tokens changing as TimG observed is this being called from a different routine. (are you calling the same script using a for loop?)
I think instead of updating the subvar everytime, he just used a bat/sh script to run it for various members.
Regards
Celvin
http://www.orahyplabs.com
Similar Messages
-
PLEASE HELP - Subtraction not calculating correctly
Post Author: hollyschulz
CA Forum: Formula
This formula I have seems to work any other time, but this one batch I am reporting on doesn't work properly:
(distinctcount({CHART.CHART_ID}))-(distinctcount({@nc})){@nc} = if ({CHART.SUSPEND_CODE} <> "GC") then 1
The results for {@nc} is 0 in the report, the result for (distinctcount({CHART.CHART_ID})) is 41. How come this result of (distinctcount({CHART.CHART_ID}))-(distinctcount({@nc})) is 40 in the report?? (41-0 should = 41 but crystal has 41-0 = 40)
I tried adding a +1 to the end of the formula and pulling data from a different batch, but the results were 1 too much.Post Author: V361
CA Forum: Formula
Hi, Sometimes I will break the formula on purpose, save it any way and run, then when the error pops up, it will show the values in the formula editor. (in CR XI anyway) try this formula..
(distinctcount({CHART.CHART_ID}))-(distinctcount({@nc})){@nc} = if ({CHART.SUSPEND_CODE} <> "GC") then 1 / 0
This will cause the formula to fail, but hopefully you will be able to see the value of {@nc} during the calculation. Also, try adding this to the details section and manually count.
If that does not help, could you give some sample data. -
Please help :: JVM Memory Calculation
Hi Guys,
I've developed a struts based web application. I've got the java.lang.OutOfMemoryError when I tried to retrieve 2000 records in the login page itself. Ofcourse even in my listing of the modules.. i am getting the same...error
still i have confused with JVM size.. how much to be increased...? presently i have JVM size 32MB with jdk1.5, tomcat 5.5 , linux os..with 1GB RAM
please suggest..,Well firstly i feel Holding 2000 records at a time is ceratinly foolish as sooner or later it would eat up all your JVM heap...
A better solution in order to maintain this is to use data paging....
first....
which you might divde into pages....
Say for example....
select count(*) from table_name where <condition>gives you total number of records present.
Say if you have divded the total records into 100 per Virtual Page
at a strench fetch first 100 records using properties like rownum(oracle),LIMIT clause in mysql and etc.
Hold the present page pointers in a bean Scoped session and then fetch the other page accordingly.this saves a lot of memory thought their is a lot of overhead involved.
the other would be usage of other caching techniques.
May be the below article might help you in this regard
http://java.about.com/library/weekly/uc_querycache1.htm
And if you are still struck to increasing increasing JVM Size you might have to configure it in App server batch server runtime parameters
check out below article of how configure few app servers to increase JVM Heap
http://www.chemaxon.com/jchem/doc/admin/tomcat.html
http://www.redhat.com/docs/manuals/jboss/jboss-eap-4.2/doc/Server_Configuration_Guide/ch02s02s02.html
http://e-docs.bea.com/wls/docs81/perform/JVMTuning.html
http://www.ibm.com/developerworks/websphere/library/techarticles/0706_sun/0706_sun.html
and checkout the below article to findout different technique followed to solve memory leak problems.
http://support.bea.com/application_content/product_portlets/support_patterns/wls/InvestigatingOutOfMemoryMemoryLeakProblemsPattern.html
Hope this might help :)
REGARDS,
RaHuL -
Daily, WTD, and MTD detail based on 0CAL_DAY
I am trying to set up a report to disply daily, WTD, and MTD based on cal_day, but am having trouble getting the WTD or MTD. I'm either able to get the WTD detail, but the MTD will look like the WTD or vice versa. I've tried different variables, hierarchies, summarization, etc. and am out of ideas. Does anyone have a suggestions? Following is what is currently displayed in the report, but I need to get a running total on MTD (currently, it looks like WTD). Thanks for any suggestions!
Actual Sales
(000s) US Dollars
Cal yr/wk
Cal Day Daily WTD MTD
05/2008
2/1/2008 $221 $221 $221
2/2/2008 $6 $226 $226
06/2008
2/4/2008 $259 $259 $259
2/5/2008 $514 $773 $773
2/6/2008 $412 $1,186 $1,186
2/7/2008 $338 $1,523 $1,523
2/8/2008 $288 $1,811 $1,811
2/9/2008 $197 $2,008 $2,008
2/10/2008 $12 $2,020 $2,020
07/2008
2/11/2008 $261 $261 $261
2/12/2008 $448 $709 $709
2/13/2008 $316 $1,025 $1,025
2/14/2008 $295 $1,320 $1,320
2/15/2008 $332 $1,652 $1,652
2/16/2008 $59 $1,711 $1,711
08/2008
2/18/2008 $338 $338 $338
2/19/2008 $302 $640 $640
2/20/2008 $400 $1,040 $1,040
2/21/2008 $514 $1,555 $1,555
2/22/2008 $653 $2,208 $2,208
2/23/2008 $294 $2,502 $2,502Hi Sandeep,
Thank you for your reply. I'm able to get the result sum to display as I need them- WTD shows the WTD total and MTD shows the MTD total, but I also need to get the detail- the MTD needs to show a running total, right now it's only showing the WTD total and resets after each weekly result. If I remove the weekly result, I can get a running MTD total, but then I lose the WTD running total- it looks like MTD. For example:
I currently have:
Week 1
Daily WTD MTD
5 5 5
2 7 7
7 7 (Total for week 1)
Week 2
Daily WTD MTD
3 3 3
4 7 7
10 14 (Total for week 2)
What I need to show is:
Week 1
Daily WTD MTD
5 5 5
2 7 7
7 7 (Total for week 1)
Week 2
Daily WTD MTD
3 3 10
4 7 14
10 14 (Total for week 2)
Is there anyway to get the detail level to display the running MTD total? -
Date Based Dynamic Member Calculation Performance (MTD, YTD, PeriodsToDate)
I'm working on an SSAS 2012 cube and I have defined several dynamic calculations based on a Date (MTD, YTD, TD, Thru Previous Month, etc.).
The cube has a well defined Date dimension and I have set up a DYNAMIC calculated set in the cube as shown below.
CREATE DYNAMIC SET CURRENTCUBE.[Latest Date]
AS TAIL(EXISTS([Payment Date].[Calendar Date].[Date].Members,[Payment Date].[Calendar Date].CURRENTMEMBER,"Claim Payment"));
... and here is an example of one of my calculations.
CREATE MEMBER CURRENTCUBE.[Measures].[Face Amount Paid MTD]
AS SUM(MTD([Latest Date].ITEM(0).ITEM(0)), [Measures].[Face Amount Paid]),
FORMAT_STRING = "$#,##0.00;-$#,##0.00",
//NON_EMPTY_BEHAVIOR = { [Claim Payment Fact Count] },
VISIBLE = 1 , DISPLAY_FOLDER = 'Face Amount' , ASSOCIATED_MEASURE_GROUP = 'Claim Payment';
This calculation returns the correct results, but performs horribly. I've noticed that changing the [Latest Date] set to STATIC, performance greatly improves, but numbers are no longer accurate as they are based on the Tail of the Claim Payment measure
group without considering the filtered dates. This is because the date is evaluated at process time, but needs to be based on users date selection to be accurate. Therefore, STATIC does not appear to be an option. Is there a better way to
perform this calculation dynamically based on the filtered or unfiltered date dimension?Typically I would just do YTD/MTD/etc off the date the user has selected. It seems like you want to do it based on the last date with data within the range they have selected. Why not just give the user what they are asking for?
In other words, why not
YTD([Payment Date].[Calendar Date].currentmember) -
Whenever I am browsing the internet or playing a game, the battery is dropping by 15-30 % daily. I am able to use only 70 percent of the fully charged Iphone battery in this way. ! It is very frustrating with this kind of thing from Apple. Can any body please help me out ! I love iPhone but this prolonged problem is giving me a lot of headache ! Any hellp will be appreciated.
How long are you using internet for? Are you using WiFi or mobile data? Are you watching video on websites? There are many variables that could explain a perfectly natural battery drain. As I said previously you should try recalibrating the battery. My phone used to drain by mid-afternoon with little to no use until I found out about recalibrating. Since then its been fine and its something I do at least once a month.
-
I have been able to access a site regularly but in the last few days get a message: "cookies required to access this site." please help, I use this site for work daily:)
Goto > Settings > Safari... Enable Cookies > Always
Good luck! -
My requirement is to update 3 valuesets daily based on data coming to my staging table. What is the API used for this and how to map any API to our staging table? I am totally new to oracle and apps. Please help. Thanks!
Hi,
You could use FND_FLEX_LOADER_APIS.UP_VALUE_SET_VALUE to upload them from staging table (I suppose you mean value set values...).
You can find a sample scripts if you google around.
What do you mean "how to map any API to our staging table" ?
You should do at least the following mapping (which column(s) in the staging table will provide these information):
- the 3 value sets name which you're going to update/upload (I suppose these are existing value sets or which have been already created)
- the value set values and description
Try to start with something and if there is any issues the community could then help... but for the time being with the description of the problem you have provided, that's the best I can do... -
How ix_sel is calculated? Jonathan Lewis please help
There is table TETRO, partitioned by column BSTATE, and subpartitioned by column C (not present below).
Also there is query:
SELECT *
FROM TETRO T
WHERE T.BOST = 'BB810'
and BSTATE = 'CLOSED'And there is global index IDX_1 on columns BOST, BSTATE.
The questions are following:
1. How in this case calculated ix_sel for the index above?
2. How calculated cardinality of index?
I think it is really one question.
Thie is excerpt from 10053:
QUERY BLOCK TEXT
SELECT *
FROM TETRO T
WHERE T.BOST = 'BB810'
and BSTATE = 'CLOSED'
QUERY BLOCK SIGNATURE
qb name was generated
signature (optimizer): qb_name=SEL$1 nbfros=1 flg=0
fro(0): flg=0 objn=789900 hint_alias="T"@"SEL$1"
SYSTEM STATISTICS INFORMATION
Using WORKLOAD Stats
CPUSPEED: 1033 millions instructions/sec
SREADTIM: 0 milliseconds
MREADTIM: 1 millisecons
MBRC: 12.000000 blocks
MAXTHR: -1 bytes/sec
SLAVETHR: -1 bytes/sec
BASE STATISTICAL INFORMATION
Table Stats::
Table: TETRO Alias: T Partition [7]
#Rows: 5689355 #Blks: 490747 AvgRowLen: 267.00
#Rows: 5689355 #Blks: 490747 AvgRowLen: 267.00
Index Stats::
Index: IDX_1 Col#: 7 9
LVLS: 3 #LB: 337246 #DK: 453 LB/K: 744.00 DB/K: 36878.00 CLUF: 16705760.00
Index: IDX_2 Col#: 7 PARTITION [7]
LVLS: 2 #LB: 28106 #DK: 2 LB/K: 14053.00 DB/K: 392101.00 CLUF: 784203.00
LVLS: 2 #LB: 28106 #DK: 2 LB/K: 14053.00 DB/K: 392101.00 CLUF: 784203.00
SINGLE TABLE ACCESS PATH
BEGIN Single Table Cardinality Estimation
Column (#7): BOST(VARCHAR2) Part#: 7
AvgLen: 7.00 NDV: 16 Nulls: 0 Density: 0.0625
Column (#7): BOST(VARCHAR2)
AvgLen: 7.00 NDV: 16 Nulls: 0 Density: 0.0625
Column (#9): BSTATE(VARCHAR2) Part#: 7
AvgLen: 6.00 NDV: 1 Nulls: 0 Density: 1
Column (#9): BSTATE(VARCHAR2)
AvgLen: 6.00 NDV: 1 Nulls: 0 Density: 1
Table: TETRO Alias: T
Card: Original: 5689355 Rounded: 355585 Computed: 355584.69 Non Adjusted: 355584.69
END Single Table Cardinality Estimation
Access Path: TableScan
Cost: 142335.78 Resp: 142335.78 Degree: 0
Cost_io: 122064.00 Cost_cpu: 5486476442
Resp_io: 122064.00 Resp_cpu: 5486476442
kkofmx: index filter:"T"."BSTATE"='CLOSED'
kkofmx: index filter:"T"."BSTATE"='CLOSED'
kkofmx: index filter:"T"."BOST"='BB810' AND "T"."BSTATE"='CLOSED'
kkofmx: index filter:"T"."BOST"='BB810' AND "T"."BSTATE"='CLOSED'
kkofmx: index filter:"T"."BSTATE"='CLOSED'
Access Path: index (AllEqRange)
Index: IDX_1
resc_io: 37627.00 resc_cpu: 351652199
ix_sel: 0.0022075 ix_sel_with_filters: 0.0022075
Cost: 38926.31 Resp: 38926.31 Degree: 1
Access Path: index (AllEqRange)
Index: IDX_2
resc_io: 50772.00 resc_cpu: 980748811
ix_sel: 0.0625 ix_sel_with_filters: 0.0625
Cost: 54395.73 Resp: 54395.73 Degree: 1
****** trying bitmap/domain indexes ******
****** finished trying bitmap/domain indexes ******
Best:: AccessPath: IndexRange Index: IDX_1
Cost: 38926.31 Degree: 1 Resp: 38926.31 Card: 355584.69 Bytes: 0
OPTIMIZER STATISTICS AND COMPUTATIONS
GENERAL PLANS
Considering cardinality-based initial join order.
Permutations for Starting Table :0
Join order[1]: TETRO[T]#0
Best so far: Table#: 0 cost: 38926.3068 card: 355584.6875 bytes: 94941195
(newjo-stop-1) k:0, spcnt:0, perm:1, maxperm:80000
Number of join permutations tried: 1
Final - First Rows Plan: Best join order: 1
Cost: 38926.3068 Degree: 1 Card: 355585.0000 Bytes: 94941195
Resc: 38926.3068 Resc_io: 37627.0000 Resc_cpu: 351652199
Resp: 38926.3068 Resp_io: 37627.0000 Resc_cpu: 351652199
kkoipt: Query block SEL$1 (#0)
Current SQL statement for this session:
explain plan for
SELECT *
FROM TETRO T
WHERE T.BOST = 'BB810'
and BSTATE = 'CLOSED'
============
Plan Table
============
------------------------------------------------------+-----------------------------------+---------------+
| Id | Operation | Name | Rows | Bytes | Cost | Time | Pstart| Pstop |
------------------------------------------------------+-----------------------------------+---------------+
| 0 | SELECT STATEMENT | | | | 38K | | | |
| 1 | TABLE ACCESS BY GLOBAL INDEX ROWID | TETRO | 347K | 91M | 38K | 00:00:11 | ROW LOCATION| ROW LOCATION|
| 2 | INDEX RANGE SCAN | IDX_1 | 12K | | 828 | 00:00:01 | | |
------------------------------------------------------+-----------------------------------+---------------+
Predicate Information:
2 - access("T"."BOST"='BB810' AND "BSTATE"='CLOSED')
I expected that ix_sel will equal density(BOST in parition 7) * density(BSTATE in parition 7) = 0.0625
And cardinality of index scan = ix_sal * num_rows(in parition 7) = 355K.
And I see this calculations in section Table
Table: TETRO Alias: T
Card: Original: 5689355 Rounded: 355585 Computed: 355584.69 Non Adjusted: 355584.69But why ix_sel(IDX_1) = 0.0022075 (instaed of 0.0625)?
And cardinality of index range scan is 12K instead of 355K ?Fathers, please help to understand following piece (10053 on the bottom of the page).
This similar case as above. The same tables and predicates.
But local index is used (forced by a hint).
select --+ index(t TETROBOSTMANAGEDBYCLOSEDSTATES)
from TETRO t
where BSTATE = 'CLOSED'
and BOST = 'BS277'Please notice, I force partition pruning using predicate BSTATE = 'CLOSED'.
And number of subpartitions is 13.
This index consists columns BOST(just a column), C (subpartition key), C1 (just a column)
So, in this case ix_sel and cardinality same as I expected to see w/o histograms.
Access Path: index (RangeScan)
Index: TETROBOSTMANAGEDBYCLOSEDSTATES
resc_io: 269487.00 resc_cpu: 1987916858
ix_sel: 0.0625 ix_sel_with_filters: 0.0625
Cost: 276832.08 Resp: 276832.08 Degree: 1
Best:: AccessPath: IndexRange Index: TETROBOSTMANAGEDBYCLOSEDSTATES
Cost: 276832.08 Degree: 1 Resp: 276832.08 Card: 355584.69 Bytes: 0But why final execution plan has another cardinality of index scan (31K)?
============
Plan Table
============
-----------------------------------------------------------------------------+-----------------------------------+---------------+
| Id | Operation | Name | Rows | Bytes | Cost | Time | Pstart| Pstop |
-----------------------------------------------------------------------------+-----------------------------------+---------------+
| 0 | SELECT STATEMENT | | | | 270K | | | |
| 1 | PARTITION RANGE SINGLE | | 347K | 91M | 270K | 00:01:13 | 8 | 8 |
| 2 | PARTITION LIST ALL | | 347K | 91M | 270K | 00:01:13 | 1 | 27 |
| 3 | TABLE ACCESS BY LOCAL INDEX ROWID | TETRO | 347K | 91M | 270K | 00:01:13 | 190 | 216 |
| 4 | INDEX RANGE SCAN | TETROBOSTMANAGEDBYCLOSEDSTATES| 31K | | 5844 | 00:00:02 | 190 | 216 |
-----------------------------------------------------------------------------+-----------------------------------+---------------+
Predicate Information:
3 - filter("BSTATE"='CLOSED')
4 - access("BOST"='BS277')
QUERY BLOCK TEXT
select --+ index(t TETROBOSTMANAGEDBYCLOSEDSTATES)
* from TETRO t where BSTATE = 'CLOSED' and BOST = 'BS277'
BASE STATISTICAL INFORMATION
Table Stats::
Table: TETRO Alias: T Partition [7]
#Rows: 5689355 #Blks: 490747 AvgRowLen: 267.00
#Rows: 5689355 #Blks: 490747 AvgRowLen: 267.00
Index Stats::
Index: TETROBOSTMANAGEDBYCLOSEDSTATES Col#: 7 11 25 PARTITION [7]
LVLS: 3 #LB: 87376 #DK: 3679167 LB/K: 1.00 DB/K: 1.00 CLUF: 4224354.00
LVLS: 3 #LB: 87376 #DK: 3679167 LB/K: 1.00 DB/K: 1.00 CLUF: 4224354.00
User hint to use this index
SINGLE TABLE ACCESS PATH
BEGIN Single Table Cardinality Estimation
Column (#9): BSTATE(VARCHAR2) Part#: 7
AvgLen: 6.00 NDV: 1 Nulls: 0 Density: 1
Column (#9): BSTATE(VARCHAR2)
AvgLen: 6.00 NDV: 1 Nulls: 0 Density: 1
Column (#7): BOST(VARCHAR2) Part#: 7
AvgLen: 7.00 NDV: 16 Nulls: 0 Density: 0.0625
Column (#7): BOST(VARCHAR2)
AvgLen: 7.00 NDV: 16 Nulls: 0 Density: 0.0625
Table: TETRO Alias: T
Card: Original: 5689355 Rounded: 355585 Computed: 355584.69 Non Adjusted: 355584.69
END Single Table Cardinality Estimation
Access Path: index (RangeScan)
Index: TETROBOSTMANAGEDBYCLOSEDSTATES
resc_io: 269487.00 resc_cpu: 1987916858
ix_sel: 0.0625 ix_sel_with_filters: 0.0625
Cost: 276832.08 Resp: 276832.08 Degree: 1
Best:: AccessPath: IndexRange Index: TETROBOSTMANAGEDBYCLOSEDSTATES
Cost: 276832.08 Degree: 1 Resp: 276832.08 Card: 355584.69 Bytes: 0
OPTIMIZER STATISTICS AND COMPUTATIONS
GENERAL PLANS
Considering cardinality-based initial join order.
Permutations for Starting Table :0
Join order[1]: TETRO[T]#0
Best so far: Table#: 0 cost: 276832.0812 card: 355584.6875 bytes: 94941195
(newjo-stop-1) k:0, spcnt:0, perm:1, maxperm:80000
============
Plan Table
============
-----------------------------------------------------------------------------+-----------------------------------+---------------+
| Id | Operation | Name | Rows | Bytes | Cost | Time | Pstart| Pstop |
-----------------------------------------------------------------------------+-----------------------------------+---------------+
| 0 | SELECT STATEMENT | | | | 270K | | | |
| 1 | PARTITION RANGE SINGLE | | 347K | 91M | 270K | 00:01:13 | 8 | 8 |
| 2 | PARTITION LIST ALL | | 347K | 91M | 270K | 00:01:13 | 1 | 27 |
| 3 | TABLE ACCESS BY LOCAL INDEX ROWID | TETRO | 347K | 91M | 270K | 00:01:13 | 190 | 216 |
| 4 | INDEX RANGE SCAN | TETROBOSTMANAGEDBYCLOSEDSTATES| 31K | | 5844 | 00:00:02 | 190 | 216 |
-----------------------------------------------------------------------------+-----------------------------------+---------------+
Predicate Information:
3 - filter("BSTATE"='CLOSED')
4 - access("BOST"='BS277') -
Please Help/ GUI Calculator
I'm trying to create a GUI Calculator but cannot get my program to compile. Please could someone assistm, thanks.
import java.io.*;
import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class CalculatorFrame extends JFrame
private Container contentPane;
//The componenets used in the calculator
private JTextField display;
private JButton addition;
private JButton subtract;
private JButton multiply;
private JButton divide;
private JButton mod;
private JButton enter;
private JButton [] digits;
//End of components
//Integer representations for the arithmetic operations needed
private final static int ADD = 1;
private final static int SUB = 2;
private final static int MUL = 3;
private final static int DIV = 4;
private final static int MOD = 5;
//ENd of arithmethic operations
//Integer holding the operator that the user requested
private int op;
//Boolean variable to help perform the calculations
private boolean firstFilled;
private boolean clearScreen;
//Constructor for the class
public CalculatorFrame()
contentPane=new Container();
this.setSize(400,300); //sets the size of the frame
this.setTitle("MIS 222 Calculator"); //sets the title of the frame
//allows the "X" box in the upper right hand corner to close the entire application
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
contentPane=this.getContentPane(); //gets the content pane
//Methods
addDisplay();
addDigits();
addDigitActionListeners();
addOperation();
private void addDisplay()
JLabel displayLab = new JLabel("Answer");
JPanel north = new JPanel();
north.add(displayLab);
contentPane.add(north, "North");
//diplay was already declared above the constructor
display = new JTextField(25);
//adding the components to the panel
north.add(displayLab);
north.add(display);
//adding the panel to frame's content pane
contentPane.add(north, "North");
//Declaring the global digits array
private void addDigits()
//Add 1 large panel to hold the 3 inner panels
JPanel digPanel = new JPanel();
//Set the panel's preferred size so that it will keep everything in line
digPanel.setPreferredSize(new Dimension(200, 275));
//Initialize the top 3 digits' JPanel and set its preferrd size
JPanel topDigits = new JPanel();
topDigits.setPreferredSize(new Dimension(200,60));
//Initialize the middle 2 digits' JPanel and set its preferred size
JPanel midDigits = new JPanel();
midDigits.setPreferredSize(new Dimension(200,60));
//Initialize the bottom digits' JPanel and set its preferred size
JPanel botDigits = new JPanel();
botDigits.setPreferredSize(new Dimension(200, 75));
//Initialize the JButton array
digits = new JButton[11];
//Initialize each of the top Panel's digit buttons, and add it to the top panel
for(int i=1; i<4; i++)
String lab=(new Integer(i)).toString();
digits=new JButton(lab);
topDigits.add(digits[i]);
//Adding the top Digit Panel to the overall digit panel
digPanel.add(topDigits, BorderLayout.CENTER);
//Adding the middle Digit Panel to the overall digit panel
digPanel.add(midDigits, BorderLayout.CENTER);
//Adding the bottom Digit Panel to the overall digit panel
digPanel.add(botDigits, BorderLayout.CENTER);
//Add the overall digit Panel to the Frame's contentpane
contentPane.add(digPanel, BorderLayout.CENTER);
//Method created to add the DigitAction Listeners
addDigitActionListeners();
//Method created to add all of the DigitActionListeners
private void addDigitActionListeners()
for(int i=0; i<10; i++)
digits[i].addActionListener(new DigitActionListener(i));
digits[10].addActionListener(new DigitActionListener("."));
//DigitActionListener class
public class DigitActionListener implements ActionListener
private String myNum;
public DigitActionListener(int num)
myNum=""+num;
public DigitActionListener(String num)
myNum=num;
public void actionPerformed(ActionEvent e)
if(display.getText().equals("Please enter a valid number")|| clearScreen)
clearScreen=false;
display.setText("");
//OperatorActionListener class
public void OpActionListener implements ActionListener
private int myOpNum;
public OpActionListener(int op)
myOpNum=op;
public void actionPerformed(ActionEvent e)
{ //Checks to see if the user has already enterd a number
if(!firstFilled)
try{
//Parse the number entered
String number=display.getText();
dNum1=Double.parseDouble(number);
//Sets the flag for the firstFilled to true
firstFilled=true
//Sets the op variable so when the "Enter" button is pressed, it will know which operation to perform
op=myOpNum;
//Clears the textbox
display.setText("");
catch(Exception er)
display.setText("Please enter a valid number");
//This is the second number being entered
else{
try{
String number=display.getText();
String result;
dNum2=Double.parseDouble(number);
firstFilled=true;
op=myOpNum;
display.setText("");
catch(Exception er)
display.setText("Please enter a valid number");
private void addOperation()
JPanel opPanel=new JPanel();
opPanel.setPreferredSize(new Dimension(75,200));
JButton clear = new JButton("C");
JButton addition = new JButton("+");
JButton subtraction = new JButton("-");
JButton multiply = new JButton("*");
JButton divide = new JButton("/");
JButton mod = new JButton("%");
JButton enter = new JButton("Enter");
addition.addActionListener(new OpActionListener(ADD));
subtraction.addActionListener(new OpActionListener(SUB));
multiply.addActionListener(new OpActionListener(MUL));
divide.addActionListener(new OpActionListener(DIV));
mod.addActionListener(new OpActionListener(MOD));
clear.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
display.setText("");
firstFilled=false;
enter.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
double result;
String answer="";
String number = display.getText();
dNum2 = Double.parseDouble(number);
dNum1=Double.parseDouble(number);
switch(op)
case ADD:
result = dNum1 + dNum2;
break;
case SUB:
result = dNum1 - dNum2;
break;
case MUL:
result = dNum1 * dNum2;
break;
case DIV:
result = dNum1 / dNum2;
break;
default:
result= -1.0;
break;
if(result==(int)result)
answer=(new Integer((int)result)).toString();
else
answer=(new Double(result)).toString();
display.setText(answer);
clearScreen=true;
firstFilled=false;
dNum1=0;
dNum2=0;
opPanel.add(clear);
opPanel.add(addition);
opPanel.add(subtraction);
opPanel.add(multiply);
opPanel.add(divide);
opPanel.add(mod);
opPanel.add(enter);
contentPane.add(opPanel, "East");
//Creating the frame object
public class CalculatorMain
public void main(String[] args)
CalculatorFrame cf=new CalculatorFrame();
cf.show();
ERRORS THAT I HAVE!!:
javac calculatorframe.javacalculatorframe.java:150: '(' expected
public void OpActionListener implements ActionListener
^
calculatorframe.java:7: class CalculatorFrame is public, should be declared in a file named CalculatorFrame.java
public class CalculatorFrame extends JFrame
^
calculatorframe.java:54: cannot resolve symbol
symbol : method addOperation ()
location: class CalculatorFrame
addOperation();
^
3 errors
>Hi, actually it's all written there:
>
ERRORS THAT I HAVE!!:
javac calculatorframe.javacalculatorframe.java:150: '(' expected
public void OpActionListener implements
ActionListenerpublic void ... is part of a possible method signature. That's probably why the compiler expects '(' as this is need for a method.
To define a class use:
public class ... (or better: private class ..., if the class is not used outside of this file.
^
calculatorframe.java:7: class CalculatorFrame is
public, should be declared in a file named
CalculatorFrame.java
public class CalculatorFrame extends JFrame
^As it says, you defined a class CalculatorFrame in a file calculatorframe.java. But the file name should be the same as the class name (case sensitive). Java classes should start with capital letters, so rename the file to:
CalculatorFrame.java
calculatorframe.java:54: cannot resolve symbol
symbol : method addOperation ()
location: class CalculatorFrame
addOperation();
^
3 errors
>You didn't declare the method 'addOperation' (-> cannot resolve symbol; which simbol: method addOperation (); where: location: class CalculatorFrame; you see it's all there)
Note there is a method called 'addOperation' in the class OpActionListener, but not in CalculatorFrame.
Note I didn't read the code, just the error messages. I hope this helps.
-Puce -
Please help me with this calculation script
Hello everyone.
I have 2 fields named A and B. FieldA is user-enter value and FieldB is calculated. I want to write a script that do the following:
If FieldA is more than or equal to $10000, then FieldB always is $1000, Else FieldB = FieldA * 10%.
I don't know about scripting; however, after hour of search through google, I wrote this one:
var tvar
If (tvar >= 10000)then deposit.value = 1000
else deposit.value = total.rawValue*0.01
endif
And when I try to run, it say "Invalid Property Set Operation, value doesn't have a default property."
I know my script is bad and over the place. Can anyone please help me with this problem ASAP. Thank you so much, I'm in your debt.
I used Adobe LiveCycle Designer to create a PDF file.Thank you for your response.
tvar = total
At first I wrote it like this:
If (total.rawValue >= 10000)then deposit.rawvalue = 1000
else deposit.rawvalue = total.rawValue*0.01
endif
then I get an error message "accessor 'Total.rawValue' is unknown"
Hic, I think my script is screwed. Can you help me start fresh :)
Thank again. -
My iphone 5 gets hot while using it and while charging too.... Please help me what should i do?? Should i replace the battery....?? Because it gets hot even within 5 minutes also.... And it is happening from 2 weeks daily.
The Basic Troubleshooting Steps are:
Restart... Reset... Restore from Backup... Restore as New...
Restart / Reset > http://support.apple.com/kb/ht1430
Backing up, Updating and Restoring > http://support.apple.com/kb/HT1414
If you try all these steps and you still have issues... Then a Visit to an Apple Store or AASP (Authorized Apple Service Provider) is the Next Step...
Be sure to make an appointment first... -
My computer kept freeze up daily with OS X Yosemite installed a while ago, and I followed the other instruction to do "OS X" Recovery to: (1) erased my start up disk (2) Reinstalling Mac OS X Yosemite.
While about 18 or 20 minutes remaining from the installation, it went back to 2 hours 57 minutes but stuck there. I let my computer run over night but it was still at 2 hours 57 minutes. so I cancelled the installation which seemed to be the only choice.
I tried again today, erased my start up disk and reinstalled again, same situation happened again, when the remaining time said around 20 minutes, it went back to 2 hours 56 minutes and stuck there. I cancelled it again.
I read some other instructions in this community and did a hard shutdown and restarted while hold down the command key + R key. it took me to the disk manager screen and the only choice I had was the OS X Lion version.
I tried to install the OS X Lion, it said that will take 3 hours or so, after 20 minutes, a screen came up and said I need to turn off the computer by press the power button down then turn the computer on again. And I did. When I turn on the computer again, with Comand + R key pressed, I had to wait for an
internet recovery before I went back to the disk manager and trying to reinstall the OS X system. It kept coming back to ask me to turn the power off…
what can I do? Please help,
MacBook AirBoot back into the Recovery Partition. Run Disk Utility Verify/Repair and Repair Permissions until you get no errors. Then re-install the OS.
X Yosemite Installation Stuck with Minutes Remaining? -
Hello
I have a problem in calculating the apple id Can you help me please
I forgot answer security questions for your account How can knowledge
Please help
Please reply as soon as possible
I can not buy from camels Store
And the rest of the account balance $25
Message was edited by: lingo azamI think you mean App Store.
Rescue email address and how to reset Apple ID security questions -
Please help in calculating average from random nos. generated
Actually i am new to LV and i don't understand e'thing pretty well. Can anyone please help me with this problem?
I have to construct a VI that displays a random no. once every sec., and then in the same VI, i am trying to compute the average of the last four nos. generated, i.e. the average is displayed only after 4 numbers have been generated, else the average displays zero.
Well, i was trying to get this, but so far what i have got is a VI that is generating average, but that is not what i need.
Thanks for any help.
CLEasiest would be to use "Mean PtByPt.vi" in the Analyze...Point by Point palette. It is most flexible, e.g. if you would want to change the averaging length in the future.
Alternatively, you could use shift registers initialized with NaN. I would prefer NaN over zero for incomplete samples, zero is not unique, it could be a legal value. See attached simple example (LabVIEW 7.1). Modify as needed.
LabVIEW Champion . Do more with less code and in less time .
Attachments:
Average4.vi 31 KB
Maybe you are looking for
-
How to update a list in parent view with data from child view/window ?
I have a view named AccountListView that displays some buttons and a list of accounts.Its viewmodel is called AccountListViewModel and has a collection : ObservableCollection<AccountViewModel>. What I'd like to acomplish: whenever I press the Add/Edi
-
I'm setting up a multiple-choice question, and I want to re-arrange the position of the button sprites representing the correct answer and distractors. I can randomly select one of the sprites via gDistractorLoc = random(4). The random function fails
-
How can I make MUSE upload one png that it overlooks? Cache cleared & shows in Preview
MUSE uploads everything to BC except an inport png. I cleared the cache, it shows inPreview, no conflicts noted in Assets and the Browser reflects any other changes I make to the page. The space for the image is missing online and the entire page m
-
Workflow Notification Mailer continues to fail with a STOPPED_ERROR component status
We are running the E-Business Suite version 12.1.3 (Standard) on Solaris Operating System (SPARC 64-bit). Multi-Org enabled. We just applied over the weekend RUP 7 patch 18004477. We have several seeded and customized workflows running (HR, BENEFITS,
-
"Recovery system update required." for Find My Mac -- after already updated!
I've run the latest round of updates on My 2011 MacBook Pro, and I have run into a snag with the new iCloud control panel. I want to enable the "Find My Mac" feature, but unfortunately I am not able to, as the checkbox is grayed out. There is an erro