Another GUI question..

Hi, I just want to know the most appropriate way of making a Gui update itself. For instance my GUI contains data that should change as I hit buttons though the data will not change unless I close the window then open the window again.. what is the "auto-update" command beyond using setVisible(false) then setVisible(true) everytime I change data in the window.
Cheers.

Phantasm235,
Well without knowing the full scope of your project, and the code you are trying to do this with I cannot provide you an helpful examples. However there are several Online tutorials right here on Sun's website:
This is the best I could find on short notices, but I know there are more, this one well explain Event Handling which is what I was talking about, and also teach you how to write your own events:
http://web2.java.sun.com/docs/books/tutorial/uiswing/events/index.html
The links below are to the main tutorial sites showing all they have to offer, you may want to look through them if the above did not help:
http://developer.java.sun.com/developer/onlineTraining/
http://web2.java.sun.com/docs/books/tutorial/
I hope these can help,
-Rodney

Similar Messages

  • Another newb question: multiple virtual servers

    Hi, I have yet another ignorant question. I have several unrelated web projects that I am working on, and I would like to be able to set up a virtual server for each one for testing purposes, such as: http://project1, http://project2, http://project3. Can someone tell me if this is doable, and if there are any tutorials/resources on this for someone who has 0 experience running a web serer? Sorry for being so ignorant!

    Yes, it is doable.
    You can setup virtual server either by IP or by name.
    If you have one IP, and want to set them up by name (ex. http://project1, http://project2, http://project3) you can do so easily with this type of configuration:
    <virtual-server>
        <name>mydomain</name>
        <http-listener-name>http-listener-1</http-listener-name>
        <host>*.mydomain.com</host>
        <document-root>/www/domain</document-root>
      </virtual-server>
      <virtual-server>
        <name>myotherdomain</name>
        <http-listener-name>http-listener-1</http-listener-name>
        <host>*.myotherdomain.com</host>
        <document-root>/www/myotherdomain</document-root>
      </virtual-server>
    ....The important part here is that
    a) all virtual servers share the same HTTP listener
    b) which virtual server serves the request depends on the $HOST request header send by the client. Sun Web Server does the matching for you. It will match $HOST vs. the virtual server's host attribute. Depending on which site you connect to the right virtual server will be used.
    c) if the $HOST request header does not match any of the virtual servers, then the default virtual server defined in the HTTP listener will be used.
    To create a virtual server, use the Admin GUI, access the configuration, and then add new virtual server. Or use the following CLI command.
    wadm> create-virtual-server --config=myconfig --http-listener-name=http-listener-1 --document-root=/www/docs/myserver.com --host-pattern=myserver.com --log-file=../logs/myserver.com-error_logs myserverHost pattern will be used for matching. Some of this elements might be optional.
    Hope that helps. And keep the questions coming :D
    Edit: Also check the documentation
    Using Virtual Servers in SJS Web Server 7.0

  • Sorry -- another GUI IDE post!

    Hi all,
    I have scoured the forums and the web to answer my own question so this may turn out to be little more than a comment/rant...
    I work in a small team of developers, using mostly Java on the server and a combination of HTML, Flash and Win32 on the front end; something's missing: I reckon Swing is the ideal face to an increasing number of our applications but, although I am comfortable with hand-coding interfaces, I have to work to designs from my colleagues who are happy prototyping in Flash or VB (for VB or C++ apps) but cannot get to grips with any of the Java GUI IDEs I have tried to promote (Forte, JBuilder in particular).
    If a simple-to-use Swing GUI designer/editor exists, even if it's not a great environment for technical development, there are dukes waiting for the person who points me in the right direction.
    The novelty factor of proving what can be done with Flash is wearing off fast and Win32 just isn't appropriate to more and more of our clients so somebody please help!
    Chris.

    Hia,
    I've had a similar problem to you, and have tried all of the Java GUI builders I can find, including Forte, JBuilder, J++, Visual Age ....
    Eventually I just had to settle with Sun one studio 4 CE, (used to be called forte, but is newer), because it provides a good form editor that generates pure java that runs on any java VM, unlike J++ and Visual Age. The way I use is to use null layouts most of the time to create the prototype user interface, then try to implement this using the other layout managers. However, the latter seems to take ages, and is very frustrating with the available managers. Often I will just settle for the null layout, which provides the desired layout, albeit static.
    Well, anyway, that's all I can say really. If you have found another GUI builder that you really like, could you let me know too?!
    Thanks in advance - Edd.
    [email protected]

  • Connect a button to another GUI

    I have created a menu using gui builder in netbeans and i want to link the items to open another gui. for example on then list i have "add a member" when click it, it should open my "add member" for. When i select AddMemberActionPerformed i get the following:
    } private void AddMemberActionPerformed(java.awt.event.ActionEvent evt) {                     
        }                                         Please tell me what to fill in here, thanks

    NetBeans creates this method structure for you.
    private void AddMemberActionPerformed(java.awt.event.ActionEvent evt) {                     
    inside it you must put your code to be executed when the event is fired. There are many kind of events, in this case is an ActionPerformed event linked to your component.
    If you want to open another GUI then you must fill it with the code to open that GUI.Not all GUIs can be opened on the same way but I will give you some example.
    1.- Lets say you have a JFrame class to open called MyFrame
    MyFrame gui=new MyFrame ();
    gui.show ();
    2.- Lets say you have a JPanel then you may want to add it to another Container or something.

  • Call another gui

    hi i m new at java fx, and i want to know how i call a gui from another gui when i press a button. For example i have mi java fx gui: loguin, and another jafa fx gui:principal. When i press the login button it should appear the principal. I designed both guis with netbeans 6.9 but i dont know who to conect both.

    You have to switch scenes. If you search this forum, you will find several examples how to do it.
    An alternative for small, transient dialogs like a login one, is to create a new stage: it will appear as a new window.

  • Another simple questions

    Hello friends:
    Another simple question: I need to learn things about Oracle on my desktop.
    My machine runs Windows 98. Oracle has some desktop product of its Database Line?
    For example: Oracle Personal?
    And Oracle Lite? What's the main difference between Oracle Personal and
    Oracle Lite?
    Thank You
    Gracias
    Ing. Pablo Romero
    CORDOBA ARGENTINA

    1. I didn't know the answer to your first question, but I googled it and it says the item is the in-call audio boost.
    http://forums.crackberry.com/f71/flag-icon-47659/
    2. isn't this setting determined by the carrier? So it's not a setting in the phone, but when you call in to your voicemail you can change your options?

  • How to tackle the dataflow problem when Value Change event always triggers after another GUI event

    We know that Value change event always triggers after another GUI event. Eg, the user modifies string control, the user clicks on a boolean control. Then event boolean clicked is triggered before event string control value change.
    Now suppose somehow the GUI event that must happen to subsequently trigger the Value change event can potentially affect the data that Value change event is supposed to work on. How can we tackle this problem ?
    For example, in a mockup application that the grand purpose is to have user entered values in a textbox logged to a file (no missing information is accepted, and there is a boolean to determine how the information is logged).
    There are 2 controls, boolean A when clicked (mouse down) will load random number in text box B. Text box B is designed with event structure VALUE change which saves whatever values user enters into text box B to a log file.
    There are 3 problems when instead of clicking anywhere on the front panel after modifying text box B, the user ends up clicking on boolean control A.
    1. Event mouse down on Boolean control A will execute first, modifying text box B content before the user entered values in B get saved.
    2. The value of boolean A can potentially affect how textbox B is loggged.
    3. The value of boolean A affects how the file is logged and this is indeterminate. Somehow when running this VI with no Highlighting, the textbox B Value change event executes -before- boolean A value is updated (F to T). When running this VI with Highlighting, the boolean A value is updated (F to T) (because we click on it) -before- textbox B value change event occurs. Why is it like this ?
    Now the situation I made up seems non-sense, but I believe it resembles one way or another a problem that you might run into. How would you solve this problem elegantly ?
     

    You can set the string control to "update while typing".
    Are you sure appending the log to itself is reasonable? Wouldn't it grow without bounds if the users keeps entering strings or pressing the ingore button?
    Why isn't the "constant" a diagram constant instead of a control. Is the user allowed to change it?
    To reset just write empty strings or a false to local variables of the controls (renit to defaults" seems a bit heavy handed).
    All you probably need is a single event case for "ignore:value change" and "String" value changed", no need for the local variable..
    Also add a stop button and an event for it.
    You don't need the timeout event.
     

  • Listen for events in another Gui class

    Most of the GUIs I have written to date have consisted of either a single class or multiple self-contained classes - mainly extensions of JPanel with JButtons etc to perform certain tasks.
    Now I want to be able to click a JButton in one class which will invoke a method in another.
    The code is too lengthy to post here but this is the general layout:
    JFrame Simulation_GUI contains a JPanel (panelMain) which is set as the content pane
    panelMain contains two GUI classes which extend JPanel;
    buttonPane > contains a number of JButtons, including the one I want to click
    loadingPane > contains the method (which takes a Hastable as an argument) I want to run
    All three panels are declared in the main class which extends JFrame, so I know that from there I can simply call;
    loadingPanel.runLoads(htData); but how do I do this from the JButton on the buttonPane.
    Any assistance greatly appreciated as I have little enough hair at the moment and can't afford to tear much more out.
    Thanks in advance

    Class GUI1 {
    //Display all the buttons.
    public void init() {
    Button.addActionListener(new
    ener(new SomeClass(this));
    Class SomeClass implements ActionListener {
    GUI1 gui = null;
    SomeClass(GUI1 gui) {
    this.gui = gui;
    public void actionPerformed(ActionEvent e) {
    //Do all your process here
    gui.setTable(table);    //table would be ur
    ould be ur hashtable
    }Cheers
    -PThis didn't fully answer my question but did two things:
    1. Told me that it is at least possible and it is just me having a senior moment,
    2. Sent me on the right road to finding a solution
    With additional help from the following post I have sorted my problem. Basically I had to centrallise the event handling into a different class. This was instantiated by the main GUI class and passed to the other GUI components as an argument.
    http://forum.java.sun.com/thread.jspa?threadID=576012&messageID=2881969
    Simple when you know how...!
    prashanth_kuppur - have some Duke Dollars on me and thanks for the poke in the right direction.

  • System.out.println in gui--- question

    Hello People.
    First of all, I'm new to the forums, so if it doesn't belong here, plese tell me where to post questions like this.
    The Problem:
    I have a GUI and another class,which contains the Program.
    Here's the code of my class:
    int Battle(String CharName) {
              System.out.println(CharName + " Is fighting agains a monster");
              while (CharHP > 0 && MonsterHP != 0) {
                   MonsterHP = MonsterHP - CharDmg;
                   System.out.println("The monster has " + MonsterHP + "Hitpoints left ");
                   CharHP = CharHP - MonsterDamage;
                   System.out.println(CharName + " has " + CharHP + " Hitpoints left");
              if (MonsterHP == 0) {
                   System.out.println(CharName + "Has lost the fight!");
                   CharEXP = CharEXP + 20;
                   System.out.println("You have gained " + CharEXP + " Exp");
              if (CharHP == 0) {
                   System.out.println("You have lost the fight!");
              return CharHP;
         }So what would be the code to print all the "System.out.println's" here into the gui test area?

    camickr wrote:
    Check out the [Message Console|http://www.camick.com/java/blog.html?name=message-console].
    Just out of curiosity, how do you come up with ideas for all the awesome stuff on your blog?

  • Another IISPROXY question (multiple SAP systems)

    Hi!
    We've got a challenge. We have SAP EP (6.0 SP12), visible from outside
    (via  MS ISA server publishing). Also we have several SAP systems (BW,
    ERP2004, Solution Manager), that we want to make available from web.
    We installed IIS proxy module on portal server machine. It's working.
    I even maneged to publish some test reports and WebGUI of BW server.
    But when I try to publish in a simmilar way other system, I fall into
    problem.
    When you call '/sap/bw/' for example, SAP system after authentication
    converts it to something like '/sap(lsdkSDF435ssdgf)/bw'. As far as I
    understand between "(" and ")" there is some hash of password or something.
    The problem is, that it's true and the same for all SAP systems.
    So if I put in iisproxy.xml following strings:
    <mapping name="bw">
    <source>
         <protocol>http</protocol>
         <prefix>/sap/bw/</prefix>
    </source>
    <source>
         <protocol>http</protocol>
         <prefix>/sap/bw</prefix>
    </source>
    <source>
         <protocol>http</protocol>
         <prefix>/sap/public/bc/its/mimes/</prefix>
    </source>
    <source>
         <protocol>http</protocol>
         <prefix>/sap(</prefix>
    </source>
    <target>
            <protocol>http</protocol>
         <host>bw-server.ourdomain.local</host>
         <port>8000</port>
    </target>
    <compress-types>text/html, text/plain</compress-types>
    </mapping>
    it's working for BW server. We able to see reports and webGUI.
    If I try to add following strings for ERP2004 server:
    <mapping name="erp">
         <source>
              <protocol>http</protocol>
              <prefix>/erp/sap/bc/gui/sap/</prefix>
              <new-prefix>/sap/bc/gui/sap/</new-prefix>
         </source>
         <source>
              <protocol>http</protocol>
              <prefix>/erp/sap/bc/gui/sap</prefix>
              <new-prefix>/sap/bc/gui/sap</new-prefix>
         </source>
         <source>
              <protocol>http</protocol>
              <prefix>/erp/sap/bw/BEx</prefix>
              <new-prefix>/sap/bw/BEx</new-prefix>
         </source>
         <source>
              <protocol>http</protocol>
              <prefix>/erp/sap/bw/BEx/</prefix>
              <new-prefix>/sap/bw/BEx/</new-prefix>
         </source>
         <source>
              <protocol>http</protocol>
              <prefix>/erp/sap/public/bc/its/mimes/</prefix>
              <new-prefix>/sap/public/bc/its/mimes/</new-prefix>
         </source>
         <source>
              <protocol>http</protocol>
              <prefix>/erp/sap/public/bc/ur/Design2002/</prefix>
              <new-prefix>/sap/public/bc/ur/Design2002/</new-prefix>
         </source>
         <source>
              <protocol>http</protocol>
              <prefix>/erp/sap/bc/public/systemlogin/</prefix>
              <new-prefix>/sap/bc/public/systemlogin/</new-prefix>
         </source>
         <source>
              <protocol>http</protocol>
              <prefix>/sap(</prefix>
         </source>
         <target>
              <protocol>http</protocol>
              <host>erp2004-server.ourdomain.local</host>
              <port>8000</port>
         </target>
    <compress-types>text/html, text/plain</compress-types>
    </mapping>
    and try to open webGUI, it redirects to BW server.
    A think that's because double '/sap(' prefixes.
    How can we avoid that?
    Same situation for SolMan.
    In portal's 'System Landscape' setup is:
    BW system
      ITS
        ITS description: CLIxxxSID
        ITS host name: portal-server.ourdomain.ru (this name in accessible from internet, it's a host where portal and IISPROXY are installed)
        ITS path: /sap/bc/gui/sap/its/webgui
    ERP2004 system
      ITS
        ITS description: CLIxxxSID
        ITS host name: portal-server.ourdomain.ru
        ITS path: /erp/sap/bc/gui/sap/its/ (I added /erp/ trying to distinguish request to ERP2004 server), without it it's also not working)
    In intranet (if we do not use IISPROXY) everything is working. Of course with other system definitions in System Landscape.
    Do I need to provide more details? Or my question is clear?
    Thanks in advance for help and support!
    Regards,
    DK
    P.S. Actually I opened an OSS message on this topic (with "high" priority), but no SAP activities since September, 6th :o(

    Hi Jayesh!
    Seems it's not working :o( And worst thing, that I do not know why :o(
    What i've done.
    1) Created an alias '/erp/sap/', that points to '/default_host/sap/bc/gui/sap/its/webgui'.
    2) In System Landscape edited system definition (of an ERP2004 system), so that ITS path is now '/erp/sap/' and ITS host 'ourportal.ourdomain.ru'.
    3) Created an 'SAP transaction iView' that should launch SU01 transaction in ERP2004 system.
    Now when I try to open it from page, portal tries to connect me to our BW server.
    Seems that alias are working in some other way :o(
    Here's what I can see in IISPROXY log:
    11:57:29 Filter J2EE --> GET /erp/sap/
    11:57:29   7616 Proxy    GET http://erp2004.ourdomain.ru:8000/erp/sap/
    11:57:29   7616 Proxy    HTTP/1.1 200 OK | queued for 0.000 sec, processed in 0.078 sec.
    11:57:29   7616 Proxy    | GET http://erp2004.ourdomain.ru:8000/erp/sap/ | HTTP/1.1 200 OK | 0.000 | 0.078
    11:59:41 Filter J2EE --> GET /sap(dslkknvDSAFSADVFDSVaslkdv)/bc/gui/sap/its/webgui?okcode=/nSU01&DisconnectOnClose=0&sap-client=200&sap-language=en&sap-accessibility=
    11:59:41   6952 Proxy    GET http://bw.ourdomain.local:8000/sap(dslkknvDSAFSADVFDSVaslkdv)/bc/gui/sap/its/webgui
    So it's still tries to open '/sap(dslkknvDSAFSADVFDSVaslkdv)/bc/gui/sap/its/webgui' instead of /erp/sap(
    dslkknvDSAFSADVFDSVaslkdv)/
    Thanks for help and support!
    Regards,
    DK

  • Reversi GUI question, A LOT of code in here!

    okay, so I've been working on his code for a long time. A REAL long time, working on it bit by bit, and all I got left is the Reversi's GUI. Basically I want to use the Jbutton and have x represent black and o represent white. I'm getting stuck on how to go about it. Any ideas?
    Here's alllll the code.
    package com.Ozo.games.reversi;
    * This utility class provides a number of static constants and
    * methods that provide abstractions for player colors and moves.
    * Colors and moves could be implemented as objects of separate
    * classes, but instead we represent them as integers and provide
    * the abstraction via these operations.
    public class Reversi {
         public static final int Black = 1;
         public static final int White = 2;
         public static final int Empty = 0;
          * Gives the color of a player's opponent.
          * @param color of this player.
          * @return color of the opponent.
         public static int playerOpposite(int color) {
              if (color == Black) return White;
              if (color == White) return Black;
              throw new Error("Player must be Black or White");
          * Compare two scores and determine whether the first is better than the second.
          * Better for black means more positive.  Better for white means more negative.
          * @param colorAsking
          * @param score1
          * @param score2
          * @return whether score1 is better than score2, as far as colorAsking is concerned.
         public static boolean isBetterScore(int colorAsking, int score1, int score2) {
              if (colorAsking == Black) return score1 > score2;
              if (colorAsking == White) return score1 < score2;
              throw new Error("Player must be Black or White");
          * Encode a move from this position as an integer.
          * A "pass" move is recorded as (-1,-1).
          * @param pos the board this move is for.
          * @param row the row at which the piece is placed.
          * @param col the column at which the piece is placed.
          * @return encoded move.
         public static int newMove(ReversiPosition pos, int row, int col) {
              return row * pos.ncols() + col;
          * A "pass" move.  I.e. no piece is placed.
         public static int newMovePass(ReversiPosition pos) {
              return newMove(pos, -1, -1);
          * Find the row of an encoded move.
          * @param pos the board this move is for.
          * @param move
          * @return the row.
         public static int moveRow(ReversiPosition pos, int move) {
              return move / pos.ncols();
          * Find the column of an encoded move.
          * @param pos the board this move is for.
          * @param move
          * @return the column.
         public static int moveCol(ReversiPosition pos, int move) {
              return move % pos.ncols();
    package com.Ozo.games.reversi;
    * Top-level driver for a Reversi game.
    public class ReversiGame {
         private ReversiPosition   _pos;
         private int               _toMoveColor;
         private ReversiTextIO     _userInterface;
         public ReversiGame(int nrows, int ncols) {
              _pos           = new ReversiPosition(nrows, ncols);
              _toMoveColor   = Reversi.Black;
              _userInterface = null;
              ReversiRules.setStartingPosition(_pos);
         public void setUserInterface(ReversiTextIO ui) {
              _userInterface = ui;
         public ReversiPosition currentPosition() { return _pos; }
         public int             toMoveColor()     { return _toMoveColor; }
         public void getHumanMoveAndApplyIt() {
              if (ReversiRules.countLegalMoves(_pos, _toMoveColor) != 0) {
                   int move = _userInterface.getMove(_pos, _toMoveColor);
                   _pos.applyMove(move, _toMoveColor);
              else
                   _userInterface.message("You have no move.  I get another turn.");
              _toMoveColor = Reversi.playerOpposite(_toMoveColor);
         public void getComputerMoveAndApplyIt() {
              if (ReversiRules.countLegalMoves(_pos, _toMoveColor) != 0) {
                   int move = ReversiStrategy.findBestMove(_pos, _toMoveColor);
                   _pos.applyMove(move, _toMoveColor);
              else
                   _userInterface.message("I have no move.  You get another turn.");
              _toMoveColor = Reversi.playerOpposite(_toMoveColor);
         public void play() {
              _userInterface.output(_pos);
              for (;;) {
                   if (ReversiRules.isGameOver(_pos, _toMoveColor)) { gameOverMessage(); break; }
                   getHumanMoveAndApplyIt();
                   _userInterface.output(_pos);
                   if (ReversiRules.isGameOver(_pos, _toMoveColor)) { gameOverMessage(); break; }
                   getComputerMoveAndApplyIt();
                   _userInterface.output(_pos);
         public void gameOverMessage() {
              _userInterface.message("Game over...");
              int winner = ReversiRules.winningColor(_pos, _toMoveColor);
              if      (winner == Reversi.Black) _userInterface.message("Black wins.");
              else if (winner == Reversi.White) _userInterface.message("White wins.");
              else    _userInterface.message("Draw.");
    package com.Ozo.games.reversi;
    * The main class to start a Reversi game as an application.
    public class ReversiMain {
         public static void main(String[] args) {
              ReversiGame   game = new ReversiGame(8, 8);
              ReversiTextIO tui  = new ReversiTextIO(System.in, System.out);
              game.setUserInterface(tui);
              game.play();
    }

    package com.Ozo.games.reversi;
    * This class provides all of the intelligence for a program to play Reversi.
    * It contains all the knowledge of play strategy.  (The knowledge of the rules
    * is maintained by the ReversiRules class.)
    * The principal method is findBestMove, which does an exhaustive search a number
    * of plys deep, and then applies a hueristic position evaluation function.
    public class ReversiStrategy {
         private static int PlysToTry = 6;
          * Find the best move for the player of the given color.
          * If there is no move, then return "pass".
          * @param pos the position to be evaluated.
          * @param toMoveColor the color of player to move.
          * @param plysRemaining the depth to examine (must be >= 1).
          * @return the best move within the default horizon.
         public static int findBestMove(ReversiPosition pos, int toMoveColor) {
              return findBestMove(pos, toMoveColor, PlysToTry).move;
          * This class is used to return a pair of values:  the best move and the score it achieves
          * after the number of plys remaining are played.
         public static class BestMove {
              public int move;
              public int score;
              public BestMove(int m, int s) { move = m; score = s; }
          * Find the best move for the player of the given color within
          * the given number of plys.
          * @param pos the position to be evaluated.
          * @param toMoveColor the color of player to move.
          * @param plysRemaining the depth to examine (must be >= 1).
          * @return a BestMove object returning the best move found and the score it achieves.
         public static BestMove findBestMove(ReversiPosition pos, int toMoveColor, int plysRemaining) {
              if (plysRemaining < 1) throw new Error("findBestMove needs plysRemaining >= 1");
              // Generate the legal moves.  If there are none, then pass.
              int opponentColor = Reversi.playerOpposite(toMoveColor);
              int[] moves = ReversiRules.generateMoves(pos, toMoveColor);
              if (moves.length == 0) {
                   if (plysRemaining == 1)
                        return new BestMove(Reversi.newMovePass(pos), summaryScore(pos));
                   else
                        return findBestMove(pos, opponentColor, plysRemaining-1);
              // Try all the moves.  Re-use one position object to make the move.
              ReversiPosition afterMove = pos.copy();
              // Start with a hypothetical worst scenario and then look for what's better.
              afterMove.fill(opponentColor);
              int bestScore = 2*summaryScore(afterMove);  // Worse that the worst possible real score.
              int bestIndex = -1;
              for (int i = 0; i < moves.length; i++) {
                   pos.copyInto(afterMove);      // Re-use the position object.
                   afterMove.applyMove(moves, toMoveColor);
                   int thisScore = (plysRemaining == 1) ?
                        summaryScore(afterMove) :
                        findBestMove(afterMove, opponentColor, plysRemaining - 1).score;
                   if (Reversi.isBetterScore(toMoveColor, thisScore, bestScore)) {
                        bestScore = thisScore;
                        bestIndex = i;
              if (bestIndex == -1) System.out.println("Number of moves " + moves.length + " plys " + plysRemaining);
              return new BestMove(moves[bestIndex], bestScore);
         * Examine contents of square and return 1 for Black, -1 for White, 0 for Empty.
         * Useful in computing scores.
         * @param r row number.
         * @param c column number.
         * @return +1/-1/0
         private static int squareVal(ReversiPosition pos, int r, int c) {
              if (pos.getSquare(r, c) == Reversi.White) return -1;
              if (pos.getSquare(r, c) == Reversi.Black) return +1;
              return 0;
         * Count the number of black squares minus the number of white squares.
         * @return difference in number of black and white squares.
         public static int squareScore(ReversiPosition pos) {
              int nBminusW = 0;
              for (int r = 0; r < pos.nrows(); r++)
                   for (int c = 0; c < pos.ncols(); c++)
                        nBminusW += squareVal(pos, r, c);
              return nBminusW;
         * Count the number of black edge squares minus the number of white ones.
         * @return difference in number of black and white squares.
         public static int edgeScore(ReversiPosition pos) {
              int nBminusW = 0;
              // East and west edges.
              for (int r = 1; r < pos.nrows()-1; r++)
                   nBminusW += squareVal(pos, r, 0) + squareVal(pos, r, pos.ncols()-1);
              // North and south edges.
              for (int c = 1; c < pos.ncols()-1; c++)
                   nBminusW += squareVal(pos, 0, c) + squareVal(pos, pos.nrows()-1, c);
              return nBminusW;
         * Count the number of black corner squares minus the number of white ones.
         * @return difference in number of black and white squares.
         public static int cornerScore(ReversiPosition pos) {
              int rlast = pos.nrows()-1, clast = pos.ncols()-1;
              return squareVal(pos, 0, 0) + squareVal(pos, 0, clast) +
              squareVal(pos, rlast, 0) + squareVal(pos, rlast, clast);
         * Compute a heuristic score for a given position. The more positive,
         * the better for Black. Controlling corners is weighted most heavily,
         * folowed by sides, then regular squares. In principle a different weight
         * function should be used at the end of the game, since then it is really
         * the total number of squares that counts.
         * @param pos the position to be assessed.
         * @return the numerical score, with positive being good for Black, negative good for White.
         public static int summaryScore(ReversiPosition pos) {
                   return squareScore(pos) + 8*edgeScore(pos) + 20*cornerScore(pos);
    }Edited by: Oozaro on Nov 19, 2009 12:41 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Another BW question about filter in the query definition

    Hi ,
    I have another question about filter in the query definition.
    <u>Question:</u>
    Which of the following objects can be filtered in the query definition?
    A. characteristic
    B. Key figure
    C. Structure
    D. Units
    E. Hierarchy
    My answer is A,B,D,E.
    The answer in the book is A,B,D
    Can anybody tell me which one is wrong?
    Thanks in advance,
    Liu Jia

    HI
    1.The answer could be A,B,D.you can not apply filters on hierarchies
    2.Whenever there is a change in Attribute data(like Location,Num etc...)that has to be reflected in all aggregates of the cube.Thsi can be done by running "ATTRIBUTE CHANGE RUN".
    sri

  • Yet another standby question...

    Hi gurus,
    Please help to resolve the quiz. I have completed manual physical standby installation. It is up and running. I then decided to install Grid Control and to use Data Guard for the standby creation. I've successfully installed GC, deployed all agents, I can see my previous standbys, life is good in short. Now, when I am trying to create the second standby for my production database using the Data Guard I stuck on a logical question:
    On the step 3 of Data Guard standby creation, there is a note, saying:
    The instance name (also referred to as the SID) must be unique on the standby host.
    Yeah, fair enough. But i can't understand what should I do next? I have:
    db_name YELLOW - primary prod
    db_name YELLOW - standby prod 1st
    and i need db_name YELLOW - standby 2nd
    But I can't create it on the same server where the first standby resides.. What options do I have? Do I need to create the second standby on another server? Do I need to kill 1st standby? Is there any way to avoid this conflict? I am confused. I have no equipment for TWO standby servers... I thought I can install there up to 9 standbys.. But it seems to be a problem.. And definitely, I cannot give my second standby other name than YELLOW as all my applications are strongly tied on db_name...
    Friends, please clarify this if you can. I am kinda lost in here..
    Thanks as usual,
    Maria

    well, that's a good question! :)
    because I don't have spare server for the standby. the question is not about: 'should I or should not put more than one standbys in one server' , but more about: 'is there any way to put two standbys with the identical db_names in one server'. I know that I probably sound unprofessional, but I just wanna know.. If the answer is 'no way', I will kill the first standby then and recreate the second one using DG with the correct name.
    Thanks for writing to me,
    M.

  • Re: another build question! (sorry lol)

    Hi all
    right, after days and days of researching all the excellent articles on here ive had to write a post! So apologies for going over old ground
    Im going to build a new CS5.5 rig (having had a guts full of Apple and their FCPX fiasco its back to pc!)
    so although i appreciate the 990x o'c is prob best option, bang for  buck is leading me down the sandybridge i7 2600k o'c option on p67 mobo with 16gb of ram (option to take to 32 down the line when the chips are out)
    anyway, im sorted on chip mobo (msi big bang marshal p67), nivida 570 etc , its the drives im struggling on!! Im edit avchd video and some after effects, small amount of 3d, and in FCP i always transcoded everything to prores. Now on cs5.5 it looks like real time performance is possible with high end hardwear.
    So mobo, ram, and chip aside, my HDD config im unsure on, ive not really got the cash to go crazy with raid controllors etc, but understand need for seperate drives, etc and tbh might even go downt he cineform route as a prores alternative (prob avoiding hassles of drive speed with avchd)
    im thinking as the SSD's are now dropping in price and the ocz are producing these 500 mb r/w speed sata 6 120gb drives for a reasonable price, would 3 of these drives (one for os, one for media , one for scracth disk ) be a good set up or is it a waste of cash and should i raid 0 from bios/mobo?
    I appreicate that 120 gb drives for media etc are small, but i would take project media from another much large backup drive and just use the 3x ssd set up as working disks for editing & os? once project over, clear out drives to larger back up and start new project!
    Its either that or i go SSD as bootdrive, but some sort of cheap raid set up for my scratch disk, media drives? prob is if i do that, from what ive read (brain dead now) i would be best off with 2 x raid 0 as scratch disk and orginal media respectively when workign with avchd
    HOWEVER, on my mobo there are only 4 sata 6 ports, so if i use one for ssd boot drive, and then im left with 3 x sata 6 ports and another 4 x sata 3 ports to raid on? how does this work? any point in getting the sata 6 drives as one would be stripped with a sata 6 drive plugged into a sata 3 port (this was my reasoning behind using 3 small sata 6 ssd's plugged to the sata 6 ports  and rest of sata 3 ports as storage and backups!
    confused lol!! I just want the overclocked sandybridge system with decent gpu card, as much ram as possible at present, but im thinking my bottleneck will be in the HDD config! any suggestions are much appreicated! im not that techy so whilst have read all the articles am more confused now (plus normally a mac user, so its out of the box configuration usually!) for what its worth looking to purchase something from scan uk in terms of parts! total build cost including a reasonable screen £2,000
    many thanks

    You have a limited budget, especially in the UK, but then don't we all?
    Going for the 980X will triple the cost of the CPU, but even when editing AVCHD material the gains are not sizable enough IMO to justify that cost differential. Add to that you will need 24 GB instead of 16 GB and that carries an additional price tag. Both factors will easily move you out of budget range if you want to have a number of disks and possibly a raid controller.
    Did you read my article To Raid or not to Raid, that is the question. It can be found under the Overview tab at the top of the page? (Currently responding from abroad on my notebook and not having the bookmarks available for easy linking). http://forums.adobe.com/thread/525263
    With media and projects I would advise against a raid0, because of the lack of redundancy. For pagefile, media cache and previews (scratch disks) raid0 is quite OK. They will be recreated if needed. The performance gain from a raid0 for media and projects over a parity raid is easily offset by the time spent on making backups. For parity raids do not use WD Caviar Blacks, but look at the Hitachi 7K3000 line of disks.
    The question of Sandy Bridge versus the old X58 platform is essentially one of 'which limitations are acceptable to me'.
    The Sandy Bridge is a great processor and at least the equal to the old i7-9xx quad cores. However, the platform, the chipset, has its shortcomings in terms of PCIe lanes. Whether that is relevant to you, only you can decide. But hey, we would be in serious trouble if Intel did not manage some progress in two years time from the i7-920 to the i7-2600K. So of course the i7-2600K shows much more potential than the almost retired 920, it is the chipset for the Sandy Bridge that is 'flawed' in comparison to the X58, but that is no surprise, since the Sandy Bridge is a 'middle-of-the-road' platform and the X58 was a 'high performance' platform.
    BFTB-wise I think that within your budget limits, you should look at the i7-2600K, but with the best disk setup you can afford.

  • Administration Port / command line /  console gui question

    In the Admin_ref.pdf doc it says "After enabling the administration port, all Administration Console traffic must connect via the administration port". Does this mean that you can no longer use the web gui console to manage the servers?
    I would like the option to script deployments (deploy ears, stop start servers etc.) via command line to reduce the possibility of user error during routine deployments.
    I do config mgmt. and am not a developer so I may be getting hung up on the language here.
    Thanks,
    gj

    Hi
    For first question the answer is no. With the administration port, you enable the SSL between the admin server and Node manager-managed Servers. You can still use the web console.
    For teh second question, you can use ANT or can use the WLS Scripting ..you can get more details in dev2dev.bea.com
    Jin

Maybe you are looking for

  • How come full screen exclusive mode is so slow?

    Hi. I am currently working on customer facing point-of-sale application. This application has a lot of animation going on and so needs quite speedy graphics performance. When I first investigated this it looked like I could do it in pure Java 2D whic

  • How do I reinstall EVERYTHING after a hard drive wipe and upgrade to Lion?

    In preparing for the iCloud migration, my iMac had problems and I had to have my hard drive wiped clean and Lion installed. How do I easily get all my old stuff (iTunes and music library, iPhoto and photo library, iMovie, applications such as CS3, Qu

  • Itunes can't find music library on computer

    Somehow I've moved my music on my computer and itunes cannot find any of it. I can't play anything on the computer, an exclamation point is next to it and the computer tells me itunes cannot find the music. Help! What did I do and how do I fix this?

  • Set message MEPO 852 to warning

    Hello All, My issue is as follows... We have maintained vendor rebate agreement for our vendor. Purchase order is created for a vendor for which vendor rebate agreement is maintained. purchase order was put on "Hold" for the first time. Then user has

  • Yellow status does not start  j2E server0

    Hi Gurus, Everything was working fine until today.  SDM and dispatcher green light but server0 yellow status for about for  1 hour now and still does not start. Status starting framework... your help is greatly appreciated. defaultTrace.1.trc below: