Need help serialize a collection object

I have a class that's going to manage a list of paths stored as strings as "ArrayList<String> fileList = null;". I can't figure out how to serialize the fileList object. The class that contains the fileList implements Externalizable. here are the read and write functions:
     public void readExternal(ObjectInput in) throws IOException
          fileList = (ArrayList)in.readObject();
     public void writeExternal(ObjectOutput out)  throws IOException//, ClassNotFoundException
          out.writeObject(fileList);
     }I've tried lots of different things and nothing works. Anybody know how to serialize an ArrayList? Is ArrayList the best class for the job?

I have a class that's going to manage a list of paths
stored as strings as "ArrayList<String> fileList =
null;". I can't figure out how to serialize the
fileList object. You don't have to do anything to serialize ArrayList, it is already Serializable.
The class that contains the fileList
implements Externalizable. here are the read and
write functions:I will assume there is a good reason this class (that contains the fileList) can itself not be Serializable and needs to be Externelizable.
>
public void readExternal(ObjectInput in) throws
s IOException
          fileList = (ArrayList)in.readObject();
public void writeExternal(ObjectOutput out)  throws
s IOException//, ClassNotFoundException
          out.writeObject(fileList);
     }I've tried lots of different things and nothing
works. Anybody know how to serialize an ArrayList? Is
ArrayList the best class for the job?I tried the same example -- with code to make it compilable and testable -- and it works as expected.
What exactly do you mean when you say "nothing works"?

Similar Messages

  • Need help with Bulk Collect ForAll Update

    Hi - I'm trying to do a Bulk Collect/ForAll Update but am having issues.
    My declarations look like this:
         CURSOR cur_hhlds_for_update is
            SELECT hsh.household_id, hsh.special_handling_type_id
              FROM compas.household_special_handling hsh
                 , scr_id_lookup s
             WHERE hsh.household_id = s.id
               AND s.scr = v_scr
               AND s.run_date = TRUNC (SYSDATE)
               AND effective_date IS NULL
               AND special_handling_type_id = 1
               AND created_by != v_user;
         TYPE rec_hhlds_for_update IS RECORD (
              household_id  HOUSEHOLD_SPECIAL_HANDLING.household_id%type,
              spec_handl_type_id HOUSEHOLD_SPECIAL_HANDLING.SPECIAL_HANDLING_TYPE_ID%type
         TYPE spec_handling_update_array IS TABLE OF rec_hhlds_for_update;
         l_spec_handling_update_array  spec_handling_update_array;And then the Bulk Collect/ForAll looks like this:
           OPEN cur_hhlds_for_update;
           LOOP
            FETCH cur_hhlds_for_update BULK COLLECT INTO l_spec_handling_update_array LIMIT 1000;
            EXIT WHEN l_spec_handling_update_array.count = 0;
            FORALL i IN 1..l_spec_handling_update_array.COUNT
            UPDATE compas.household_special_handling
               SET effective_date =  TRUNC(SYSDATE)
                 , last_modified_by = v_user
                 , last_modified_date = SYSDATE
             WHERE household_id = l_spec_handling_update_array(i).household_id
               AND special_handling_type_id = l_spec_handling_update_array(i).spec_handl_type_id;
              l_special_handling_update_cnt := l_special_handling_update_cnt + SQL%ROWCOUNT;         
          END LOOP;And this is the error I'm receiving:
    ORA-06550: line 262, column 31:
    PLS-00436: implementation restriction: cannot reference fields of BULK In-BIND table of records
    ORA-06550: line 262, column 31:
    PLS-00382: expression is of wrong type
    ORA-06550: line 263, column 43:
    PL/SQL: ORA-22806: not an object or REF
    ORA-06550: line 258, column 9:
    PL/SQL: SQMy problem is that the table being updated has a composite primary key so I have two conditions in my where clause. This the the first time I'm even attempting the Bulk Collect/ForAll Update and it seems like it would be straight forward if I was only dealing with a single-column primary key. Can anyone please help advise me as to what I'm missing here or how I can accomplish this?
    Thanks!
    Christine

    You cannot reference a column inside a record when doin a for all. You need to refer as a whole collection . So you will need two collections.
    Try like this,
    DECLARE
       CURSOR cur_hhlds_for_update
       IS
          SELECT hsh.household_id, hsh.special_handling_type_id
            FROM compas.household_special_handling hsh, scr_id_lookup s
           WHERE hsh.household_id = s.ID
             AND s.scr = v_scr
             AND s.run_date = TRUNC (SYSDATE)
             AND effective_date IS NULL
             AND special_handling_type_id = 1
             AND created_by != v_user;
       TYPE arr_household_id IS TABLE OF HOUSEHOLD_SPECIAL_HANDLING.household_id%TYPE
                                   INDEX BY BINARY_INTEGER;
       TYPE arr_spec_handl_type_id IS TABLE OF HOUSEHOLD_SPECIAL_HANDLING.SPECIAL_HANDLING_TYPE_ID%TYPE
                                         INDEX BY BINARY_INTEGER;
       l_household_id_col         arr_household_id;
       l_spec_handl_type_id_col   arr_spec_handl_type_id;
    BEGIN
       OPEN cur_hhlds_for_update;
       LOOP
          FETCH cur_hhlds_for_update
            BULK COLLECT INTO l_household_id_col, l_spec_handl_type_id_col
          LIMIT 1000;
          EXIT WHEN cur_hhlds_for_update%NOTFOUND;
          FORALL i IN l_household_id_col.FIRST .. l_household_id_col.LAST
             UPDATE compas.household_special_handling
                SET effective_date = TRUNC (SYSDATE),
                    last_modified_by = v_user,
                    last_modified_date = SYSDATE
              WHERE household_id = l_household_id_col(i)
                AND special_handling_type_id = l_spec_handl_type_id_col(i);
       --l_special_handling_update_cnt := l_special_handling_update_cnt + SQL%ROWCOUNT; -- Not sure what this does.
       END LOOP;
    END;G.

  • Urgent. Need help in the Calendar Object.

    Hello developers, best regards!
    Well my problem is that i'm facing a fact that i need a calendar object just like that one when u click the time down there in the taskbar, i need to embedd it in my java windows application.
    To be more clear, if u're familiar with the Visual Basic.NET environment, just the kind of calendars that i need is found there, in which it displays a small box which i can select the months, and accordingly i can select the specific date i need.
    Please i need your help so much.
    Thank you in advance.

    [url http://www.google.co.uk/search?hl=en&q=jcalendar&meta=]click

  • Need help on -- Size of object

    how do i get the size of the object ?
    Thanks in Advance

    You can't. What makes you think you need this, because in Java we don't need to worry about this. You do not explicitly allocate or free memory, so the size of an object is not needed. Some people will tell you to serialize an object to a byte array and that the size of the array is the size of the object, but they're completely wrong. The size of an object is, roughly, the size of every primitive field it has, plus the size of a reference to an object multiplied by the number of reference fields, plus a small overhead for simply existing itself. But as I said, you don't need to worry about it

  • Need help in Bulk collect

    Hi All,
    I need a help to create a bulk statement. Please find the scenario below
    I would like to copy a table A from table B using bulk collect also the table A has more records (1Million). Before doing this I need to either truncate the table B or drop the table to load the data from table A.
    Please provide me the correct statement to achieve this request. Thanks in advance!!
    Regards,
    Boovan.

    disabling any indexes on the target should be looked at first. If there are none then look at the above.
    When you do a direct path load the indexes are build after loading.The point is that the direct path load does not avoid the undo due to the indexes.
    In this example on a table with no indexes the undo used goes from 216kb to 16kb using append.
    When an index is added the undo used goes up from 216kb to 704kb an increase of 488kb for a standard insert.
    For the direct path insert the undo goes up from 16kb to 440kb so almost the full amount of undo due to the index.
    So the presence of a single index can have a much greater impact on the amount of undo required than the use of a direct path load and that undo may not be avoided by the use of a direct path load unless the index is disabled beforehand.
    Also note the tiny amounts of undo we are talking about for 50k rows.
    SQL> create table t as select * from all_objects where 0 = 1;
    Table created.
    SQL> insert into t select * from all_objects;
    56108 rows created.
    SQL> select
      2      used_ublk undo_used_blk,
      3      used_ublk * blk_size_kb undo_used_kb,
      4      log_io logical_io,
      5      cr_get consistent_gets
      6  from
      7      v$transaction, v$session s,
      8      (select distinct sid from v$mystat) m,
      9      (select to_number(value)/1024 blk_size_kb
    10          from v$parameter where name='db_block_size')
    11  where
    12      m.sid       =   s.sid
    13  and ses_addr    =   saddr;
    UNDO_USED_BLK UNDO_USED_KB LOGICAL_IO CONSISTENT_GETS
               27          216      13893         1042736
    SQL> rollback;
    Rollback complete.
    SQL> insert /*+ append */ into t select * from all_objects;
    56108 rows created.
    SQL> select
      2      used_ublk undo_used_blk,
      3      used_ublk * blk_size_kb undo_used_kb,
      4      log_io logical_io,
      5      cr_get consistent_gets
      6  from
      7      v$transaction, v$session s,
      8      (select distinct sid from v$mystat) m,
      9      (select to_number(value)/1024 blk_size_kb
    10          from v$parameter where name='db_block_size')
    11  where
    12      m.sid       =   s.sid
    13  and ses_addr    =   saddr;
    UNDO_USED_BLK UNDO_USED_KB LOGICAL_IO CONSISTENT_GETS
                2           16       1307         1041151
    SQL> rollback;
    Rollback complete.
    SQL> create unique index t_idx on t (object_id);
    Index created.
    SQL> insert into t select * from all_objects;
    56109 rows created.
    SQL> select
      2      used_ublk undo_used_blk,
      3      used_ublk * blk_size_kb undo_used_kb,
      4      log_io logical_io,
      5      cr_get consistent_gets
      6  from
      7      v$transaction, v$session s,
      8      (select distinct sid from v$mystat) m,
      9      (select to_number(value)/1024 blk_size_kb
    10          from v$parameter where name='db_block_size')
    11  where
    12      m.sid       =   s.sid
    13  and ses_addr    =   saddr;
    UNDO_USED_BLK UNDO_USED_KB LOGICAL_IO CONSISTENT_GETS
               88          704      20908         1043193
    SQL> rollback;
    Rollback complete.
    SQL> insert /*+ append */ into t select * from all_objects;
    56109 rows created.
    SQL> select
      2      used_ublk undo_used_blk,
      3      used_ublk * blk_size_kb undo_used_kb,
      4      log_io logical_io,
      5      cr_get consistent_gets
      6  from
      7      v$transaction, v$session s,
      8      (select distinct sid from v$mystat) m,
      9      (select to_number(value)/1024 blk_size_kb
    10          from v$parameter where name='db_block_size')
    11  where
    12      m.sid       =   s.sid
    13  and ses_addr    =   saddr;
    UNDO_USED_BLK UNDO_USED_KB LOGICAL_IO CONSISTENT_GETS
               57          456       2310         1041047

  • Need help in SAP Business Object Dashboard

    Hey, I need some help.
    i have a dashboard which is current built in Qlikview.
    Now our client proposed that they need to migrate this dashboard to SAP Business Object.
    Please guide about dashboard desigining using SAP, since i am absolute novice about BO so guide according like which BO software needs to be install and some learning material of BO, please email @ [email protected]
    Many Many Thanks in advance!!

    Too generic to answer this question and also you can find lot of thread, discussions & blogs are available to get the info. Also you can find some templates & samples inside the dashboard itself, play with those component and understand them better.
    Best place to get familiar with the dashboard using the tutorials.
    Official Product Tutorials – SAP BusinessObjects Dashboards
    Installing SAP BusinessObjects Dashboards 4.0
    http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_dashD_user_en.pdf
    SAP BusinessObjects Dashboards 4.0, SAP Crystal Dashboard Design 2011, SAP Crystal Presentation Design 2011 - Product Av…
    SAP BusinessObjects Dashboards 4.1 – SAP Help Portal Page
    SAP BusinessObjects Dashboards Resource Centre
    Please go through the above links which can help you to understand how dashboard works, install & Product availability matrix.

  • Need help moving music collection from external hard drive to Macbook Pro

         I just bought a Macbook Pro today after my Windows desktop was bricked a few weeks ago. Luckily, I didn't lose the most important files on my pc, my music, because it was all on my Zune, as well. So, I borrowed an external hard drive, copied all of the music from my zune onto a friend's pc, and then copied it again from their pc to the external. Finally, I just plugged the external into my new mac, copied the folder within it holding my music, and hit "paste item" in the "Automatically Add to iTunes" folder. Initially, everything seemed to work perfectly, however, after transferring a little over 7 of my 54gb of music, an error message appeared saying that the operation was ending because it could not transfer all files.
         I then tried playing a file off of the hard drive, a wma, and received a prompt that the file was incompatible with Quicktime player, the default for no apparent reason. I tried then opening it with iTunes, and nothing happened, as far as I could see. Naturally, my next step was to google how one would transfer wma files to a mac, and, to make matters even more confusing, all of the results seemed to tell me that iTunes should automatically convert wma files to mp3, which does not seem to be happening in my case.
         I'm still not sure why this isn't working, as I'm sure more than 7gb of my music collection is non-wma, so that doesn't even seem to be the sole issue. Any help with importing my collection would be hugely appreciated, as I'm enjoying my mac so far, but will have to return it if I can't get music on here.
         Thanks.

    One problem is that iTunes for Mac can't handle WMA files, iTunes for Windows will convert them, but not iTunes for Mac. When you add unprotected WMA files to your iTunes library (Windows only), iTunes converts them to new files that iTunes can play, based on your import settings. See if you can use your friend's PC to do this.  If the borrowed PC has iTunes, create an alternate iTunes library so you don't mess up your friend's library.  This explains how:  http://support.apple.com/kb/HT1589
    This support document might be helpful:  iTunes: About the Add to Library, Import, and Convert functions, http://support.apple.com/kb/ht1347

  • Needed help in bulk collect using collections

    Hi,
    I have created a schema level collection like "CREATE OR REPLACE TYPE T_EMP_NO IS TABLE OF NUMBER ;
    will i able to use this in a where clause which involves bulk collect?
    Please share ur thoughts.
    My oracle version is 10g

    user13710379 wrote:
    Will i be able to do a bulk collect into a table using this collection of my sql type?Bulk fetches collects into an array like structure - not into a SQL table like structure. So calling a collection variable in PL/SQL a "+PL/SQL table+" does not make much sense as this array structure is nothing like a table. For the same reason, one needs to question running SQL select statements against PL/SQL arrays.
    As for your SQL type defined - it is a collection (array) of numbers. Thus it can be used to bulk fetch a numeric column.

  • Need help with OCI8::Cursor object

    I'm using ActiveRecord::Base.connection.execute to run a SQL statement against an Oracle schema that is "external" to my Rails database.
    I'm building the connection on the fly using connection parameters stored in my Rails database (MySQL).
    So far so good...I can create the connection and run the query...I'm getting back an OCI8::Cursor object and that's where I'm stuck.
    I need to display the results of the query in a Rails view.
    New to Ruby and I'm not sure how to proceed.
    Here's what I'm getting back:
    #<OCI8::Cursor:0xb76c679c @stmttype=1, @svc=#<OCISvcCtx:0xb76c6c24>, @env=#<OCIEnv:0xb7765928>, @defns=[nil, #<OCIDefine:0xb76c5d10>, #<OCIDefine:0xb76c5cd4>, #<OCIDefine:0xb76c5c5c>, #<OCIDefine:0xb76c5bf8>, #<OCIDefine:0xb76c5bd0>, #<OCIDefine:0xb76c5ba8>, #<OCIDefine:0xb76c5b80>, #<OCIDefine:0xb76c5b58>, #<OCIDefine:0xb76c5b30>, #<OCIDefine:0xb76c5b08>, #<OCIDefine:0xb76c5ae0>, #<OCIDefine:0xb76c5ab8>, #<OCIDefine:0xb76c5a90>, #<OCIDefine:0xb76c5a68>, #<OCIDefine:0xb76c5a40>, #<OCIDefine:0xb76c5a18>, #<OCIDefine:0xb76c59f0>, #<OCIDefine:0xb76c59c8>, #<OCIDefine:0xb76c59a0>, #<OCIDefine:0xb76c5978>, #<OCIDefine:0xb76c5950>, #<OCIDefine:0xb76c5928>, #<OCIDefine:0xb76c5914>, #<OCIDefine:0xb76c58d8>, #<OCIDefine:0xb76c58b0>, #<OCIDefine:0xb76c5888>, #<OCIDefine:0xb76c5860>, #<OCIDefine:0xb76c5838>, #<OCIDefine:0xb76c5810>, #<OCIDefine:0xb76c57e8>, #<OCIDefine:0xb76c57c0>, #<OCIDefine:0xb76c5798>, #<OCIDefine:0xb76c5770>, #<OCIDefine:0xb76c5748>, #<OCIDefine:0xb76c5720>, #<OCIDefine:0xb76c56f8>, #<OCIDefine:0xb76c56d0>, #<OCIDefine:0xb76c56a8>, #<OCIDefine:0xb76c5680>, #<OCIDefine:0xb76c5658>, #<OCIDefine:0xb76c5630>, #<OCIDefine:0xb76c5608>, #<OCIDefine:0xb76c55e0>, #<OCIDefine:0xb76c55b8>, #<OCIDefine:0xb76c5590>, #<OCIDefine:0xb76c5568>, #<OCIDefine:0xb76c5540>, #<OCIDefine:0xb76c5518>, #<OCIDefine:0xb76c54f0>, #<OCIDefine:0xb76c54c8>, #<OCIDefine:0xb76c54a0>], @binds=nil, @ctx=[32, #<Mutex:0xb76c6c38>, nil, 65535], @parms=[#<OCIParam:0xb76c66c0>, #<OCIParam:0xb76c66ac>, #<OCIParam:0xb76c6698>, #<OCIParam:0xb76c6684>, #<OCIParam:0xb76c6670>, #<OCIParam:0xb76c665c>, #<OCIParam:0xb76c6648>, #<OCIParam:0xb76c6634>, #<OCIParam:0xb76c6620>, #<OCIParam:0xb76c65f8>, #<OCIParam:0xb76c65e4>, #<OCIParam:0xb76c65d0>, #<OCIParam:0xb76c65bc>, #<OCIParam:0xb76c65a8>, #<OCIParam:0xb76c6594>, #<OCIParam:0xb76c6580>, #<OCIParam:0xb76c656c>, #<OCIParam:0xb76c6558>, #<OCIParam:0xb76c6544>, #<OCIParam:0xb76c6530>, #<OCIParam:0xb76c651c>, #<OCIParam:0xb76c6508>, #<OCIParam:0xb76c64f4>, #<OCIParam:0xb76c64e0>, #<OCIParam:0xb76c64cc>, #<OCIParam:0xb76c64b8>, #<OCIParam:0xb76c64a4>, #<OCIParam:0xb76c6490>, #<OCIParam:0xb76c647c>, #<OCIParam:0xb76c6418>, #<OCIParam:0xb76c638c>, #<OCIParam:0xb76c62c4>, #<OCIParam:0xb76c61e8>, #<OCIParam:0xb76c6080>, #<OCIParam:0xb76c6058>, #<OCIParam:0xb76c5fcc>, #<OCIParam:0xb76c5fb8>, #<OCIParam:0xb76c5f68>, #<OCIParam:0xb76c5f54>, #<OCIParam:0xb76c5ea0>, #<OCIParam:0xb76c5e64>, #<OCIParam:0xb76c5e14>, #<OCIParam:0xb76c5e00>, #<OCIParam:0xb76c5dec>, #<OCIParam:0xb76c5dd8>, #<OCIParam:0xb76c5dc4>, #<OCIParam:0xb76c5db0>, #<OCIParam:0xb76c5d9c>, #<OCIParam:0xb76c5d88>, #<OCIParam:0xb76c5d74>, #<OCIParam:0xb76c5d60>], @stmt=#<OCIStmt:0xb76c6760>>
    My problem is that I simply don't have a firm enough grasp on the basics of Ruby to dissect this thing and get at it's innards.
    If someone could drop me a code snippet that shows how to reference the contents of this in my erb file I think I'll be off to the races.

    If you want low level access to Oracle database then you can use ruby-oci8 API directly without using ActiveRecord.
    You can read about ruby-oci8 API at http://ruby-oci8.rubyforge.org/en/api.html
    But if you want to use ActiveRecord then install and use oracle_enhanced adapter, see http://wiki.github.com/rsim/oracle-enhanced
    If you have any questions about oracle_enhanced adapter then probably it is better to ask them in http://groups.google.com/group/oracle-enhanced discussion group.
    It is not recommended approach to establish ActiveRecord connection and then use low level ruby-oci8 API.
    And if you have some problem then please describe exactly what you are doing and what you would like to achive and then also what error do you get.

  • NEED HELP! passing an object array to a method

    Hi, i need to make a method called public Server[] getServers() and i need to be able to see if specific server is available for use.
    I have this so far:
    public abstract class AbstractServer
    protected String serverName;
    protected String serverLocation;
    public AbstractServer(String name,String location)
    this.serverName=name;
    this.serverLocation=location;
    public abstract class Server extends AbstractServer
    public Server(String name,String location)
    super(name,location);
    public class CreateServers
    Server server[];
    public CreateServers()
    public Server create()
    for(int i=0; i<10; i++)
    server=new Server(" ", " "); //i was going to fill in something here
    return server;
    OK NOW HERE IS THE PROBLEM
    i have another class that is supposed to manage all these servers, and i dont understand how to do the public Server[] getServers(), this is what i have tried so far
    public class ServerManager()
    public Server[] getServers(Server[] AbstractServer)
    Server server=null; //ok im also confused about what to do here
    return server;
    in the end i need this because i have a thread class that runs the servers that has a call this like:
    ServerManager.getServers("serverName", null);
    Im just really confused because i need to get a specific server by name but i have to go through AbstractServer class to get it
    Any help?

    ok, right
    since i have to call this method in the thread class saying
    ServerManger.getServer(AbstractServer[]) //to see if i have all the servers i need to proceed
    im confused about how it should be declared in the actual ServerManager
    should it be like
    public Server[] getServers(AbstractServer[]) ???? and then have it return all the servers it has
    thats the part i dont get, because instead of saying ServerManager.getServer(string, string) i want it to go and find out if i have all the servers i need to continue
    does that make sense? sort of?

  • Need help w/ making an object appear WHEN a button is pressed

    I've tried to figure this out on my own, but am stumped. I even tried using the .setVisible command... but that didnt work. What I would like to happen is to just have the stick figure appear, sans clothing. Then when the "Add Shirt" button is pressed I want the stick figure to acquire a shirt. Same goes for pants.
    import java.awt.event.*;
    import java.awt.*;
    import java.applet.*;
    public class dolls extends Applet implements AdjustmentListener, ActionListener {
         Shirt myShirt;
         Pants myPants;
         Color c;
         Scrollbar red,green,blue;
         int redValue, greenValue, blueValue, clothing = 0;
         Label redColor, greenColor, blueColor;
         Button shirt, pants;
         boolean clickedShirt = false, clickedPants = false;
         public void init(){
              redColor = new Label("Red");
              add(redColor);
              red = new Scrollbar(Scrollbar.HORIZONTAL,0,0,0,256);
              add(red);
              red.addAdjustmentListener(this);
              greenColor = new Label("Green");
              add(greenColor);
              green = new Scrollbar(Scrollbar.HORIZONTAL,0,0,0,256);
              add(green);
              green.addAdjustmentListener(this);
              blueColor = new Label("Blue");
              add(blueColor);
              blue = new Scrollbar(Scrollbar.HORIZONTAL,0,0,0,256);
              add(blue);
              blue.addAdjustmentListener(this);
              shirt = new Button("Add Shirt");
              add(shirt);
              pants = new Button("Add Pants");
              add(pants);
              myShirt = new Shirt(120,125,3);
              myPants = new Pants(120,125,3);
         public void adjustmentValueChanged(AdjustmentEvent e){
              redValue = red.getValue();
              greenValue = green.getValue();
              blueValue = blue.getValue();
              repaint();
         public void paint(Graphics g){
              g.drawOval(150,100,30,30);
              g.drawLine(165,130,165,180);
              g.drawLine(165,133,120,160);
              g.drawLine(165,133,210,160);
              g.drawLine(165,180,143,235);
              g.drawLine(165,180,187,235);
              if(clickedShirt = true) {
                   c = new Color(redValue, greenValue, blueValue);
                   g.setColor(c);
                   myShirt.display(g);
              if(clickedPants = true){
                   clickedPants = true;
                   c = new Color(redValue, greenValue, blueValue);
                   g.setColor(c);
                   myPants.display(g);
         public void actionPerformed(ActionEvent ae){
              if(ae.getSource() == shirt)
                   clickedShirt = true;
                   repaint();
              if(ae.getSource() == pants)
                   clickedPants = true;
    // <applet code = "dolls.class" height = 300 width=350> </applet>If needed I will post the code for the shirt and pants classes.
    Thank you all for your help.

    code for pants.class
    import java.awt.*;
    public class Pants {
         Polygon pants;
         public Pants(int h, int v, int size){
              pants = new Polygon();
              pants.addPoint(10*size+h,18*size+v); // 1
              pants.addPoint(20*size+h,18*size+v); // 2
              pants.addPoint(25*size+h,35*size+v); // 3
              pants.addPoint(18*size+h,35*size+v); // 4
              pants.addPoint(15*size+h,27*size+v); // 5
              pants.addPoint(13*size+h,35*size+v); // 6
              pants.addPoint(05*size+h,35*size+v); // 7
         public void display(Graphics g){
              g.fillPolygon(pants);
    }code for shirts.class
    import java.awt.*;
    public class Shirt {
         Polygon shirts;
         int h;
         public Shirt(int h, int v, int size){
              shirts = new Polygon();
              shirts.addPoint(12*size+h,1*size+v); // 1
              shirts.addPoint(18*size+h,1*size+v); // 2
              shirts.addPoint(29*size+h,9*size+v); // 3
              shirts.addPoint(26*size+h,12*size+v); // 4
              shirts.addPoint(20*size+h,8*size+v); // 5
              shirts.addPoint(20*size+h,20*size+v); // 6
              shirts.addPoint(10*size+h,20*size+v); // 7
              shirts.addPoint(10*size+h,8*size+v); // 8
              shirts.addPoint(4*size+h,12*size+v); // 9
              shirts.addPoint(1*size+h,9*size+v); //10
         public void display(Graphics g){
              g.fillPolygon(shirts);
         public void changeH(int changeHpos){
              h = h + changeHpos;
    }

  • Need Help With Smart Collections (Lightroom 2.7)

    I am trying to set up a smart collection to list files that are blank in the Location field.  Some fields such as Caption allow you to check if the field "is empty".  Location does not allow the "is empty" option.  What can I do to check if Location is empty or blank?

    Does not contain a e i o u.
    Yes, it's stupid that you need such workarounds.

  • Need Help for Array with Object

    hey there guys... am trying to complete my project which is to create a Library System. Was able to create a list to show the books available when they select the book and click a borrow button it can print out the book.
    what problem i have now is that when a student click borrow... the value how can i transfer to an array inside the object student.
    i am usin a main screen (ms) who is controlling all the functions. been trying and trying on this for very long hopefully there will be those who are able to help me out.
    my customer screen would be like this... but how can i add in the array for books borrowed
    import javax.swing.*;
    class Customer
         private String name;
         private int accNo;
         private String password;
         private double balance;
         private Books borrow[]=new Books[5];
         int borrowCount=0;
         static int customerCount=0;
         private MainScreen ms;
         Customer(String n, int no, String p, double b)
              name=n;
              accNo=no;
              password=p;
              balance=b;
              customerCount++;
              JOptionPane.showMessageDialog(null,name +" record created");
              display();
    /* Trying to Create the Array to store information
         public void setStudentBorrow(String a)
              borrow[borrowCount]=a;
              borrowCount++;
              JOptionPane.showMessageDialog(null,"Book Borrowed");
         public String getStudentBorrow()
              for(int i=0;i<borrowCount-1;i++)
              {     return borrow;     }
         public String getPassword()
         {     return password;     }
         public String getName()
         {     return name;          }
         public int getAccNo()
         {     return accNo;     }
         public double getBalance()
         {     return balance;     }
         public void setName(String n)
         {     name=n;     }
         public void setPassword(String p)
         {     password=p;     }
         public void setBalance(double b)
         {     balance=b;     }
         public void setAccNo(int no)
         {     accNo=no;     }
         public void display()
              JOptionPane.showMessageDialog(null,
              "\nCutomer Number : "+ customerCount+
              "\nName :"+name+
              "\nAccount Number: "+accNo+
              "\nBalance (RM): "+balance,"Customer record",
              JOptionPane.INFORMATION_MESSAGE     );

    Cross Post:
    http://forum.java.sun.com/thread.jspa?threadID=779224&messageID=4433689#4433689

  • Need help!  Simple session object problem.

    Help! I've been working on this for 4 days, but I'm sure it's simple if you are experienced. I'm receiving an error when I try to create the session variable (line 29)
    I just want to
    A) take the record ID's from a string variable on a sort page,
    B) create a string session variable which has those ID's
    C) and then pass it to the cart page, where the ID's will be used to display multiple records.
    1) (From the sort page), using an ADD TO CART BUTTON, Pass the record ID's in the String chkValues[] to a session variable.
    2)Figure out how to be able to access that session variable from the cart page: (The issue is that the form on the sort page already uses a GET method to perform the sort.)
    ERROR
    500 Internal Server Error - /jserv/Detail2.jsp:
    Compilation error occured:
    Found 2 errors in JSP file:
    C:\\Inetpub\\wwwroot\\Beachwear\\jserv\\Detail2.jsp:27: Syntax: Expression expected after this token
    <%@page language="java" import="java.sql.*"%>
    <%@ include file="../Connections/connBeachwear.jsp" %>
    <%@page language="java" import="java.sql.*,java.util.*"%><%//ADDED 12/14 %>
    <%
    //INCLUDE CHECKED ITEMS IN SORT:
    String rsBeachwear__varCheckbox = "1";
    if (request.getParameter ("valueCheckbox") !=null) {rsBeachwear__varCheckbox = (String)request.getParameter ("valueCheckbox")   ;}
    %>
    <%
    String rsBeachwear__name = "ID";//default sort value
         if (request.getParameter ("order") !=null) {rsBeachwear__name = (String)request.getParameter ("order");}
    String rsBeachwear__sort = "ASC";//default sort value
         if (request.getParameter ("sort") !=null) {rsBeachwear__sort = (String)request.getParameter ("sort");}
    String rsBeachwear__orderby ="ID";//default value
         if (request.getParameter ("order") !=null) {rsBeachwear__orderby = (String)request.getParameter("order");}
    String rsBeachwear__sortby ="ASC";//default value
         if (request.getParameter ("sort") !=null) {rsBeachwear__sortby = (String)request.getParameter("sort");}
    %>
    <%
    Driver DriverrsBeachwear = (Driver)Class.forName(MM_connBeachwear_DRIVER).newInstance();
    Connection ConnrsBeachwear = DriverManager.getConnection(MM_connBeachwear_STRING,MM_connBeachwear_USERNAME,MM_connBeachwear_PASSWORD);
    String chkValues[]=request.getParameterValues("valueCheckbox");
    session.setAttribute("chkValues2",chkValues[]);          //AND NOW MAY BE ADDED TO CART
    StringBuffer prepStr=new StringBuffer("SELECT ID, Item, Color, Size FROM Beachwear WHERE ID=");
    for(int x = 0; x < chkValues.length; ++x) {
         prepStr.append(chkValues[x]);
         if((x+1)<chkValues.length){
              prepStr.append(" OR ID=");
              }//end if
         }//end for loop
         prepStr.append(" ORDER BY " + rsBeachwear__name + " " + rsBeachwear__sort ); //NEW SQL SORT CODE:
    PreparedStatement StatementrsBeachwear=ConnrsBeachwear.prepareStatement(prepStr.toString());
    ResultSet rsBeachwear = StatementrsBeachwear.executeQuery();
    Object rsBeachwear_data;
    %>
    <title>Beachwear Title</title>
    <body bgcolor="#FFFFFF">
    <p align="center"><b><font size="4">DETAIL PAGE</font></b></p>
    <form name="form1" method="get" action="Detail2.jsp">
    <table width="75%" border="1">
    <tr>
    <td width="20%">
    <div align="center">Sort Parameter </div>
    </td>
    <td width="19%">
    <div align="center">Sort 1</div>
    </td>
    <td width="25%">
    <div align="center">Sort 2</div>
    </td>
    <td width="36%">
    <div align="center">Add Records to Cart:</div>
    </td>
    <td width="36%">
    <div align="center">
    <div align="center">Go to Cart</div>
    </div>
    </td>
    </tr>
    <tr>
    <td width="20%">
    <div align="center">
    <input type="submit" value="Sort /Select" name="submit">
    </div>
    </td>
    <td width="19%">
    <div align="center">
    <select name="order" size="1">
    <option value="ID" <% if (rsBeachwear__orderby.equals("ID")) {out.print("selected"); } %> >ID</option>
    <option value="Item" <% if (rsBeachwear__orderby.equals("Item")) {out.print("selected"); } %> >Item</option>
    <option value="Color" <% if (rsBeachwear__orderby.equals("Color")) {out.print("selected"); } %> >Color</option>
    <option value="Size" <% if (rsBeachwear__orderby.equals("Size")) {out.print("selected"); } %> >Size</option>
    </select>
    </div>
    </td>
    <td width="25%">
    <div align="center">
    <select name="sort" size="1">
    <option value="ASC" <% if (rsBeachwear__sortby.equals("ASC")) {out.print("selected"); } %>>Ascending</option>
    <option value="DESC" <% if (rsBeachwear__sortby.equals("DESC")) {out.print("selected"); } %>>Descending</option>
    </select>
    </div>
    </td>
    <td width="36%">
    <div align="center">
    <input type="submit" name="Submit" value="Add to Cart">
    </div>
    </td>
    <td width="36%">
    <div align="center">
    <div align="center">
    <input type="button" name="butGoToCart" value="Go to Cart" onClick="window.location='../jserv/Cart2.jsp'">
    </div>
    </div>
    </td>
    </tr>
    </table>
    <p>�</p>
    <%while(rsBeachwear.next()){%>
    <table width="75%" border="1">
    <tr>
    <td width="17%">ID:</td>
    <td width="58%"><%=(((rsBeachwear_data = rsBeachwear.getObject("ID"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    <td width="25%">
    <div align="center">Include in Sort:
    <input type="checkbox" name="valueCheckbox" value="<%=(((rsBeachwear_data = rsBeachwear.getObject("ID"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%>" checked>
    </div>
    </td>
    </tr>
    <tr>
    <td width="17%">ITEM:</td>
    <td colspan="3"><%=(((rsBeachwear_data = rsBeachwear.getObject("Item"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    </tr>
    <tr>
    <td width="17%">COLOR:</td>
    <td colspan="3"><%=(((rsBeachwear_data = rsBeachwear.getObject("Color"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    </tr>
    <tr>
    <td width="17%">SIZE:</td>
    <td colspan="3"><%=(((rsBeachwear_data = rsBeachwear.getObject("Size"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    </tr>
    <tr>
    <td width="17%" bgcolor="#00FFFF" bordercolor="#FFFFFF">
    <div align="left"></div>
    </td>
    <td colspan="3" bgcolor="#00FFFF" bordercolor="#FFFFFF">� </td>
    </tr>
    </table>
    <%
    %>
    <p>�</p>
    </form>
    <%
    rsBeachwear.close();
    ConnrsBeachwear.close();
    %>

    Thanks so much for your informative response!
    I would value your advice and direction to correct the structure of the code, but I am a very methodical person and first must complete the prototype in JSP before I go on to the next step of applying the MVC structure to correct the inefficiencies. (Also, it will be invaluable to the learning process be able to compare the two.) Just as in learning Math, you must learn the long way of problem solving before you apply the sophisticated, less error prone, and more structured approach.
    I have a sort that works pefectly, and displays only the records that have "checks" in the checkboxes. By unchecking the checkbox for individual records, (and then pressing the Sort/Select button), the sort is re-run using only the ID's of records that have been "checked."
    When ADD TO CART is pressed, I want to pass the ID's from the displayed records to a persistent session variable. And then when "DISPLAY CART" is pressed, I want to view a sort page EXACTLY like the original sort page, except the variable holding the diplayed records IS the persistent session variable. I'm not sure how to add only unique ID's to the session variable?
    I'd appreciate any assistance to complete this step, so I can go on and develop the MVC structure.
    Thank you again.
    <%@page language="java" import="java.sql.*"%>
    <%@ include file="../Connections/connBeachwear.jsp" %>
    <%@page language="java" import="java.sql.*,java.util.*"%><%//ADDED 12/14 %>
    <%
    //INCLUDE CHECKED ITEMS IN SORT:
    String rsBeachwear__varCheckbox = "1";
    if (request.getParameter ("valueCheckbox") !=null) {rsBeachwear__varCheckbox = (String)request.getParameter ("valueCheckbox")   ;}
    %>
    <%
    String rsBeachwear__name = "ID";//default sort value
    if (request.getParameter ("order") !=null) {rsBeachwear__name = (String)request.getParameter ("order");}
    String rsBeachwear__sort = "ASC";//default sort value
    if (request.getParameter ("sort") !=null) {rsBeachwear__sort = (String)request.getParameter ("sort");}
    String rsBeachwear__orderby ="ID";//default value
    if (request.getParameter ("order") !=null) {rsBeachwear__orderby = (String)request.getParameter("order");}
    String rsBeachwear__sortby ="ASC";//default value
    if (request.getParameter ("sort") !=null) {rsBeachwear__sortby = (String)request.getParameter("sort");}
    %>
    <%
    Driver DriverrsBeachwear = (Driver)Class.forName(MM_connBeachwear_DRIVER).newInstance();
    Connection ConnrsBeachwear = DriverManager.getConnection(MM_connBeachwear_STRING,MM_connBeachwear_USERNAME,MM_connBeachwear_PASSWORD);
    String chkValues[]=request.getParameterValues("valueCheckbox");
    session.setAttribute("chkValues2",chkValues); //IS THIS THE CORRECT WAY TO ADD ID'S TO A SESSION VARIABLE?
    StringBuffer prepStr=new StringBuffer("SELECT ID, Item, Color, Size FROM Beachwear WHERE ID=");
    for(int x = 0; x < chkValues.length; ++x) {
    prepStr.append(chkValues[x]);
    if((x+1)<chkValues.length){
    prepStr.append(" OR ID=");
    }//end if
    }//end for loop
    prepStr.append(" ORDER BY " + rsBeachwear__name + " " + rsBeachwear__sort ); //NEW SQL SORT CODE:
    PreparedStatement StatementrsBeachwear=ConnrsBeachwear.prepareStatement(prepStr.toString());
    ResultSet rsBeachwear = StatementrsBeachwear.executeQuery();
    Object rsBeachwear_data;
    %>
    <title>Beachwear Title</title>
    <body bgcolor="#FFFFFF">
    <p align="center"><b><font size="4">DETAIL PAGE</font></b></p>
    <form name="form1" method="get" action="Detail2.jsp">
    <table width="75%" border="1">
    <tr>
    <td width="20%">
    <div align="center">Sort Parameter </div>
    </td>
    <td width="19%">
    <div align="center">Sort 1</div>
    </td>
    <td width="25%">
    <div align="center">Sort 2</div>
    </td>
    <td width="36%">
    <div align="center">Add Records to Cart:</div>
    </td>
    <td width="36%">
    <div align="center">
    <div align="center">View Cart</div>
    </div>
    </td>
    </tr>
    <tr>
    <td width="20%">
    <div align="center">
    <input type="submit" value="Sort /Select" name="submit">
    </div>
    </td>
    <td width="19%">
    <div align="center">
    <select name="order" size="1">
    <option value="ID" <% if (rsBeachwear__orderby.equals("ID")) {out.print("selected"); } %> >ID</option>
    <option value="Item" <% if (rsBeachwear__orderby.equals("Item")) {out.print("selected"); } %> >Item</option>
    <option value="Color" <% if (rsBeachwear__orderby.equals("Color")) {out.print("selected"); } %> >Color</option>
    <option value="Size" <% if (rsBeachwear__orderby.equals("Size")) {out.print("selected"); } %> >Size</option>
    </select>
    </div>
    </td>
    <td width="25%">
    <div align="center">
    <select name="sort" size="1">
    <option value="ASC" <% if (rsBeachwear__sortby.equals("ASC")) {out.print("selected"); } %>>Ascending</option>
    <option value="DESC" <% if (rsBeachwear__sortby.equals("DESC")) {out.print("selected"); } %>>Descending</option>
    </select>
    </div>
    </td>
    <td width="36%">
    <div align="center">
    <input type="submit" name="Submit" value="Add to Cart">
    </div>
    </td>
    <td width="36%">
    <div align="center">
    <div align="center">
    <input type="button" name="butViewCart" value="View Cart" onClick="window.location='../jserv/Cart2.jsp'">
    </div>
    </div>
    </td>
    </tr>
    </table>
    <p> </p>
    <%while(rsBeachwear.next()){%>
    <table width="75%" border="1">
    <tr>
    <td width="17%">ID:</td>
    <td width="58%"><%=(((rsBeachwear_data = rsBeachwear.getObject("ID"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    <td width="25%">
    <div align="center">Include in Sort:
    <input type="checkbox" name="valueCheckbox" value="<%=(((rsBeachwear_data = rsBeachwear.getObject("ID"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%>" checked>
    </div>
    </td>
    </tr>
    <tr>
    <td width="17%">ITEM:</td>
    <td colspan="3"><%=(((rsBeachwear_data = rsBeachwear.getObject("Item"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    </tr>
    <tr>
    <td width="17%">COLOR:</td>
    <td colspan="3"><%=(((rsBeachwear_data = rsBeachwear.getObject("Color"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    </tr>
    <tr>
    <td width="17%">SIZE:</td>
    <td colspan="3"><%=(((rsBeachwear_data = rsBeachwear.getObject("Size"))==null || rsBeachwear.wasNull())?"":rsBeachwear_data)%></td>
    </tr>
    <tr>
    <td width="17%" bgcolor="#00FFFF" bordercolor="#FFFFFF">
    <div align="left"></div>
    </td>
    <td colspan="3" bgcolor="#00FFFF" bordercolor="#FFFFFF">  </td>
    </tr>
    </table>
    <%
    %>
    <p> </p>
    </form>
    <%
    rsBeachwear.close();
    ConnrsBeachwear.close();
    %>

  • Need help with APEX Collection - C

    Hi
    I have values in 2 fields on my page that I use to build a collection - "On Submit - After Computations and Validations"
    I want to delete collection using HTMLDB_COLLECTION.DELETE_COLLECTION ; and recreate if user changes a value in any of the above 2 fileds ( field 1 is LOV and field 2 is DATE )
    I know I have to use AJAX but could not figure out how to code it . Can someone please direct me to any similar peice of code or suggest the steps?
    Thanks
    Aali

    You can find it here:
    http://apex.oracle.com/pls/otn/f?p=31517:246
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

Maybe you are looking for

  • I am having problems installing adobe photoshop cs5 extended

    Hi, When I install this version of photoshop, I type in the serial number which allows me to install the program, then once installed it asks for another serial number in which I type the same number in only to be told it is an invalid serial number.

  • Why "DOESN'T" Firefox open a new Application in a "NEW TAB" Like it used to?

    I want a new tab ope for each app. I am using so I can just click on the tab, and continue to work on that app. I "Don't" want to use the "History" and then wait for it to "Reload" that tab!! I want my tabs all open until I close them. Also, why isn'

  • System refresh backup

    Hi All, I am doing System Refresh, could you please suggest me how can I take the backup of printers, RFCu2019s and Logical systems Previously I used to note RFCu2019s but in this Landscape we have many RFC, printers and logical systems are different

  • E52 CAN USE AS A MODEM TO PC?

    hi guys , is nokia E52 can use as  a modem in PC?  thanks 

  • Advice on best way to transition to Leopard

    Hi all, apologies in advance if this has been discussed before (although I didn't find anything similar). My copy of Leopard should arrive sometime next week. I have a G5 PowerMac with an internal 160GB drive (Old Drive) that is around 2/3 full. I ju