Rolling up a string

i have a string field (bill to name)
i would like to take the following and foll it up to one value
abc industries
abc international
abc industries international
i would like them to all be grouped by ABC
i have tried
if instr({string field},"/")>0 then
split({string field},"/") [1]
i receive an error THIS ARRAY MUST BE SUBSCRIPTED for example ARRAY <i>,
im a bit confused can anyone tell me how to get this to work please, not familar with arrays.

Hi Sharon,
I'm not exactly sure what it is you are trying to do but your formula is erring out because of the subscript in the last line. 
You can't subscript a function.  Are you trying to get the first character from the split?  It should look like:
StringVar X;
X := split({string field},"/");
X [1];
Next, what you described and what your formula are doing is confusing.  Your formula is looking for "/" but I don't see any in your example. 
Can you explain what you mean by rolling the records into one value?  Are you trying to append them together or just group based on the "abc"?
To group them create a formula like:
If {string.field} [1 to 3] = "abc" Then
   "abc"
Else {string.filed};
Now you should be able to group on this formula.
Good luck,
Brian

Similar Messages

  • How do I use serial port read and show text, but not have it scroll off screen?

    I am new-ish/returning amateur user of Labview and I am trying to edit the example VI "Advanced serial write and read VI" that is part of dev suite 2012.  I need to use the string box to show ALL text received from serial port, always appending and only rolls off screen when more real data arrives at serial port. 
    What is actually happening is as more bytes (or no bytes AT ALL!) arrive during read time, current text rolls off the string box.  Even when 0 bytes are received, screen is blanked out.  I am not very familiar with functions locations and even worse at understanding obscure references to functions, so please keep replies very basic so I can follow.
    Just to be clear, I need the string window to behave like hyperterm does-always shows data and it is not pushed out of window arbitrarily.
    Thanks,
    Steve  
    Solved!
    Go to Solution.

    OK- lets start back at the beginning.  I have a few questions...
    WHy does incoming txt get placed at top of txt box and then scroll up?  why would it make more sense to input at the bottom and scroll toward the top.  I have created this huge txt box that appears to be impossible to use.
    I have attached example of txt boxes I have tried, and pic of VI I have edited.  Bad marks for uglyness....
    Attachments:
    Capture_VI.JPG ‏117 KB
    Capture_VI2.JPG ‏133 KB

  • New to Java RMI

    I am having problems with the following code that I am currently trying to understand RMI from Java head First, the following are meant to be part of an universal browser that the browser downloads and displays interactive Java GUIs. Can someone explain what I am doing wrong as I am still new to Java please?
    import java.awt.*;
    import javax.swing.*;
    import java.rmi.*;
    import java.awt.event.*;
    public class ServiceBrowser {
       JPanel mainPanel;
       JComboBox serviceList;
       ServiceServer server;
       public void buildGUI() {
          JFrame frame = new JFrame("RMI Browser");
          mainPanel = new JPanel();
          frame.getContentPane().add(BorderLayout.CENTER, mainPanel);
          Object[] services = getServicesList();
          serviceList = new JComboBox(services);
          frame.getContentPane().add(BorderLayout.NORTH, serviceList);
          serviceList.addActionListener(new MyListListener());    
          frame.setSize(500,500);
          frame.setVisible(true);
       void loadService(Object serviceSelection) {
           try {
              Service svc = server.getService(serviceSelection);
              mainPanel.removeAll();
              mainPanel.add(svc.getGuiPanel());
              mainPanel.validate();
              mainPanel.repaint();
            } catch(Exception ex) {
               ex.printStackTrace();
       Object[] getServicesList() {
          Object obj = null;
          Object[] services = null;
          try {
              obj = Naming.lookup("rmi://127.0.0.1/ServiceServer");   
         catch(Exception ex) {
           ex.printStackTrace();
         server = (ServiceServer) obj;
          try {
            services = server.getServiceList();
          } catch(Exception ex) {
             ex.printStackTrace();
         return services;
       class MyListListener implements ActionListener {
          public void actionPerformed(ActionEvent ev) {
              // do things to get the selected service
              Object selection =  serviceList.getSelectedItem();
              loadService(selection);
      public static void main(String[] args) {
         new ServiceBrowser().buildGUI();
    }I am able to compile the code but come up with the following error messages at runtime
    java.rmi.ConnectException: Connection refused to host: 127.0.0.1; nested exception is:
         java.net.ConnectException: Connection refused
         at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)
         at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)
         at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)
         at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:322)
         at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
         at java.rmi.Naming.lookup(Naming.java:84)
         at ServiceBrowser.getServicesList(ServiceBrowser.java:53)
         at ServiceBrowser.buildGUI(ServiceBrowser.java:19)
         at ServiceBrowser.main(ServiceBrowser.java:82)
    Caused by: java.net.ConnectException: Connection refused
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
         at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
         at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)
         at java.net.Socket.connect(Socket.java:529)
         at java.net.Socket.connect(Socket.java:478)
         at java.net.Socket.<init>(Socket.java:375)
         at java.net.Socket.<init>(Socket.java:189)
         at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
         at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
         at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)
         ... 8 more
    java.lang.NullPointerException
         at ServiceBrowser.getServicesList(ServiceBrowser.java:64)
         at ServiceBrowser.buildGUI(ServiceBrowser.java:19)
         at ServiceBrowser.main(ServiceBrowser.java:82)
    Exception in thread "main" java.lang.NullPointerException
         at javax.swing.DefaultComboBoxModel.<init>(DefaultComboBoxModel.java:53)
         at javax.swing.JComboBox.<init>(JComboBox.java:175)
         at ServiceBrowser.buildGUI(ServiceBrowser.java:21)
         at ServiceBrowser.main(ServiceBrowser.java:82)
    The code for the remote implementation compile and runs, but the other code for services compiles but come back with the following error message at runtime:
    Exception in thread "main" java.lang.NoSuchMethodError: main
    I have included one of the services code below this happens with:
    import javax.swing.*;
    import java.awt.event.*;
    import java.io.*;
    public class DiceService implements Service {
        JLabel label;
        JComboBox numOfDice;
        public JPanel getGuiPanel() {
           JPanel panel = new JPanel();
           JButton button = new JButton("Roll 'em!");
           String[] choices = {"1", "2", "3", "4", "5"};
           numOfDice = new JComboBox(choices);
           label = new JLabel("dice values here");
           button.addActionListener(new RollEmListener());
           panel.add(numOfDice);
           panel.add(button);
           panel.add(label);
           return panel;
       public class RollEmListener implements ActionListener {
          public void actionPerformed(ActionEvent ev) {
             // roll the dice
             String diceOutput = "";
             String selection = (String)  numOfDice.getSelectedItem();
             int numOfDiceToRoll = Integer.parseInt(selection);
             for (int i = 0; i < numOfDiceToRoll; i++) {
                int r = (int) ((Math.random() * 6) + 1);
                diceOutput += (" " + r);
            label.setText(diceOutput);
    }

    how I do get suitable server running, can I not test the code on a local ip address first, i have included the remote implementation code below, can you advise how I can resolve this please or point me in the right direction?
    import java.rmi.*;
    import java.util.*;
    import java.rmi.server.*;
    public class ServiceServerImpl extends UnicastRemoteObject implements ServiceServer  {
        HashMap<String, Service> serviceList;
        public ServiceServerImpl() throws RemoteException {
           // start and set up services
           setUpServices();
       private void setUpServices() {
           serviceList = new HashMap<String, Service>();
           serviceList.put("Dice Rolling Service", new DiceService()); 
           serviceList.put("Day of the Week Service", new DayOfTheWeekService()); 
           serviceList.put("Visual Music Service", new MiniMusicService());  
        public Object[] getServiceList() {
           System.out.println("in remote");
           return serviceList.keySet().toArray();
        public Service getService(Object serviceKey) throws RemoteException {       
           Service theService = (Service) serviceList.get(serviceKey);      
           return theService;
        public static void main (String[] args) {
           try {
             Naming.rebind("ServiceServer", new ServiceServerImpl());
            } catch(Exception ex) { }
            System.out.println("Remote service is running");
    }

  • How to combine this code

    Hi,
    I am learning JSP. I made this page which takes up user name and roll and prints it.Can you please show me how to do this in a more better way. Such as instate of 3 page can I combine it into two or any thing that you have in mind...
    Thank you very much,
    M
    Form.html (this gets the user data)
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      </head>
      <body>
          <FORM METHOD="POST" ACTION="SaveName.jsp">
              Enter Name:
              <input type="text" name="name" value="" size="30" />
              Enter Roll:
              <input type="text" name="roll" size="30"/>
                  <input type="SUBMIT"/>
          </FORM>
      </body>
    </html>UserData.java
    package newpackage;
    public class UserData {
        String name;
        int roll;
        public void setName(String value){
            name = value;
        public void setRoll(int value){
            roll = value;
        public String getName(){
            return name;
        public int getRoll(){
            return roll;
    }SaveName.jsp
    <jsp:useBean id="newpackage" class="newpackage.UserData" scope="session"/>
    <jsp:setProperty name="newpackage" property="*"/>
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>SaveName.jsp</title>
        </head>
        <body>
            <A HREF="NextPage.jsp">Click here</A>
        </body>
    </html>NextPage.jsp
    <jsp:useBean id="newpackage"class="newpackage.UserData" scope="session"/>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>JSP Page</title>
        </head>
        <body>
            <h2>Hello World!</h2>
            Name = <%= newpackage.getName() %>
            <br>
            Roll = <%= newpackage.getRoll() %>
        </body>
    </html>

    Geesh. Throw that tutorial away. Right now.
    Start over at one of those tutorials:
    Sun Java EE tutorial part II: [http://java.sun.com/javaee/5/docs/tutorial/doc]
    Coreservlet.com tutorials: [http://courses.coreservlets.com/Course-Materials/]
    I also highly recommend a book of Bates & Sierra: [http://www.amazon.com/Head-First-Servlets-JSP-Certified/dp/0596005407]

  • Error in java/jsp files

    hi, i`m developing a web app for my boss. i usually only programm de web frontend part of the software so i'm not that used to java lang speifics. here is my prob:
    i have a class which shoul save and retrieve the String "rolle"
    package at.mobilkom.ears;
    public class Sessionhandler
        private String rolle;
        public void setRolle(String r)  {
         rolle=r;
        public String getRolle()  {
        return rolle;
    } i call this methods just as normal in a jsp file:
    Sessionhandler.setRolle(rolle); and session.putValue("ROLLE", Sessionhandler.getRolle());i did all the import stuff so that's not the mistake. i'm developing with bea weblogic and i get the error message:
    "Error: Method cannot be accessed from a static context"
    so what should i do to make it work?? thx

    hi, i`m developing a web app for my boss. i usually
    only programm de web frontend part of the software so
    i'm not that used to java lang speifics. here is my
    prob:
    i have a class which shoul save and retrieve the
    String "rolle"
    package at.mobilkom.ears;
    public class Sessionhandler
    private String rolle;
    public void setRolle(String r)  {
    rolle=r;
    public String getRolle()  {
    return rolle;
    } i call this methods just as normal in a jsp file:
    Sessionhandler.setRolle(rolle); and session.putValue("ROLLE",
    Sessionhandler.getRolle());i did all the import stuff so that's not the mistake.
    i'm developing with bea weblogic and i get the error
    message:
    "Error: Method cannot be accessed from a static
    context"
    so what should i do to make it work?? thxYou have to create an instance before you call the methods which aren't static. Please spend some time reading the fundamentals.
    The following code will work.
    Sessionhandler sessionhandler=new Sessionhandler();
    sessionhandler.setRolle(rolle);
    session.putValue("ROLLE",sessionhandler.getRolle());

  • My first java program!! ALMOST done..I hope

    I've just written my first java program (part of a class I'm taking).. It's feeling kinda awkward since I'm a C++ programmer.. I've written most of the code but I'm still having problems and I thought I should show it to you to get some help..
    import java.lang.*;
    import java.util.*;
    public class Dice
    private static Random generator = new Random();
    int Die1, Die2, rolled, pairNum, pairSum;
    public Dice()
       int[] Dice_arr={Die1, Die2};
       new Random(System.currentTimeMillis());
       return;
      }//end_func_Dice
       public static roll()
         rolled = generator.nextInt(6) + 1;
         return rolled;
        }//end_func_roll
       public String toString()
         StringBuffer bfr = new StringBuffer("\n");
         System.out.println("Rolling Dice...");
          for(pairNum=0; pairNum==10; pairNum++)
            System.out.println("Pair"+pairNum+": "+Die1+","+Die2+" Sum= "+pairSum);
           }//end_for_
        }//end_func_ 
    }//end_class_Dice
    public static void main(String args[])
          for (int dieNum=0; dieNum==2; dieNum++)
            Dice.roll();
            Dice_arr[dieNum]=rolled;
           }//end_for_
         return;
        }//end_func_mainI need main to instatiate the Dice class and then use the toString to print the dice numbers and their sum 10 times..
    I hope this doesn't need much effort,
    Thanks a bunch in advance..

    Right now, my opinion in java is that it's too
    complicated for no reason compared to C++..It's not too complicated, it's just that you are new at this.
    Here's a little example of a simple class with a simple main method, the rest figure it out yourself, and with time read some java books, you won't learn java just by knowing C++.
    public class Human {
        // See this as C constants (although they're not their Equivalent)
        public static boolean MALE = true;
        public static boolean FEMALE = false;
        //member variables.
        private String name;
        private boolean sex;
        /** Creates a new instance of Human */
        public Human(String n, boolean s) {
            name = n;
            sex = s;
        }//End of CONSTRUCTOR.
        public String getName() {
            return name;
        }//End of getName
        public String toString() {
            StringBuilder sb = new StringBuilder();
            sb.append("[Name: " + name);
            if(sex)
                sb.append(", sex: Male]");
            else
                sb.append(",sex: Female]");
            String returnValue = new String(sb);
            return returnValue;
        }//End of toString()
        //Just the main program, it could be at another class.
        public static void main(String[] args) {
            Human h = new Human("Pablo", Human.MALE);
            String theHumanAsAString = h.toString();
            System.out.println(theHumanAsAString);
        }//End of main method
    }//End of class

  • Tecra Z40 - HDD Upgrade

    Hi,
    i bought the Z40 with a 500 GB HDD. As a replacement i bought the following SSD:
    Crucial CT512MX100SSD1 - 500 GB
    Unfortunately i didn't get it to work. On the BIOS i can see that the system recognizes the ssd. But neither the restored system boots, nor windows 8.1 Retail installs. Are there any known compatibility issues?
    The problems persist whether the bios setting is UEFI oder CSM.
    I upgraded to the latest bios version to 3.7, but that didn't change the result.

    "But I think if this will not work, you will need to reinstall the system once again".
    Well, Paupau that's basically what I did.
    The long story :
    I tried to boot with the SSD in a enclosure plugged on an USB port : still got BSODs.
    I really didn't want to have to reinstall and parametrize everything : Windows patches, office, various programs, copy my files... But as I was having [bad problems while putting the PC in sleep mode|http://forums.computers.toshiba-europe.com/forums/thread.jspa?threadID=80456], I finally decided that a factory restore on the SSD might fix everything. Moreover, I had the original SSHD at hand in case it would not work.
    So I booted, chose repair mode, thenToshiba's utility to do a factory restore.
    Then the installation sequence rolled, with its string of reboots.
    (By the way, one stage even failed, with a Windows crash, that would loop again and again after every reboot. So I finally chose to start in safe mode, and the installation routine could go on... weird.)
    Next, I let Windows Update do its job, and installed my apps. Having had a bad experience with the quite old drivers that the Toshiba's Tempro utility advised me to install (see link above), I rather kept away from it, and used Intel's Driver Update Utility wich made me upgrade the wifi and bluetooth drivers. I made system resore points at every stage in case the sleep mode would cause BSODs again. Luckily, this didn't occur.
    So here I am, with a much faster Tecra Z40, and no more sleep crashes. It was a chore, but I guess it was worth it.
    Thanks for yout help, Paupau. :)

  • Simple GUI - Help

    Hi, for my Java class, we have to write a simple GUI for a program that we wrote last week. This is what I have so far:
    import javax.swing.*;
    import java.awt.*;
    import java.util.Random;
    /* Class Kozyra which contains main method */
    public class Kozyra {     
        /* Method question: gets the user to enter whether or not he/she wants to continue
         * running the program */
        public static String question(){
              String s, answer;
              boolean valid;
              do{
                   s = JOptionPane.showInputDialog("Continue? (Y/N or P to Pause)");
                 answer = s.toUpperCase();
                 valid = answer.equals("Y") || answer.equals("N") || answer.equals("P");
                 if(!valid){
                        JOptionPane.showMessageDialog(null, answer + " is not a valid response. Please retype.");
                 } // end if
                 if(answer.equals("P")){
                      JOptionPane.showMessageDialog(null, "Game Paused.  Press OK to continue.");
              }while (!valid); // end do-while
              return answer;
        } // end method question
        public static void frame(){
             Homework3GUI frame = new Homework3GUI();
              frame.setTitle("CRAPS");
              frame.setLocationRelativeTo(null);
             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.setSize(600,400);
              frame.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 20));
              frame.setVisible(true);
        } // end method frame
        /* Main method: creates new object called player and determines whether or not the game
         * continues running*/
        public static void main(String[] args){     
            frame();
            String answer = "Y";
              Dice player = new Dice(100, "");
              JOptionPane.showMessageDialog(null,"Welcome to CRAPS, " + player.getName());
              while(!player.busted() && !player.reachedGoal() && answer.equals("Y")){           
                player.begin();
                if(!player.busted() && !player.reachedGoal()){
                        answer = question();
                   } // end if
                   else{
                        answer = "N";
                   } // end if
              } // end while                 
        } // end main
    } // end class Homework3
    /* Beginning of class Dice (driver) */
    class Dice extends JPanel{
         // Declare variables
         private int amount, betValue;
         private int roll = 0;
        private String name;
            private boolean win, lose;
            private JTextField text1, text2, text3, text4, text5, text6;
         /* Constructor */
        public Dice(int amount, String name){
            this.name = name; // this refers to instance variabls
            this.amount = amount;
        } // end method Dice
        public void layout(){
             setLayout(new FlowLayout(FlowLayout.LEFT, 10, 20));
             text1 = new JTextField();
             text2 = new JTextField();
             text3 = new JTextField();
             text4 = new JTextField();
             text5 = new JTextField();
             text6 = new JTextField();
             add(text1, null);
             add(text2, null);
             add(text3, null);
             add(text4, null);
             add(text5, null);
             add(text6, null);
             text1.setSize(15,25);
             text2.setSize(15,25);
             text3.setSize(15,25);
             text4.setSize(15,25);
             text5.setSize(15,25);
             text6.setSize(15,25);
             text1.setLocation(10,10);
             text2.setLocation(10,40);
             text3.setLocation(10,70);
             text4.setLocation(10,100);
             text5.setLocation(10,130);
             text6.setLocation(10,160);
             setVisible(true);
        } // end method layout
        /* Prompts the user to enter his/her name using the scanner class and returns it as a string */
        public String getName(){
             String name = JOptionPane.showInputDialog("Please enter your name: ");
            return name;
        } // end method getName
        /* Asks the user to input his/her bet and determines if it is valid */
         private void getBet(){
              String betValueString = JOptionPane.showInputDialog("You have $" + amount +
                   ".  Please enter your bet: $");
              betValue = Integer.parseInt(betValueString);
              if(betValue > amount){
                      betValueString = JOptionPane.showInputDialog("You only have $" + amount +
                           ".  Please enter a bet that is less than or equal to $" + amount + ":  $");
                      betValue = Integer.parseInt(betValueString);
              } // end if
              if(betValue < 1){
                   betValueString = JOptionPane.showInputDialog("You have $" + amount +
                        ".  Please enter an amount greater than $1:  $");
                      betValue = Integer.parseInt(betValueString);
              } // end if
         } // end getBet
         /* Simulates the craps game and returns win */
         private boolean playGame(){
               int answer = roll();
               text1.setText("Your roll is: " + answer);
               win = answer == 11 || answer == 7;
               lose = answer == 2 || answer == 12;
               if(!(win || lose)){
                    int point = answer;
                    text2.setText("Your point value is: "+ point);
                    while(!(win||lose)){
                         answer = roll();
                         text3.setText("Your total is: " + answer);
                         win = answer == point;
                         lose = answer == 7;
                    } // end while
               } // end if
               return win;
          } // end method game
         /* Simulates the rolling of the die */
         public int roll(){
               int die1 = (int)(6*Math.random() + 1);
               int die2 = (int)(6*Math.random() + 1);
               text4.setText("You rolled " + die1 + " and " + die2 + ".  ");
               return die1 + die2;
          } // end method roll
         /* Informs the user of the result of his/her game and updates the amount of "money" */
         private void displayMessage(boolean win){
              if(win == true){
                   text5.setText("Congratulations, you won that round.  You bet $" + betValue +
                        " so you won $" + betValue + ". You now have $" + (amount += betValue));
              } // end if
              else{
                   text5.setText("Sorry, you lost that round.  You bet $" + betValue +
                        " so you lost $" + betValue + ".  You now have $" + (amount -= betValue));
              } // end else if
         } // end method displayMessage
        /* Determines if the user has busted or won and will or will not continue playing */
        public boolean terminate(){
             boolean go;
             if(busted() == true){
                  text6.setText("Sorry, you have lost. :( Somewhere, the world's tiniest violin is " +
                       "playing you a sad song.");
                  go = false;
             } // end if
             else if(reachedGoal() == true){
                  text6.setText("CONGRATULATIONS!  YOU HAVE BEAT THE ODDS AND WON!" +
                       " THE COSMOS SALUTES YOU! GO SPEND YOUR WINNINGS");
                  go = false;
             } // end else if
             else
                  go = true;
             return go;
        } // end method terminate
        /* Determines of goal of amount greater than or equal to $300 has been reached */
        public boolean reachedGoal(){
             return amount >= 300;
        } // end method reachedGoal
        /* Determines if the user has run out of money to play with */
        public boolean busted(){
            return amount <= 0;
        } // end method busted
        /* Calls other methods in order to play game */
        public void begin(){
            getBet();
            playGame();
            displayMessage(win);
            terminate();
        } // end begin
    } // end DiceI'm sure it's simple and terrible and all but I really don't know what I'm doing, and this is my first time writing a GUI (plus my professor's teaching consisted of him telling us to go look online). Firstly I can't get anything to show up on the frame. Secondly, it compiles but does not run and I am getting the following two errors:
    Exception in thread "main" java.lang.NullPointerException
    at Dice.roll(Kozyra.java:182)
    at Dice.playGame(Kozyra.java:155)
    at Dice.begin(Kozyra.java:238)
    at Kozyra.main(Kozyra.java:56)
    Note: C:\Program Files\Xinox Software\JCreatorV4LE\MyProjects\Honors2\Kozyra.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Any help would be appreciated, as I am becoming increasingly frustrated (I can't find where the pointer exception is and I have no idea what the "note" one is...). Thanks.

    Thanks, Corlett.
    The Homework3GUI thing was a vestige from something else that I missed correcting. However, I still cannot get anything to show up on the JFrame...Also, what does private static final long serialVersionUID = 54645635L; do?
    This is how the code reads now:
    import javax.swing.*;
    import java.awt.*;
    import java.util.Random;
    public class Kozyra2 extends JFrame{
          // returns true if user wishes to continue playing
         public static boolean playAgain() {
              return JOptionPane.YES_OPTION == JOptionPane.showConfirmDialog(null,
                   "Play again ?", "Do you wish to continue playing?", JOptionPane.YES_NO_OPTION);
          } // end method playAgain
          // builds and shows a GUI.
         public static void buildAndShowGUI(){
              Kozyra2 frame = new Kozyra2();
                 frame.setTitle("CRAPS");
                 frame.setLocationRelativeTo(null);
                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                 frame.setSize(600,400);
                frame.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 20));
                 frame.setVisible(true);
          } // end buildAndShowGUI
         // Main method: gets this show on the road.
         public static void main(String[] args){
                buildAndShowGUI();
                Player player = new Player(100, enterName());
              JOptionPane.showMessageDialog(null,"Welcome to CRAPS, " + player.getName());
              while(player.play() && playAgain());
         } // end main method
         // returns the name entered by the user
         private static String enterName() {
              return JOptionPane.showInputDialog("Please enter your name: ");
         } // end method enterName
    } // end class
    class Player extends JPanel{
         private static final long serialVersionUID = 54645635L;
         private static final int TARGET_BALANCE = 300;
         private int balance;
         private String name;
         private JTextField[] text = null;
         public Player(int stake, String name){
              this.name = name;
                 this.balance = stake;
                 this.layoutPanel();
         } // end constructor
         public String getName() {
              return this.name;
         } // end method getName
         private void layoutPanel() {
                setLayout(new FlowLayout(FlowLayout.LEFT, 10, 20));
                 text = new JTextField[6];
                 for (int i=0; i<6; i++) {
                   text[i] = newTextField(10+i*30);
                   add(text, null);
              } // end for loop
              setVisible(true);
         } // end method layoutPanel
         private JTextField newTextField(int y) {
              JTextField t = new JTextField();
              t.setSize(15,25);
              setLocation(10,y);
              return t;
         } // end method newTextField
         // returns the users bet balance
         private int getBet(){
              while (true) {
                   try {
                        String response = JOptionPane.showInputDialog("You have " + balance + ". Your bet ? ");
                        int bet = Integer.parseInt(response);
                        if(bet>=1 && bet<=balance)
                             return bet;
                        JOptionPane.showMessageDialog(null, "Oops: An integer between 1 and " + balance + " is required.");
              } catch (NumberFormatException E) {
                   JOptionPane.showMessageDialog(null, "Oops: An integer value is required.");
              } // end try-catch
              } // end while loop
         } // end method getBet
         // returns true of the user wins this round.
         private boolean playRound(int bet){
              int score = roll();
              text[1].setText("Your score is: " + score);
              boolean win = (score == 11 || score == 7);
              boolean lose = (score == 2 || score == 12);
              int previousScore = score;
              while ( !(win||lose) ) {
                   score = roll();
                   text[3].setText("Your score is: " + score);
              win = (score == previousScore);
              lose = (score == 7);
              previousScore = score;
              } // end while loop
              if (win) {
                   balance += bet;
                   text[5].setText("You won. You won $" + bet + ". You now have $" + balance);
              } // end if statement
              else {
                   balance -= bet;
                   text[5].setText("You lost. You now have $" + balance);
              } // end else
              return win;
         } // end method playRoung
         // returns the total of rolling a pair of dice.
         public int roll(){
              int die1 = (int)(6*Math.random() + 1);
              int die2 = (int)(6*Math.random() + 1);
              int total = die1 + die2;
              text[4].setText("You rolled " + die1 + " and " + die2 + " = " + total);
              return total;
         } // end method roll
    // are we there yet?
         public boolean checkBalance(){
              if (balance <= 0) {
                   text[6].setText("Busted!");
              return true;
              } // end if statement
              if (balance >= TARGET_BALANCE) {
                   text[6].setText("Congratulations! Go spend your winnings.");
                   return true;
              } // end if statement
              return false;
         } // end method checkBalance
         public boolean play(){
              int bet = getBet();
              playRound(bet);
              return checkBalance();
         } // end method play
    } // end class Player

  • ORA-02050 transaction string rolled back, some remote DBs may be in-doubt

    Hi...guys...How ru all...
    I got follwoing error...and I searched in google but there is not clear information..plz help me ...
    Error Message: ORA-02050 transaction string rolled back, some remote DBs may be in-doubt
    Error Cause:
    Network or remote failure during a two-phase commit.
    Action:
    Notify operations; remote databases will automatically re-sync when the failure is repaired.
    SQL>SELECT local_tran_id, global_tran_id, state, mixed, host, commit#
    FROM dba_2pc_pending
    LOCAL_TRAN_ID GLOBAL_TRAN_ID STATE MIX HOST COMMIT#
    5.44.98254 JICRACDB.e1ab4089.5.44.98254 collecti no JICN\ROOM9 1132915640
    ng 7-ITC
    SQL> SELECT local_tran_id, in_out, database, dbuser_owner, interface
    2 FROM dba_2pc_neighbors
    3 /
    LOCAL_TRAN_ID IN_OUT DATABASE DBUSER_OWNER INT
    5.44.98254 in JIC N
    5.44.98254 out RC_DBLINK JIC N
    SQL> ;
    1 select state, tran_comment, advice from dba_2pc_pending
    2* where local_tran_id ='5.44.98254'
    SQL> /
    STATE TRAN_COMMENT ADVICE
    collecting
    so how can I delete distributed transaction..plz provide me any Metalink Docids.

    See if following MOS note helps.
    Manually Resolving In-Doubt Transactions: Different Scenarios (Doc ID 126069.1)

  • Programming strings in piano roll - pizzicato, legato, etc. - how?

    Hi all
    I have been messing around in Logic creating some pretty cool orchestral tunes. The one thing I am struggling with is how to go between different string hits when you choose, for example, Orchestral Section (another question is: what is an orchestral section - does this cover a range of instruments?).
    I have managed to change from normal held notes to staccato hits using my modulation wheel on the keyboard but, as soon as I change tracks, it stops working.
    Can anybody advice on what settings I should be looking at? I am quite serious about getting into composition and would love some advice.
    Thanks in advance.
    Steve

    Don't know which instrument sound you're talking about, but I can answer your question about orchestral sections:
    Woodwinds
    Brass
    Percussion
    Strings
    In that order.
    Those are the four basic orchestral food groups. Within "brass" are horns (which, depending on the music, can be considered part of the brass or the woodwinds). "Percussion" includes everything from harp to piano to xylophone, etc. If you're seriously into studying composition, you will also want to study orchestration and instrumentation (they are not the same things). Two books you should get (and marry) are "Instrumentation/Orchestration" by Alfred Blatter, and "The Study of Orchestration" by Samuel Adler. These are not the only such books but they're both great starting points. Oh yes, and they're expensive, but if you're serious you won't shy away from the price tag.

  • How do I cast a String to an int ?  HELP !

    Dear Java People,
    If I have a program that outputs a String of the time ie
    09:25
    How do I code in Java to check this String to see if it is greater than 12 o'clock and if so tack on a String of "PM'.....
    I tried
    if ((int) hours.getDisplayValue()> 12 )
    to attempt to add "PM" at the end of the String
    The error message says:
    "ClockDisplay.java": Error cannot cast java.lang.String to int at line 88, column 12
    below is the program
    Thank you in advance
    Stan
    * The ClockDisplay class implements a digital clock display for a
    * European-style 24 hour clock. The clock shows hours and minutes. The
    * range of the clock is 00:00 (midnight) to 23:59 (one minute before
    * midnight).
    * The clock display receives "ticks" (via the timeTick method) every minute
    * and reacts by incrementing the display. This is done in the usual clock
    * fashion: the hour increments when the minutes roll over to zero.
    * @author Michael Kolling and David J. Barnes
    * @version 2001.05.26
    public class ClockDisplay
    private NumberDisplay hours;
    private NumberDisplay minutes;
    private String displayString; // simulates the actual display
    * Constructor for ClockDisplay objects. This constructor
    * creates a new clock set at 00:00.
    public ClockDisplay()
    hours = new NumberDisplay(24);
    minutes = new NumberDisplay(60);
    updateDisplay();
    * Constructor for ClockDisplay objects. This constructor
    * creates a new clock set at the time specified by the
    * parameters.
    public ClockDisplay(int hour, int minute)
    hours = new NumberDisplay(24);
    minutes = new NumberDisplay(60);
    setTime(hour, minute);
    * This method should get called once every minute - it makes
    * the clock display go one minute forward.
    public void timeTick()
    minutes.increment();
    if(minutes.getValue() == 0) { // it just rolled over!
    hours.increment();
    updateDisplay();
    * Set the time of the display to the specified hour and
    * minute.
    public void setTime(int hour, int minute)
    //Exercise 3.19 This condition will insure that it will be a 12 hour clock
    if(hour > 12)
    hour = hour - 12;
    hours.setValue(hour);
    minutes.setValue(minute);
    updateDisplay();
    * Return the current time of this display in the format HH:MM.
    public String getTime()
    return displayString;
    * Update the internal string that represents the display.
    private void updateDisplay()
    if ((int) hours.getDisplayValue() > 12 )
    displayString = hours.getDisplayValue() + ":" +
    minutes.getDisplayValue() ;
    * The NumberDisplay class represents a digital number display that can hold
    * values from zero to a given limit. The limit can be specified when creating
    * the display. The values range from zero (inclusive) to limit-1. If used,
    * for example, for the seconds on a digital clock, the limit would be 60,
    * resulting in display values from 0 to 59. When incremented, the display
    * automatically rolls over to zero when reaching the limit.
    * @author Michael Kolling and David J. Barnes
    * @version 2001.05.26
    public class NumberDisplay
    private int limit;
    private int value;
    * Constructor for objects of class Display
    public NumberDisplay(int rollOverLimit)
    limit = rollOverLimit;
    value = 0;
    * Return the current value.
    public int getValue()
    return value;
    * Return the display value (that is, the current value as a two-digit
    * String. If the value is less than ten, it will be padded with a leading
    * zero).
    public String getDisplayValue()
    if(value < 10)
    return "0" + value;
    else
    return "" + value;
    * Set the value of the display to the new specified value. If the new
    * value is less than zero or over the limit, do nothing.
    public void setValue(int replacementValue)
    if((replacementValue >= 0) && (replacementValue < limit))
    value = replacementValue;
    * Increment the display value by one, rolling over to zero if the
    * limit is reached.
    public void increment()
    value = (value + 1) % limit;
    public class TryClockDisplay
    public static void main(String[] args)
    ClockDisplay clockDisplay_1 = new ClockDisplay();
    clockDisplay_1.setTime(17,40);
    System.out.println("\nThe time now is " + clockDisplay_1.getTime());
    clockDisplay_1.timeTick();
    clockDisplay_1.timeTick();
    clockDisplay_1.timeTick();
    clockDisplay_1.timeTick();
    clockDisplay_1.timeTick();
    clockDisplay_1.timeTick();
    clockDisplay_1.timeTick();
    System.out.println("\nThe time now is " + clockDisplay_1.getTime());

    String time = "09:25";
    String hrs = time.substring(0,2);
    int hrsInt = Integer.parseInt(hrs);
    if(hrsInt>12){
        time += "PM";
    System.out.println(time);                                                                                                                                                                                                                                                                                                                                       

  • Show end of label text when String is too long

    I have a JLabel with a string in it, but the string is too long for the label, and only the first part of the string is visible.
    How can I make the label show the end of the string?

    I use the field as a rollover helper. When the mouse rolls over a cell or column in a table, it shows the value in the textfield.
    Now, when the field gets a new value, it flickers because it first enters the string and shows it from the beginning and then scrolls to the end, causing a flicker.
    Is there any way I can get around this?

  • Oversize A2 Paper Size value(stri​ng) for HP Designjet 500 Plus 24 (Paper Roll).

    Greetings.
    I am working at constructor’s bureau. Recently we decided to automate drawing printing from SolidWorks program (it’s a CAD software). I have written a code. SolidWorks API allows to choose for printing such settings as paper tray, scale, color, orientation and paper size. I am having an issue with the last option. Paper size gets set by passing value (string). Here are some of them: http://msdn.microsoft.com/en-us/library/windows/de​sktop/dd319099(v=vs.85).aspx. I can get the needed value by “Recording macro” and selecting the size I need in SolidWorks
    Such paper sizes as A4, ISO A4, Oversize A4 have different numbers. Same goes for A3, A2 and etc. In addition, the values are not universal. They can alter depending on printer.
    We have 5 printers for various paper sizes (from A0 to A4) and I set correct value for 4 of them, but I have a trouble with – “HP Designjet 500 Plus 24”. This printer can print both A1 and A2. I managed to make A1 printing work (I just pass value 621 that means “Overize A1”, without changing paper tray), as for A2 the value must be 620 that is "Oversize A2", but it does not work. Only part of the drawing gets printed and it gets placed somewhere in the middle. I guess it just prints according to printer default settings. Maybe the value is not 620? If it is so, can you tell me the real one?
    I can try to change default settings to match the A2 printing. However, the printer itself is a network printer. So changing some settings there might get someone in the office angry. So getting the right values is a perfect solution.
    I am slowly getting desperate, because all printers work perfectly, except for one. Which makes the code unusable. I can post the code, but it will not help much, because I only need to set one or two values correctly.
    One more thing, we are using roll of paper, so maybe I have to also set the paper tray, even if it is still the same as for A1?
    Thank you in advance.

    This forum is focused on consumer level products.  For the Designjet you may have better results posting in the HP Designjet forum here.  There are a number of very knowledgable Designjet folks there.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • Add Multiple Detail Items Using the Same Query String Parameter

    I am using InfoPath 2010 and SharePoint 2010. 
    I have 2 forms libraries - Expense and Expense Details. 
    The 2 libraries are linked via a custom site column Expense ID. 
    The Expense form contains the main header type info you would typically find on an expense report; e.g., name, purpose, department, etc. 
    The Expense Details form contains multiple detail expenses related to the main expense report such as airfare, rental car, etc. 
    I have created a page that displays an expense report with all of the related expense detail items. 
    The page contains a link to add a new expense detail and passes the Expense ID of the Expense form to the Expense Detail form. 
    This all works fine.  The problem comes in after the first expense detail form is submitted. 
    I can successfully submit the first detail item.  However, the expense detail form loses the Expense ID that was passed to it after the first expense detail form has been submitted. 
    The parameter still shows in the URL but the detail form no longer shows the value of the parameter. 
    What do I need to do in order to be able to add multiple expense detail items using the same Expense ID that was passed to the form? 
    I have tried using a Submit Behavior of Open a new form, Close the form, and Leave the form open. 
    None of these options give me what I need.  Thanks for your help.
    pam

    Laura Rogers Blog
    In case anyone stumbles upon this looking for an answer. Laura Rogers has the answer found in the comments section of her blog above.  It’s not the best but it
    does work. You have to add an extra Info Path Web Form for it to work. I know, you can roll your eyes.<o:p></o:p>
    Steps.<o:p></o:p>
    1. Add Query String<o:p></o:p>
    2. Add the extra Info Path form to the page. This form will be a hidden on the page and will receive the value from the query string.<o:p></o:p>
    3. Add your original Info Path form and have it receive a parameter from the hidden Info Path form.<o:p></o:p>
    Now, when you hit save and it opens a new form the 3 Info Path form will function properly. <o:p></o:p>

  • Apache Roller (or mayb Struts 2) problem on Tomcat 5.5.20 on Debian Etch

    Firstly I'm not at all sure whether this is the right forum for asking for help on this issue. People here have been very helpful in the past. If this post is in the wrong place, my apologies and please feel free to move it.
    I am trying to install Apache Roller 4.0 on a Debian Etch system that has the Apache Tomcat 5.5 package installed. I am using the Sun Java package as well. You might think the solution to this problem might be better sought in the Apache Roller community or the Debian community. However the problem I am experiencing is a far more general Java problem (I think).
    h1. Software versions
    java version "1.5.0_10"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_10-b03)
    Java HotSpot(TM) Client VM (build 1.5.0_10-b03, mixed mode, sharing)Tomcat 5.5.20 (Debian Etch package)
    Apache Roller 4.0
    h1. The error
    When I load up the application for the first time, following the Apacher Roller instructions for installation I get a bunch of IllegalAccessExceptions that AFAIK should not happen. An example is in the exception trail below.
    h2. Exception trail.
    ERROR 2007-12-30 11:31:25,476 StandardWrapperValve:invoke - Servlet.service() for servlet jsp threw exception
    Caught OgnlException while setting property 'location' on type 'org.apache.struts2.views.tiles.TilesResult'. - action - file:/vhost/beanlogic.co.uk/roller/WE
    B-INF/classes/struts.xml:129:77
            at com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:199)
            at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:342)
            at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253)
            at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:221)
            at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
            at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
            at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
            at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
            at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
            at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:150)
            at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:48)
    //(there is a large stack trace here which probably not relevant so I cut it out. The caused by is next)
    Caused by: Caught OgnlException while setting property 'location' on type 'org.apache.struts2.views.tiles.TilesResult'. - Class: ognl.OgnlRuntime
    File: OgnlRuntime.java
    Method: invokeMethod
    Line: 508 - ognl/OgnlRuntime.java:508:-1
            at com.opensymphony.xwork2.util.OgnlUtil.internalSetProperty(OgnlUtil.java:367)
            at com.opensymphony.xwork2.util.OgnlUtil.setProperties(OgnlUtil.java:76)
            at com.opensymphony.xwork2.ObjectFactory.buildResult(ObjectFactory.java:222)
            at com.opensymphony.xwork2.DefaultActionInvocation.createResult(DefaultActionInvocation.java:195)
            ... 287 more
    Caused by: java.lang.IllegalAccessException: Method [public void org.apache.struts2.dispatcher.StrutsResultSupport.setLocation(java.lang.String)] cannot be a
    ccessed.
            at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:508)
            at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:812)
            at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:964)
            at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:75)
            at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131)
            at com.opensymphony.xwork2.util.OgnlValueStack$ObjectAccessor.setProperty(OgnlValueStack.java:68)
            at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
            at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
            at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
            at ognl.SimpleNode.setValue(SimpleNode.java:246)
            at ognl.Ognl.setValue(Ognl.java:476)
            at com.opensymphony.xwork2.util.OgnlUtil.setValue(OgnlUtil.java:186)
            at com.opensymphony.xwork2.util.OgnlUtil.internalSetProperty(OgnlUtil.java:360)
            ... 290 moreAny help would be great.
    Cheers
    Elwyn

    Have you resolved your problem? I am running into the SAME EXACT issues with my application. The only difference is I'm not deploying to webapps/ROOT/; I'm deploying to my own directory based on my WAR file name (webapps/<web_application_name>/WEB-INF....blah blah). If you figured out your problem (believe me, I wish I could be of some help) I would LOVE to hear what you did/figured out.
    -C

Maybe you are looking for

  • ASA 5520 intervlan routing at low speed

    I have ASA 5520 and SSM-10 module. During copy between vlans, connected to gigabit port of asa the speed is up to 6,5 Mbyte/sec. Network cards and trunked switch are gigabit. I've temporarily disabled SSM but it didn't help. Here is my config. Also I

  • Error Message 3 Quick Time failed to install

    I have tried every way I know possible to download iTunes. I have loaded Quicktime stand alone, I have loaded iTunes to my hard drive and tried to start the install from there and not the internet. I have turned off all firewalls and virus/spyware so

  • Home Sharing on my PC won't work?

    i got a new mac a few weeks ago and trying to put my music from my pc on it by "home sharing" problem is, on my pc, when i try the Home Sharing option, it gives me error (-2146885613). i've tried uninstalling and restalling itunes but nothing works.

  • How can I install Windows XP on my Lenovo IdeaPad S10-2 with all partitions deleted?

    Lenovo Masters: Good day to you all. I would like to ask how can I install WinXP in my S10 (no DVD drive)?  First, I want to share that I committed the mistake of using it without any anti-virus software installed.  As a result, it bugged down.  Now

  • Java Heap not clearing

    All, We have weblogic running on a sun ultra 450. The general design of the system is we have jsp pages that have session variables that are instances of java classes that we use to hold our business logic. My current issue is that as the system is s