Problem in String.replaceAll please help

String ash = "XXX";
String ch = ash.replaceAll("X","$");
while executing the above code i am getting an exception
java.lang.StringIndexOutOfBoundsException: String index out of range: 1
     at java.lang.String.charAt(Unknown Source)
     at java.util.regex.Matcher.appendReplacement(Unknown Source)
     at java.util.regex.Matcher.replaceAll(Unknown Source)
     at java.lang.String.replaceAll(Unknown Source)
please help me
baiju

Cross-post
http://forum.java.sun.com/thread.jspa?threadID=607145

Similar Messages

  • Problems with string array, please help!

    I have a String array floor[][], it has 20 rows and columns
    After I do some statement to modify it, I print this array
    out in JTextArea, why the output be like this?
    null* null....
    null null...
    null null...
    How to correct it?

    a turtle graphics applet:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class TG extends JApplet implements ActionListener {
      private int x, y;
      private int pendown, command, movement;
      String direction, output, temp;
      JLabel l1;
      JTextField tf1;
      JTextArea ta1;
      String floor[][] = new String[20][20];;
      public void init()
        x = 0;
        y = 0;
        pendown = 0;
        direction = "r";
        Container c = getContentPane();
        c.setLayout( new FlowLayout() );
           l1 = new JLabel( "Please type a command:" );
           c.add( l1 );
           tf1 = new JTextField(20);
           tf1.addActionListener( this );
           c.add( tf1 );
           ta1 = new JTextArea(20,20);
           ta1.setEditable( false );
           c.add( ta1 );
    public void actionPerformed( ActionEvent e )
           temp = tf1.getText();
           if( temp.length() > 1)
           command = Integer.parseInt(temp.substring(0,1));
           movement = Integer.parseInt(temp.substring(2,temp.length()));
           else
           command = Integer.parseInt(temp);
           switch(command)
                case 1:
                pendown=0;
                break;
                case 2:
                pendown=1;
                break;
                case 3:
                direct("r");
                break;
                case 4:
                direct("l");
                break;
                case 5:
               move(movement);           
                break;
                case 6:
                print();
                break;                                     
      public void direct(String s)
           if(direction == "r" && s =="r")
              direction = "d";
           else if(direction == "r" && s =="l")
              direction = "u";
           else if(direction == "l" && s =="r")
              direction = "u";
           else if(direction == "l" && s =="l")
              direction = "d";
           else if(direction == "u" && s =="r")
              direction = "r";
           else if(direction == "u" && s =="l")
              direction = "l";
           else if(direction == "d" && s =="r")
              direction = "l";
           else if(direction == "d" && s =="l")
              direction = "r";
      public void move(int movement)
           if(pendown == 1)
                if(direction == "u")
                for(int b=0;b<movement;b++)
                     floor[x][y+b] = "*";
                else if(direction == "d")
                for(int b=0;b<movement;b++)
                     floor[x][y-b] = "*";
                else if(direction == "l")
                for(int b=0;b<movement;b++)
                     floor[x-b][y] = "*";
                else if(direction == "r")
                for(int b=0;b<movement;b++)
                     floor[x+b][y] = "*";
            else if(pendown == 0)
                 if(direction == "u")
                for(int b=0;b<movement;b++)
                     floor[x][y+b] = "-";
                else if(direction == "d")
                for(int b=0;b<movement;b++)
                     floor[x][y-b] = "-";
                else if(direction == "l")
                for(int b=0;b<movement;b++)
                     floor[x-b][y] = "-";
                else if(direction == "r")
                for(int b=0;b<movement;b++)
                     floor[x+b][y] = "-";
          public void print()
         for(int row=0;row<20;row++)
           for( int column=0;column<20;column++)
                output += floor[row][column];
                if(column == 19)
                 output+="\n";
            ta1.setText(output);
    }

  • TS1538 I have tried everything but I can't connect my iphone to my laptop. It says that apple mobile device failed to be installed. I have read everything on the internet and did everything but still am facing the same problem. Can you please help me.

    I have tried everything but I can't connect my iphone to my laptop. It says that apple mobile device failed to be installed. I have read everything on the internet and did everything but still am facing the same problem. Can you please help me.

    Again without stating the trouble shooting steps you have taken, its hard to direct you with any information.
    Try a different port on the computer.
    Does the iphone beep when u plug it up. ?
    Plug iphone into computer and give it 3 to 4 minutes to see if it connects and is running slow.,
    Delete the apple mobile device from your computer.
    Upgrade itunes to newest version.
    Is you USB cord defective ?
    Any USB 3.0 on your system ? .
    Delete or Disable  any antivirus program on your computer ?
    I will tell u the problem is your computer not the phone.
    We could do this for hours.

  • HT201363 Hello I forgot my Security question of my Apple ID ? I don't kow what should I do and how to solve this problem ? could you please help  ?

    Hello I forgot my Security question of my Apple ID ? I don't kow what should I do and how to solve this problem ? could you please help  ?

    You need to ask Apple to reset your security questions; ways of contacting them include phoning AppleCare and asking for the Account Security team, clicking here and picking a method for your country, and filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (104569)

  • Developer 6 Timer Problem... Please help

    Hi all,
    I have installed Developer 6(Oracle Product) on my system. I am facing a strange problem whenever I try to use Create_Timer built in. The cursor moves to starting of the Item being modified as soon as the space bar is pressed (timed for timer expiration). If I remove the Built-in the problem is resolved.
    Please help urgently.
    Regards
    Anand

    Upgrade to the latest patch and the problem shoudl go away - this issue was fixed I think in 6.0.8.13+
    You can also try setting Keey Cursor position to Yes on the item.

  • HT1926 i've tried so many times but the problem still exists! please help!!

    i've tried so many times but the problem still exists! please help!!

    Could you describe what your problem is, please?

  • What to do when iTunes cannot sync my iPad 3. Problem Event Name: BEX (Please Help)

    What to do when iTunes cannot sync my iPad 3. Problem Event Name: BEX
    Please Help to solve...

    Hi Ahmed,
    In iTunes, go to the Store in the left menu, select iTunes Store, wehn it opens, make sure you are on the home screen (icon of a house in the menu bar) and from the righthand side, select Account.
    Next you will see all of your account information. Just a little don, you will find: Apple ID overview, there it says, Authorised computers; click on the button to deauthorise.
    And you should be done.
    Grtz, Carl.

  • No sound for incoming calls but it works using speaker and earpiece. I can't hear anything but the other party can hear me clearly. I was told it's hardware problem. Would anyone please help? Thanks

    No sound for incoming calls but it works using speaker and earpiece. I can't hear anything but the other party can hear me clearly. I was told it's hardware problem. Would anyone please help me? Thanks

    This is an annoying problem for many people. Most likely your dock connector (on the bottom where you plug in your phone) is dirty or screwed up and is probably just coincidence that it happened after you updated. Some people have had success cleaning the port with a dry clean tooth brush. There is a long discussion going on at the thread I linked below. Good luck...
    https://discussions.apple.com/thread/2475631

  • I suppose it is the problem with socket connection,Please help

    Hi,
    I'm trying to build a chat server in Java on Linux OS.I've created basically 2 classes in the client program.The first one shows the login window.When we enter the Login ID & password & click on the ok button,the data is sent to the server for verification.If the login is true,the second class is invoked,which displays the messenger window.This class again access the server
    for collecting the IDs of the online persons.But this statement which reads from the server causes an exception in the program.If we invoke the second class independently(ie not from 1st class) then there is no problem & the required data is read from the server.Can anyone please help me in getting this program right.I'm working on a p4 machine with JDK1.4.
    The Exceptions caused are given below
    java.net.SocketException: Connection reset by peer: Connection reset by peer
    at java.net.SocketInputStream.SocketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:119)
         at java.io.InputStreamReader$CharsetFiller.readBytes(InputStreanReader.java :339)
         at java.io.InputStreamReader$CharsetFiller.fill(InputStreamReader.java:374)
         at java.io.InputStreamReader.read(InputStreamReader.java:511)
         at java.io.BufferedReader.fill(BufferedReader.java:139)
         at java.io.BufferedReader.readLine(BufferedReader.java:299)
         at java.io.BufferedReader.readLine(BufferedReader.java:362)
         at Login.LoginData(Login.java:330)
         at Login.test(Login.java:155)
         at Login$Buttonhandler.actionPerformed(Login.java:138)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1722)
         at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:17775)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:4141)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:253)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:261)
         at java.awt.Component.processMouseEvent(Component.java:4906)
         at java.awt.Component.processEvent(component.java:4732)
         at java.awt.Container.processEvent(Container.java:1337)
         at java.awt.component.dispatchEventImpl(Component.java:3476)
         at java.awt.Container.dispatchEventImpl(Container.java:1399)
         at java.awt.Component.dispatchEvent(Component.java:3343)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3302)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3014)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2967)
         at java.awt.Container.dispatchEventImpl(Container.java:1373)
         at java.awt.window.dispatchEventImpl(Window.java:1459)
         at java.awt.Component.dispatchEvent(Component.java:3343)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:439)
         at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:150)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:136)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:131)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:99)
         My program looks somewhat like this :
    1st class definition:
    public class Login extends Jframe// Login is the name of the first class;
    Socket connection;
    DataOutputStream outStream;
    BufferedReader inStream;
    Frame is set up here
    public class Buttonhandler implements ActionListener
    public void actionPerformed(ActionEvent e) {
    String comm = e.getActionCommand();
    if(comm.equals("ok")) {
    check=LoginCheck(ID,paswd);
    test();
    public void test() //checks whether the login is true
    if(check)
    new Messenger(ID);// the second class is invoked
    public boolean LoginCheck(String user,String passwd)
    //Enter the Server's IP & port below
    String destination="localhost";
    int port=1234;
    try
    connection=new Socket(destination,port);
    }catch (UnknownHostException ex){
    error("Unknown host");
    catch (IOException ex){
    ex.printStackTrace ();
    error("IO error creating socket ");
    try{
    inStream = new BufferedReader(new InputStreamReader(connection.getInputStream()));
    outStream=new DataOutputStream(connection.getOutputStream());
    }catch (IOException ex){
    error("IO error getting streams");
    ex.printStackTrace();
    System.out.println("connected to "+destination+" at port "+port+".");
    BufferedReader keyboardInput=new BufferedReader(new InputStreamReader(System.in));
    String receive=new String();
    try{
    receive=inStream.readLine();
    }catch(IOException ex){ error("Error reading from server");}
    if(receive.equals("Logintrue"))
    check=true;
    else
    check=false;
    try{
    inStream.close();
    outStream.close();
    connection.close();
    }catch (IOException ex){
    error("IO error closing socket");
    return(check);
    // second class is defined below
    public class Messenger
    Socket connect;
    DataOutputStream outStr;
    BufferedReader inStr;
    public static void main(String args[])
    { Messenger mes = new Messenger(args[0]);}
    Messenger(String strg)
    CreateWindow();
    setupEvents();
    LoginData(strg);
    fram.show();
    void setupEvents()
    fram.addWindowListener(new WindowHandler());
    login.addActionListener(new MenuItemHandler());
    quit.addActionListener(new MenuItemHandler());
    button.addActionListener(new Buttonhandle());
    public void LoginData(String name)
    //Enter the Server's IP & port below
    String dest="localhost";
    int port=1234;
    int r=0;
    String str[]=new String[40];
    try
    connect=new Socket(dest,port);
    }catch (UnknownHostException ex){
    error("Unknown host");
    catch (IOException ex){
    ex.printStackTrace ();
    error("IO error creating socket ");
    try{
    inStr = new BufferedReader(new InputStreamReader(connect.getInputStream()));
    outStr=new DataOutputStream(connect.getOutputStream());
    }catch (IOException ex){
    error("IO error getting streams");
    ex.printStackTrace();
    String codeln=new String("\n");
    try{
    outStr.flush();
    outStr.writeBytes("!@*&!@#$%^");//code for sending logged in users
    outStr.writeBytes(codeln);
    outStr.write(13);
    outStr.flush();
    String check="qkpltx";
    String receive=new String();
    try{
    while((receive=inStr.readLine())!=null) //the statement that causes the exception
    if(receive.equals(check))
    break;
    else
         str[r]=receive;
         r++;
    }catch(IOException ex){ex.printStackTrace();error("Error reading from socket");}
    catch(NullPointerException ex){ex.printStackTrace();}
    } catch (IOException ex){ex.printStackTrace();
    error("Error reading from keyboard or socket ");
    try{
    inStr.close();
    outStr.close();
    connect.close();
    }catch (IOException ex){
    error("IO error closing socket");
    for(int l=0,k=1;l<r;l=l+2,k++)
    if(!(str[l].equals(name)))
    stud[k]=" "+str[l];
    else
    k--;
    public class Buttonhandle implements ActionListener
    public void actionPerformed(ActionEvent e) {
    //chat with the selected user;
    public class MenuItemHandler implements ActionListener
    public void actionPerformed(ActionEvent e)
    String cmd=e.getActionCommand();
    if(cmd.equals("Disconnect"))
    //Disconnect from the server
    else if(cmd.equals("Change User"))
         //Disconnect from the server & call the login window
    else if(cmd.equals("View Connection Details"))
    //show connection details;
    public class WindowHandler extends WindowAdapter
    public void windowClosing(WindowEvent e){
    //Disconnect from server & then exit;
    System.exit(0);}
    I�ll be very thankful if anyone corrects the mistake for me.Please help.

    You're connecting to the server twice. After you've successfully logged in, pass the Socket to the Messenger class.
    public class Messenger {
        Socket connect;
        public static void main(String args[]) {
            Messenger mes = new Messenger(args[0]);
        Messenger(Socket s, String strg) {
            this.connect = s;
            CreateWindow();
            setupEvents();
            LoginData(strg);
            fram.show();
    }

  • Problem in VO execution----Please help me urgent

    Hi,
    I have One region(ASNOpptyReviewRN).this region is a tab in the main page(OpptyPG).For the region i am using one VO(OppReviewVO).
    When i came to this page i am writing the code in the process request to execute the VO based on the condition..so i can get the data on the page.
    First time VO is getting executed and data is coming in the page.if there is no data then i have the requirement to insert or update the fields in the region.
    So everything is working fine first time..or if i not insert anything new row...it is working fine all the time.
    But the problem is...after insert a new row and if i come to home page(not OpptyPG) and if i go to the ASNOpptyReviewRN the vo is getting executed but it is not showing the data on the page..
    This is happenig only when i insert a new row and i come back to that page..
    Please Help me..its urgent.. i am pasting the Processrequest and Amimpl code here...
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    OAApplicationModule am=pageContext.getApplicationModule(webBean);
    String BidNumber=(String)pageContext.getTransactionTransientValue("ASNOpptyDetNbr");
    String reviewdBy=pageContext.getParameter("ReviewedBy");
    String reviewdDate=pageContext.getParameter("ReviewedDate");
    String versionNum=pageContext.getParameter("VersionNumber");
    String effortWithoutCont=pageContext.getParameter("EffortWithoutContingency");
    String contEffort=pageContext.getParameter("ContingencyEffort");
    String reviewFlag=pageContext.getParameter("ReviewFlag");
    String expiryDate=pageContext.getParameter("ExpiryDate");
    String comments=pageContext.getParameter("Comments");
    Serializable[] parameters={BidNumber,reviewdBy,reviewdDate,versionNum,effortWithoutCont,contEffort,reviewFlag,expiryDate,comments};
    pageContext.writeDiagnostics(this, "Inside ifff Bharat", 1);
    am.invokeMethod("insertBidReviewRow",parameters);
    and the method in the am is
    public void insertBidReviewRow(String BidNumber,String reviewdBy,String reviewdDate,String versionNum,String effortWithoutCont,String contEffort,String reviewFlag,String expiryDate,String comments) throws SQLException,
    ParseException
    String msg1="Hi i am inside bidreview"+BidNumber+reviewdBy+reviewdDate+versionNum+effortWithoutCont+contEffort+reviewFlag+expiryDate+comments;
    logMessages(msg1);
    Number bidnum=new Number(BidNumber);
    OpportunityBidReviewVOImpl vo;
    vo = getOpportunityBidReviewVO1();
    vo.setWhereClause(null);
    vo.setWhereClauseParams(null);
    vo.setWhereClause("BID_ID=:1");
    vo.setWhereClauseParam(0,bidnum);
    vo.executeQuery();
    int rowCount=vo.getRowCount();
    String msg8="Hi no of row count:-.."+":-- "+rowCount;
    logMessages(msg8);
    if(rowCount==0)
    String msg2="Hi iam inside bidreview:- Before fetch...";
    logMessages(msg2);
    vo.setMaxFetchSize(0);
    Row row=vo.createRow();
    String msg3="Hi iam inside bidreview:- After create....";
    logMessages(msg3);
    vo.insertRow(row);
    String msg4="Hi iam inside bidreview:- insert row....";
    logMessages(msg4);
    row.setNewRowState(Row.STATUS_INITIALIZED);
    vo.setCurrentRow(row);
    String msg5="Hi iam inside bidreview:- insert row....";
    logMessages(msg5);
    OpportunityBidReviewVORowImpl opptybidreviewVo = (OpportunityBidReviewVORowImpl)vo.getCurrentRow();
    opptybidreviewVo.setBidId(bidnum);
    opptybidreviewVo.setReviewedBy(reviewdBy);
    //opptybidreviewVo.setReviewedDate(reviewdate);
    opptybidreviewVo.setVersionNumber(versionNum);
    opptybidreviewVo.setEffortWithoutContingency(effortWithoutCont);
    opptybidreviewVo.setContingencyEffort(contEffort);
    opptybidreviewVo.setReviewFlag(reviewFlag);
    //opptybidreviewVo.setExpiryDate(expirydate);
    opptybidreviewVo.setComments(comments);
    String msg6="Hi iam inside bidreview:- after all....";
    logMessages(msg6);
    String msg7="vo is cleared";
    logMessages(msg7);
    else
    String msg7="Hi iam inside bidreview:- already existing.....";
    logMessages(msg7);
    Thanks in advance
    Edited by: 842238 on Jul 1, 2011 7:07 AM

    Hi Kristoper,
    No..that Vo is based on some EO..why i am using the row.setAttribute() is...the bid number is coming from some other page...and i need to insert it in table..
    and except the bid number..other values are coming from the page...
    Thank you

  • Problem in socket communication please help me!

    server
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    import java.net.*;
    class SocketServer extends JFrame
              implements ActionListener {
         JLabel text1, text2;
         JButton button1, button2;
         JPanel panel;
         JTextField textField1, textField2;
    ServerSocket server = null;
    Socket socket = null;
    BufferedReader in1 = null;
    PrintWriter out1 = null;
    String line1;
    String line2;
    SocketServer(){ //Begin Constructor
              text1 = new JLabel("Send Information:");
              text2 = new JLabel("Receive Information:");
              textField1 = new JTextField(20);
              textField2 = new JTextField(20);
              button1 = new JButton("Send");
              button2 = new JButton("Receive");
              button1.addActionListener(this);
              button2.addActionListener(this);
              panel = new JPanel();
              panel.setLayout(new GridLayout(2,3));
              panel.setBackground(Color.lightGray);
              getContentPane().add(panel);
              panel.add(text1);
              panel.add(textField1);
              panel.add(button1);
              panel.add(text2);
              panel.add(textField2);
              panel.add(button2);
              setSize(500,100);
    } //End Constructor
         public void actionPerformed(ActionEvent event) {
              Object source = event.getSource();
              if(source == button1){
                   //Send data over socket
                   String text = textField1.getText();
                   out1.println(text);
                   textField1.setText(new String(""));
                   //Receive text from server
                   try{
                        String line1 = in1.readLine();
                        System.out.println("Text received :" + line1);
                   } catch (IOException e){
                        System.out.println("Read failed");
                        System.exit(1);
              if(source == button2){
                   textField2.setText(line2);
         public void listenSocket(){
              try{
                   server = new ServerSocket(4444);
              } catch (IOException e) {
                   System.out.println("Could not listen on port 4444");
                   System.exit(-1);
              try{
                   socket = server.accept();
              } catch (IOException e) {
                   System.out.println("Accept failed: 4444");
                   System.exit(-1);
              try{
                   in1 = new BufferedReader(new InputStreamReader(socket.getInputStream()));
                   out1 = new PrintWriter(socket.getOutputStream(), true);
              } catch (IOException e) {
                   System.out.println("Accept failed: 4444");
                   System.exit(-1);
              while(true){
                   try{
                        line2 = in1.readLine();
                        //Send data back to client
                        out1.println(line2);
                   } catch (IOException e) {
                        System.out.println("Read failed");
                        System.exit(-1);
         protected void finalize(){
              //Clean up
              try{
                   in1.close();
                   out1.close();
                   server.close();
              } catch (IOException e) {
                   System.out.println("Could not close.");
                   System.exit(-1);
         public static void main(String[] args){
              SocketServer frame = new SocketServer();
              frame.setTitle("Chat (Server)");
              WindowListener l = new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        System.exit(0);
              frame.addWindowListener(l);
              frame.pack();
              frame.setVisible(true);
              frame.listenSocket();
    client
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.io.*;
    import java.net.*;
    class SocketClient extends JFrame
              implements ActionListener {
    JLabel text1, text2;
    JButton button1, button2;
    JPanel panel;
    JTextField textField1, textField2;
    Socket socket = null;
    PrintWriter out = null;
    BufferedReader in = null;
    String line3;
    String line4;
    SocketClient(){ //Begin Constructor
    text1 = new JLabel("Send Information:");
         text2 = new JLabel("Receive Information:");
    textField1 = new JTextField(20);
         textField2 = new JTextField(20);
    button1 = new JButton("Send");
         button2 = new JButton("Receive");
    button1.addActionListener(this);
         button2.addActionListener(this);
    panel = new JPanel();
    panel.setLayout(new GridLayout(2,3));
    panel.setBackground(Color.lightGray);
    getContentPane().add(panel);
    panel.add(text1);
    panel.add(textField1);
    panel.add(button1);
         panel.add(text2);
         panel.add(textField2);
         panel.add(button2);
         setSize(500,100);
    } //End Constructor
         public void actionPerformed(ActionEvent event){
              Object source = event.getSource();
              if(source == button1){
                   //Send data over socket
                   String text = textField1.getText();
                   out.println(text);
                   textField1.setText(new String(""));
                   //Receive text from server
                   try{
                        String line3 = in.readLine();
                        System.out.println("Text received :" + line3);
                   } catch (IOException e){
                        System.out.println("Read failed");
                        System.exit(1);
              if(source == button2){
                   textField2.setText(line4);
         public void listenSocket(){
              //Create socket connection
              try{
                   socket = new Socket("Localhost", 4444);
                   out = new PrintWriter(socket.getOutputStream(), true);
                   in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
              } catch (UnknownHostException e) {
                   System.out.println("Unknown host: Localhost");
                   System.exit(1);
              } catch (IOException e) {
                   System.out.println("No I/O");
                   System.exit(1);
              while(true){
                   try{
                        line4 = in.readLine();
                        //Send data back to client
                        out.println(line4);
                   } catch (IOException e) {
                        System.out.println("Read failed");
                        System.exit(-1);
         public static void main(String[] args){
              SocketClient frame = new SocketClient();
              frame.setTitle("Chat (Client)");
              WindowListener l = new WindowAdapter() {
                   public void windowClosing(WindowEvent e) {
                        System.exit(0);
              frame.addWindowListener(l);
              frame.pack();
              frame.setVisible(true);
              frame.listenSocket();
    There were problems when executing the application
    please help me

    i had no problem running this... make sure you open the server part first and have that sitting and waiting for the client to connect.... then it should work.
    Would you believe that i too am working on the server / socket thing... however my problem is getting the server to read from a database and report back to the client....

  • Problem with binary tree please help

    i am trying to make a binary tree but the problem is that when i print the data only the last value is printed i think i am moving my root. but dont know how to solve it please help me.
    public void insert(String n)
    //          (void)
              if (root == null)
                   System.out.println("Root is null");
                   TreeNode temp = new TreeNode(n);
                   System.out.println("\n\n\n\n"+temp.name+"\n\n\n\n\n");
                   root = rootTemp = temp;
              else
                   System.out.println("Root is not null" +rootTemp.name);
                   insert(rootTemp, n);
         private TreeNode insert(TreeNode v, String n) {
              if (v == null)
                   return new TreeNode(n);
              else
                   if (n.compareTo(v.name) < 0)
                        v.left = insert(v.left, n);
                   else
                        v.right = insert(v.right, n);
                   return v;
         }

    Are you sure the problem is not in the printing code?
    I can't see any obvious mistakes after a quick look... But if "root" is a reference to the root node, what is "rootTemp"?

  • Vector problem... Please help!

    Hi,
    I searched the forum but I could not get a correct answer for a vector problem I am facing. I have 2 SQL queries that are nested. Initially I tried to nest them but realized that when I close the connection to one query I cannot nest the other since the first query is closed ( blazix web server does not let you open open a wuery if you have not closed one query) Somebody had suggested to include the infor on a Vector and then reuse it. However I am not sure of how to do this.
    The following is what I have so far.
    <%@ page import="java.util.Vector" %>
    <%
    <blx:sqlQuery id="Buttons">
    Select      ID, Ntive, ButtonLabel ButtonLink
    From Pages
    </blx:sqlQuery>
    <% } else { %>
    <blx:sqlQuery id="Project">
    Select      ID, ProjectName, PLongName
    From Projects
    </blx:sqlQuery>
    <% } %>
    // now both of these queries are nested within each other to get the output.
    <blx:sqlExecuteQuery resultSet="rs" queryRef="Buttons">
    <%
    int ID = rs.getInt("ID");
    int Ntive = rs.getInt("Ntive");
    String ButtonLabel=rs.getString("ButtonLabel");
    String ButtonLink=rs.getString("ButtonLink");
    %>
    <% if (ID != 1){
    if (Ntive ==1) {
         Link="index.jsp?Page="+ID;
         } else {
         Link= ButtonLink;
    %>
    <LI><a href="<%=Link%">> <%=ButtonLabel%></a></LI>     
    <% if (ID==2) {%>
    // then I start the second query projects.
    <blx:sqlExecuteQuery resultSet="rs" queryRef="Project">
    </blx:sqlExecuteQuery>
    <% if (ID==3) %>// this is again from the first query
    // here i start the second query again
    //now I close the first query.
    Please help me to write a Vector withnin here and to retrieve the information to be used again on the same JSP page.
    Thanks!

    I wonder why Blazix dosnt allow multiple queries.
    Here is the logic using Vectors.
    <%@ page import="java.util.Vector" %>
    Vector IDVector = new Vector();
    Vector NtiveVector = new Vector();
    Vector ButtonLabelVector = new Vector();
    Vector ButtonLinkVector = new Vector();
    if(whatever is the codition here)
         %>
         <blx:sqlQuery id="Buttons">
              Select ID, Ntive, ButtonLabel, ButtonLink
              From Pages
         </blx:sqlQuery>
         <%
    else
         %>
         <blx:sqlQuery id="Project">
         Select ID, ProjectName, PLongName
         From Projects
         </blx:sqlQuery>
         <%
    %>
    <blx:sqlExecuteQuery resultSet="rs" queryRef="Buttons">
    <%
         IDVector.add(rs.getInt("ID"));
         NtiveVector.add(rs.getInt("Ntive"));
         ButtonLabelVector.add(rs.getString("ButtonLabel"));
         ButtonLinkVector.add(rs.getString("ButtonLink"));
    %>
    //now I close the first query.
    </blx:sqlQuery>
    <%
    for(rec=0;rec<IDVector.size();rec++)
         int ID = (int) IDVector.elementAt(rec);
         int Ntive = (int) NtiveVector.elementAt(rec);
         String ButtonLabel = (String) ButtonLabelVector.elementAt(rec);
         String ButtonLink = (String) ButtonLinkVector.elementAt(rec);
         if (ID != 1)
              if (Ntive ==1)
                   Link="index.jsp?Page="+ID;
              else
                   Link= ButtonLink;
              %>
              <LI><a href="<%=Link%">> <%=ButtonLabel%></a></LI>
              <%
              if (ID==2)
                   %>
                   // then I start the second query projects.
                   <blx:sqlExecuteQuery resultSet="rs" queryRef="Project">
                   </blx:sqlExecuteQuery>
                   <%
              if (ID==3)
                   %>
                   // this is again from the first query
                   // here i start the second query again
                   <%
    %>
    Hope it helps.
    -Mak

  • TOMCAT problem on REDHAT 9,PLEASE HELP

    Hello, i am new to redhat and i installed tomcat 4.0.1 and it worked properly, i used tomcat for studying issues so i used to start it and stop it many times
    now when i use mozilla and try to request the server using http://localhost:8080/ ,mozilla status bar shows "Transfering data from localhost" and loops for ever
    so please help me

    I think this is not problem of redhat just check reinstalling tomcat.

  • Very Odd Problem connecting to network please help

    Ok so I have had my Macbook Pro for a while and I have both an Airport Extreme and an Airport Express in my room. So until recently I could turn on my computer and my Airport would automatically connect to the internet. Now recently I turn on or open my computer and I can still see my network but I cannot connect to it. I have restarted all the devices and my computer, but the only thing that eventually logs me on (after anywhere between 5 minutes - an hour) is waiting. But the second I close my laptop I will get booted off the Internet and I cannot connect again.
    However I can still see the network I just cannot connect to it.
    Also another problem I have noticed is that when in Network Setup Assistant it asks me for the password for the network, and I have entered this password many times in my life for my iPhone and for my other devices. And yet recently when I input the correct password (ive tried over 100 times) I get a message saying that the password is incorrect, when I know for a fact that I am putting the right password in.
    If anyone could please help me I would be very grateful.

    The Airport Extreme base station has 2 passwords, one for logging into the router, the other for your network access (assuming you have security switched on). Just make sure you are trying to enter the correct password (I know this sounds obvious and no offense is meant).
    If you added the Extreme to your other router, make sure in Airport utility the Extreme is set to Bridge Mode, this will remove any incompatibility issues with 2 devices trying to obtain IP addresses from your ISP. Only one router should connect to your ISP, using password, username and relevant settings, the other is a bridge for your internal network allowing faster transfers between devices connected to say for example your extreme.
    I have a Netgear DG834PN modem/router which is assigned control to connect to my ISP (as it is a modem, the Extreme Base Station isn't a modem). The Apple Extreme is connected through ethernet to the Netgear. I have all my 802.11g/b/a devices connected through the Netgear wireless network (2.4Ghz) and all my 802.11n devices connected through the Apple Extreme Base Station wireless network ('n' only @5Ghz). I also have my Mac Pro and my AppleTV connected through gigabit ethernet (through the Extreme ethernet). Everything works well. AppleTV and Mac Pro sync very quickly, my MacBook Pro connects to other computers or devices (AppleTV for streaming content) within the Apple Extreme network, wired or wireless, and allows fast transfer speeds, especially with no g/b/a devices slowing things up.
    I also have a USB hub connected to the Extreme with USB printer attached and additional external storage connected, both available throughout the Extreme network to either wired or wireless devices.
    It sounds a bit complicated but it is really easy to do.

Maybe you are looking for

  • [SOLVED][BASH] Using a string to pass multiple arguments.

    I'm scratching my brain on this little project my friend roped me into. I have a function which generates a list of VM's and their states and stores it as a variable. this list is to be presented to the user using the libgui.sh 'ask_option' function.

  • ATI Catalyst Install Manager and catalyst Control Center Help

    I just run the Windows 7 Upgrade advisor report and it said that I should uninstall the ATI Catalyst Install Manager and Catalyst Control Center then reinstall after upgrade.. Could someone direct me where I might t find these programs for Windows 7

  • Vendor Evaluation - complaints/rejections

    Hi friends, I'm going to implement vendor evaluation without QM. But my customer wants to evaluate the vendors using the number of complaints. Can I use Quality subcriteria complaints/rejections only creating a notification? If so, where do I change

  • OS X issue with 10g, dbca won't run due to classChangeError

    I am trying to install oracle 10g on my powerbook G4 (1gb) and I keep getting the same problem with the database creation assistant (dbca). I am running OS X 10.3.6 and xCode 1.5. The installation goes fine with no issues but the at the point of laun

  • Regarding message AA478

    Dear colleagues, What is the significance of message AA478 (Posting transaction is not possible (value date not allowed))? We have option to set this message as warning instead of error but what would be consequence.  We procure assets through purcha