Help me with my survy

I am doing this survy for my professor- I am at Bethedsa community college. (Currently, our JVM runs about 400% faster than commercial JVM, so this is definitely in research stage. )
I will appreciate your response- I need to get 20-30 responses- before my professor will release my stipend... I am sure you were a student once- So I will really really appreciate your inputs. You do not have to be complementary or negative to the idea- just be unbiased and honest...
We are building a better version of JVM which will allow profiling in production. This technology, if feasible and successful may be ported to commercial application servers such as WebLogic, WebSphere, JBoss and others, with the cooperation of J2EE vendors.
In this document, we will be calling this system- "DiagnoseNow".
The DiagnoseNow project is in research stage, and we want to adjust the goals of the project to better meet the requirements of the application administrator, designer and IT manager.
Your inputs will be tremendously appreciated.
PROFILING AND TRANSACTION TRACKING IN PRODUCTION
We are building a better version of JVM which will allow profiling in production. This technology, if feasible and successful may be ported to commercial application servers such as WebLogic, WebSphere, JBoss and others, with the cooperation of J2EE vendors.
In this document, we will be calling this system- "DiagnoseNow".
The DiagnoseNow project is in research stage, and we want to adjust the goals of the project to better meet the requirements of the application administrator, designer and IT manager.
Your inputs will be tremendously appreciated.
We are giving away one $50 gift certificate at Amazon.com to one respondent. We expect about 25-50 responses only- So your odds of winning are high.
The features of this proposed JVM are best explained using an example of an ecommerce site.
Ecommerce site scenario
Description of system
Consider a typical ecommerce site with the following features: User Validation, Product Search, Shopping Cart Management and Checkout.
Each user that actually purchases or attempts to purchase a product on the website is consider a "Tracking unit" or a "Session". This new research JVM will allow the time spent in a particular "Sessions" to be tracked at the method level.
System administrator can if he / she so wishes get a report with the following columns:
Session ID, MethodName, Time spent in the method(inclusive of called methods), Time spent in the method(excluding called methods)
Put simply, the goal is to support session level tracking and profiling at the method level in the JVM itself.
This will allow faster debugging and application turnaround, reducing application maintenance cost.
A production ecommerce site could have millions of users and many more transactions per day. We are optimistic about supporting real life production sites.
User Validation
1. login: This validates the user using user name and password.
2. logout: This logs the user off.
3. passwordVerification: Using a database, the password is
verified.
4. retrievalOfLostPassword: If the user has lost his/her
password the password is emailed to the user.
Product search
1. byname: Search product catalog by name.
2. byDescription: Search product catalog by Description
3. bySku: Search product catalog by SKU
4. byBrand: Search product catalog by brand
5. Shopping Cart
6. add: Adds items to the cart
7. remove: Removes Items from the cart.
8. update: Updates Items from the cart.
9. checkout: Checkout items from the cart, by asking for credit
card. .
10. retrievePastData: Retrieve user information from the past.
11. validateCreditCard: Validate credit Card by checking with
the bank.
12. sendConfirmationEmail: Send Email confirming the purchase.
13. sendConfirmationEmailShipping: Send Email confirming that
the product has shipped.
14. sendSurveyEmail: Send Email checking customer satisfaction.
What is a "Transaction" or a "Tracking Unit" or a "Session"?
Each user who searches the product catalog is considered a "Tracking unit" or sessions. A session ends when the users leaves the website.
Transaction tracking/ reporting data at method level
Time spent by each user, in each and every method above is tracked in two ways: Time spent in a method itself, Time spent in the method
and the called methods. This will be done for each and every invocation of the method.
Email alerts
Emails can be generated whenever a particular method(eg.
sendSurveyEmail) takes longer than a specified threshold.
Analysis Reports
Analysis can be done on a variety of topics: Reasons for abandoning shopping carts, Slow or underperforming parts of the application.
Thread dumps
If a particular method runs slower than a threshold value, then optionally a thread dump may be taken and stored. In this way, even if the slowdown occurs at midnight, the thread dump will still be available.
Triggered heap profile
Similarly, if the system is running out of heap memory a heap profiler may become active. Heap profile may also be taken periodically, to allow analysis of heap growth.
The system is best explained using a few examples:
Slowdown in search-books
Problem: Analysis of sessions shows that a large number of customers are browsing for books, but conversion to actual sales is slow.
Analysis: The book database has grown in size, and the server running the database has many more apps on it.
Moving the database to another machine solved the problem.
How and Why did DiagnoseNow help?
DiagnoseNow maintains history of all sessions. The history was analyzed to show customers who were not converting to purchases- a large proportion of them were searching for books, and abandoning the site afterwards.
Slowdown in search-general
Problem: Search has slowed down for all products.
Analysis and Resolution: Analysis showed that all search methods are taking 250% longer than normal. The slowdown happened after a specific date- it was the date on which the OS was upgraded. Rolling back the upgrade and reinstalling it properly resolved the issue.
How and Why did DiagnoseNow help?
DiagnoseNow maintains a baseline of past search method response times. So when a slowdown happens, there is no time wasted "apportioning blame" or debating whether a problem exists.
Credit card authorization- intermittent failure
Problem: Credit card authorization was failing intermittenty after hours
Analysis/Resolution: Credit card authorization was failing intermittently. The automatically generated thread dump showed a faulty connection. The problem was traced to the credit card authorization end, and was resolved.
How and Why did DiagnoseNow help?
Without the thread dump this problem could not have been solved, and without DiagnoseNow the problem would not have been detected unless the system administrator was able to take thread Dumps- for that to happen the problem would have had to occur during normal business
hours. (The off hours system administrators are Unix technicians with no app server or Java knowledge. )
Slowdown of overall system at midnight
Problem: The entire system slows down at midnight.
Analysis/Resolution: All methods show a slowdown around midnight, degrading system performance.
How and Why did DiagnoseNow help?
DiagnoseNow detected the slowdown, and it was discovered that a large admin program ran at midnight. Splitting up the work in the admin program into 5 chunks, made the performance impact lot smaller.
Slowdown at 9.05 pm Saturday/Sunday evening
Problem: The entire system performance degrades by 50% around 9.05 pm on Saturday/Sunday evening
Analysis/Resolution: The weekend cleaning crew was unplugging one of the appservers, to plug in the vaccum cleaner.
How and Why did DiagnoseNow help?
DiagnoseNow allows method level historical tracking and system level analysis. This allowed quick detection of an overall slowdown. Without system level analysis, a variety of alerts may get triggered, but the root cause may not be identified.
SURVEY
Your Name(Required to get the prize):
Your role: Developer/IT Administrator/Manager/ App server
administrator/Software QA
Email address(Required to get the prize):
Phone number(optional):
Place a tick mark against the question:
1. Reducing application maintenance cost is important to me.
Disagree Somewhat disagree Neutral Somewhat Agree
Strongly Agree
2. Triggering a thread dump based on specific conditions is an
important feature
Disagree Somewhat disagree Neutral Somewhat Agree
Strongly Agree
3. Tracking each and every session/transaction down to the
method level is an important feature
Disagree Somewhat disagree Neutral Somewhat Agree
Strongly Agree
4. Rapidly localizing and diagnosing a problem is important to
me
Disagree Somewhat disagree Neutral Somewhat Agree
Strongly Agree
5. Creating alerts based on overall transaction performance is
important to me
Disagree Somewhat disagree Neutral Somewhat Agree
Strongly Agree
7. I can accept a CPU overhead of 8% for extensive monitoring leading to reduced costs.
Disagree Somewhat disagree Neutral Somewhat Agree
Strongly Agree
8. If DiagnoseNow is proven to be a stable system, then I will be willing to pay 1500 dollars per CPU license fee(inclusive of 2
business day email support. )
Disagree Somewhat disagree Neutral Somewhat Agree
Strongly Agree
9. If DiagnoseNow is proven to be a stable system, then I will be willing to pay 7500 dollars per CPU license fee(inclusive of
support with 1 hour response time)
Disagree Somewhat disagree Neutral Somewhat Agree
Strongly Agree

Profiling in production is a pipedream.
With modern JVMs and processors, hundreds of thousands of methods will be invoked on multi-CPU machines in just one second. Tracking and analyzing this data is beyond the power of the fastest database.
To analyze one hour of data, 360 million methods will have to be handled for a 4 CPU Pentium/Xeon machine.
This is clearly impossible to do in real life, with current hardware. May be 5 to 10 years from now, things will be better- however, by then CPUs will be processing many more methods per second...
I think it is a nice ACADEMIC project!

Similar Messages

  • Help me with my survy for my projeect

    I am doing this survy for my professor- I am at Bethedsa community college. I am already behind on this survey- so I will appreciate if you guys can quickly look at the survey file- One lucky winner will get $50 gift coupon at amazon.com
    We are building a better version of JVM which will allow profiling in production. This technology, if feasible and successful may be ported to commercial application servers such as WebLogic, WebSphere, JBoss and others, with the cooperation of J2EE vendors.
    In this document, we will be calling this system- "DiagnoseNow".
    The DiagnoseNow project is in research stage, and we want to adjust the goals of the project to better meet the requirements of the application administrator, designer and IT manager.
    Your inputs will be tremendously appreciated.
    I will appreciate your response- I need to get 20-30 responses-
    before my professor will release my stipend... I am sure you were a
    student once- So I will really really appreciate your inputs. You do
    not have to be complementary or negative to the idea- just be
    unbiased and honest...
    PROFILING AND TRANSACTION TRACKING IN PRODUCTION
    We are building a better version of JVM which will allow profiling
    in production. This technology, if feasible and successful may be
    ported to commercial application servers such as WebLogic,
    WebSphere, JBoss and others, with the cooperation of J2EE vendors.
    In this document, we will be calling this system- "DiagnoseNow".
    The DiagnoseNow project is in research stage, and we want to adjust
    the goals of the project to better meet the requirements of the
    application administrator, designer and IT manager.
    Your inputs will be tremendously appreciated.
    We are giving away one $50 gift certificate at Amazon.com to one
    respondent. We expect about 25-50 responses only- So your odds of
    winning are high.
    The features of this proposed JVM are best explained using an
    example of an ecommerce site.
    Ecommerce site scenario
    Description of system
    Consider a typical ecommerce site with the following features: User
    Validation, Product Search, Shopping Cart Management and Checkout.
    Each user that actually purchases or attempts to purchase a product
    on the website is consider a "Tracking unit" or a "Session". This
    new research JVM will allow the time spent in a
    particular "Sessions" to be tracked at the method level.
    System administrator can if he / she so wishes get a report with
    the following columns:
    Session ID, MethodName, Time spent in the method(inclusive of
    called methods), Time spent in the method(excluding called methods)
    Put simply, the goal is to support session level tracking and
    profiling at the method level in the JVM itself.
    This will allow faster debugging and application turnaround,
    reducing application maintenance cost.
    A production ecommerce site could have millions of users and many
    more transactions per day. We are optimistic about supporting real
    life production sites.
    User Validation
    1. login: This validates the user using user name and password.
    2. logout: This logs the user off.
    3. passwordVerification: Using a database, the password is
    verified.
    4. retrievalOfLostPassword: If the user has lost his/her
    password the password is emailed to the user.
    Product search
    1. byname: Search product catalog by name.
    2. byDescription: Search product catalog by Description
    3. bySku: Search product catalog by SKU
    4. byBrand: Search product catalog by brand
    5. Shopping Cart
    6. add: Adds items to the cart
    7. remove: Removes Items from the cart.
    8. update: Updates Items from the cart.
    9. checkout: Checkout items from the cart, by asking for credit
    card. .
    10. retrievePastData: Retrieve user information from the past.
    11. validateCreditCard: Validate credit Card by checking with
    the bank.
    12. sendConfirmationEmail: Send Email confirming the purchase.
    13. sendConfirmationEmailShipping: Send Email confirming that
    the product has shipped.
    14. sendSurveyEmail: Send Email checking customer satisfaction.
    What is a "Transaction" or a "Tracking Unit" or a "Session"?
    Each user who searches the product catalog is considered a "Tracking
    unit" or sessions. A session ends when the users leaves the website.
    Transaction tracking/ reporting data at method level
    Time spent by each user, in each and every method above is tracked
    in two ways: Time spent in a method itself, Time spent in the method
    and the called methods. This will be done for each and every
    invocation of the method.
    Email alerts
    Emails can be generated whenever a particular method(eg.
    sendSurveyEmail) takes longer than a specified threshold.
    Analysis Reports
    Analysis can be done on a variety of topics: Reasons for abandoning
    shopping carts, Slow or underperforming parts of the application.
    Thread dumps
    If a particular method runs slower than a threshold value, then
    optionally a thread dump may be taken and stored. In this way, even
    if the slowdown occurs at midnight, the thread dump will still be
    available.
    Triggered heap profile
    Similarly, if the system is running out of heap memory a heap
    profiler may become active. Heap profile may also be taken
    periodically, to allow analysis of heap growth.
    The system is best explained using a few examples:
    Slowdown in search-books
    Problem: Analysis of sessions shows that a large number of
    customers are browsing for books, but conversion to actual sales is
    slow.
    Analysis: The book database has grown in size, and the server
    running the database has many more apps on it. Moving the database
    to another machine solved the problem.
    How and Why did DiagnoseNow help?
    DiagnoseNow maintains history of all sessions. The history was
    analyzed to show customers who were not converting to purchases- a
    large proportion of them were searching for books, and abandoning
    the site afterwards.
    Slowdown in search-general
    Problem: Search has slowed down for all products.
    Analysis and Resolution: Analysis showed that all search methods
    are taking 250% longer than normal. The slowdown happened after a
    specific date- it was the date on which the OS was upgraded. Rolling
    back the upgrade and reinstalling it properly resolved the issue.
    How and Why did DiagnoseNow help?
    DiagnoseNow maintains a baseline of past search method response
    times. So when a slowdown happens, there is no time
    wasted "apportioning blame" or debating whether a problem exists.
    Credit card authorization- intermittent failure
    Problem: Credit card authorization was failing intermittenty after
    hours
    Analysis/Resolution: Credit card authorization was failing
    intermittently. The automatically generated thread dump showed a
    faulty connection. The problem was traced to the credit card
    authorization end, and was resolved.
    How and Why did DiagnoseNow help?
    Without the thread dump this problem could not have been solved, and
    without DiagnoseNow the problem would not have been detected unless
    the system administrator was able to take thread Dumps- for that to
    happen the problem would have had to occur during normal business
    hours. (The off hours system administrators are Unix technicians
    with no app server or Java knowledge. )
    Slowdown of overall system at midnight
    Problem: The entire system slows down at midnight.
    Analysis/Resolution: All methods show a slowdown around midnight,
    degrading system performance.
    How and Why did DiagnoseNow help?
    DiagnoseNow detected the slowdown, and it was discovered that a
    large admin program ran at midnight. Splitting up the work in the
    admin program into 5 chunks, made the performance impact lot
    smaller.
    Slowdown at 9.05 pm Saturday/Sunday evening
    Problem: The entire system performance degrades by 50% around 9.05
    pm on Saturday/Sunday evening
    Analysis/Resolution: The weekend cleaning crew was unplugging one
    of the appservers, to plug in the vaccum cleaner.
    How and Why did DiagnoseNow help?
    DiagnoseNow allows method level historical tracking and system level
    analysis. This allowed quick detection of an overall slowdown.
    Without system level analysis, a variety of alerts may get
    triggered, but the root cause may not be identified.
    SURVEY
    Your Name(Required to get the prize):
    Your role: Developer/IT Administrator/Manager/ App server
    administrator/Software QA
    Email address(Required to get the prize):
    Phone number(optional):
    Place a tick mark against the question:
    1. Reducing application maintenance cost is important to me.
    Disagree Somewhat disagree Neutral Somewhat Agree
    Strongly Agree
    2. Triggering a thread dump based on specific conditions is an
    important feature
    Disagree Somewhat disagree Neutral Somewhat Agree
    Strongly Agree
    3. Tracking each and every session/transaction down to the
    method level is an important feature
    Disagree Somewhat disagree Neutral Somewhat Agree
    Strongly Agree
    4. Rapidly localizing and diagnosing a problem is important to
    me
    Disagree Somewhat disagree Neutral Somewhat Agree
    Strongly Agree
    5. Creating alerts based on overall transaction performance is
    important to me
    Disagree Somewhat disagree Neutral Somewhat Agree
    Strongly Agree
    6. If DiagnoseNow is proven to be a stable system, then I will
    be willing to pay 1500 dollars per CPU license fee
    Disagree Somewhat disagree Neutral Somewhat Agree
    Strongly Agree
    7. I can accept a CPU overhead of 8% for extensive monitoring
    leading to reduced costs.
    Disagree Somewhat disagree Neutral Somewhat Agree
    Strongly Agree
    8. If DiagnoseNow is proven to be a stable system, then I will
    be willing to pay 1500 dollars per CPU license fee(inclusive of 2
    business day email support. )
    Disagree Somewhat disagree Neutral Somewhat Agree
    Strongly Agree
    9. If DiagnoseNow is proven to be a stable system, then I will
    be willing to pay 7500 dollars per CPU license fee(inclusive of
    support with 1 hour response time)
    Disagree Somewhat disagree Neutral Somewhat Agree
    Strongly Agree

    Profiling in production is a pipedream.
    With modern JVMs and processors, hundreds of thousands of methods will be invoked on multi-CPU machines in just one second. Tracking and analyzing this data is beyond the power of the fastest database.
    To analyze one hour of data, 360 million methods will have to be handled for a 4 CPU Pentium/Xeon machine.
    This is clearly impossible to do in real life, with current hardware. May be 5 to 10 years from now, things will be better- however, by then CPUs will be processing many more methods per second...
    I think it is a nice ACADEMIC project!

  • Could someone help me with a Runtime Error while saving a PDF file?

    While saving a 28 page PDF file in Illustrator today, I got a window saying, "This application has requested the "Runtime" to terminate it in a unusual way." It said to contact the applications support team for more information. I keep getting the same thing each time I try it. Does anyone know how to fix this issue or how I contact the applications support team ?
    Thank you for any insight.
    Pam

    It is a 13.5x11 inch calendar. There are 14 pages with images on them and
    some text. The other pages have text, a grid and a colored background with a
    gaussian blur. I saved each page as an "outline".
    The printer I am using requested I save all pages in a pdf file. I was
    successful in saving all but about six pages, now I can't even open the
    file.
    What happens is... I open Illustrator
                                   I open the pdf file
                                   A window appears that says... Runtime Error,
    This application has requested the Runtime to terminate it in an unusual
    way. Please contact the application's support team for more information.
                                   I select ok
                                   then a window appears that says... Adobe
    Illustrator CS5 has stopped working. A problem caused the program to stop
    working correctly. Windows will close the program and notify you if a
    solution is available.
                                   Then the program closes.
    So far I have not been notified of anything.
    Please let me know if you need more details.
    Thank you so much for helping me with this.
    Pam

  • Can someone pls help me with this code

    The method createScreen() creates the first screen wherein the user makes a selection if he wants all the data ,in a range or single data.The problem comes in when the user makes a selection of single.that then displays the singleScreen() method.Then the user has to input a key data like date or invoice no on the basis of which all the information for that set of data is selected.Now if the user inputs a wrong key that does not exist for the first time the program says invalid entry of data,after u click ok on the option pane it prompts him to enter the data again.But since then whenever the user inputs wrong data the program says wrong data but after displaying the singlescreen again does not wait for input from the user it again flashes the option pane with the invalid entry message.and this goes on doubling everytime the user inputs wrong data.the second wrong entry of data flashes the error message twice,the third wrong entry flashes the option pane message 4 times and so on.What actually happens is it does not wait at the singlescreen() for user to input data ,it straight goes into displaying the JOptionPane message for wrong data entry so we have to click the optiion pane twice,four times and so on.
    Can someone pls help me with this!!!!!!!!!
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.text.*;
    import java.util.*;
    public class MainMenu extends JFrame implements ActionListener,ItemListener{
    //class     
         FileReaderDemo1 fd=new FileReaderDemo1();
         FileReaderDemo1 fr;
         Swing1Win sw;
    //primary
         int monthkey=1,counter=0;
         boolean flag=false,splitflag=false;
         String selection,monthselection,dateselection="01",yearselection="00",s,searchcriteria="By Date",datekey,smonthkey,invoiceno;
    //arrays
         String singlesearcharray[];
         String[] monthlist={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"};
         String[] datelist=new String[31];
         String[] yearlist=new String[100];
         String[] searchlist={"By Date","By Invoiceno"};
    //collection
         Hashtable allinvoicesdata=new Hashtable();
         Vector data=new Vector();
         Enumeration keydata;
    //components
         JButton next=new JButton("NEXT>>");
         JComboBox month,date,year,search;
         JLabel bydate,byinvno,trial;
         JTextField yeartext,invtext;
         JPanel panel1,panel2,panel3,panel4;
         JRadioButton single,range,all;
         ButtonGroup group;
         JButton select=new JButton("SELECT");
    //frame and layout declarations
         JFrame jf;
         Container con;
         GridBagLayout gridbag=new GridBagLayout();
         GridBagConstraints gc=new GridBagConstraints();
    //constructor
         MainMenu(){
              jf=new JFrame();
              con=getContentPane();
              con.setLayout(null);
              fr=new FileReaderDemo1();
              createScreen();
              setSize(500,250);
              setLocation(250,250);
              setVisible(true);
    //This is thefirst screen displayed
         public void createScreen(){
              group=new ButtonGroup();
              single=new JRadioButton("SINGLE");
              range=new JRadioButton("RANGE");
              all=new JRadioButton("ALL");
              search=new JComboBox(searchlist);
              group.add(single);
              group.add(range);
              group.add(all);
              single.setBounds(100,50,100,20);
              search.setBounds(200,50,100,20);
              range.setBounds(100,90,100,20);
              all.setBounds(100,130,100,20);
              select.setBounds(200,200,100,20);
              con.add(single);
              con.add(search);
              con.add(range);
              con.add(all);
              con.add(select);
              search.setEnabled(false);
              single.addItemListener(this);
              search.addActionListener(new MyActionListener());     
              range.addItemListener(this);
              all.addItemListener(this);
              select.addActionListener(this);
         public class MyActionListener implements ActionListener{
              public void actionPerformed(ActionEvent a){
                   JComboBox cb=(JComboBox)a.getSource();
                   if(a.getSource().equals(month))
                        monthkey=((cb.getSelectedIndex())+1);
                   if(a.getSource().equals(date)){
                        dateselection=(String)cb.getSelectedItem();
                   if(a.getSource().equals(year))
                        yearselection=(String)cb.getSelectedItem();
                   if(a.getSource().equals(search)){
                        searchcriteria=(String)cb.getSelectedItem();
         public void itemStateChanged(ItemEvent ie){
              if(ie.getItem()==single){
                   selection="single";     
                   search.setEnabled(true);
              else if (ie.getItem()==all){
                   selection="all";
                   search.setEnabled(false);
              else if (ie.getItem()==range){
                   search.setEnabled(false);
         public void actionPerformed(ActionEvent ae){          
              if(ae.getSource().equals(select))
                        if(selection.equals("single")){
                             singleScreen();
                        if(selection.equals("all"))
                             sw=new Swing1Win();
              if(ae.getSource().equals(next)){
                   if(monthkey<9)
                        smonthkey="0"+monthkey;
                   System.out.println(smonthkey+"/"+dateselection+"/"+yearselection+"it prints this");
                   allinvoicesdata=fr.read(searchcriteria);
                   if (searchcriteria.equals("By Date")){
                        System.out.println("it goes in this");
                        singleinvoice(smonthkey+"/"+dateselection+"/"+yearselection);
                   else if (searchcriteria.equals("By Invoiceno")){
                        invoiceno=invtext.getText();
                        singleinvoice(invoiceno);
                   if (flag == false){
                        System.out.println("flag is false");
                        singleScreen();
                   else{
                   System.out.println("its in here");
                   singlesearcharray=new String[data.size()];
                   data.copyInto(singlesearcharray);
                   sw=new Swing1Win(singlesearcharray);
         public void singleinvoice(String searchdata){
              keydata=allinvoicesdata.keys();
              while(keydata.hasMoreElements()){
                        s=(String)keydata.nextElement();
                        if(s.equals(searchdata)){
                             System.out.println(s);
                             flag=true;
                             break;
              if (flag==true){
                   System.out.println("vector found");
                   System.exit(0);
                   data= ((Vector)(allinvoicesdata.get(s)));
              else{
                   JOptionPane.showMessageDialog(jf,"Invalid entry of date : choose again");     
         public void singleScreen(){
              System.out.println("its at the start");
              con.removeAll();
              SwingUtilities.updateComponentTreeUI(con);
              con.setLayout(null);
              counter=0;
              panel2=new JPanel(gridbag);
              bydate=new JLabel("By Date : ");
              byinvno=new JLabel("By Invoice No : ");
              dateComboBox();
              invtext=new JTextField(6);
              gc.gridx=0;
              gc.gridy=0;
              gc.gridwidth=1;
              gridbag.setConstraints(month,gc);
              panel2.add(month);
              gc.gridx=1;
              gc.gridy=0;
              gridbag.setConstraints(date,gc);
              panel2.add(date);
              gc.gridx=2;
              gc.gridy=0;
              gc.gridwidth=1;
              gridbag.setConstraints(year,gc);
              panel2.add(year);
              bydate.setBounds(100,30,60,20);
              con.add(bydate);
              panel2.setBounds(170,30,200,30);
              con.add(panel2);
              byinvno.setBounds(100,70,100,20);
              invtext.setBounds(200,70,50,20);
              con.add(byinvno);
              con.add(invtext);
              next.setBounds(300,200,100,20);
              con.add(next);
              if (searchcriteria.equals("By Invoiceno")){
                   month.setEnabled(false);
                   date.setEnabled(false);
                   year.setEnabled(false);
              else if(searchcriteria.equals("By Date")){
                   byinvno.setEnabled(false);
                   invtext.setEnabled(false);
              monthkey=1;
              dateselection="01";
              yearselection="00";
              month.addActionListener(new MyActionListener());
              date.addActionListener(new MyActionListener());
              year.addActionListener(new MyActionListener());
              next.addActionListener(this);
              invtext.addKeyListener(new KeyAdapter(){
                   public void keyTyped(KeyEvent ke){
                        char c=ke.getKeyChar();
                        if ((c == KeyEvent.VK_BACK_SPACE) ||(c == KeyEvent.VK_DELETE)){
                             System.out.println(counter+"before");
                             counter--;               
                             System.out.println(counter+"after");
                        else
                             counter++;
                        if(counter>6){
                             System.out.println(counter);
                             counter--;
                             ke.consume();
                        else                    
                        if(!((Character.isDigit(c) || (c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)))){
                             getToolkit().beep();
                             counter--;     
                             JOptionPane.showMessageDialog(null,"please enter numerical value");
                             ke.consume();
              System.out.println("its at the end");
         public void dateComboBox(){          
              for (int counter=0,day=01;day<=31;counter++,day++)
                   if(day<=9)
                        datelist[counter]="0"+String.valueOf(day);
                   else
                        datelist[counter]=String.valueOf(day);
              for(int counter=0,yr=00;yr<=99;yr++,counter++)
                   if(yr<=9)
                        yearlist[counter]="0"+String.valueOf(yr);
                   else
                        yearlist[counter]=String.valueOf(yr);
              month=new JComboBox(monthlist);
              date=new JComboBox(datelist);
              year=new JComboBox(yearlist);
         public static void main(String[] args){
              MainMenu mm=new MainMenu();
         public class WindowHandler extends WindowAdapter{
              public void windowClosing(WindowEvent we){
                   jf.dispose();
                   System.exit(0);
    }     

    Hi,
    I had a similar problem with a message dialog. Don't know if it is a bug, I was in a hurry and had no time to search the bug database... I found a solution by using keyPressed() and keyReleased() instead of keyTyped():
       private boolean pressed = false;
       public void keyPressed(KeyEvent e) {
          pressed = true;
       public void keyReleased(KeyEvent e) {
          if (!pressed) {
             e.consume();
             return;
          // Here you can test whatever key you want
       //...I don't know if it will help you, but it worked for me.
    Regards.

  • Can anyone help me with Magicjack? after I purchased US number I am unable to log in on my Iphone, I keep getting an error "YOUR DEVICE IS NOT ON THIS ACCOUNT" I contacted MJ support but they are very much useless and dont know how to fix it!

    can anyone help me with Magicjack? after I purchased US number I am unable to log in on my Iphone, I keep getting an error "YOUR DEVICE IS NOT ON THIS ACCOUNT" I contacted MJ support but they are very much useless and dont know how to fix it!

    There's a whole lot to read in your post, and frankly I have not read it all.
    Having said that, this troubleshooting guide should help:
    http://support.apple.com/kb/TS1538
    In particular, pay attention to the mobile device support sections near the bottom, assuming you have already done the items above it.

  • Hello, we have both Creative Cloud and Creative Cloud for teams. Can you help me with the difference and if i need to have both?

    Hello, we have both Creative Cloud membership and Creative Cloud for team. Can you help me with the difference and if i need to have both? We have 9 employees that are using it. Just not sure if i'm paying for something i don't need.
    Thank you

    Please refer to Creative Cloud Help | Creative Cloud / Common Questions
    CC is for retail use with 20 GB of storage space, CCT is where number of seats are purchased & assigned by one program admin where each seat gets 100GB of storage space.
    You can not have both the CC & team in one account as it will only provide you added storage space of 120 GB but you can activate the CC any of them or either of them twice as CC is based on Adobe ID.
    Regards
    Rajshree

  • HELP me with my K7N2 delta ilsr

    Can anyone help me with this problem. I have just upgraded to MSI's K7N2 delta ilsr motherboard. Its all working quite well apart from the fact that the pc wont start up from cold....at all.
    When I start the pc from an off state, it runs up the fans and drives, but does not post.
    The diagnostic led pannel on the back of the pc shows that the cpu is faulty or not installed correctly.
    If I then press the reset button, the pc posts, and boots up just fine.
    It does this EVERY time I start up.
    I have tried re installing the cpu, which is an XP 2800+ 333 barton, but to no avail.
    I have asked a few questions on other forums, but I cant solve it.
    These are the suggestions so far.
    1. the psu (I have a Tsunami 400 atx psu) could not be giving out enough power on initial startup, but once the pc is running, it has enough to boot the pc from a reset.
    2. The mobo or the bios could be at fault. I have not flashed the bios, or upgraded it in any way from original, so is there an issue with the original bios on these boards, and 2800 barton chips??? Could it be a mobo fault? The pc runs fine once the machine is booted.? how do I test it?
    3. The cpu could be faulty? but would this not stop it running fuull stop?
    4. my ram. I have a single stick of OCZ 512mb pc3200 ddr, which I was told would make the pc fly. Not shure on that statement, but is this ram compatible?? could this be the problem?
    Im fairly new to the upgrade side of things, and I need some help with this one.
    Also, Id be really greatfull if some one could talk me through flashing my bios to the latest version, as the thought of doing this narks me a bit...I dont want to mess it up and get a dead pc...
    HELP

    +3.3v 14A
    +5v 28A
    +12v 16A
    +5vsb 2A
    -5v 0.5A
    -12v 0.8A
    Hope this helps, as my pc seems to be living with its case off a lot these days..haha

  • Pls Help me with steps to add data from xml file to SAP B1 through B1iSN.

    Pls Help me with steps to add data from xml file to SAP B1 through B1iSN. I  am getting stuck in xsl transformation. not able to understand where the mapping code needs to be added.
    Pls explain me the steps for adding data from xml to B1 quotation step by step.
    thanks and regards
    Priya

    Hi,
    Have you checked this: https://sap.na.pgiconnect.com/p45508295/?launcher=false&fcsContent=true&pbMode=normal ?
    Thanks,
    Gordon

  • My MacBook Pro iTunes movie purchase is not showing in iTunes store movie purchases nor does it show on my iPad or Apple TV.  Can someone please help me with a solution?  Thanks.

      First of all, I live in Ho Chi Minh City, Vietnam. Sometimes, I use a VPN to search on the web here. I purchased Toy Story 3 on my MacBook Pro 2011 OS/X - Lion through iTunes.  I initially had trouble downloading it which may be due to being on and off the VPN but after a while it finally downloaded and shows up in my iTunes library on my MacBook. 
      Under my Apple ID account (which is the only Apple ID account I have), I look under purchase history and it shows that I paid for Toy Story which is where I got my Order # from.  But if you go to the iTunes Store then to the Quick Links then click on Purchased, under all my Movies, it does NOT show Toy Story 3 as one of my movies.
      Now when I go to my iPad (3rd gen.), Toy Story 3 does not show up under purchased movies (all or not on my iPad).  It does not show up on my Apple TV as well.  If I want to have Toy Story 3 on my iPad or Apple TV, then it says I have to purchase it again.
      I have searched for help via Apple support communities but so far none of their solutions have worked for me.  I have tried logging off iTunes & App Store on iPad and also shutting down the iPad.  I also made sure that under iTunes Preferences>Store that iTunes in the Clouds purchases is checked. Can someone please help me with this?  Your consideration is greatly appreciated.  Thanks.

    Thanks King_Penguin for taking time to read and reply. 
    I just purchased this movie on Thursday, May 15, so just a few days ago.  I have never had any trouble whatsoever since I have been in Vietnam.  I have downloaded several movies and even music and they have all synced to my respected Apple products except for this purchase. 
    Sorry, I don't quite understand what you mean by studios and different versions.  Could you please explain? 
    I checked my purchased list in my purchase history under my account and there are no hidden items. 

  • HELP NEEDED WITH ADDAPTER-DVI TO VGA.

    PLEASE ...HELP NEEDED WITH WIRING CROSS OVER....CAN YOU HELP WITH BACK OF PLUG CONNECTIONS...I SORTA UNDERSTAND THE PINOUTS BUT CANT MAKE AN EXACT MACH...WOULD LIKE TO BE 100% SURE...
    ......THIS ENSURES NO SMOKE!!!                                                                                           
    THE CARD IS AN ATI RADEON RX9250-DUAL HEAD-.........ADDAPTER IS DVI(ANALOG)MALE TO VGA(ANALOG)FEMALE.
    ANY HELP VERY MUCH APPRECIATED........ SEEMS YOU NEED TO BE ROCKET SCI TO ATTACH A BLOODY PICTURE...SO THIS HAS BEEN BIG WASTE OF FING TIME!

    Quote from: BOBHIGH on 17-December-05, 09:21:31
    Get over it mate !
    I find it easy t read CAPS...and if you dont like it ...DONT READ IT!
    And why bother to reply...some people have nothing better to do.
    Yes there chep and easy to come by...Ive already got a new one.
    All I wanted was to make a diagram of whats inside the bloody thing...it was a simple question and required a simple answer.
    NO NEED TO A WANKA !!
    I feel a bann comming up.
    Have you tryed Google ? really.. your question is inrelevant. No need to reply indeed.
    Why do you come here asking this question anyway ? is it becouse you have a MSI gfx card ? and the adapter has nothing to do with this ?
    You think you can come in here yelling.. thinking we have to put up with it and accept your style of posting. This is not a MSI tech center.. it's a user to user center.. Your question has nothing to do with MSI relavant things anyway's.
    Google = your friend.
    Quote from: BOBHIGH on 17-December-05, 09:21:31
    it was a simple question and required a simple answer
    Simple for who ? you (buying a new one) ? me ? we ?   .really...........
    Quote from: Dynamike on 16-December-05, 04:11:48
    1: There are allot of diffrent types of those adapters.
    If any of the mods have a problem about my reply.. please pm me.

  • Help needed with Vista 64 Ultimate

    "Help needed with Vista 64 UltimateI I need some help in getting XFI Dolby digital to work
    Okay so i went out and I bought a yamaha 630BL reciever, a digital coaxial s/pdif, and a 3.5mm phono plug to fit perfectly to my XFI Extreme Music
    -The audio plays fine and reports as a PCM stream when I play it normally, but I can't get dolby digital or DTS to enable for some reason eventhough I bought the DDL & DTS Connect Pack for $4.72
    When I click dolby digital li've in DDL it jumps back up to off and has this [The operation was unsuccessful. Please try again or reinstall the application].
    Message Edited by Fuzion64 on 03-06-2009 05:33 AMS/PDIF I/O was enabled under speakers in control panel/sound, but S/PDIF Out function was totally disabled
    once I set this to enabled Dolby and DTS went acti've.
    I also have a question on 5. and Vista 64
    -When I game I normally use headphones in game mode or 2. with my headphones, the reason for this is if I set it on 5. I get sounds coming out of all of the wrong channels.
    Now when I watch movies or listen to music I switch to 5. sound in entertainment mode, but to make this work properly I have to open CMSS-3D. I then change it from xpand to stereo and put the slider at even center for 50%. If I use the default xpand mode the audio is way off coming out of all of the wrong channels.
    How do I make 5. render properly on vista

    We ended up getting iTunes cleanly uninstalled and were able to re-install without issue.  All is now mostly well.
    Peace...

  • Help needed with itunes

    help needed with itunes please tryed to move my itunes libary to my external hard drive itunes move ok and runs fin but i have none of my music or apps or anything all my stuff is in the itunes folder on my external hard drive but there is nothing on ituns how do i get it back help,please

    (Make sure the Music (top left) library is selected before beginning this.)
    If you have bad song links in your library, hilite them and hit the delete button. Then locate the folder(s) where your music is located and drag and drop into the large library window in iTunes ( where your tracks show up). This will force the tunes into iTunes. Before you start, check your preferences in iTunes specifically under the"Advanced" tab, general settings. I prefer that the 1st 2 boxes are unchecked. (Keep iTunes Music folder organized & Copy files to iTunes Music folder when adding to library). They are designed to let iTunes manage your library. I prefer to manage it myself. Suit yourself. If there is a way for iTunes to restore broken links other than locating one song at a time I haven't found it yet. (I wish Apple would fix this, as I have used that feature in other apps.) This is the way I do it and I have approx. 25,000 songs and podcasts and videos at present. Hope this helps.

  • Urgent help needed with un-removable junk mail that froze Mail!!

    Urgent help needed with un-removable junk mail that froze Mail?
    I had 7 junk mails come in this morning, 5 went straight to junk and 2 more I junked.
    When I clicked on the Junk folder to empty it, it froze Mail and I can't click on anything, I had to force quit Mail and re-open it. When it re-opens the Junk folder is selected and it is froze, I can't do anything.
    I repaired permissions, it did nothing.
    I re-booted my computer, on opening Mail the In folder was selected, when I selected Junk, again, it locks up Mail and I can't select them to delete them?
    Anyone know how I can delete these Junk mails from my Junk folder without having to open Mail to do it as it would appear this will be the only solution to the problem.

    Hi Nigel
    If you hold the Shift key when opening the mail app, it will start up without any folders selected & no emails showing. Hopefully this will enable you to start Mail ok.
    Then from the Mail menus - choose Mailbox-Erase Junk Mail . The problem mail should now be in the trash. If there's nothing you want to retain from the Trash, you should now choose Mailbox- Erase Deleted Messages....
    If you need to double-check the Trash for anything you might want to retain, then view the Trash folder first, before using Erase Junk Mail & move anything you wish to keep to another folder.
    The shift key starts Mail in a sort of Safe mode.

  • Can you help me with mouse pressed method please?

    hi
    can you help me with my problem please, player label doesn't show up in the applet and the draw string method it doesn't draw any strings like X or O for the game I don't know what is the problem maybe it is with MousePressed method which is in Board class. I tried to write the code of the location many times I'm not sure if the problem comes from there.
    there is no error in my code, but it doesn't work.
    this is class Board which has the mouseListener
    class Board extends JPanel  implements MouseListener, MouseMotionListener
        private JLabel playerlabel; 
         private boolean play;
         private boolean start;
        private int turn; 
        private Square squares[][];
      private Player myplayer[][];
         public Board()
              setBackground( Color.WHITE );
              playerlabel = new JLabel( "X player first" );
              //playerlabel.setLayout(null);
         //     playerlabel.setLocation(500,500);
              add( playerlabel );
              play = true;
              turn = 1;
             squares = new Square[3][3];
             myplayer = new Player[3][3];
             int x = 40;
              int y = 40;
              for (int i=0; i<3; i++){
                   x = 40;
                   for (int j=0; j<3; j++){
                        Square s = new Square( x,y );
                        squares[i][j] = s;
                        x +=50;
                   y +=50;
                this.addMouseListener(this);
            this.addMouseMotionListener(this);
          public void mouseClicked( MouseEvent event ){}
          public void mouseMoved( MouseEvent event ){}
          public void mouseEntered( MouseEvent event ){}
          public void mouseExited( MouseEvent event ){}
          public void mousePressed( MouseEvent event )
          {int xPos = event.getX();
                  int yPos = event.getY();
                    if(play && turn ==1){
                    for (int i=0; i<3; i++){
                        for (int j=0; j<3; j++){
                             int x = squares[i][j].getX();
                             int y = squares[i][j].getY();
                             if(xPos> x && xPos<x+40&& yPos> y && yPos<y+40){
                                  if( squares[i][j].getOccupied() ==0 ){
                                       String ptext;
                                       ptext = "X";
                                       Player p = new Player(x, y,ptext);
                                       myplayer[i][j] = p;
                                       squares[i][j].setOccupied(1);
                                       playerlabel.setText( "O Player Turn" );
                                       turn = 2;
                                       repaint();
                                       Win();
                                  else{
                                       turn = 2;
                                       playerlabel.setText( "O Player Turn" );
                                       repaint();
              if ( play && turn ==2 )
    for (int i=0; i<3; i++){
                        for (int j=0; j<3; j++){
                             int x = squares[i][j].getX();
                             int y = squares[i][j].getY();
                             if(xPos> x && xPos<x+40&& yPos> y && yPos<y+40){
                                  if( squares[i][j].getOccupied() ==0 ){
                                       String ptext;
                                       ptext = "O";
                                       Player p = new Player(x, y,ptext);
                                       myplayer[i][j] = p;
                                       squares[i][j].setOccupied(2);
                                       playerlabel.setText( "X Player Turn" );
                                       turn = 1;
                                       repaint();
                                       Win();
                                  else{
                                       turn = 1;
                                       playerlabel.setText( "X Player Turn" );
                                       repaint();
          public void mouseReleased( MouseEvent event )
          public void mouseDragged( MouseEvent event )
         public void Win(){
              if(squares[0][0].getOccupied() == squares[0][1].getOccupied() &&squares[0][1].getOccupied()==squares[0][2].getOccupied() &&squares[0][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else if (squares[1][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[1][2].getOccupied() &&squares[1][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else      if(squares[2][0].getOccupied() == squares[2][1].getOccupied() &&squares[2][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
                   if(squares[0][0].getOccupied() == squares[0][1].getOccupied() &&squares[0][1].getOccupied()==squares[0][2].getOccupied() &&squares[0][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else if (squares[1][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[1][2].getOccupied() &&squares[1][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else      if(squares[2][0].getOccupied() == squares[2][1].getOccupied() &&squares[2][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              //Vertically win
               if (squares[0][0].getOccupied() == squares[1][0].getOccupied() &&squares[1][0].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else if (squares[0][1].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][1].getOccupied() &&squares[2][1].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else      if(squares[0][2].getOccupied() == squares[1][2].getOccupied() &&squares[1][2].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
               if (squares[0][0].getOccupied() == squares[1][0].getOccupied() &&squares[1][0].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else if (squares[0][1].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][1].getOccupied() &&squares[2][1].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else      if(squares[0][2].getOccupied() == squares[1][2].getOccupied() &&squares[1][2].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              //Diagonal win
                    if (squares[0][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else if (squares[0][2].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
               if (squares[0][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else if (squares[0][2].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
         }//end win
    public void setTurn(int t)
              turn = t;
              playerlabel.setText( "X Player Plays First" );
         public void paintComponent( Graphics g )
               super.paintComponent( g );
               this.setBackground( Color.WHITE );
              for (int i=0; i<3; i++){
                   for (int j=0; j<3; j++){
                        g.setColor( Color.BLACK );
                         g.drawRect( squares[i][j].getX(), squares[i][j].getY(), 50, 50 );     
               for (int i=0; i<3; i++){
                   for (int j=0; j<3; j++){
                         myplayer[i][j].draw(g);     
            //End of paintComponent   
    }and this is the whole code of my program.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    class Player{
         private int xCoordinate;
         private int yCoordinate;
        private String playerText;
      public   Player(int x, int y, String t)
            playerText = t;
            xCoordinate = x;
            yCoordinate = y;
        public void draw(Graphics g)
               g.drawString(playerText,  xCoordinate, yCoordinate);
         public void SetText(String t)
         { playerText = t;
    }//end player
    class Square
         private int x;
         private int y;
         private int occupied;
         public Square(int x1, int y1)
              x = x1;
              y= y1;
              occupied = 0;
         public void setX(int x1)
              x = x1;
         public int getX()
              return x;
         public void setY(int y1)
              y = y1;
         public int getY()
              return y;
         public void setOccupied(int o)
              occupied = o;
         public int getOccupied()
              return occupied;
    public class TicTac extends JApplet implements ActionListener
    { private JPanel panel;
         private JButton newgame;
         private Board B;
         public void init()
              B = new Board();
              add( B, BorderLayout.CENTER );
              panel = new JPanel();
               newgame = new JButton( "New Game" );
               panel.add( newgame);
               add( panel, BorderLayout.SOUTH );
               newgame.addActionListener(this);
              public void actionPerformed( ActionEvent ev)
               {     Object source = ev.getSource();
         if (source == newgame)
                    {remove(B);
                   repaint();
              B = new Board();
                   add( B, BorderLayout.CENTER );
         B.setTurn(1);
                   repaint();
                   validate();
            }//end class TicTac
    class Board extends JPanel  implements MouseListener, MouseMotionListener
        private JLabel playerlabel; 
         private boolean play;
         private boolean start;
        private int turn; 
        private Square squares[][];
      private Player myplayer[][];
         public Board()
              setBackground( Color.WHITE );
              playerlabel = new JLabel( "X player first" );
              //playerlabel.setLayout(null);
         //     playerlabel.setLocation(500,500);
              add( playerlabel );
              play = true;
              turn = 1;
             squares = new Square[3][3];
             myplayer = new Player[3][3];
             int x = 40;
              int y = 40;
              for (int i=0; i<3; i++){
                   x = 40;
                   for (int j=0; j<3; j++){
                        Square s = new Square( x,y );
                        squares[i][j] = s;
                        x +=50;
                   y +=50;
                this.addMouseListener(this);
            this.addMouseMotionListener(this);
          public void mouseClicked( MouseEvent event ){}
          public void mouseMoved( MouseEvent event ){}
          public void mouseEntered( MouseEvent event ){}
          public void mouseExited( MouseEvent event ){}
          public void mousePressed( MouseEvent event )
          {int xPos = event.getX();
                  int yPos = event.getY();
                    if(play && turn ==1){
                    for (int i=0; i<3; i++){
                        for (int j=0; j<3; j++){
                             int x = squares[i][j].getX();
                             int y = squares[i][j].getY();
                             if(xPos> x && xPos<x+40&& yPos> y && yPos<y+40){
                                  if( squares[i][j].getOccupied() ==0 ){
                                       String ptext;
                                       ptext = "X";
                                       Player p = new Player(x, y,ptext);
                                       myplayer[i][j] = p;
                                       squares[i][j].setOccupied(1);
                                       playerlabel.setText( "O Player Turn" );
                                       turn = 2;
                                       repaint();
                                       Win();
                                  else{
                                       turn = 2;
                                       playerlabel.setText( "O Player Turn" );
                                       repaint();
              if ( play && turn ==2 )
    for (int i=0; i<3; i++){
                        for (int j=0; j<3; j++){
                             int x = squares[i][j].getX();
                             int y = squares[i][j].getY();
                             if(xPos> x && xPos<x+40&& yPos> y && yPos<y+40){
                                  if( squares[i][j].getOccupied() ==0 ){
                                       String ptext;
                                       ptext = "O";
                                       Player p = new Player(x, y,ptext);
                                       myplayer[i][j] = p;
                                       squares[i][j].setOccupied(2);
                                       playerlabel.setText( "X Player Turn" );
                                       turn = 1;
                                       repaint();
                                       Win();
                                  else{
                                       turn = 1;
                                       playerlabel.setText( "X Player Turn" );
                                       repaint();
          public void mouseReleased( MouseEvent event )
          public void mouseDragged( MouseEvent event )
         public void Win(){
              if(squares[0][0].getOccupied() == squares[0][1].getOccupied() &&squares[0][1].getOccupied()==squares[0][2].getOccupied() &&squares[0][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else if (squares[1][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[1][2].getOccupied() &&squares[1][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else      if(squares[2][0].getOccupied() == squares[2][1].getOccupied() &&squares[2][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
                   if(squares[0][0].getOccupied() == squares[0][1].getOccupied() &&squares[0][1].getOccupied()==squares[0][2].getOccupied() &&squares[0][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else if (squares[1][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[1][2].getOccupied() &&squares[1][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else      if(squares[2][0].getOccupied() == squares[2][1].getOccupied() &&squares[2][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              //Vertically win
               if (squares[0][0].getOccupied() == squares[1][0].getOccupied() &&squares[1][0].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else if (squares[0][1].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][1].getOccupied() &&squares[2][1].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else      if(squares[0][2].getOccupied() == squares[1][2].getOccupied() &&squares[1][2].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
               if (squares[0][0].getOccupied() == squares[1][0].getOccupied() &&squares[1][0].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else if (squares[0][1].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][1].getOccupied() &&squares[2][1].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else      if(squares[0][2].getOccupied() == squares[1][2].getOccupied() &&squares[1][2].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              //Diagonal win
                    if (squares[0][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
              else if (squares[0][2].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 1)
              {playerlabel.setText("Player 1 X WON THE GAME!");
              play =false;          }
               if (squares[0][0].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][2].getOccupied() &&squares[2][2].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
              else if (squares[0][2].getOccupied() == squares[1][1].getOccupied() &&squares[1][1].getOccupied()==squares[2][0].getOccupied() &&squares[2][0].getOccupied() == 2)
              {playerlabel.setText("Player 2 O WON THE GAME!");
              play =false;          }
         }//end win
    public void setTurn(int t)
              turn = t;
              playerlabel.setText( "X Player Plays First" );
         public void paintComponent( Graphics g )
               super.paintComponent( g );
               this.setBackground( Color.WHITE );
              for (int i=0; i<3; i++){
                   for (int j=0; j<3; j++){
                        g.setColor( Color.BLACK );
                         g.drawRect( squares[i][j].getX(), squares[i][j].getY(), 50, 50 );     
               for (int i=0; i<3; i++){
                   for (int j=0; j<3; j++){
                         myplayer[i][j].draw(g);     
            //End of paintComponent   
            Edited by: mshadows on May 18, 2008 7:53 AM

    I was playing with this a little bit and came up with this game model, something that I'm sure can be improved upon greatly:
    TttXO.java
    an enum to encapsulate X vs O. I could use a boolean here since it has 2 states, but this seems more intuitive to me
    package dy08.m05.ttt;
    * tic tac toe encapsulation of X vs O
    * @author Pete
    public enum TttXO
        X, O
    }TttCell.java
    encapsulates an individual cell in the tictactoe grid.
    package dy08.m05.ttt;
    * Tic Tac Toe Game cell
    * can be occupied or not
    * can hold TttXO X or O or null 
    * @author Pete
    public class TttCell
        private boolean occupied = false;
        private TttXO xo = null;
        public TttCell()
         * sets a Square for either x or o
         * @param TttXO
         * @return true if successful, false if already occupied
        public boolean setXO(TttXO xo)
            if (occupied)
                return false;
            else
                occupied = true;
                this.xo = xo;
                return true;
        public void reset()
            occupied = false;
            xo = null;
        public boolean isOccupied()
            return occupied;
        public TttXO getXO()
            return xo;
        // used to test and debug the class
        public String toString()
            if (occupied)
                return xo.toString();
            else
                return "-";
    package dy08.m05.ttt;
    * Tic Tac Toe game model
    * @author Pete
    public class TttGameModel
        private TttCell[][] cellGrid = new TttCell[3][3];
        private boolean xTurn = true;
        private boolean win = false;
        public TttGameModel()
            for (int i = 0; i < cellGrid.length; i++)
                for (int j = 0; j < cellGrid.length; j++)
    cellGrid[i][j] = new TttCell();
    public void reset()
    xTurn = true;
    win = false;
    for (int i = 0; i < cellGrid.length; i++)
    for (int j = 0; j < cellGrid[i].length; j++)
    cellGrid[i][j].reset();
    public boolean isXTurn()
    return xTurn;
    public boolean isWin()
    return win;
    * @param row
    * @param col
    * @return true if valid move, false if game already over or cell occupied
    public boolean takeTurn(int col, int row)
    TttXO currentXO = TttXO.O;
    TttCell cell = cellGrid[row][col];
    if (win)
    return false;
    if (cell.isOccupied())
    return false;
    if (xTurn)
    currentXO = TttXO.X;
    cell.setXO(currentXO);
    win = checkWin(col, row, currentXO);
    xTurn = !xTurn; // toggle xturn
    return true;
    public boolean checkWin(int col, int row, TttXO xo)
    boolean win = false;
    // first rows and columns
    boolean temp = true;
    for (int i = 0; i < 3; i++)
    temp &= cellGrid[row][i].getXO() == xo;
    win |= temp;
    temp = true;
    for (int i = 0; i < 3; i++)
    temp &= cellGrid[i][col].getXO() == xo;
    win |= temp;
    if (row == col) // if slash diagonal
    temp = true;
    for (int i = 0; i < 3; i++)
    temp &= cellGrid[i][i].getXO() == xo;
    win |= temp;
    if (row + col == 2) // if backslash diagonal
    temp = true;
    for (int i = 0; i < 3; i++)
    temp &= cellGrid[i][2 - i].getXO() == xo;
    win |= temp;
    return win;
    // used to test and debug the class
    public String toString()
    StringBuilder sb = new StringBuilder();
    for (int i = 0; i < cellGrid.length; i++)
    for (int j = 0; j < cellGrid[i].length; j++)
    sb.append(cellGrid[i][j] + " ");
    sb.append("\n");
    if (win)
    sb.append("win! Game over");
    else
    sb.append("No winner yet");
    return sb.toString();
    // test the class
    public static void main(String[] args)
    TttGameModel model = new TttGameModel();
    checkMove(model, 0, 0);
    checkMove(model, 1, 0);
    checkMove(model, 1, 1);
    checkMove(model, 2, 0);
    checkMove(model, 1, 0); // bad move
    checkMove(model, 2, 2);
    // to test the class
    private static void checkMove(TttGameModel model, int i, int j)
    System.out.println("OK move: " + model.takeTurn(i, j));
    System.out.println(model + "\n");

  • Can you help me with an jsp execption please?

    Hello!
    Could you please try to help me with this code
    that brings me an exception?
    this is the jsp page :
    <%@ page import="java.io.*,javax.servlet.http.HttpServletRequest,javax.servlet.ServletInputStream" %>
    <%@ page import="java.io.FileWriter,java.io.IOException" %>
    <%
        String savePath = "", filepath = "", filename = "";
        String contentType = "", fileData = "", strLocalFileName = "";
        int startPos = 0;
        int endPos = 0;
    %>
    <%!
        temp data buffer
        void copyByte(byte [] fromBytes, byte [] toBytes, int start, int len){
           for(int i=start;i<(start+len);i++)
              toBytes[i - start] = fromBytes;
    %>
    <%
    int BOF = 0, EOF = 0;
    contentType = request.getContentType();
    out.println("<br>Content type is :: " +contentType);
    if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) {
         DataInputStream in = new DataInputStream(request.getInputStream());
         DataInputStream in1 = in;
         int formDataLength = request.getContentLength();
         byte dataBytes[] = new byte[formDataLength];
         int byteRead = 0;
         int totalBytesRead = 0;
         while (totalBytesRead < formDataLength){     
              byteRead = in1.read(dataBytes, totalBytesRead, formDataLength);
              totalBytesRead += byteRead;
         out.println("<br>totalBytesRead : " + totalBytesRead + " : formDataLength = " + formDataLength);
         byte[] line = new byte[128];
         if (totalBytesRead < 3){
         return;     //exit if file length is not sufficiently large
         String boundary = "";
         String s = "";
         int count = 0;          
         int pos = 0;
         do{
         copyByte(dataBytes, line, count ,1);     //read 1 byte at a time
         count+=1;
         s = new String(line, 0, 1);
         fileData = fileData + s;
         pos = fileData.indexOf("Content-Disposition: form-data; name=\""); //set the file name
         if(pos != -1)
         endPos = pos;
         }while(pos == -1);
         boundary = fileData.substring(startPos, endPos);
         startPos = endPos;
         do{
         copyByte(dataBytes, line, count ,1);     //read 1 byte at a time
         count+=1;
         s = new String(line, 0, 1);
         fileData = fileData + s;
         pos = fileData.indexOf("filename=\"", startPos); //set the file name
         if(pos != -1)
    startPos = pos;
         }while(pos == -1);                         
         do{
         copyByte(dataBytes, line, count ,1);     //read 1 byte at a time
         count+=1;
         s = new String(line, 0, 1);
         fileData = fileData + s;
         pos = fileData.indexOf("Content-Type: ", startPos);
         if(pos != -1)
              endPos = pos;                              
         }while(pos == -1);
         filename = fileData.substring(startPos + 10, endPos - 3);     //to eliminate " from start & end
         strLocalFileName = filename;
         int index = filename.lastIndexOf("\\");
         if(index != -1)
         filename = filename.substring(index + 1);
         else
         filename = filename;
         boolean blnNewlnFlag = false;
         startPos = endPos;     //added length of "Content-Type: "
         do{
         copyByte(dataBytes, line, count ,1);     //read 1 byte at a time
         count+=1;
         s = new String(line, 0, 1);
         fileData = fileData + s;               
         pos = fileData.indexOf("\n", startPos);
         if(pos != -1){
              if(blnNewlnFlag == true)
                   endPos = pos;                         
              else{
              blnNewlnFlag = true;
              pos = -1;
         }while(pos == -1);
    contentType = fileData.substring(startPos + 14, endPos);
         startPos = count + 1;
         do{
         copyByte(dataBytes, line, count ,1);     //read 1 byte at a time
         count+=1;
         s = new String(line, 0, 1);
         fileData = fileData + s;
         pos = fileData.indexOf(boundary, startPos);     //check for end of file data i.e boundry value               
         }while(pos == -1);
         endPos = count - boundary.length();
         out.println("<br><br>0. Local File Name = " + strLocalFileName);
         out.println("<br><br>1. filename = " + filename);
         out.println("<br>2. contentType = " + contentType);
         out.println("<br>3. startPos = " + startPos);
         out.println("<br>4. endPos = " + endPos);
         out.println("<br>5. boundary = " + boundary);
         String appPath = application.getRealPath("/");
         out.println("<br>appPath : " + appPath);
         String destFolder = appPath + "images/";
    String name = request.getParameter("signinName").trim();
    String email = request.getParameter("signinEmail").trim();
    String age = request.getParameter("signinAge").trim();
    String passwd = request.getParameter("signinPassword").trim();
    String profile = request.getParameter("signinProfile").trim();
    String type = filename.substring(filename.lastIndexOf("."));
         filename = destFolder + name + type;
         fileOutputStream fileOut = new FileOutputStream(filename);
         fileOut.write(dataBytes, startPos, (endPos - startPos));
         fileOut.flush();
         fileOut.close();
         out.println("<br>File saved as >> " + filename);
         else {
              out.println("Error in uploading ");
    %>
    this is the exception:
    exception
    org.apache.jasper.JasperException: java.lang.NullPointerException
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:382)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:409)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:317)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
         com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
         org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
         com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
         com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
         com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
         com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
         com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
         com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
         com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
    root cause
    java.lang.NullPointerException
         org.apache.jsp.uploadFile_jsp._jspService(uploadFile_jsp.java:190)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:353)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:409)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:317)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
         com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
         com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
         org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
         com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
         com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
         com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
         com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
         com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
         com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
         com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)Thanks a lot !!

    root cause
    java.lang.NullPointerException
         org.apache.jsp.uploadFile_jsp._jspService(uploadFile_jsp.java:190)Some variable is getting null value ..so debug it.
    Best way is to start putting System.out's ....
    System.out.println("Step ############1");
    Put the incremental numbering between several code blocks. Check the log output. You will surely be able to find out till what point ur code is Ok.
    -Rohit

Maybe you are looking for