Problem detecting when four in a row has been acheived

Hi, i am having problems with my game of connect 4 and would like some help, i have look through the other forum posts but cant seem to find an answer that works. I am having problems getting the program to output " Winner" when four values in a row of the array are the same.
If someone could give me some pointers id be very gratefull.
Thanks.
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class FourInARow extends JApplet implements ActionListener
     Panel top;
     Panel main;
     Panel bottom;
     JButton[] columnButtons;
     JPanel[][] gridPanel;
     int[][] win;
     JButton reset;
     int Count;
     int levelA;
     int levelB;
     int levelC;
     int levelD;
     int levelE;
     int levelF;
     int levelG;
     boolean hasAWinner = false;
     public void init()
          Count = 0;
          levelA = 5;
          levelB = 5;
          levelC = 5;
          levelD = 5;
          levelE = 5;
          levelF = 5;
          levelG = 5;
          setLayout(new BorderLayout());
          top = new Panel();
          add(top, BorderLayout.NORTH);
          top.setBackground(Color.black);
          top.setLayout(new GridLayout(1,7));
          columnButtons = new JButton[7];
          for(int i=0; i<7; i++)
                    columnButtons[i] = new JButton("X");
                    top.add(columnButtons);
                    columnButtons[i].addActionListener(this);
          main = new Panel();
          add(main, BorderLayout.CENTER);
          main.setBackground(Color.black);
          main.setLayout(new GridLayout(6,7,2,2));
          gridPanel = new JPanel[6][7];
          for(int i=0; i<6; i++)
               for(int j=0; j<7; j++)
                    gridPanel[i][j] = new JPanel();
                    main.add(gridPanel[i][j]);
                    gridPanel[i][j].setBackground(Color.blue);
                    gridPanel[i][j].setLayout(new FlowLayout());
          bottom = new Panel();
          add(bottom, BorderLayout.SOUTH);
          bottom.setBackground(Color.black);
          reset = new JButton("RESET");
          bottom.add(reset);
          reset.addActionListener(this);
          win= new int[6][7];
     public void actionPerformed(ActionEvent ev)
          Counter1 counter;
          if(ev.getSource() == columnButtons[0])
               counter = new Counter1(Count);
               gridPanel[levelA][0].add(counter);
               Count ++;
               levelA--;
               System.out.println("col 1 and Count=" + Count);
          if(ev.getSource() == columnButtons[1])
               counter = new Counter1(Count);
               gridPanel[levelB][1].add(counter);
               Count ++;
               levelB--;
               System.out.println("col 2 and Count=" + Count);
          if(ev.getSource() == columnButtons[2])
               counter = new Counter1(Count);
               gridPanel[levelC][2].add(counter);
               Count ++;
               levelC--;
               System.out.println("Col 3 and Count=" + Count);
          if(ev.getSource() == columnButtons[3])
               counter = new Counter1(Count);
               gridPanel[levelD][3].add(counter);
               Count ++;
               levelD--;
               System.out.println("col 4 and Count=" + Count);
          if(ev.getSource() == columnButtons[4])
               counter = new Counter1(Count);
               gridPanel[levelE][4].add(counter);
               Count ++;
               levelE--;
               System.out.println("col 5 and Count=" + Count);
          if(ev.getSource() == columnButtons[5])
               counter = new Counter1(Count);
               gridPanel[levelF][5].add(counter);
               Count ++;
               levelF--;
               System.out.println("Col 6 and Count=" + Count);
          if(ev.getSource() == columnButtons[6])
               counter = new Counter1(Count);
               gridPanel[levelG][6].add(counter);
               Count ++;
               levelG--;
               System.out.println("Col 7 and Count=" + Count);
          if(ev.getSource() == reset)
               Count = 0;
               levelA = 5;
               levelB = 5;
               levelC = 5;
               levelD = 5;
               levelE = 5;
               levelF = 5;
               levelG = 5;
               System.out.println("Restart and count = " + Count);
          if(Count %2 == 0)
               System.out.println("Player 1");
               showStatus("Player 1");
          else
               System.out.println("Player2");
               showStatus("Player 2");
          if(Count >= 42)
               System.out.println("Draw Please Restart");
               showStatus("Draw Please Restart");
          if(Count %2 == 0 && ev.getSource() == columnButtons[0])
               win[levelA+1][0]=1;
          else if(Count %2 == 1 && ev.getSource() == columnButtons[0])
               win[levelA+1][0]=2;
          if(Count %2 == 0 && ev.getSource() == columnButtons[1])
               win[levelB+1][1]=1;
          else if(Count %2 == 1 && ev.getSource() == columnButtons[1])
               win[levelB+1][1]=2;
          if(Count %2 == 0 && ev.getSource() == columnButtons[2])
               win[levelC+1][2]=1;
          else if(Count %2 == 1 && ev.getSource() == columnButtons[2])
               win[levelC+1][2]=2;
          if(Count %2 == 0 && ev.getSource() == columnButtons[3])
               win[levelD+1][3]=1;
          else if(Count %2 == 1 && ev.getSource() == columnButtons[3])
               win[levelD+1][3]=2;
          if(Count %2 == 0 && ev.getSource() == columnButtons[4])
               win[levelE+1][4]=1;
          else if(Count %2 == 1 && ev.getSource() == columnButtons[4])
               win[levelE+1][4]=2;
          if(Count %2 == 0 && ev.getSource() == columnButtons[5])
               win[levelF+1][5]=1;
          else if(Count %2 == 1 && ev.getSource() == columnButtons[5])
               win[levelF+1][5]=2;
          if(Count %2 == 0 && ev.getSource() == columnButtons[6])
               win[levelG+1][6]=1;
          else if(Count %2 == 1 && ev.getSource() == columnButtons[6])
               win[levelG+1][6]=2;
          repaint();
          paintAll(this.getGraphics());
          for(int i=0; i<6; i++)
               for(int j=0; j<7; j++)
                    System.out.print(win[i][j]);
                    /*if(win[i][j] != 0 &&
                    win[i][j]== win[i+1][j] &&
                    win[i][j]== win[i+2][j] &&
                    win[i][j]== win[i+3][j])
               System.out.println();
class Counter1 extends JPanel
     int Count;
     public Counter1(int Count)
          this.Count = Count;
     public void paintComponent (Graphics graf)
          if(Count %2 == 0)
               graf.setColor(Color.red);
               graf.fillOval(1,1,this.getWidth(),this.getHeight());
          else
               graf.setColor(Color.yellow);
               graf.fillOval(1,1,this.getWidth(),this.getHeight());

Cheers for the ideas guys, i was trying to do something like this:
          for(int i=0; i<6; i++)
               for(int j=0; j<7; j++)
                    if(win[i][j] != 0 &&
                       win[i][j]== win[i+1][j] &&
                       win[i][j]== win[i+2][j] &&
                       win[i][j]== win[i+3][j])
                                                                       //I would have a bit of code here that changed the value of a boolean variable
          }but it wont compile, any way of doing something along thesed lines?
Edited by: zakyg on Mar 12, 2008 6:55 AM

Similar Messages

  • How to show a row has been "removed" from a table

    We maintain rows in a table with a version number which will determine the current set of accounts for a version. I need to be able to show the changes between the versions - when a row was ADDED, REMOVED or there was NO CHANGE. I can work out ADDED and NO_CHANGE without any problem, but I'm not sure how I can determine that a row has been REMOVED when it no longer exists in the next version.
    I have provided an example piece of SQL below:
    with w_acct1 as
    (select 'A1' acct, 0 vers from dual
    union all
    select 'A2' acct, 0 vers from dual
    union all
    select 'A3' acct, 0 vers from dual
    union all
    select 'A1' acct, 1 vers from dual
    union all
    select 'A2' acct, 1 vers from dual
    union all
    select 'A1' acct, 2 vers from dual
    union all
    select 'A4' acct, 2 vers from dual)
    select a.*,
           nvl(lead(acct) over (partition by acct order by vers desc),'NULL') ld,
           case when lead(acct) over (partition by acct order by vers desc) is null then
                   'ADDED'
               when lead(acct) over (partition by acct order by vers desc) = acct then
                   'NO_CHANGE'
               else
                   'REMOVED'
               end add_remove
    from w_acct1 a
    order by vers,acctWhich gives me the following result:
    ACCT VERS LD ADD_REMOVE
    A1     0     NULL     NEW
    A2     0     NULL     NEW
    A3     0     NULL     NEW
    A1     1     A1     NO_CHANGE
    A2     1     A2     NO_CHANGE
    A1     2     A1     NO_CHANGE
    A4     2     NULL     NEW
    The result I want is:
    ACCT VERS LD ADD_REMOVE
    A1     0     NULL     NEW
    A2     0     NULL     NEW
    A3     0     NULL     NEW
    A1     1     A1     NO_CHANGE
    A2     1     A2     NO_CHANGE
    A3     1     NULL     REMOVED
    A1     2     A1     NO_CHANGE
    A2     2     NULL     REMOVED
    A4     2     NULL     NEW
    Note the REMOVED rows associated with the version even though they don't exist in the dataset for that version number.
    Can this be done with analytic functions or some other cool Oracle feature I'm missing?
    Regards
    Richard

    You can't know about a row being removed unless you have a record of that row somewhere, either as a copy of your old data (see example below) or you've recorded the information using delete triggers etc.
    SQL> ed
    Wrote file afiedt.buf
      1  with old_data as (select 1 as id, 'A' as dta from dual union all
      2                     select 2, 'B' from dual union all
      3                     select 3, 'C' from dual)
      4      ,new_data as (select 1 as id, 'A' as dta from dual union all
      5                    select 3, 'X' from dual union all
      6                    select 4, 'Y' from dual)
      7  --
      8      ,ins_upd as (select * from new_data minus select * from old_data)
      9      ,del_upd as (select * from old_data minus select * from new_data)
    10      ,upd as (select id from ins_upd intersect select id from del_upd)
    11      ,ins as (select id from ins_upd minus select id from upd)
    12      ,del as (select id from del_upd minus select id from upd)
    13  --
    14  select 'Inserted' as action, null as old_id, null as old_dta, new_data.id as new_id, new_data.dta as new_dta
    15  from new_data join ins on (ins.id = new_data.id)
    16  union all
    17  select 'Updated', old_data.id, old_data.dta, new_data.id, new_data.dta
    18  from old_data join new_data on (old_data.id = new_data.id)
    19                join upd on (upd.id = new_data.id)
    20  union all
    21  select 'Deleted', old_data.id as old_id, old_data.dta as old_dta, null as new_id, null as new_dta
    22  from old_data join del on (del.id = old_data.id)
    23  union all
    24  select 'No Change' as action, new_data.id as old_id, new_data.dta as old_dta, new_data.id as new_id, new_data.dta as new_dta
    25  from new_data where id not in (select id from ins_upd union all
    26*                                select id from del_upd)
    SQL> /
    ACTION        OLD_ID O     NEW_ID N
    Inserted                        4 Y
    Updated            3 C          3 X
    Deleted            2 B
    No Change          1 A          1 A
    SQL>

  • How to Know, No. of Rows has been Update, throught Triggers

    Hi all,
    I am having problem in after update trigger. I want to know How many rows has been updated by a sql statement, for that I have written on (AFTER UPDATE TRIGGER ON EMP). But it is not giving any result. I am executing Update statement from
    Sqlplus (UPDATE EMP SET SAL=23 WHERE EMPNO=7369;) We cant use Commit, and dbms_output.put_line in trigger. thats why I have used exception.
    CREATE OR REPLACE TRIGGER EMP_UPDATE AFTER UPDATE ON EMP
    DECLARE
    NO      NUMBER;
    NOROW      EXCEPTION;
    PRAGMA      EXCEPTION_INIT(NOROW, -20101);
    BEGIN
    NO:=SQL%ROWCOUNT;
    IF NO<>0 THEN
    RAISE_APPLICATION_ERROR(-20101,'Some Rows UPDATED');
    END IF;
    END;

    Hi Sachindra
    What SQL*Plus version you are using?
    Some versions that come with forms6i they dont write the number of rows updated, they just write operation 44 succeeded or something like that.
    But if you use the SQL*Plus database client (sqlplusw.exe or sqlplus.exe) which those 2 get installed with the db you will be able to see the number of rows update/deleted/inserted
    SQL> conn scott/tiger
    Connected.
    SQL> DESC EMP
    Name Null? Type
    EMPNO NOT NULL NUMBER(4)
    ENAME VARCHAR2(10)
    JOB VARCHAR2(9)
    MGR NUMBER(4)
    HIREDATE DATE
    SAL NUMBER(7,2)
    COMM NUMBER(7,2)
    DEPTNO NUMBER(2)
    SQL> UPDATE EMP SET SAL = 23 WHERE EMPNO = 7369;
    1 row updated.
    SQL>
    Hope this helps
    Regards
    Tony G.

  • My computer restarts itself to update then when it comes the password has been changed and im locked

    my computer restarts itself to update then when it comes the password has been changed and im locked out how do i stop it and fix it

    Hi
    try to boot in safe mode, and check there if you have any alternate account (administrator ect) where you can gain access to your window and then change password of it.
    Hope it helps!
    **Clicking on the Kudos! white star is a nice way to say thank you on any post that helped you or resolved the problem.**
    **Selecting "Accept as Solution" for a reply that solves your issue helps others who are searching the web for an answer**
    **Clicking on the Kudos! white star is a nice way to say thank you on any post that helped you or resolved the problem.**
    **Selecting "Accept as Solution" for a reply that solves your issue helps others who are searching the web for an answer**

  • When i run Time Machine to back up my computer onto an external hard drive, i have no way of knowing when the back up process has been completed. I don't know when it is safe to disconnect the external hard drive - which is store in a separate location.

    When i run Time Machine to back up my computer on to an external hard drive, i have no way of knowing when the back up process has been completed.  This is necessary to know because i don't leave my external hard drive connected to the computer.  I routinely disconnect it after backing up the hard drive, and then i store the external hard drive in a different location from the computer.  So, knowing when the back up process has been completed would be a very helpful thing to have the computer specify. 

    Just enable Time Machine's menu extra (System Preferences -> Time Machine -> Show Time Machine in menu bar.
    This will add a little Time Machine icon to your menubar. When Time Machine is actively backing up your data, the icon will spin as a visual indicator. You can also click the menu icon to see the backup status, including how much data is left to back up.

  • Can you set up a new I Tunes account, but still use the same email address, as having problems with it keep telling me it has been disabled, no matter what I do to chnage the passwords, I haven't used the account since 2010?

    can you set up a new I Tunes account, but still use the same email address, as having problems with it keep telling me it has been disabled, no matter what I do to change the passwords, I haven't used the account since 2010?

    Hi eddinchina,
    You should have no need to use the Old Sync account.
    As long as device or devices are Firefox 29 or later (They should all be Firefox 30 now) you should use the New Sync.
    You may use the same email address with both accounts.

  • When my I tunes Match has been downloaded but when i open I Tunes I do not see it in the left hand column. I have to go to I tunes store about and click on it.

    When my I tunes Match has been downloaded but when i open I Tunes I do not see it in the left hand column. I have to go to I tunes store about and click on it.

    When the match process is not running iTunes match will not be present in the side bar, this is normal behavior.
    If you go to store in the iTunes menu bar you should see "Turn off iTunes match" and "update iTunes match".
    When the match process runs, after you have restarted iTunes, or manually selected update iTunes match it will re-appear in your sidebar.

  • Can I restore from an iTunes backup after setting up as a new phone when a full reboot/restore has been carried out?

    Can I restore from an iTunes backup after setting up as a new phone when a full reboot/restore has been carried out?

    As @wjosten says. Note, however, that it is important to NOT sync the phone after resetting it. A Sync will overwrite the backup that you want to restore.

  • How do i know if row has been updated?

    Hi
    Please can someone guide me on how I can determine if my update has been successful. I am currently using the method below but my data is being put into the table but the method rowUpdated() returns false when it should return true.
    rs.moveToInsertRow();
    rs.updateString("SL_Name", "Antek")
    rs.insertRow();
    System.out.println("Row updated " + rs.rowUpdated());
    Thanxs
    Antek

    I am using a primary key which is set by ms-sql server and it has the properties not-null auto incrementing. I was using the manual insert function before but then I realised the moveToInsertRow() method so I changed because of the added benefits to my program I can get. Before I was using the following code to see if a row was inserted see below. (I want something similar for the new way I insert data into table please)
    ======
    what i use to use before
    ======
    int numRows= myStatement.executeUpdate(sql);          
    System.out.println(numRows + " rows updated");
    if (numRows > 0)
    returnString = "success";
    Antek

  • SSL indicator disappears when page with video tag has been loaded

    I have a strange bug in Firefox, that was detected when site moved to SSL.
    There is single page site built on Backbone.
    When page with video tag loaded SSL indicator disappears.
    Firebug shows that Firefox create GET request connection to the server but it hangs.
    All site logic work correctly. And video on this page works perfect, I can click play and new connection will be created and video played but first connection still hangs.
    There is four page with video tag (four steps of wizard) and hanged connection appears randomly on this pages.
    Actually this issue exists without SSL, but detected only when we moved to SSL and lock icon began to disappear.

    The SSL indicator can disappear if there is mixed content on that page (i.e. coming via an unencrypted http connection).
    Did you click the Site Identity Button (globe/padlock) and proceeded to the Security tab in Page Info?
    *https://developer.mozilla.org/en/Security/MixedContent
    *https://developer.mozilla.org/en/Tools/Web_Console

  • Short Clicking noise when resuming pc after it has been idle

    This isn't really a problem just something that is annoying me. When going to my pc after it has been sitting idle, (not hibernating nor do I have the hardisks turnoff ever) I notice a one time short clicking noise from the box. To me it sounds like some extra voltage is being sent somewhere. It has never caused a problem and my rig is and has been stable since I built it. I did have a cheapo powersupply blow up on me so I've kinda been tuned in to that. Anyone know what I'm referring to? Thanks.

    It is a non issue really...I've had alot of machines do this...it is the HD that's doing it and some of them I've seen *especially the older drives* did it all the time...they have a spot that they rest the heads at and when you're away from the machine it parks it there...then it sets a safety level on it and when you come back it doesn't always wait for the safety lever to unegage and that is the click you hear...I don't know if they still do this or not but that click is common...
    Sometimes tho that click, to me, means that the drive is on its way out...but that hasn't been the norm...
    Cheers!! 8)

  • Problems with data cache plugin - The ResultList has been closed

    I'm testing out the data cache to see if it helps some of my performance
    problems, but I now get lots of exceptions that I didn't get before I
    enabled the cache. Here's how I enabled it:
    # CACHE
    com.solarmetric.kodo.DataCacheClass=com.solarmetric.kodo.runtime.datacache.p
    lugins.CacheImpl
    com.solarmetric.kodo.RemoteCommitProviderClass=com.solarmetric.kodo.runtime.
    event.impl.SingleJVMRemoteCommitProvider
    The exception I'm getting follows. I'm curious if anyone has any insight
    into what's going on? I'm sure there is a problem with my code, I'm
    forgetting to close something or other but since it works fine without the
    cache I'm really stuck as to what it is.
    Thanks
    Michael
    22:17:32,792 ERROR ObjectFinder - Exception =
    com.solarmetric.kodo.runtime.FatalUserException: The ResultList has been
    closed.
    NestedThrowables:
    com.solarmetric.kodo.runtime.ClosurePoint: Closure point of object held in
    embedded stack trace.
    com.solarmetric.kodo.runtime.FatalUserException: The ResultList has been
    closed.
    NestedThrowables:
    com.solarmetric.kodo.runtime.ClosurePoint: Closure point of object held in
    embedded stack trace.
    at
    com.solarmetric.kodo.runtime.objectprovider.EagerResultList.checkClosed(Eage
    rResultList.java:66)
    at
    com.solarmetric.kodo.runtime.objectprovider.EagerResultList.get(EagerResultL
    ist.java:84)
    at
    com.solarmetric.kodo.runtime.datacache.query.CachingRandomAccessList.get(Cac
    hingRandomAccessList.java:124)
    at java.util.AbstractList$Itr.next(AbstractList.java:416)
    at java.util.AbstractList.equals(AbstractList.java:604)
    at serp.util.WeakCollection$WeakValue.equals(WeakCollection.java:123)
    at java.util.HashMap.eq(HashMap.java:270)
    at java.util.HashMap.removeEntryForKey(HashMap.java:525)
    at java.util.HashMap.remove(HashMap.java:507)
    at java.util.HashSet.remove(HashSet.java:198)
    at serp.util.RefValueCollection.removeFilter(RefValueCollection.java:272)
    at serp.util.RefValueCollection.remove(RefValueCollection.java:235)
    at
    com.solarmetric.kodo.runtime.datacache.query.QueryCacheImpl.unregisterClassC
    hangeListener(QueryCacheImpl.java:160)
    at
    com.solarmetric.kodo.runtime.datacache.query.CachingRandomAccessList.abortCa
    ching(CachingRandomAccessList.java:103)
    at
    com.solarmetric.kodo.runtime.datacache.query.CachingRandomAccessList.get(Cac
    hingRandomAccessList.java:149)
    at java.util.AbstractList$Itr.next(AbstractList.java:416)
    at java.util.AbstractList.hashCode(AbstractList.java:624)
    at serp.util.WeakCollection$WeakValue.<init>(WeakCollection.java:93)
    at serp.util.WeakCollection.createRefValue(WeakCollection.java:64)
    at serp.util.RefValueCollection.addFilter(RefValueCollection.java:193)
    at serp.util.RefValueCollection.add(RefValueCollection.java:166)
    at serp.util.RefValueCollection.add(RefValueCollection.java:157)
    at
    com.solarmetric.kodo.runtime.datacache.query.QueryCacheImpl.registerClassCha
    ngeListener(QueryCacheImpl.java:151)
    at
    com.solarmetric.kodo.runtime.datacache.query.CachingRandomAccessList.<init>(
    CachingRandomAccessList.java:76)
    at
    com.solarmetric.kodo.runtime.datacache.query.CacheAwareQuery.wrapList(CacheA
    wareQuery.java:146)
    at
    com.solarmetric.kodo.runtime.datacache.query.CacheAwareQuery.execute(CacheAw
    areQuery.java:270)
    at
    com.verideon.veriguard.persistence.ObjectFinder.getObjects(ObjectFinder.java
    :62)
    at
    com.verideon.veriguard.persistence.ObjectFinder.getObject(ObjectFinder.java:
    44)
    at
    com.verideon.veriguard.persistence.ObjectFinder.getRole(ObjectFinder.java:91
    at
    com.verideon.veriguard.services.VeriguardService.createCustomerAccount(Verig
    uardService.java:210)
    at
    com.verideon.veriguard.services.TestVeriguardServiceMonitors.createTestUser(
    TestVeriguardServiceMonitors.java:133)
    at
    com.verideon.veriguard.services.TestVeriguardServiceMonitors.setUp(TestVerig
    uardServiceMonitors.java:80)
    at junit.framework.TestCase.runBare(TestCase.java:125)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
    nner.java:392)
    at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
    java:276)
    at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
    ..java:167)
    NestedThrowablesStackTrace:
    com.solarmetric.kodo.runtime.ClosurePoint: Closure point of object held in
    embedded stack trace.
    at
    com.solarmetric.kodo.runtime.objectprovider.EagerResultList.close(EagerResul
    tList.java:78)
    at com.solarmetric.kodo.impl.jdbc.query.JDBCQuery.close(JDBCQuery.java:127)
    at com.solarmetric.kodo.query.QueryImpl.closeAll(QueryImpl.java:637)
    at
    com.solarmetric.kodo.runtime.datacache.query.CacheAwareQuery.closeAll(CacheA
    wareQuery.java:343)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.closeQueries(Persistence
    ManagerImpl.java:934)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.close(PersistenceManager
    Impl.java:914)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.close(PersistenceManager
    Impl.java:884)
    at com.verideon.veriguard.services.PMService.close(PMService.java:120)
    at com.verideon.veriguard.services.PMService.close(PMService.java:111)
    at
    com.verideon.veriguard.services.TestVeriguardServiceMonitors.deleteTestUser(
    TestVeriguardServiceMonitors.java:127)
    at
    com.verideon.veriguard.services.TestVeriguardServiceMonitors.tearDown(TestVe
    riguardServiceMonitors.java:103)
    at junit.framework.TestCase.runBare(TestCase.java:130)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
    nner.java:392)
    at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
    java:276)
    at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
    ..java:167)

    Michael,
    Could you send your test case to [email protected] so that we
    can take a look at what's going on to cause this exception?
    Thanks,
    -Patrick
    On Thu, 22 May 2003 17:18:50 -0400, Michael wrote:
    I'm testing out the data cache to see if it helps some of my performance
    problems, but I now get lots of exceptions that I didn't get before I
    enabled the cache. Here's how I enabled it:
    # CACHE
    com.solarmetric.kodo.DataCacheClass=com.solarmetric.kodo.runtime.datacache.p
    lugins.CacheImpl
    com.solarmetric.kodo.RemoteCommitProviderClass=com.solarmetric.kodo.runtime.
    event.impl.SingleJVMRemoteCommitProvider
    The exception I'm getting follows. I'm curious if anyone has any
    insight into what's going on? I'm sure there is a problem with my code,
    I'm forgetting to close something or other but since it works fine
    without the cache I'm really stuck as to what it is.
    Thanks
    Michael
    22:17:32,792 ERROR ObjectFinder - Exception =
    com.solarmetric.kodo.runtime.FatalUserException: The ResultList has been
    closed.
    NestedThrowables:
    com.solarmetric.kodo.runtime.ClosurePoint: Closure point of object held
    in embedded stack trace.
    com.solarmetric.kodo.runtime.FatalUserException: The ResultList has been
    closed.
    NestedThrowables:
    com.solarmetric.kodo.runtime.ClosurePoint: Closure point of object held
    in embedded stack trace.
    at
    com.solarmetric.kodo.runtime.objectprovider.EagerResultList.checkClosed(Eage
    rResultList.java:66)
    at
    com.solarmetric.kodo.runtime.objectprovider.EagerResultList.get(EagerResultL
    ist.java:84)
    at
    com.solarmetric.kodo.runtime.datacache.query.CachingRandomAccessList.get(Cac
    hingRandomAccessList.java:124)
    at java.util.AbstractList$Itr.next(AbstractList.java:416) at
    java.util.AbstractList.equals(AbstractList.java:604) at
    serp.util.WeakCollection$WeakValue.equals(WeakCollection.java:123) at
    java.util.HashMap.eq(HashMap.java:270) at
    java.util.HashMap.removeEntryForKey(HashMap.java:525) at
    java.util.HashMap.remove(HashMap.java:507) at
    java.util.HashSet.remove(HashSet.java:198) at
    serp.util.RefValueCollection.removeFilter(RefValueCollection.java:272)
    at serp.util.RefValueCollection.remove(RefValueCollection.java:235) at
    com.solarmetric.kodo.runtime.datacache.query.QueryCacheImpl.unregisterClassC
    hangeListener(QueryCacheImpl.java:160)
    at
    com.solarmetric.kodo.runtime.datacache.query.CachingRandomAccessList.abortCa
    ching(CachingRandomAccessList.java:103)
    at
    com.solarmetric.kodo.runtime.datacache.query.CachingRandomAccessList.get(Cac
    hingRandomAccessList.java:149)
    at java.util.AbstractList$Itr.next(AbstractList.java:416) at
    java.util.AbstractList.hashCode(AbstractList.java:624) at
    serp.util.WeakCollection$WeakValue.<init>(WeakCollection.java:93) at
    serp.util.WeakCollection.createRefValue(WeakCollection.java:64) at
    serp.util.RefValueCollection.addFilter(RefValueCollection.java:193) at
    serp.util.RefValueCollection.add(RefValueCollection.java:166) at
    serp.util.RefValueCollection.add(RefValueCollection.java:157) at
    com.solarmetric.kodo.runtime.datacache.query.QueryCacheImpl.registerClassCha
    ngeListener(QueryCacheImpl.java:151)
    at
    com.solarmetric.kodo.runtime.datacache.query.CachingRandomAccessList.<init>(
    CachingRandomAccessList.java:76)
    at
    com.solarmetric.kodo.runtime.datacache.query.CacheAwareQuery.wrapList(CacheA
    wareQuery.java:146)
    at
    com.solarmetric.kodo.runtime.datacache.query.CacheAwareQuery.execute(CacheAw
    areQuery.java:270)
    at
    com.verideon.veriguard.persistence.ObjectFinder.getObjects(ObjectFinder.java
    :62)
    at
    com.verideon.veriguard.persistence.ObjectFinder.getObject(ObjectFinder.java:
    44)
    at
    com.verideon.veriguard.persistence.ObjectFinder.getRole(ObjectFinder.java:91
    at
    com.verideon.veriguard.services.VeriguardService.createCustomerAccount(Verig
    uardService.java:210)
    at
    com.verideon.veriguard.services.TestVeriguardServiceMonitors.createTestUser(
    TestVeriguardServiceMonitors.java:133)
    at
    com.verideon.veriguard.services.TestVeriguardServiceMonitors.setUp(TestVerig
    uardServiceMonitors.java:80)
    at junit.framework.TestCase.runBare(TestCase.java:125) at
    junit.framework.TestResult$1.protect(TestResult.java:106) at
    junit.framework.TestResult.runProtected(TestResult.java:124) at
    junit.framework.TestResult.run(TestResult.java:109) at
    junit.framework.TestCase.run(TestCase.java:118) at
    junit.framework.TestSuite.runTest(TestSuite.java:208) at
    junit.framework.TestSuite.run(TestSuite.java:203) at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
    nner.java:392)
    at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
    java:276)
    at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
    .java:167)
    NestedThrowablesStackTrace:
    com.solarmetric.kodo.runtime.ClosurePoint: Closure point of object held
    in embedded stack trace.
    at
    com.solarmetric.kodo.runtime.objectprovider.EagerResultList.close(EagerResul
    tList.java:78)
    at
    com.solarmetric.kodo.impl.jdbc.query.JDBCQuery.close(JDBCQuery.java:127)
    at com.solarmetric.kodo.query.QueryImpl.closeAll(QueryImpl.java:637) at
    com.solarmetric.kodo.runtime.datacache.query.CacheAwareQuery.closeAll(CacheA
    wareQuery.java:343)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.closeQueries(Persistence
    ManagerImpl.java:934)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.close(PersistenceManager
    Impl.java:914)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.close(PersistenceManager
    Impl.java:884)
    at com.verideon.veriguard.services.PMService.close(PMService.java:120)
    at com.verideon.veriguard.services.PMService.close(PMService.java:111)
    at
    com.verideon.veriguard.services.TestVeriguardServiceMonitors.deleteTestUser(
    TestVeriguardServiceMonitors.java:127)
    at
    com.verideon.veriguard.services.TestVeriguardServiceMonitors.tearDown(TestVe
    riguardServiceMonitors.java:103)
    at junit.framework.TestCase.runBare(TestCase.java:130) at
    junit.framework.TestResult$1.protect(TestResult.java:106) at
    junit.framework.TestResult.runProtected(TestResult.java:124) at
    junit.framework.TestResult.run(TestResult.java:109) at
    junit.framework.TestCase.run(TestCase.java:118) at
    junit.framework.TestSuite.runTest(TestSuite.java:208) at
    junit.framework.TestSuite.run(TestSuite.java:203) at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
    nner.java:392)
    at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
    java:276)
    at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
    .java:167)--
    Patrick Linskey
    SolarMetric Inc.

  • Detecte when a row has been inserted a year ago

    Hi!
    I don't know if this is the right forum to ask this but I'll try. I have a table full of student data (including the date of row insertion) in an Oracle database and I'd like to know if it's possible to detect the rows that have been inserted a year ago. Do my servlet app have to poll the table constantly to know them ? Is there a better way to do this ?
    thanks in advance

    I don�t see the problem in using a servlet to start
    and stop your timer task. You can start it in the init
    method and stop it in the destroy method. This is the
    approach taken to start / stop the popular Quartz
    scheduler. This means that the TimerTask will only run
    while your application is deployed which may or may
    not be what you want.And what HTTP request is going to tell the servlet container to load the servlet and kick off the init() method?
    I'm sure you could make it work, but I'm arguing that it's not how HTTP and servlets were meant to work, IMO. Better to have this be a job scheduled by the OS, IMO.
    >
    Quartz is a J2EE job scheduler
    (http://www.opensymphony.com/quartz/) that has many
    more features than TimerTask, it may be worth
    considering if TimerTask is not sufficient for your
    requirements.I'm sure TimerTask will work well enough if the precise start time isn't an issue.
    I'd still say it doesn't belong in a servlet.

  • Querying a View Object after a Row has been inserted

    Hi All,
    I have a query as to whether something can be done or if I should be approaching my problem in a slightly different way.
    First an explanation of what I am trying to achieve:
    I have a header record that deals with a new user request. From one of the pages within the train one or more of several different ‘applications’ can be selected. When an ‘application’ is selected I am navigating to a new page, it queries the linesVO to see if any lines exist for that ‘application’, where they don’t it adds lines to the VO each representing ‘questions’ specific to that ‘application’. This works fine, however if I then come out of that page back into the train and then back into the same page specific for the same ‘application’ the initQuery is run and the lines I have just created are not found, it then tries to reinsert the question lines but will error as primary key validation fails. I do not want to commit after coming back from the lines page as the user has not specified a save, adding a save to the lines page would also cause the header to commit.
    Now the Question:
    Is there a way of ensuring that I can run my created method ‘initQuery’ which sets a where clause and calls ‘executeQuery’ will bring back lines that I have created in the VO and are held in cache? They must be held in cache else I would not be getting the error ‘Too many objects match the primary key’
    Any guidance on this matter would be most appreciated,
    Thanks
    Mike

    Unfortunately I do need to query the view again, each time the user clicks on a different ‘application’ in the train it will need to show only the lines in the view relating to that application. It is a bit like a master-detail except I want to show the detail lines on a separate page.
    I could have made each page separately but I am trying to make it dynamic so if a new application is added in the future I only have to add the details to the database tables.
    Thanks, Mike

  • Problem reconnecting to wifi after the  notebooks has been turned on again

    I have a problem recoonecting to my wifi network when my notebook is turned on again.
    I have tried many suggestions online, but none seems to eradicate the problem.

    Resolving Stubborn Wi-Fi Connection Problems in Mac OS X
    View CTaztec steps here: https://discussions.apple.com/message/24210066#24210066
    (This link is a bit technical.)
    Download and run:  Namebench (free) http://code.google.com/p/namebench/
    Namebench hunts down the fastest DNS servers available for your computer to use.
    Namebench openS a browser window with results:(look in box at top right after it completes)
    Once you have the fastest domain name servers, you then have to manually change your DNS settings in System Preferences/Network/
    System Preferences > Network > Select you internet service (be it Airport, Ethernet etc) then click advanced tab > Select  DNS and enter the settings

Maybe you are looking for

  • Calculate stock reach based on MRP data by date

    HI I have a challenge that I'm unable to solve by myself - I hope you guys can help me out:-) I have an ODS containing current stock and expected future movements of different types. In the ODS I have (simplified): 1) Material 2) Date of movement 3)

  • [AS CS2] Create a list of all items whose clipping type = detect edges

    I am creating myself a light preflight script for Indesign CS2 documents where a part of it creates a list of all the images that have had the clipping path "detect edges" applied. But I am struggling to work out how to address the clipping path sett

  • Issue in ALV configuration

    Hi, I have some requirements to make some changes in WD ALV layout. By reading some earlier blog i guess i can make use fo class CL_SALV_WD_CONFIG_TABLE. however im not sure how would i make my ALV node (or data) available to methods of these class.

  • Updating iTunes software

    I'm currently working on my girlfriends macbook and one of the problems she was having was updating her iTunes to the newest version which is 10.0.1 or something like that. When i go into the itunes browser and select the "Check for updates" button,

  • Prettiest & ugliest part of the java codebase

    In the interests of promoting good coding practices (whatever that may mean), I'd like to see peoples' opinions on what constitutes the prettiest & ugliest parts of the java codebase. As far as pretties go, I dunno... Integer.java perhaps??? Uglies o