GUI Architecture book

Hi,
I'm looking for a good book that deals with the underlying architecture of GUIs. I'm not looking for a Swing book necessarily, but a more general Design book that offers good architectural solutions and suggestions for people who need to design and control GUIs. In suggestions?
I'm quite familiar with Design Patterns by Gamma et al. Some of the patterns in this book deal with GUI topics, which is the sort of discussion that I'm looking for. I'd be quite interested in seeing a book which suggests GUI architectures that combine a number of patterns.

dated but good (and only $8)
http://www.amazon.com/exec/obidos/tg/detail/-/020160891X/qid=1045503559/sr=8-1/ref=sr_8_1/104-6741858-0465541?v=glance&s=books&n=507846

Similar Messages

  • Good Data warehouse architecture  books or Documentation

    Hi,
    i was looking for the good data warehousing Architecture/Concept books or documentation links. Can you suggest me please ? Your advice is greatly appreciated!
    Thanks,
    shashi

    See if following helps
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14223/toc.htm
    http://download.oracle.com/docs/cd/B10500_01/server.920/a96520/concept.htm
    http://principlepartners.com/presentations/DataWarehouseConceptsAndArchitecture.pdf

  • Requiring several database queries for my GUI - where to put the reads?

    Requiring several database queries for my GUI
    Hi all,
    I am to create a GUI with a couple of drop downs
    These are populated from database queries, as well as the main program reading from the database based on all inputs in the GUI.
    Should I put all database reads into a class as seperate methods.
    e.g,
    one method for the database read to populate the first combo box.
    a second method to take the choice from combobox 1 and read from the database to populate combobox 2
    a third method to then perform the main database read based on GUI selections from the above two methods..
    is this the 'right' way to do it.
    my GUI would then be in a sperate class.
    or should I sperate the 3 database reads into 3 different classes?
    thanks in advance,
    Matt

    BigDaddyLoveHandles wrote:
    walker8 wrote:
    You might also read some info on three tier design using MVC (Model, View, Control) if i recall correctly.
    Here's an article by Martin Fowler on GUI architecture: [http://martinfowler.com/eaaDev/uiArchs.html]
    awesome! that's just what i needed. i haven't read all of it yet but it gives me ideas about the classes i need.
    regards
    walker8

  • My (mini) GUI framework proposal

    Hello,
    As a hobby I started a stand-alone java music application that allows to edit a music lead sheet (list of chords like "Cm F7"), select a rhythm and some instruments, and generate a MIDI accompaniment for that leadsheet (for those who know, it's a bit like the "Band In A Box" program). GUI is quite classical : JFrame with menubar, toolbars, status bar, main content pane being split in a "playback settings" pane (e.g. instruments) and a "music leadsheet editor" pane. There are also numerous Dialogs used for app configuration or controlling some special modes (record mode etc..).
    The application getting bigger and bigger, I realized I had to review completly my GUI architecture, because it was more and more difficult to extend (though I always tried to separate views from application logic using kind of controllers).
    After some search on the web (MVC/HMVC models, design patterns, UI frameworks etc...), I came up with a rough idea of an architecture that I hope would suit my needs (extendable but not too heavy). As I'm really not sure it's the right way to go, I thought I could expose my plans here and maybe get feedback from experienced people in java GUI development. Thanks in advance !
    0) GUI is decomposed in GUI modules (I guess they are the "views" of the MVC model)
    A GUI module is a high-level brick of the application GUI, e.g. a JDialog, the "leadsheet editor" panel, the "midi settings" panel.
    1) Each GUI module has a Controller object and a model
    Controller has a direct reference to its GUI module, but GUI module does not have a direct reference to its Controller.
    Controller registers its GUI module to get change events due to user input.
    Both Controller and GUI module have a direct reference to the model and register it to get model change events.
    2) Actions, toolbars, menus are defined in an actions.xml file (see http://www.javadesktop.org/articles/actions/index.html)
    Actions are loaded at runtime into a Singleton instance of an ActionManager.
    When possible the Swing components that compose a GUI module are built from these actions (e.g. JMenu, JButton...). For Swing components that do not support Actions (e.g. JSpinner), the GUI module offers some "addChangeListener()" functions to allow the Controller to receive the JSpinner changes.
    3) Using the ActionManager, the Controller registers each Action he's responsible for
    The actionXXXPerformed() will:
    IF action don't need to change the model (e.g. navigation event) THEN
    - call GUI module functions to update the view (e.g. move the focus to the next "chord" in my leadsheet editor)
    END IF
    IF action needs to change the model (e.g. change the value of a chord)
    - call the change_XXX() function in the Controller
    - the GUI module will be automatically notified of the model changes as it registered the model to get change events
    END IF
    4) All changes to model are made thru Controller's change_XXX() functions
    The change_XXX() function will:
    - Start an undoable Coumpound Edit
    - get some information from the GUI module (e.g. get the list of selected "chords" in my leadsheet editor)
    - update the model (e.g. change the value of the selected "chords" in the leadsheet model)
    - End the undoable Coupound Edit
    - fire a UndoableEditHappened() (listened by a Singleton instance of an UndoManager used by all the application)
    In the Controller, separating the actionXXXXperformed() from change_XXXX() allows that even if change_XXX() is called programmatically, it is still "undoable".
    6) The Controller enables/disables the actions he's responsible for depending of the application state
    I'm not sure for this : maybe it would be better to let the ActionManager do this in a centralized way (as the actions.xml file already centralizes all the actions of the application), but I feel it would be too much logic in one place, so I preferred to assign some Actions to each Controller and let the Controller manage its own actions only.
    7) All Controllers register an "EventBus" (see http://projects.d-haven.org/modules/mydownloads/index.php)
    In case an event managed by Controller X is also needed by other Controllers, Controller X will generate a PropertyChangeEvent on that bus. Controllers that have registered the bus for such events will receive it.
    8) If we have Module GUI X-Controller X and Module GUI Y-Controller Y, Controller X can't directly get some information from Module GUI Y, he must get the information from Controller Y
    This is because I believe a Controller is less likely to evolve than a Module GUI, so less maintenace problems.
    However it can happen that due to a redesign the information hold by Controller Y will be now managed by Controller Z, and I'll have to update Controller X accordingly. To avoid this coupling, I would need a kind of protocol on the EventBus to send the request "GET_INFO(XXXX)", then a Controller I don't have to know could take the request and reply with a new message on the bus. But this solution seems too heavy for my problem.

    It sounds like you may be where I was three years ago, trying to cope with increasing GUI complexity as an application develops.
    There is a surprising lack of standard solutions to this problem, possibly because of the huge variety of possible applications. However I have had a go at a general solution, demonstrated at http://superficial.sourceforge.net.
    The demo is only an applet, but the general principle can easily be adapted for free-standing applications, even MDI.
    Perhaps this will be of help to you.

  • CUDA and PyCUDA

    Does anyone here use CUDA for scientific computing? I need pointers to any good tutorials and sample code that anyone knows about. Also, I'm really interested in working with PyCUDA and coding in Python instead of C/C++. I need this code to be cross platform without alot of trouble and I'm leaning to wxPython as a possible GUI (I'm developing an app that must be usable by people that don't even know what Python or CUDA or even C are).:cool:

    I do not know about the pyCUDA API. But I have been using CUDA. The best way to start is to use the CUDA programming manual http://developer.download.nvidia.com/co … de_1.1.pdf
    The 2.0 manual is in beta... So I guess you can read that as well. For running CUDA based programs, you need a fairly new GPU like geforce 8x or the newer teslas. CUDA programs are sadly not too portable because it depends on the graphics card which limits the number of grids of threads.  Also, you have to be very strong in C. CUDA is just a big extension of C for data parallel SIMD computing. Dust out your old parallel computer architecture books and enjoy!

  • What Classes do you use for developing Database Applications

    Hi ! (sorry for my bad english)
    I develop now an application for production planning and I use an informix database-server. I have no problems with the database an the connection. I,m a database expert, but I,m a newcommer in java. What classes do you use to develop a database application ? (specially Table Handling) I tried it with JTable and AbstractTableModel. Are there better possibilities ?
    JdbTable OR
    JTable with DBTableModel OR
    JTable with DBTableModel and DataSet
    I know that this is a big question, but some little Informations can help me. (I develop with JBuilder Proffessional)
    Thank you for your help.
    Wolfgang

    No - the classes you have described (AbstractTableModel etc) are Swing classes - that is, they are Models in the MVC GUI architecture. Database-related stuff (SQL at any rate) is contained in the packages java.sql and javax.sql - The latter is part of the Enterprise addition. You would also need to purchase a database driver (or use the sun one, which is something like com.sun.odbc.jdbc.Driver or whatever). The driver supplies you with connections to the database (java.sql.Connection).
    Alternatively, you may be deploying code in a J2EE AppServer (eg. WebLogic, WebSphere etc) in which case you can use the JNDI to get a javax.sql.DataSource object (by setting one up in the AppServer and doing a lookup on it) and use this to get database Connections.
      Class c = Class.forName("com.sybase.jdbc2.jdbc.SybDriver");
      SybDriver sybDriver = (SybDriver) c.newInstance();
      java.sql.DriverManager.registerDriver((Driver) sybDriver);
      //then use Driver object to get hold of a Connection
      //or alternatively using DataSources
      InitialContext ctx = new InitialContext();
      DataSource ds = (DataSource) ctx.lookup("jdbc/MyDriver");
      Connection conn = null;
      try{
        Connection conn = ds.getConnection("login", "password");
        Statement stmt = conn.createStatement();
        ResultSet rs = stmt.executeQuery("select * from MY_TABLE");
        while (rs.next()) {
          //columns are enumerated 1...n
          String s = rs.getString(1);
          //or can get by Col Name
          String str = rs.getString("name_col");
      } finally {
        conn.close();
      }Anyway, I hope this helps - you'll probably need to get a book on it (Java Enterprise by O'Reilly is a good one)

  • Locking and blocking - puzzlement.

    I have a table - relatively simple
    CREATE TABLE Sysstat
    M_Time     DATE,
    Usr_pct    NUMBER(10, 0),
    Sys_pct    NUMBER(10, 0),
    <a few more NUMBER(10, 0) deleted...
    CONSTRAINT Sysstat_PK PRIMARY KEY (M_Time)
    );Issue (From an SQLPlus session) the command DELETE FROM Sysstat - but do not COMMIT.
    Go to SQLDeveloper - and (try to) do the following
    INSERT INTO Sysstat
    SELECT ROUND(TO_DATE  (Sysstat_ext.M_Time, 'DD-MM HH24:MI:SS'), 'MI') AS "Measurement Time",
           ROUND(TO_NUMBER(Sysstat_ext.Usr_pct),    0) AS "% Usr",
           <fields deleted>
    FROM Sysstat_ext
    COMMIT;The SQLDeveloper session completely hangs - forever* (at least 20 mins at this stage).
    As I understood matters with Oracle there were three possibilities.
    1) PK violation. The SQLDeveloper session "sees" that there are still records in Sysstat (changes
    are uncommitted as far as he's concerned), but there is a PK violation in the data to
    be inserted anyway, so the SQLDeveloper session should tell the user Sysstat_PK violation.... error...
    2) No potential PK violation. The SQLDeveloper session doesn't know whether the SQL*Plus
    session will commit its deletions or not, therefore the SQLDeveloper session commits and Oracle keeps track of the
    necessary chains of pointers internally and/or when the SQL*Plus session tries to commit, it's accepted or refused
    depending on whether this will cause other issues (FK violation for example)
    or
    3) Oracle knows that there's a deadlock and after a certain period (configurable?) rolls back the SQLDeveloper session
    and informs the user.
    Could some kind soul explain to me what, exactly, is going on - and why my reasoning is so obviously erroneous.
    I have been looking at Kyte's architecture book, so maybe a concrete example (I've never deadlocked Oracle
    before) would help clarify the concepts for me.
    Paul...

    Paulie wrote:
    >
    Could some kind soul explain to me what, exactly, is going on - and why my reasoning is so obviously erroneous.
    I have been looking at Kyte's architecture book, so maybe a concrete example (I've never deadlocked Oracle
    before) would help clarify the concepts for me.I've now read a bit about mutexes in Oracle - not that I understood all of it.
    no deadlock is occuring.Well, what else should one call a session that is blocked indefinitely? Is there another
    computer science term for this phenomenon?
    I suspect a Mutex wait is the cause.OK - so, some sort of device to "regulate concurrent access to a shared resource". That's fine.
    The blogs and websites which discuss this seem to be a propeller-head's wet dream with obscure X$_Blah
    table configs and Totallyunknown_even_to_Oracle_Support parameters being bandied about like there's
    no tomorrow.
    What I would like to know is a bit more prosaic (and perhaps a level less technically sophisticated).
    Is my reading of Oracle's Locking/Latching/Multi-User behaviour correct in what I wrote originally, i.e.
    Scenarios:
    1) PK violation. The SQLDeveloper session "sees" that there are still records in Sysstat (deletion
    is uncommitted as far as he's concerned), but there is a PK violation in the data to
    be inserted anyway, so the SQLDeveloper session should tell the user Sysstat_PK violation.... error...
    no change to database - SQLDev user informed
    2) No potential PK violation. The SQLDeveloper session doesn't know whether the SQL*Plus
    session will commit its deletions or not, therefore the SQLDeveloper session commits and Oracle keeps track of the
    necessary chains of pointers internally and/or when the SQL*Plus session tries to commit, it's accepted or refused
    depending on whether this will cause other issues (FK violation for example)
    or
    3) Oracle knows that there's a deadlock and after a certain period (configurable?) rolls back the SQLDeveloper session
    and informs the user.
    Or am I still competely at sea with what Oracle is about? I was of the understanding that whatever* happened,
    you should never have a situation where a session hangs indefinitely, due to Oracle's system
    of multi-version concurrency - basically, I'm asking what is going on here and how does it
    fit with my current* (and obviously mistaken) understanding of how Oracle works.
    Thanks for your input so far.
    Paul...A basic truism exist for Oracle.
    Readers do not block writers & writers do not block readers!
    What you fail to recognize is that your test case has two WRITERS; both are doing DML!
    two sessions want to change same resource & to maintain data consistency & integrity
    the changes must be serialized. One must complete before the second can proceed.
    Oracle utilizes Interested Transaction List (ITL) to maintain block level data consistency.
    SELECT DECODE(request,0,'Holder: ','Waiter: ')||sid sess,
    id1, id2, lmode, request, type
    FROM V$LOCK
    WHERE (id1, id2, type) IN
    (SELECT id1, id2, type FROM V$LOCK WHERE request>0)
    ORDER BY id1, request
    /

  • Networking - Why Doesn't This Work?

    Hey all
    Just wondering if any of you have any ideas why this code isn't working properly - for the Client to connect the Server has to be restarted. Is there a solution to this problem?
    The Client Class:
    import java.awt.Container;
    import java.awt.Color;
    import java.awt.Font;
    import java.awt.FlowLayout;
    import java.awt.Dimension;
    import java.awt.GridBagLayout;
    import java.awt.GridBagConstraints;
    import java.awt.Insets;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JColorChooser;
    import javax.swing.ButtonGroup;
    import javax.swing.Box;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.BoxLayout;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.JLabel;
    import javax.swing.JComboBox;
    import javax.swing.JOptionPane;
    import javax.swing.JRadioButton;
    import java.io.*;
    import java.net.*;
    * This is the user class and holds all the details for the GUI. The gui contains listeners
    * ans it sends messages to the server and also recieves messages from the server. This class
    * works primarily with the ClienttoServer class.
    * Help was used to create this class, mainly from the Java GUI devlopment book by Varan Piroumian
    * as this hsowed the basic components needed to create a GUI and which imports were the most essential
    * in order to have an interactive interface for the chat application.
    public class Client extends JFrame implements ActionListener
         private static final long serialVersionUID = 1L;
         private JTextArea conversationDisplay;
         private JTextField createMsg, hostfield, portnumfd, usernamey;
         private JScrollPane scrolly;
         private JLabel hosty, portnum, convoLabel, msgLabel, netwrk, netwrk2, talk2urself, fonts, nickName, ustatus, econs;
         private JPanel lpanel, rpanel, lpanel1, lpanel2, lpanel3, lpanel4, lpanel5, rpanel1, rpanel2, rpanel3, rpanel4, rpanel5;
         private JButton sendMsgButton, colourButton, exitButton, connect, dropconnection;
         private JRadioButton talk2urselfOn, talk2urselfOff;
         private JComboBox fontcombiBox, statusbox, emoticons;
         private JColorChooser colourchoo;
         private Container theWholeApp;
         private String username;
         private PrintWriter writer;
         private Socket socky;
         //for the self comm button
         private boolean talktoself = true;
         //used as when a msg is sent to the server the name & msg are sent in 2 parts (\n function) i.e
         //2 different messages. So in self comm mode then the next message needs to be ignored
         private boolean ignoreyourself = false;
          * The Constructor or the class
         public Client()
              makeGUI();
              System.out.println("Loading the GUI....");
          * Creates the GUI for the user to see/use
         public void makeGUI()
              //create the whole window
              JFrame.setDefaultLookAndFeelDecorated(true);
              //set the title of the whole app
              this.setTitle("Welcome To Elliot's Chat Network...");
              //set the app window size
              this.setSize(600, 575);
              //create the outer container for the app
              theWholeApp = getContentPane();
              //make new gridbag layout
              GridBagLayout layoutgridbag = new GridBagLayout();
              //create some restraints for this...
              GridBagConstraints gbconstraints = new GridBagConstraints();
              //make the app use this gridbag layout
              theWholeApp.setLayout(layoutgridbag);
              //this is where elements are added into the application's window
              //creates and adds the convo label
              convoLabel = new JLabel("Your Conversation:");
              gbconstraints = new GridBagConstraints();
              gbconstraints.gridx = 0;
              gbconstraints.gridy = 0;
              gbconstraints.gridheight = 1;
              gbconstraints.gridwidth = 1;
              gbconstraints.weightx = 5;
              gbconstraints.weighty = 1;
              gbconstraints.anchor = GridBagConstraints.WEST;
              layoutgridbag.setConstraints(convoLabel, gbconstraints);
              theWholeApp.add(convoLabel);
              //create & add the exit button
              exitButton = new JButton("Exit");
              gbconstraints = new GridBagConstraints();
              gbconstraints.gridx = 10;
              gbconstraints.gridy = 0;
              gbconstraints.gridheight = 1;
              gbconstraints.gridwidth = 1;
              gbconstraints.weightx = 1;
              gbconstraints.weighty = 1;
              gbconstraints.anchor = GridBagConstraints.EAST;
              layoutgridbag.setConstraints(exitButton, gbconstraints);
              theWholeApp.add(exitButton);
              exitButton.addActionListener(this);
              //create & add the txt area
              conversationDisplay = new JTextArea(15,15);
              scrolly = new JScrollPane(conversationDisplay);
              gbconstraints = new GridBagConstraints();
              gbconstraints.gridx = 0;
              gbconstraints.gridy = 1;
              gbconstraints.gridheight = 4;
              gbconstraints.gridwidth = 11;
              gbconstraints.weightx = 10;
              gbconstraints.weighty = 20;
              gbconstraints.anchor = GridBagConstraints.WEST;
              gbconstraints.fill = GridBagConstraints.BOTH;
              gbconstraints.insets = new Insets(10, 10, 15, 15);
              //so the clients cant write in the display area...
              conversationDisplay.setEditable(false);
              layoutgridbag.setConstraints(scrolly, gbconstraints);
              theWholeApp.add(scrolly);
              //create & add the nick name area
              nickName = new JLabel("Your nick \nthis is required");
              gbconstraints = new GridBagConstraints();
              gbconstraints.gridx = 0;
              gbconstraints.gridy = 5;
              gbconstraints.gridheight = 1;
              gbconstraints.gridwidth = 1;
              gbconstraints.weightx = 5;
              gbconstraints.weighty = 1.5;
              gbconstraints.anchor = GridBagConstraints.WEST;
              gbconstraints.fill = GridBagConstraints.HORIZONTAL;
              gbconstraints.insets = new Insets(3, 10, 0, 0);
              layoutgridbag.setConstraints(nickName, gbconstraints);
              theWholeApp.add(nickName);
              //create & add the nick name box
              usernamey = new JTextField(10);
              gbconstraints = new GridBagConstraints();
              gbconstraints.gridx = 0;
              gbconstraints.gridy = 6;
              gbconstraints.gridheight = 1;
              gbconstraints.gridwidth = 1;
              gbconstraints.weightx = 1;
              gbconstraints.weighty = 1;
              gbconstraints.anchor = GridBagConstraints.WEST;
              gbconstraints.fill = GridBagConstraints.HORIZONTAL;
              gbconstraints.insets = new Insets(0, 10, 0, 0);
              layoutgridbag.setConstraints(usernamey, gbconstraints);
              theWholeApp.add(usernamey);
              //create & add the your message label
              msgLabel = new JLabel("Your Message:");
              gbconstraints = new GridBagConstraints();
              gbconstraints.gridx = 0;
              gbconstraints.gridy = 7;
              gbconstraints.gridheight = 1;
              gbconstraints.gridwidth = 1;
              gbconstraints.weightx = 1;
              gbconstraints.weighty = 1;
              gbconstraints.anchor = GridBagConstraints.WEST;
              gbconstraints.fill = GridBagConstraints.BOTH;
              gbconstraints.insets = new Insets(0, 10, 0, 0);
              layoutgridbag.setConstraints(msgLabel, gbconstraints);
              theWholeApp.add(msgLabel);
              //create & add the create message box
              createMsg = new JTextField(15);
              gbconstraints = new GridBagConstraints();
              gbconstraints.gridx = 0;
              gbconstraints.gridy = 8;
              gbconstraints.gridheight = 2;
              gbconstraints.gridwidth = 10;
              gbconstraints.weightx = 10;
              gbconstraints.weighty = 1;
              gbconstraints.anchor = GridBagConstraints.WEST;
              gbconstraints.fill = GridBagConstraints.HORIZONTAL;
              gbconstraints.insets = new Insets(3, 10, 0, 0);
              layoutgridbag.setConstraints(createMsg, gbconstraints);
              theWholeApp.add(createMsg);
              createMsg.addActionListener(this);
              createMsg.setActionCommand("Press Enter!");
              //create & add the send message button
              sendMsgButton = new JButton("Send Msg");
              gbconstraints = new GridBagConstraints();
              gbconstraints.gridx = 10;
              gbconstraints.gridy = 8;
              gbconstraints.gridheight = 1;
              gbconstraints.gridwidth = 1;
              gbconstraints.weightx = 1;
              gbconstraints.weighty = 1;
              gbconstraints.anchor = GridBagConstraints.EAST;
              layoutgridbag.setConstraints(sendMsgButton, gbconstraints);
              theWholeApp.add(sendMsgButton);
              sendMsgButton.addActionListener(this);
              //create & add the left panel
              lpanel = new JPanel();
              gbconstraints = new GridBagConstraints();
              gbconstraints.gridx = 0;
              gbconstraints.gridy = 10;
              gbconstraints.gridheight = 3;
              gbconstraints.gridwidth = 4;
              gbconstraints.weightx = 5;
              gbconstraints.weighty = 0;
              gbconstraints.anchor = GridBagConstraints.WEST;
              gbconstraints.insets = new Insets(0, 10, 0, 0);
              layoutgridbag.setConstraints(lpanel, gbconstraints);
              theWholeApp.add(lpanel);
              //create & add the right panel
              rpanel = new JPanel();
              gbconstraints = new GridBagConstraints();
              gbconstraints.gridx = 5;
              gbconstraints.gridy = 10;
              gbconstraints.gridheight = 3;
              gbconstraints.gridwidth = 4;
              gbconstraints.weightx = 5;
              gbconstraints.weighty = 0;
              gbconstraints.anchor = GridBagConstraints.EAST;
              layoutgridbag.setConstraints(rpanel, gbconstraints);
              theWholeApp.add(rpanel);
              //add to the left JPanel - set the layout for this
              lpanel.setLayout(new BoxLayout(lpanel, BoxLayout.Y_AXIS));
              //add panels into this left panel...
              lpanel1 = new JPanel();
              lpanel2 = new JPanel();
              lpanel3 = new JPanel();
              lpanel4 = new JPanel();
              lpanel5 = new JPanel();
              lpanel.add(lpanel1);
              lpanel.add(lpanel2);
              lpanel.add(lpanel3);
              lpanel.add(lpanel4);
              lpanel.add(lpanel5);
              //set FlowLyout for each of these panels
              lpanel1.setLayout(new FlowLayout(FlowLayout.LEFT));
              lpanel2.setLayout(new FlowLayout(FlowLayout.LEFT));
              lpanel3.setLayout(new FlowLayout(FlowLayout.LEFT));
              lpanel4.setLayout(new FlowLayout(FlowLayout.LEFT));
              lpanel5.setLayout(new FlowLayout(FlowLayout.LEFT));
              //add in the network items...
              netwrk = new JLabel("Network Details:");
              lpanel1.add(netwrk);
              //create and add instructions for this
              netwrk2 = new JLabel("Please enter the details for \nthe person you want to chat to...");
              lpanel2.add(netwrk2);
              //create/add the ip addy label
              hosty = new JLabel("Host:");
              lpanel3.add(hosty);
              lpanel3.add(Box.createRigidArea(new Dimension(5,0)));
              hostfield = new JTextField("Enter Hostname",10);
              lpanel3.add(hostfield);
              //port num next
              portnum = new JLabel("Port Number:");
              lpanel4.add(portnum);
              lpanel4.add(Box.createRigidArea(new Dimension(5, 0)));
              portnumfd = new JTextField("2250", 10);
              lpanel4.add(portnumfd);
              //create & add the connect butt
              connect = new JButton("Connect");
              lpanel5.add(connect);
              dropconnection = new JButton("Disconnect");
              lpanel5.add(dropconnection);
              connect.addActionListener(this);
              dropconnection.addActionListener(this);
              //start the creation of the right hand panel.
              rpanel.setLayout(new BoxLayout(rpanel, BoxLayout.Y_AXIS));
              //create the panels again
              rpanel1 = new JPanel();
              rpanel2 = new JPanel();
              rpanel3 = new JPanel();
              rpanel4 = new JPanel();
              rpanel5 = new JPanel();
              rpanel.add(rpanel1);
              rpanel.add(rpanel2);
              rpanel.add(rpanel3);
              rpanel.add(rpanel4);
              rpanel.add(rpanel5);
              rpanel1.setLayout(new FlowLayout(FlowLayout.LEFT));
              rpanel2.setLayout(new FlowLayout(FlowLayout.LEFT));
              rpanel3.setLayout(new FlowLayout(FlowLayout.LEFT));
              rpanel4.setLayout(new FlowLayout(FlowLayout.LEFT));
              rpanel5.setLayout(new FlowLayout(FlowLayout.LEFT));
         //now start putting things into them again
              //add in the font settings
              String[] fonty = {"Normal", "Bold", "Italic"};
              fonts = new JLabel("Set your text style:");
              fontcombiBox = new JComboBox(fonty);
              rpanel2.add(fonts);
              rpanel2.add(Box.createRigidArea(new Dimension(4,0)));
              rpanel2.add(fontcombiBox);
              //default text will be plain..
              fontcombiBox.setSelectedIndex(0);
              String[] userstatus = {"Online", "Away", "Be Right Back", "Busy", "Out To Lunch", "On The Phone"};
              ustatus = new JLabel("Select a status:");
              statusbox = new JComboBox(userstatus);
              rpanel2.add(ustatus);
              rpanel2.add(Box.createRigidArea(new Dimension(2,0)));
              rpanel2.add(statusbox);
              //add in some emotion to the conversations
              String[] emotion = {"Angry", "Happy", "Sad", "Crying", "Shocked", "Laughing", "Laughing My Ass Off!"};
              econs = new JLabel("Select an emoticon:");
              emoticons = new JComboBox(emotion);
              rpanel3.add(econs);
              rpanel3.add(Box.createRigidArea(new Dimension(3,0)));
              rpanel3.add(emoticons);
              //self comm options
              talk2urself = new JLabel("Set Self Communication Mode:");
              rpanel4.add(talk2urself);
              talk2urselfOn = new JRadioButton("On", true);
              rpanel4.add(talk2urselfOn);
              rpanel4.add(Box.createRigidArea(new Dimension(4, 0)));
              talk2urselfOff = new JRadioButton("Off", false);
              rpanel4.add(talk2urselfOff);
              //create a group that will hold both these buttons together
              ButtonGroup groupy = new ButtonGroup();
              //add them to the group
              groupy.add(talk2urselfOn);
              groupy.add(talk2urselfOff);
              //create and add the change backgrd button
              colourButton = new JButton("Alter Background");
              rpanel5.add(colourButton);
              //add in some listeners
              talk2urselfOn.addActionListener(this);
              talk2urselfOff.addActionListener(this);
              fontcombiBox.addActionListener(this);
              colourButton.addActionListener(this);
              statusbox.addActionListener(this);
              //add in the 'X' button in the top right corner of app
              setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              //put all elements together
              this.pack();
              //show the GUI for the user..
              this.show();
          * Creates a new client and GUI as its the main method
         public static void main(String args[])
              new Client();
          * This method listens for actions selected by the user and then performs the
          * necessary tasks in order for the correct events to take place...!
          * This method was mainly created thanks to the Developing Java GUI book which has already
          * been mentioned as it covers listeners and event handling...
         public void actionPerformed(ActionEvent event)
              //if the send button is clicked or if hard carriage return after message
              if((event.getSource() == (sendMsgButton)) || (event.getSource().equals(createMsg)))
                   //if theres no text dont send message
                   if(createMsg.getText().equals(""))
                        JOptionPane.showMessageDialog(this, "There's no text to send!");
                   else
                        String str  = createMsg.getText();
                        printMessage(str);
              //if the exit button is clicked
              if(event.getSource() == (exitButton))
                   //quit the chat app
                   JOptionPane.showMessageDialog(this, "Thanks For Using Elliot's Chat Network! \nSee You Again Soon!");
                   System.exit(0);
              //if the self comm option is turned on
              if(event.getSource() == (talk2urselfOn))
                   talktoself = true;
                   JOptionPane.showMessageDialog(this, "You have begun self communication \nmessages you send are now displayed");
              //if the self comm option is turned off
              if(event.getSource() == (talk2urselfOff))
                   talktoself = false;
                   JOptionPane.showMessageDialog(this, "You have stopped self communication \nmessages you send are no longer displayed");
              //for the normal font option
              if(fontcombiBox.getSelectedItem().equals("Plain"))
                   //makes a new font style plain...
                   conversationDisplay.setFont(new Font("simple", Font.PLAIN, 12));
                   createMsg.setFont(new Font("simple", Font.PLAIN, 12));
              //for the bold font option
              if(fontcombiBox.getSelectedItem().equals("Bold"))
                   conversationDisplay.setFont(new Font("simple", Font.BOLD, 12));
                   createMsg.setFont(new Font("simple", Font.BOLD, 12));
              //for the italic font option
              if(fontcombiBox.getSelectedItem().equals("Italic"))
                   conversationDisplay.setFont(new Font("simple", Font.ITALIC, 12));
                   createMsg.setFont(new Font("simple", Font.ITALIC, 12));
               *      //the status events if they didnt create null points...
              if(statusbox.getSelectedItem().equals("Online"))
                   String status = "<Online>";
                   printMessage(status);
              if(statusbox.getSelectedItem().equals("Away"))
                   String status = "<Away>";
                   printMessage(status);
              if(statusbox.getSelectedItem().equals("Be Right Back"))
                   String status = "<Be Right Back>";
                   printMessage(status);
              if(statusbox.getSelectedItem().equals("Busy"))
                   String status = "<Busy>";
                   printMessage(status);
              if(statusbox.getSelectedItem().equals("Out To Lunch"))
                   String status = "<Out To Lunch>";
                   printMessage(status);
              if(statusbox.getSelectedItem().equals("On The Phone"))
                   String status = "<On The Phone>";
                   printMessage(status);
              //the emoticons events...
              if(emoticons.getSelectedItem().equals("Angry"))
                   String status = "<Angry>";
                   printMessage(status);
              if(emoticons.getSelectedItem().equals("Sad"))
                   String status = "<Sad>";
                   printMessage(status);
              if(emoticons.getSelectedItem().equals("Shocked"))
                   String status = "<Shocked>";
                   printMessage(status);
              if(emoticons.getSelectedItem().equals("Happy"))
                   String status = "<Happy>";
                   printMessage(status);
              if(emoticons.getSelectedItem().equals("Crying"))
                   String status = "<Crying>";
                   printMessage(status);
              if(emoticons.getSelectedItem().equals("Laughing"))
                   String status = "<Laughing>";
                   printMessage(status);
              if(emoticons.getSelectedItem().equals("Laughing My Ass Off!"))
                   String status = "<Laughing My Ass Off!>";
                   printMessage(status);
              //if the colour button is clicked
              if(event.getSource() == colourButton)
                   //create a new colour chooser
                   colourchoo = new JColorChooser();
                   //create the dialog its shown in
                   JColorChooser.createDialog(colourButton, "Choose your background colour", true, colourchoo, this, this);
                   //now show the dialog
                   Color col = JColorChooser.showDialog(sendMsgButton, "Choose your background colour", Color.GRAY);
                   //when a colour is chosen it becomes the bg colour
                   theWholeApp.setBackground(col);
                   rpanel1.setBackground(col);
                   rpanel2.setBackground(col);
                   rpanel3.setBackground(col);
                   rpanel4.setBackground(col);
                   rpanel5.setBackground(col);
                   lpanel1.setBackground(col);
                   lpanel2.setBackground(col);
                   lpanel3.setBackground(col);
                   lpanel4.setBackground(col);
                   lpanel5.setBackground(col);
              //if the connect button is clicked
              if(event.getSource() == (connect))
                   //get the txt entered into ip addy field & port num fields with a text check...
                   if(hosty.getText().equals("") || portnumfd.getText().equals("") || nickName.getText().equals(""))
                        JOptionPane.showMessageDialog(this, "You cant connect! \nThis is because the either the \n0 - HostName\n 0 - Port Number \n0 - Your Nick \nIs Missing...");
                   else
                        //get details and connect
                        username = nickName.getText();
                        String ipay = hostfield.getText();
                        String porty = portnumfd.getText();
                        connectto(ipay,porty);
          * This method is similar to an append method in that it allows msgs recieved by the server to
          * be displayed in the conversation window. It also deals with the self comm mode as if its disabled
          * then no messages from the sender will be displayed.
         public void moveTextToConvo(String texty)
              //check
              if(ignoreyourself == true)
                   ignoreyourself = false;
              else
                   //If self comm is on the send message as normal
                   if(talktoself)
                        conversationDisplay.setText(conversationDisplay.getText() + texty);
                   else
                        //check message isnt sent by the current client - if it is ignore it!
                        if(texty.startsWith(nickName.getText()))
                             ignoreyourself = true;
                        else
                             conversationDisplay.setText(conversationDisplay.getText() + texty);
              //allows the scroll pane to move automatically with the conversation
              conversationDisplay.setCaretPosition(conversationDisplay.getText().length());
          * This method (connectto) is called if the button's clicked and also sets up a relation
          * between the client and clienttoserver class
         public void connectto(String ipa,String portNO)
              //portNO needs to be changed from string to int
              int portNum = new Integer(portNO).intValue();
              try
                   //creates a socket
                   socky = new Socket(ipa, portNum);
                   writer = new PrintWriter(socky.getOutputStream(), true);
                   ClienttoServer cts = new ClienttoServer(socky, this);
                   cts.runit();
                   //give user a prompt
                   JOptionPane.showMessageDialog(this, "You're now connected!");
              catch(UnknownHostException e)
                   System.err.println("Unknown host...");
                   //prompt the user
                   JOptionPane.showMessageDialog(this, "Failed to connect! \nPlease try again...");
              catch(IOException e)
                   System.err.println("Could Not Connect!");
                   //prompt user
                   JOptionPane.showMessageDialog(this, "Error! \nCould not connect - please try again!");
          * This method sends msgs from current client to server, sends username and then the message.
          * This is split into two different messages as the "\n" is used.
         public void printMessage(String mess)
              writer.println(usernamey.getText() + " says: \n" + mess);
              //then clear the text in the message creation area...
              createMsg.setText("");
          * Accessor method to retrieve userName
         public String getUName()
              return username;
          * Disconnect this user from the server so that they can no longer recieve/send messages
         public void dropconnection()
              try
                   //Start to close everything - informing user
                   writer.close();
                   socky.close();
                   //Give the user info on whats happening
                   JOptionPane.showMessageDialog(this, "You are now disconnected \nYou will no longer be able to \nsend and recieve messages");
                   System.out.println("A user has left the conversation...");
              catch (IOException e)
                   System.err.println("IOException " + e);
    The Server Class:
    import java.net.*;
    import java.io.*;
    * This class works in sync with the ServertoClient class in order to read
    * messages from clients and then send back out to all the active clients. Due to
    * the usage of threading multiple clients can use this server.
    * Once again some of this code is from Florians 2005 tutorial work.
    public class Server
         private ServerSocket server;
         private ServertoClient threads[];
         private static int portNo  = 2250;
         private static String Host = ""; //find method to retrieve ip
         private int maxPeeps = 20; //20 people can talk together but this can be altered
          * 1st Constructor - has no params
         public Server()
          * 2nd Constructor - allows for port number setting
         public Server(int portnumber)
              portNo = portnumber;
          * 3rd Constructor - allows for port number & max users
         public Server(int portnumber, int maxiusers)
              portNo = portnumber;
              maxPeeps = maxiusers;
          * This method is to constantly listen for possible messages from clients
         public void listener()
              //set the time out of method to just under a minute
              final int waitingTime = 500000000;
              //a boolean variable to keep it waiting
              boolean keepWait = true;
              //create a threads array of length maxpeeps
              threads = new ServertoClient[maxPeeps];
              //define a variable that will be used as a count of the no of threads
              int x = 0;
              try
                   //open a new socket on this port number
                   server = new ServerSocket(portNo);
              catch (IOException e)
                   System.err.println("IOException " + e);
                   return;
              //while the keepWait is true and the no. of threads is less than the max...
              while(keepWait && x < maxPeeps)
                   try
                        //set the timeout, this is the waitingTime (50 secs)
                        server.setSoTimeout(waitingTime);
                        //listen for connection to accept
                        Socket socky = server.accept();
                        System.out.println("A New User Has Connected");
                        //creates a new thread and adds it to array
                        threads[x] = new ServertoClient(this, socky);
                        //the thread begins
                        threads[x].start();
                   catch (InterruptedIOException e)
                        System.err.println("The Connection Timed Out...");
                        keepWait = false;
                   catch (IOException e)
                        System.err.println("IOException " + e);
                   x++; //increment no. of threads
              //if waitingTime is reached or there are too many threads then server closes
              try
                   server.close();
              catch(IOException e)
                   System.err.println("IOException " + e);
                   return;
          * This prints the string to all active threads
         public void printAll(String printy)
              for(int x = 0; x < threads.length; x++)
                   if(threads[x] !=null && threads[x].isAlive())
                        threads[x].sendMsg(printy);
          * Main method for the server, creates a new server and then continues to listen
          * for messages from different users
         public static void main(String[] args)
              Server chatsession = new Server();
              System.out.println("The Server Is Now Running on port NO: " + portNo);
              System.out.println("And IP Address: " + Host);
              chatsession.listener();
    [/code
    The ServertoClient Classimport java.lang.Thread;
    import java.net.*;
    import java.io.*;
    * This is the ClienttoServer class that acts as an intermediary between the server
    public class ClienttoServer extends Thread
         private Socket socky;
         private BufferedReader bready;
         private boolean active;
         private Client client;
         * This is the constructor to create a new client service
         public ClienttoServer(Socket socket, Client cli)
              socky = socket;
              active = false;
              client = cli;
              //try to read from the client
              try
                   bready = new BufferedReader(new InputStreamReader(socky.getInputStream()));
              catch (IOException e)
                   System.err.println("IOException " + e);
         * This method reads in from the client
         public void runit()
              active = true;
              while(active == true)
              {//continue to read in and then change the text in the conversation window
                   try
                        String message = bready.readLine();
                        client.moveTextToConvo(message + "\n");
                   catch (IOException e)
                        System.err.println("IOException " + e);
                        active = false;
    And finaly the servertoclient class
    import java.net.*;
    import java.io.*;
    import java.lang.Thread;
    * This clas provides the services that the server uses
    public class ServertoClient extends Thread
         private Socket socky;
         private Server server;
         private BufferedReader bready;
         private PrintWriter writer;
          * This constructor sets up the socket
         public ServertoClient(Server theServer, Socket theSocket)throws IOException
              socky = theSocket;
              server = theServer;
              //sets up the i/o streams
              writer = new PrintWriter(socky.getOutputStream(), true);
              bready = new BufferedReader(new InputStreamReader(socky.getInputStream()));
          * This method keeps listening until user disconnects
         public void run()
              boolean keepRunning = true;
              try
                   //keep listening 'til user disconnects
                   while(keepRunning = true)
                        final String tempmsg = bready.readLine();
                        //is there a message (if yes then print it!)
                        if(tempmsg == null)
                        else
                             server.printAll(tempmsg);
                   dropconnection();
              catch (IOException e)
                   System.err.println("IOException in thread " + Thread.currentThread() + ": " + e);
          * This method is for when a user disconnects from the server...
         public void dropconnection()
              try
                   bready.close();
                   writer.close();
                   socky.close();
              catch (IOException e)
                   System.err.println("IOException in thread " + Thread.currentThread() + ": " + e);
              System.out.println("A User Has Disconnected...");
          * This method prints the message
         public void sendMsg(String msg)
              writer.println(msg);
    }Thats it any help would be much appreciated
    Cheers.

    Like the previous poster indicated: try to find a minimal example that shows the error your experiencing.
    One thing that seems bogus is the Server.listener() method. For one thing, it can increment x even if no new connection has been established (e.g., x will be incremented if an exception is caught).

  • Partitioning For Optimal Parallel Query Execution

    Hi All,
    We are trying to design an architecture that benefits from partitioning and parallel query to obtain the best query response times for our system.
    Let me start by describing the main table which has five columns:
    Columns:
    1) DocId ------- Numeric Primary Key Constraint (Unique)
    2) Text ------- CLOB of XML Content
    3) SCode ------- Varchar 12 ( service code Can be one of 200 values)
    4) A_Date ------- Oracle Date ( The arrival date )
    5) A_Month ------- Numeric partition key, the month number (1-12)
    We insert 100,000 records daily so a month of data will contain 3,000,000 rows. The Text varies from 4k to 200k bytes and on average is around 30k bytes per document. A_Date is obtained when the C++ application receives a client connection. After document transmission is complete the DocId is obtained from an Oracle sequence. It is true that A_Date and DocId increase together. However because of varying document sizes and transmission rates, there is no guarantee that consistent order between the two columns exists.
    For Example: If time (t) increases and the connection times are: t1, t2, t3, t4 and the document at t2 took long to transmit, we can have:
    A_Date -------- DocId (From Oracle Sequence)
    t2 -------------- 1004
    t4 -------------- 1003
    t3 -------------- 1002
    t1 -------------- 1001
    A_Month is simply the month number (1-12) extracted from the transmission entry timestamp. It is also our Partition Key (see below). When the year wraps around from 2006 to 2007, data for January will simpy fall into the 1st partition bucket, and so on..
    QUERY NEEDS: Our queries are centered around a DateTime interval Where the left endpoint is current day/time. They can query the current day, current to 1 month back, current to 2 months back, .. current to 15 months back. We MUST RETURN a list of DocId's sorted in DESCENDING ORDER for screen display purposes.
    In General we need to return sub-second for the 1st month. As we query further back in time longer response times between 1 and 4 seconds are acceptable.
    PARTITIONING AND INDEXES:
    The table is partitioned by A_Month as shown below:
    Create Table IndexTable
    PARTITION BY RANGE (A_Month)
    ( PARTITION p1 VALUES LESS THAN 1.1 ...
    PARTITION p2 VALUES LESS THAN 2.1 ...
    PARTITION p3 vALUES LESS THAN 3.1 ...
    There are GLOBAL INDEXES on DocId, Text(Domain Index), and SCode.
    A_Date is a LOCAL INDEX.
    QUERY STRUCTURE:
    My Query structure looks like this (for a 2 month query):
    SELECT DocId from IndexTable WHERE
    Contains (Text, 'BUSH and EARNINGS') > 0 AND
    SCode in ('S1', 'S2', 'S3', 'S4') AND
    A_Date Between '2006-01-15 11:00:00' AND '2006-03-15 11:00:00'
    Order By DocId DESC;
    QUESTIONS (THERE ARE THREE)
    #### QUESTION 1 ####
    As I examine various explain plans, the PSTART and PSTOP do not reflect consistency with my A_Date range. It seems to always display:
    PStart PStop
    RowId RowId
    no matter what my A_Date range is.. I don't see it pruning my partitions. I cannot find documentation as to what RowId means or how it affects the optimizer's plan.
    #### QUESTION 2 ####
    I have tried parallelization hints on the table and indexes such as
    /*+ PARALLEL( IndexTable, 4) */ and on the A_Date index
    /*+ PARALLEL_INDEX( IndexTable, A_Date_Index, 4) */.
    I can't really tell if the parallel hints make a difference.
    However, the FIRST_ROWS hint makes a big difference if I nest the query inside a rownum clause as:
    SELECT * from
    ( Select /+* first_rows */ ... WHERE CONTAINS... > 0 AND... )
    Where ROWNUM <=20;
    #### QUESTION 3 ####
    I'm running close to the latest RedHat Linux and Oracle 10g2 and I have read about Parallel Slave Processes in Tom Kyte's Expert Oracle Architecture book in which he says you should see processes like:
    ora...p000..
    ora...p001..
    ora...pnnn..
    Which are the parallel slave processes. I have NEVER seen any oracle processes numbered as such running on my system when I run test queries. I have seen some q_ processes and others, but not the pnnn processes..
    Can I benefit from parallel query without ever seeing these processes??
    I Greatly Appreciate Any Advice To Any Of These Questions..
    Joe

    Well I can tell you this much. You will never get partition pruning if you don't have the partition key in the where clause.
    I'm not sure about the parallel query. There was a time that this wasn't supported with Text indexes, but not sure if that still applies today.
    In theory there are two levels of partitioning that can be defined that you may want to test out.
    1st, range partition the base table and create a partitioned text index based on that. This is what you are currently doing.
    2nd, in the storage preference for the $I table specify a range or hash partition (I've never tried this, but in theory it should work) on the token_text column. Try this out and see if it works.

  • PDF to CBR

    I'm converting comics for my grandson from PDF to CBR or CBZ.  With Win XP I used PDFtoCBR but that doesn't work with my new Win8.1 OS. So what will work for batch conversion (please don't advise I leave them as PDF)?

    download the file from the Adobe Acrobat 
    Comical 0.8 is a free CBR and CBZ GUI comic book reader. from the Adobe reder.
    CBZ Adobe reader.
    A .cbz file is actually just a .zip file with an amended file extension. What makes a .cbz file different is that it can be opened directly by comic book viewer applications without a requirement to decompress it first. The user can also
    associate the file extension with a comic book viewer application. Typical image formats are allowed for a .cbr file such as JPEG, GIFF, TIFF and PNG.

  • PersistenceManager Patterns for Multithreaded Applications

    Hi,
    I'm looking for a good way, how to use Kodo JDO in a multithread application
    (actually Tomcat ;). The most easy thing is perhaps, to use only one
    persistence
    manager for the entire application, i.e. for all threads. Another solution
    might be,
    to create a PersistenceManager for each HTTP request. I don't like the
    solution,
    to have one PeristenceManager per session, because I expect thousands
    concurrent
    users. What I'm concerned with is the number of data base connections in
    this
    case.
    So my question to you is, what pattern do you use in your web applications?
    When do you create and close the PersistenceManagers to free resources?
    Has anybody alreay tried different patterns and compared the performance?
    Is there something like a best practice?
    Michael

    The other nice thing about the filter is that it should be easy to
    selectivly store and retrieve the PM in a user's session if they have a
    longer running transaction that spans multiple requests.
    So far, I've simply been passing the PM to each service method, although I
    don't particularliy like that approach. I haven't had time to try anything
    different yet and it isn't TOO bad, although I have a few ideas:
    1. The hashtable method you mentioned. I see there is a "Registry" pattern
    in the "Patterns of Enterprise Application Architecture" book I'm currently
    reading, but haven't gotten to it yet. I think it is close to what you
    mentioned.
    2. Retrieve the PM through JNDI. I don't know, however, if I can set up a
    PM in JNDI the way that the CurrentTransaction JNDI lookup works with
    container managed transactions.
    "Michael" <[email protected]> wrote in message
    news:[email protected]...
    I've never used a servlet filter before but I must say that is the most
    elegant approach I've seen, thanks for sharing that. How do you pass thePM
    to the service layer? Do you store it in a hashtable with the current
    thread as a key or do you pass it in to each service method?
    Thanks,
    Michael
    "Nathan Voxland" <[email protected]> wrote in message
    news:[email protected]...
    We've created the PersistenceManager in a filter and attached it to the
    request object. That way, the persistence manager can be accessed fromthe
    Struts Action, JSP Page, and anything else we do, plus we don't have to
    worry about closing it because it is closed by the filter after
    everything
    is done (Even if an exception is thrown)
    Here is the code:
    public void doFilter(final ServletRequest request, final ServletResponse
    response, FilterChain chain) throws IOException, ServletException {
    PersistenceManager pm = getPersistenceManager();
    request.setAttribute(JDO_PERSISTENCE_MANAGER, pm);
    try {
    chain.doFilter(request, response);
    } finally {
    if (pm.currentTransaction().isActive()) {
    pm.currentTransaction().rollback();
    pm.close();
    "Michael" <[email protected]> wrote in message
    news:[email protected]...
    I currently doing exactly this: getting a persistence manager at the
    beginning of a jsp page and close it at the end of the jsp page.
    When you use <jsp:include ...>, you must be careful not to close the
    persistence manager to early. I do it like this:
    This sounds like a good approach, especially the hashtable with the
    thread
    as the key. The only issue I see is if you create the PM in the JSPpage,
    often an Action is executed before the JSP is called. This is why I
    was
    thinking of creating the PM in the struts request processor, it'salways
    called for every request.

  • Data Mapper to relational database

    I've been reading the "Patterns of Enterprise Application Architecture" book and it has opened my mind to a lot of different designs.
    I'm trying to design a large accounting system in OO. I'm unclear on how I should design the mapping inbetween the domain logic and database.
    Should the controller classes talk to the data mappers?
    In inheritance if my classes don't directly relate to tables should I have one data mapper or one for each class?
    When I'm using a data mapper and I select all from a table does the mapper create multiple objects or does it return a result set?
    If it creates multiple objects how does the domain logic sort this data?
    Do I really need a Unit of Work to manage my data mappers? How hard are they to create? Is there only one Unit of Work class for all data mappers?

    I've been reading the "Patterns of Enterprise
    Application Architecture" book and it has opened my
    mind to a lot of different designs.Usually the worst time to apply the stuff, because you're looking to use it before you really understand. But there must be a first time for everything. Great book, though.
    I'm trying to design a large accounting system in OO.Wow, is this for personal education or a paid gig? I hope it's the former. If not, make sure that "build versus buy" is part of the decision. Would anybody write an accounting package in this day and age, with SAP, Oracle, QuickBooks, Great Plains, and a thousand others ready to buy?
    I'm unclear on how I should design the mapping
    inbetween the domain logic and database.
    Should the controller classes talk to the data mappers?Depends on what you call controllers. I like to think of them as the classes that implement the service interfaces. The methods in the service interface are the use cases. I think the distinction between controller and service is very important, because a web-based app will certainly have a controller. If you fall into the trap of putting all the logic into that class, you can't use it WITHOUT the web controller. It also puts you right in line to turn this into a service oriented architecture.
    The services will certainly call the persistence interface. Make sure you have one.
    In inheritance if my classes don't directly relate to
    tables should I have one data mapper or one for each
    class?That's one way to do it.
    When I'm using a data mapper and I select all from a
    table does the mapper create multiple objects or does
    it return a result set?I think it ought to return a Collection of objects. You should never return a ResultSet. That should be instantiated and closed within the scope of the persistence layer. ResultSets are database cursors, a scarce resource. They should be kept open for the shortest time and scope possible.
    If it creates multiple objects how does the domain logic sort this data?You won't ask for all of them unless you have something sensible to do with them. If you're referring to the literal "sort", it's an easier question. Have the database do an ORDER BY in the SELECT. Hard to tell what you mean by this.
    Do I really need a Unit of Work to manage my data mappers? You do if you need ACID properties for transactions.
    So you're going to try to do all of this by hand? A hard job, indeed. You're talking about writing your own transaction manager.
    How hard are they to create? Is there only
    one Unit of Work class for all data mappers?I haven't read Fowler's book in a while, and I don't have it handy, but it's one Unit of Work per transaction when I think about the term. What you need is something that will demark transaction boundaries.
    If you weren't writing this yourself, you'd be using JTA (Java Transaction Architecture.) That's what I'd recommend that you do.
    But if this is an educational effort, knock yourself out.
    %

  • Illustrator CS5 crashing on exit

    Illustrator CS5 keeps crashing on every exit. I am hoping someone can identify a more appealing solution than the workaround I found.
    Steps I take to reproduction the problem (with or without creating or opening documents between):
    Launch Illustrator
    Exit Illustrator
    Symptoms
    Once the Illustrator application window and taskbar icon disappear, a message window pops up, "Adobe Illustrator CS5.1 has stopped working. Windows is checking for a solution." The only option is to click the "Cancel" button. The window pops up again. So, I click the "Cancel" button again.
    The following errors are added to the Windows application error logs (note the two different exception codes):
    Event ID: 1000
    Task Category: (100)
    Details:
    Faulting application name: Illustrator.exe, version: 15.0.2.399, time stamp: 0x4ce0f2fc
    Faulting module name: AdobeOwl.dll_unloaded, version: 0.0.0.0, time stamp: 0x4b958fed
    Exception code: 0xc0000005
    Fault offset: 0x5e78fe38
    Faulting process id: 0xc84
    Faulting application start time: 0x01cd86e83d5ab11d
    Faulting application path: C:\Program Files (x86)\Adobe\Adobe Illustrator CS5\Support Files\Contents\Windows\Illustrator.exe
    Faulting module path: AdobeOwl.dll
    Report Id: d0597ad3-f2db-11e1-b11d-c80aa9deb457
    Event ID: 1000
    Task Category: (100)
    Details:
    Faulting application name: Illustrator.exe, version: 15.0.2.399, time stamp: 0x4ce0f2fc
    Faulting module name: AdobeOwl.dll_unloaded, version: 0.0.0.0, time stamp: 0x4b958fed
    Exception code: 0xc000041d
    Fault offset: 0x5e78fe38
    Faulting process id: 0xc84
    Faulting application start time: 0x01cd86e83d5ab11d
    Faulting application path: C:\Program Files (x86)\Adobe\Adobe Illustrator CS5\Support Files\Contents\Windows\Illustrator.exe
    Faulting module path: AdobeOwl.dll
    Report Id: d1b2a25a-f2db-11e1-b11d-c80aa9deb457
    System Specifics
    Hardware: PC, HP Pavilion DV7
    Operating system: Microsoft Windows 7 Home Premium 64-bit edition
    Illustrator version: 15.0.2.399 (up-to-date, theoretically)
    Efforts to Remedy
    Functioning or inconclusive workarounds:
    Launch Illustrator from a new Windows user account
    I got this one to work. But, I lose a lot of personal settings.
    "Verify" Illustrator
    Member usgrant7 posted a solution (#5 in the discussion "Illustrator error upon closing") that worked for him/her. But, the instructions were too vague and unspecific to follow with any success. I haven't had success so far with contacting that member.
    Common solutions having no effect:
    Reboot the computer
    Uninstall Illustrator and reinstall (also tried removing various Illustrator settings folders between)
    Granti full control permissions to Illustrator application folder (and all subfolders)
    Launch Illustrator with administrative priviledges ("as Administrator")
    Launch Illustrator in various compatibility modes

    Finally, A FIX !!!!!!!!
    If you are reading this for your own fix, you likely have TeamViewer installed.
    "What?!", you say. "How on Earth did he know I have that on my computer?"
    As odd as it sounds, TeamViewer with it's Quick Connect feature is the culprit.
    Explanatory Hypothesis (Here's What I Think is Going On)
    Since Adobe likes to be different even on a PC, they add their own computer code to handle the application's window dressing instead of standard Windows GUI architecture code. Notice the title bar looks different than that of any non-Adobe software installed on your computer. They decided to re-invent the wheel, so to speak.
    What I believe is going on is that while TeamViewer is running, it monitors for windowed processes (those you see as a window on the screen). And, for almost every one of these processes, TeamViewer adds a little button near the standard minimize-window button. This little button being added is called a Quick Connect button, a TeamViewer feature that let's you share your application's window with another computer running TeamViewer.
    So, I believe that the Quick Connect button is causing the clash between Adobe's insistance on a non-Windows look and TeamViewer's assumption that every software publisher would use Windows GUI.
    Solution
    “Yeah, yeah. That’s all good. So, how do I fix it?”
    Here's the skinny:
    Open the TeamViewer window.
    From the menu bar, select "Extras" and "Options".
    Select the "Advanced" tab.
    Click the "Show advanced options" button and then the "Configure..." button (for "QuickConnect button").
    Add "illustrator.exe" to disable the QuickConnect button for it.
    You may also want to add "flash.exe" if you have professional installed, which is reported to have the same problem.
    Good luck and happy illustrating without crashing every single time you exit Illustrator.

  • Content Aggregation

    Hi,
    I am now studying and analyzing the Bea WebLogic Portal. I want to know is there any engine similar to personalization engine , which will manage the aggregation of contents from various portals.
    I am elaborating it further now, In a portal page there will be plenty of portlets and each and every portlet will communicate with the App Server to generate the content into the portal page, my question is how the requests from all the portlets is managed. Is there any engine or services to manage the requests from the portlets.
    Any clarification will be very helpfull.
    Thanks
    Ponraj Rajagopalan

    Ponraj,
    There are many answers to this questions, so please excuse me if I am being
    too vague. Typically your portlet will serve as the presentation layer for
    some business objects (BO). In a typical 3 tier architecture:
    Webflow (presentation controller)
    |
    Portlet (presentation layer) ---> Business Objects ---> Persistence Layer
    There are many variations on this theme.
    The presentation layer also relies on the Webflow architecture which acts as
    a controller/coordinator and given a presentation event may dispatch it to
    another presentation component (JSP) or perhaps a BO.
    Your Porlets will render the output from the BOs (EJBs...) - either by
    calling them directly or (better) by invoking them through dispatching an
    event to Webflow, which in turn invokes the BO. The portlet can then pull
    attributes out of the PipelineSession (placed their by the BOs) and render
    the results.
    There are therefore many ways in which control can pass from a UI event in a
    Portlet, back into the BO layer, and possibly onto the persistence layer
    (JDBC).
    A good J2EE architecture book should be able to fill in the (many) holes in
    this explanation.
    Sincerely,
    Daniel Selman
    "Ponraj" <[email protected]> wrote in message
    news:[email protected]..
    Hi,
    I am now studying and analyzing the Bea WebLogic Portal. I want to know is
    there any engine similar to personalization engine , which will manage the
    content aggregation from various portets.
    I am elaborating it further now, In a portal page there will be plenty of
    portlets and each and every portlet will communicate with the App Serverto
    generate the content into the portal page, my question is how the requests
    from all the portlets is managed. Is there any engine or services tomanage
    the requests from the portlets.
    Any clarification will be very helpfull.
    Thanks
    Ponraj Rajagopalan

  • How to work with ResultSet!

    Hi
    I an mew to java programming and I have a small project to do!
    Basically I have to connect to a database make a select query and display it in a JTable!
    The code to connect to make the table was provided by the teacher, I just added a connection to this class and used it! the resultset is being populated when I run the query! the problem is that when the class(Table) reaches resultSet.beforeFirst(); it breaks!
    I can write
    while(resultSet.next()){
    system.out.println(resultSet.getString(2));
    }before calling BeforeFirst() and the result displays but everything brakes at this point!
    Here are 2 of the 3 Classes used for this project! Hope u can help me!
    I didn't show u the class connexion due to character limitations, if you need something from this class please tell me.
    Class Main:
    import javax.swing.*;
    public class Main {
    JFrame frame = new JFrame ("my Table");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setBounds(200,100,500,500);
    Connexion con= new Connexion();
    con.connect();
    Table table= new Table("SELECT * FROM CUSTOMER", con);
    frame.add(table.getTable());
    frame.setVisible(true);
    Class Table (given by teacher):
    import java.awt.Color;
    import java.sql.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.util.*;
    import java.sql.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.util.*;
    public class Table implements ListSelectionListener{
         private ResultSet resultSet;
         private ResultSetMetaData metaData;
         private int numberOfRows;
         private JTable tab;
         private int selectedRow;
         private Vector dataVector = new Vector();
         private Vector headVector;
         private ListSelectionModel listSelectionModel;
          public Table(String sql, Connexion cx){  //String sql correspond  la requete sql
               try{
               setQuery(sql, cx);
               catch(SQLException e){
          public void setQuery( String query, Connexion BD ) throws SQLException
          // specify query and execute it
          resultSet = BD.select(query); //Execution de la requete par la methode classe select() dans la classe BD
          metaData = resultSet.getMetaData();
          resultSet.last(); // se deplacer  la derniere ligne du ResultSet
          numberOfRows = resultSet.getRow(); // acceder au nombre de lignes
          headVector = new Vector(metaData.getColumnCount());
          getNomsCol(); //appel de la mthode pour les intitules des enttes des colonnes
          getData(); //appel de la mthode pour les donnes
          //Methode pour le vector des enttes des colonnes de JTable
          public void  getNomsCol()throws SQLException{
               for (int i=0; i<metaData.getColumnCount();i++){
                    headVector.addElement(metaData.getColumnName(i+1));
          public void getData()throws SQLException{
               resultSet.beforeFirst(); //////////////           brakes here             positionner le curseur avant la premiere ligne du ResultSet
               if (!resultSet.next()) 
                    JOptionPane.showMessageDialog(null,"No records query");
                    else {
                    do {
                    Vector rowVector = new Vector(); //definit un vector pour un enregistrement
                    rowVector.addElement(resultSet.getString("numaccount"));
                    rowVector.addElement(new Float(resultSet.getFloat("balance")));
                    rowVector.addElement(new Float(resultSet.getFloat("interet")));
                    dataVector.addElement(rowVector); //ajoute l'enregistrement au dataVector
                    } while (resultSet.next());
    public JTable getTable(){
                    tab = new JTable(dataVector, headVector); //creation de l'objet JTable
                         listSelectionModel = tab.getSelectionModel(); //Associer un modele pour l'objet JTable
                         listSelectionModel.addListSelectionListener(this); //Ajouter le listener au modele pour la selection dans un JTable
                    return tab;
             //Methode valueChanged pour les evenemnts ListSelectionEvent  
                    public void valueChanged(ListSelectionEvent listSelectionEvent){
                    if (listSelectionEvent.getValueIsAdjusting())
                    return;
                    ListSelectionModel lsm = (ListSelectionModel)listSelectionEvent.getSource();
                    if (lsm.isSelectionEmpty()) {
                    System.out.println("No rows selected");
                    else{
                    selectedRow = lsm.getMinSelectionIndex();
                    System.out.println("The row "+selectedRow+" is now selected");
                   //Renvoie le numero de ligne selectionne de l'objet JTable
                   public int getSelectedRow() {
                        return selectedRow;
    }I know it's a long question! but I have been facing this problem for 2 days now and I am not finding any solution! thanks for your help!

    eliedh wrote:
    Can u guide me to a tutorial that shows me how to transfer my data to the JTable in a nice simple way (with or without this class! I dont care anymore)! I am googling but I can't find a simple way to do it! I would have read and learned if I had more time but i have to get this program working before tomorrow! please help!!
    Edited by: eliedh on Jan 9, 2009 8:49 AMThe general idea is to design your application as a bunch of separate components that are loosely coupled.
    Take a car as an example. You can remove your car's radio and replace it with another one. When you pull the radio out, you don't find the tires are attached to it!
    Suppose you were designing a new car door window assembly, say one that senses obstructions so as not to decapitate kids! You may need to know the specs for the door, but won't need the actual door in order to design and test your window, let alone the car itself.
    My rule of thumb for a decent design is: can I test pieces separately? For example, can I test the database code without using GUI code?
    And stop for a minute. How does one "test" code? It's tempting at first to test code manually, like you are the end user, but that quickly becomes unwieldy. The proper way to test parts (unit testing) is to write testing code. Then it's easy to rerun the tests whenever you make changes:
    [http://www.junit.org/]
    To expand a little, there a lot that can be said just about the GUI side, ignoring the database back end. Here is a good general discussion of GUI architecture:
    [http://martinfowler.com/eaaDev/uiArchs.html]
    As a starting point, I would define a class that represents one row of data from the database. This class is used to bridge between the database and the GUI, and as such should be independent of either one.
    Your database component can have select methods that return List<YourRowObject>, and your GUI takes the same list. Then you can test each separately.

Maybe you are looking for

  • Print to vide/External video not working in FCP, PLEASE HELP

    I have the FCP HD 4.5 and am having difficulty communicating to my Panasonic PV-800. Capture is great, but when trying to view external video or print to video, the default blue screen of my cameras vtr mode is distorted and no video comes through. I

  • SFTP to AS2(non-seeburger): How to get sender Filename to be used in AS2 Receiver Channel

    Hi Experts, I have this scenario, SFTP > Process Orchestration > AS2(non-seeburger) My interface is not using Message Mapping and I want to use the source Filename as my Receiver Filename. Sender orders_1234 - source filename Receiver orders_1234 - t

  • Help getting .mov off of new 3gs iphone windows

    Is there a way to get the videos u take off of the new iphone on a windows pc. I see lots of post for mac users but non for pc users. Any help please. Is there any good software out there or a workaround. Thank you in advance.

  • Deployment for OC4J 11g doesn't work

    Jdeveloper 11g ADF runtime installer for standalone OCJ4 11 doesn't find the following file: - Input File doesn't exist "adfcm.jar". So, when i deploy an application (ear or war) on standalone OC4J, i have the following error: 2007-06-26 11:54:14.328

  • HT1414 error:  *we are unable to continue with your activation at this time*

    is there anyone can help me how activate my iphone 3gs when i have tried to update it from IOS 4.1 to IOS 6 , but now there is just an activation form on my iphone screen that i need to connect to WIFi to be able to activate it or connect to I TUNES.