Urgent Help required! - Storing the XML as String instead as a file

Hi,
I need urgent help on this.
I have an XML file. I have used org.w3c.dom to build dom and manipulate the XML file.
I have updated the values for some of the nodes and I have deleted some of the unwanted nodes.
I am able to save the output of the DOM as another XML file using
either transform class or XMLSerializer with OutputFormatter class.
But my requirement is to save the output of the DOM into a String instead of a file.
When I save it in String, I need to have the following XML decalration and DOCTYPE declration also with it.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Test SYSTEM "Test.dtd">
Can anyone pls help me in this??
Thanks in Advance. Expecting some inpputs pls....!
Regards,
Gayathri.

hi,
i think this is what u want
    public static String getXmlString(Document d) {
      StringWriter strResponse = null;
      try {
         OutputFormat format  = new OutputFormat(d);
         strResponse = new StringWriter();
         XMLSerializer serial = new XMLSerializer( strResponse, format );
         serial.asDOMSerializer();
         serial.serialize(d.getDocumentElement());
      catch (Exception e) {
        System.out.println(e.toString());
      return strResponse.toString();
}HTH
vasanth-ct

Similar Messages

  • Urgent help required: color template - use color ramp instead

    hello,
    I want to match color using the color matching vi. i understand you need a color template before executing the system.
    however i want to give my users the chance to choose any color from a color ramp and then this should be used an input to the color match vi (template). is this possible????
    if yes how... i have put a color ramp in the front panel and then put the output to the input of the color match template but get an error: not a template...
    thanks

    Hi farhan,
    Can you please send in some example code, as I can not find the VI you are talking about. The closest match I have is IMAQ Color Match and this does not have a template input.
    Please can you also tell me what version of LabVIEW you are using as well.
    Regards
    JamesC
    NIUK and Ireland

  • I need help getting past the installation error "windows cannot fint TEMP file"

    I need help getting past the installation error "windows cannot find TEMP file"

    Seems like some who have tried two devices on the JMICRON IDE port have had trouble. Try without the hard drive and see if you get that error. If that is the case I would try a PATA to SATA converter for your hard drive and connect it to one of the Intel SATA Ports.
    http://www.newegg.com/Product/Product.aspx?Item=N82E16812107112
    http://www.amazon.com/ADDONICS-IDE-SERIAL-CONVERTER-ADIDESA/dp/B000090169
    http://www.compusa.com/products/product_info.asp?product_code=339900#ts
    http://www.xpcgear.com/ide2sata.html
    http://www.ubuyitdirect.com/-p-1045.html?currency=USD
    http://www.satasite.com/sata-ide-converter.htm
    http://www.pcgears.com/default.aspx?oid=187150
     

  • Urgent help required to write the code in  update routine

    Hi all,
    i want to calculate open purchase order qty in update routine
    formula is
    open purchase order qty = scl qty - rec qty
    where schd line date is less then or equal to 90 days from the current date.
    I have written one code : but its giving error that comm_structure is not defined in abap dictionary,can any body help to write appropriate routine. this calculation i am making for MM, and data source and cube are 2lis_02_scl and cube is zc_pur01 ( made by coping the 0pur_c01), data source scl has all fields required in the foumula...here is my code
    DATA:  COMM_STRUCTURE LIKE  /BIC/CS2LIS_02_SCL.
    DATA: SCL_QTY LIKE COMM_STRUCTURE-/BIC/ZK_SCLQTY.
    DATA:      GR_QTY LIKE COMM_STRUCTURE -/BIC/ZK_GRQTY.
    DATA: SCL_DATE.
    SCL_DATE = SY-DATUM + 90.
    SELECT COMM_STRUCTURE -/BIC/ ZK_SCLQTY COMM_STRUCTURE -/BIC/ ZK_GRQTY FROM
    /BIC/CS2LIS_02_SCL INTO   SCL_QTY     GR_QTY  
    WHERE
    COMM_STRUCTURE -/0SCHED_DATE LE SCL_DATE.
    IF SYSUBRC  = 0
    RESULT = SCL_QTY - GR_QTY.
    ELSE = NOVALUE.
    ENDIF.
    Can any body help me soon its very urgent.
    thanks

    Hi Anupam,
    I am not a very good ABAP Programmer, but found some things to notify u inyour code..
    DATA: COMM_STRUCTURE LIKE /BIC/CS2LIS_02_SCL,
          SCL_QTY LIKE COMM_STRUCTURE-/BIC/ZK_SCLQTY,
          GR_QTY LIKE COMM_STRUCTURE -/BIC/ZK_GRQTY.
    DATA  SCL_DATE LIKE SY-DATUM.
    SCL_DATE = SY-DATUM + 90.
    SELECT COMM_STRUCTURE -/BIC/ ZK_SCLQTY COMM_STRUCTURE -/BIC/ ZK_GRQTY FROM
    /BIC/CS2LIS_02_SCL INTO SCL_QTY GR_QTY
    WHERE
    COMM_STRUCTURE -/0SCHED_DATE LE SCL_DATE.
    IF SYSUBRC = 0
    RESULT = SCL_QTY - GR_QTY.
    ELSE.
    What should be the return value if you dont have to    calculate the result."
    ENDIF.
    try it.. and see..
    regards,
    kishore.

  • Urgent HELP required on forming the Matrix of data using PL/SQL

    Hi All,
    I'm new to this thread and require your urgent help in this regard.
    I've got a requirement for building a 5000 X 5000 matrix using PL/SQL. My original data tables have 5000 rows each and I need to do a correlation analysis using this data and need to store in a physical table and not in-memory. Is this feat achievable using mere PL/SQL? I understand that Oracle DB has a limitation of 1000 columns(but not sure) and hence I'd like to know whether there is any work-around for such scenarios. If not, what are the other alternative method(s) to achieve this feat? Do I need to use any 3rd party tools to get this done? An early reply from the experts is highly appreciated.
    Thanking you all Gurus in advance.
    Rgds
    Sai

    Welcome to OTN!
    I'll get to your quesiton in a moment, but first some welcome information. Many OTN posters consider it impolite to mark threads as "urgent". We are volunteers and have jobs of our own to do without people we don't know making demands. You are brand new and deserve some patience but please understand this. It is very likely before I finish this post someone will complain about the word "urgent" in your subject.
    On to more interesting things :)
    You can do the matrix, but are out of luck with a 5000 x 5000 table because Oracle only allows 1000 columns per table. There are ways to work around this.
    How do do the matrix depends on what you want to do. You can do this different ways. You can create a table beforehand and use PL/SQL or simple SQL to populate it, or use the CREATE TABLE AS syntax to create and populate it in one step if you can get the underlying SQL to work the way you want, something like
    create table my_table as
      select a.*, b.*
        from table1 a, table2 bcan populate a matrix from 2 tables with an intentional cartesian join (the WHERE clause was left out intentionally, provided your data is already in the data base.
    If not you can use a PL/SQL routine to populate the data.
    There are a couple of ways to solve the 1000 column limit. The easiest way might be to have 5 collections of 1000 columns each. A more complicated but more elegant soltion would be to have nested collections, allowing 2 colliections that you can loop through - a collection of collections. Nested collections can be hard to work with. A third way would be to use nested tables in the database but I personally do not like them and the insert, update, and delete statements for nested tables are hard to use.
    I'm not going to give a code example because I am not sure which solution is best for you. If you have further questions post them.

  • Urgent help required: Query regarding LC Variables

    Hi All
    Sometime earlier I was working on a performance issue raised by a customer. It was shell script that was taking almost 8-9 hrs to complete. During my research I came across a fact that there were some variables which were not set, the LC variables were impacting the sort funnel operations because of which the script was taking a long time to execute.
    I asked them to export the following commands, after which the program went on smoothly and finished in a couple of mins:
    export LC_COLLATE=en_US.ISO8859-1
    export LC_MESSAGES=C
    export LC_MONETARY=en_US.ISO8859-1
    export LC_MONETARY=en_US.ISO8859-1
    export HZ=100
    export LC_CTYPE=en_US.ISO8859-1
    export LANG=en_US.UTF-8
    Later I did recover that setting the LC_COLLATE to C, is not helping and the program was again taking a lot of time. Few questions that I want to ask are:
    1. Can someone please tell me, what each of these variable mean and how these values make a difference.
    2. When I exported LC_COLLATE=en_US.ISO8859-1, it worked fine, but when i tried with the defalut value LC_COLLATE=C, then why the program didnt work.
    As this issue is still going on, hence I would request All to provide their valuable inputs and let me know as much as possible.
    Appreciate your help in this regard.
    Thanks
    Amit
    Hi All
    A new development in this regard. The customer has send us a screen shot in which they were trying to export the locale variable using the commands which I have pasted above. I can see in the screen shot that while exporting LC_COLLATE and LC_TYPE, they get a message that ""ksh: export: couldn't set locale correctly"".
    Request everyone to please give their inputs as it's a bit urgent.
    Thanks for all the help in advance.
    Thanks
    Amit
    Some help required please...
    Edited by: amitsinhaengg on Jul 22, 2009 2:03 AM
    Edited by: amitsinhaengg on Jul 22, 2009 2:06 AM

    LC_CTYPE
    Controls the behavior of character handling functions.
    LC_TIME
    Specifies date and time formats, including month names, days of the week, and common full and abbreviated representations.
    LC_MONETARY
    Specifies monetary formats, including the currency symbol for the locale, thousands separator, sign position, the number of fractional digits, and so forth.
    LC_NUMERIC
    Specifies the decimal delimiter (or radix character), the thousands separator, and the grouping.
    LC_COLLATE
    Specifies a collation order and regular expression definition for the locale.
    LC_MESSAGES
    Specifies the language in which the localized messages are written, and affirmative and negative responses of the locale (yes and no strings and expressions).
    You can use command
    # locale -k LC_CTYPE
    to see more detail about each type.

  • Urgent Help Required for Connect Four Game

    Hi all,
    I am a student and I have a project due 20th of this month, I mean May 20, 2007 after 8 days. The project is about creating a Connect Four Game. I have found some code examples on the internet which helped me little bit. But there are lot of problems I am facing developing the whole game. I have drawn the Board and the two players can play. The players numbers can fill the board, but I have problem implementing the winner for the game. I need to implement the hasWon() method for Horizontal win, Vertical win and Diagonal win. I also found some code examples on the net but I was unable to make it working. I have 5 classes and one interface which I m implementing. The main problem is how to implement the hasWon() method in the PlayGame class below with Horizontal, vertical and diagonal moves.
    Sorry there is so much code.
    This the interface I must implement, but now I am only implementing the int move() of this interface. I will implement the rest later after solving the winner problem with your help.
    Interface code..............
    interface Player {
    void init (Boolean color);
    String name ();
    int move ();
    void inform (int i);
    Player1 class......................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class Player1 implements Player
    public Player1()
    public int move()
    Scanner scan = new Scanner(System.in);
    // BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
    int player1;
    System.out.println ("What is your Number, player 1?");
    player1 = scan.nextInt();
    System.out.println ("Hey number"+player1+" are you prepared to CONNECT FOUR");
    System.out.println();
    return player1;
    //Player.move();
    //return player1;
    }//end move method
    public void init (Boolean color)
    public void inform (int i)
    public String name()
    return "Koonda";
    }//end player1 class
    Player2 class...........................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class Player2 implements Player
    public int move()
    //int cup0,cup1,cup2,cup3,cup4,cup5,cup6;
    // cup0=5;cup1=5;cup2=5;cup3=5;cup4=5;cup5=5;cup6=5;
    //int num1, num2;
    Scanner scan = new Scanner(System.in);
    // BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
    int player2;
    System.out.println ("What is your Number, player 2?");
    player2 = scan.nextInt();
    System.out.println ("Hey "+player2+" are you prepared to CONNECT FOUR");
    System.out.println();
    //return player1;
    return player2;
    }//end move method
    public void init (Boolean color)
    public void inform (int i)
    public String name()
    return "malook";
    }//end player1 class
    PlayGame class which contains all the functionality.........................................................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class PlayGame
    //Player player1;
    //Player player2;
    int [][]ConnectFourArray;
    boolean status;
    int winner;
         int player1;
         int player2;
         public PlayGame()
              //this.player1 = player1;
              //this.player2 = player2;
         public void StartGame()
         try{
         // int X = 0, Y = 0;
         //int value;
         int cup0,cup1,cup2,cup3,cup4,cup5,cup6;
    cup0=5;cup1=5;cup2=5;cup3=5;cup4=5;cup5=5;cup6=5;
         int[][] ConnectFourArray = new int[6][7];
         int num1, num2;
         for(int limit=21;limit!=0;limit--)
    BufferedReader selecter = new BufferedReader (new InputStreamReader(System.in));
    String column1;
    System.out.println();
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    System.out.println ("Please Select a column of 0 through 6 ");
    column1 = selecter.readLine();
    num1= Integer.parseInt(column1);
    System.out.println();
    if (num1==0){
    ConnectFourArray[cup0][0]=1;
    cup0=cup0-1;
    else if (num1==1){
    ConnectFourArray[cup1][1]=1;
    cup1=cup1-1;
    else if (num1==2){
    ConnectFourArray[cup2][2]=1;
    cup2=cup2-1;
    else if (num1==3){
    ConnectFourArray[cup3][3]=1;
    cup3=cup3-1;
    else if (num1==4){
    ConnectFourArray[cup4][4]=1;
    cup4=cup4-1;
    else if (num1==5){
    ConnectFourArray[cup5][5]=1;
    cup5=cup5-1;
    else if (num1==6){
    ConnectFourArray[cup6][6]=1;
    cup6=cup6-1;
    System.out.println();
    BufferedReader selecter2 = new BufferedReader (new InputStreamReader(System.in));
    String column2;
    System.out.println();
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    System.out.println ("Please Select a column of 0 through 6 ");
    column1 = selecter.readLine();
    num1= Integer.parseInt(column1);
    System.out.println();
    if (num1==0){
    ConnectFourArray[cup0][0]=2;
    cup0=cup0-1;
    else if (num1==1){
    ConnectFourArray[cup1][1]=2;
    cup1=cup1-1;
    else if (num1==2){
    ConnectFourArray[cup2][2]=2;
    cup2=cup2-1;
    else if (num1==3){
    ConnectFourArray[cup3][3]=2;
    cup3=cup3-1;
    else if (num1==4){
    ConnectFourArray[cup4][4]=2;
    cup4=cup4-1;
    else if (num1==5){
    ConnectFourArray[cup5][5]=2;
    cup5=cup5-1;
    else if (num1==6){
    ConnectFourArray[cup6][6]=2;
    cup6=cup6-1;
    System.out.println();
    System.out.println();
    catch (Exception E){
    System.out.println("Error with input");
    System.out.println("Would you like to play again");
    try{
    String value;
    BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));
    // Scanner scan = new Scanner(System.in);
    System.out.println("Enter yes to play or no to quit");
    // value = scan.nextLine();
    // String value2;
    value = reader.readLine();
    //value2 = reader.readLine();
    if (value.equals("yes"))
    System.out.println("Start again");
    StartGame(); // calling the StartGame method to play a game once more
    else if (value.equals("no"))
    System.out.println("No more games to play");
    // System.exit(0);
    else
    System.exit(0);
    System.out.println();
    catch (Exception e){
    System.out.println("Error with input");
    finally
    System.out.println(" playing done");
    //StartGame();
    //check for horizontal win
    public int hasWon()
    int status = 0;
    for (int row=0; row<6; row++)
    for (int col=0; col<4; col++)
    if (ConnectFourArray[col][row] != 0 &&
    ConnectFourArray[col][row] == ConnectFourArray[col+1][row] &&
    ConnectFourArray[col][row] == ConnectFourArray[col+2][row] &&
    ConnectFourArray[col][row] == ConnectFourArray[col+3][row])
    //status = true;//int winner;
    if(status == player1)
    System.out.println("Player 1 is the winner");
    else if(status == player2)
    System.out.println("Player 2 is the winner" );
    }//end inner for loop
    }// end outer for loop
    } // end method Winner
    return status;
    }//end class
    ClassConnectFour which designs the board........................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class ClassConnectFour
         //Player player1;
         //Player player2;
         public ClassConnectFour()
              //this.player1 = player1;
    public void DrawBoard()
    int[][] ConnectFourArray = new int[6][7] ;
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    }//end class
    TestConnetFour class which uses most of the above class..................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class TestConnectFour
    public static void main(String[] args)
    ClassConnectFour cf = new ClassConnectFour();
    cf.DrawBoard();
    Player1 player1 = new Player1();
    Player2 player2 = new Player2();
    player1.move();
    player2.move();
    System.out.println("Number 1 belongs to player " + player1.name());
    System.out.println("Number 2 belongs to player " + player2.name());
    PlayGame pg = new PlayGame();
    pg.StartGame();
    pg.hasWon();
    //pg.Play();
    //System.out.println(player.name());
    //System.out.println(player2.name());
    }// end main
    }//end class
    I am sorry for all this junk code but I only understand it this way. Your urgent help is required. Looking forward to your reply.
    Thanks in advance.
    Koonda
    //

    Hi,
    Thanks for your help but I really don't understand the table lookup algorithm. Could you please send me some code to implement that.
    I will send you the formatted code as well
    Thanks for your help.
    looking forward to your reply.
    Koonda
    Hi all,
    I am a student and I have a project due 20th of this month, I mean May 20, 2007 after 8 days. The project is about creating a Connect Four Game. I have found some code examples on the internet which helped me little bit. But there are lot of problems I am facing developing the whole game. I have drawn the Board and the two players can play. The players numbers can fill the board, but I have problem implementing the winner for the game. I need to implement the hasWon() method for Horizontal win, Vertical win and Diagonal win. I also found some code examples on the net but I was unable to make it working. I have 5 classes and one interface which I m implementing. The main problem is how to implement the hasWon() method in the PlayGame class below with Horizontal, vertical and diagonal moves.
    Sorry there is so much code.
    This the interface I must implement, but now I am only implementing the int move() of this interface. I will implement the rest later after solving the winner problem with your help.
    Interface code..............
    interface Player {
    void init (Boolean color);
    String name ();
    int move ();
    void inform (int i);
    Player1 class......................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class Player1 implements Player
    public Player1()
    public int move()
    Scanner scan = new Scanner(System.in);
    // BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
    int player1;
    System.out.println ("What is your Number, player 1?");
    player1 = scan.nextInt();
    System.out.println ("Hey number"+player1+" are you prepared to CONNECT FOUR");
    System.out.println();
    return player1;
    //Player.move();
    //return player1;
    }//end move method
    public void init (Boolean color)
    public void inform (int i)
    public String name()
    return "Koonda";
    }//end player1 class
    Player2 class...........................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class Player2 implements Player
    public int move()
    //int cup0,cup1,cup2,cup3,cup4,cup5,cup6;
    // cup0=5;cup1=5;cup2=5;cup3=5;cup4=5;cup5=5;cup6=5;
    //int num1, num2;
    Scanner scan = new Scanner(System.in);
    // BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in));
    int player2;
    System.out.println ("What is your Number, player 2?");
    player2 = scan.nextInt();
    System.out.println ("Hey "+player2+" are you prepared to CONNECT FOUR");
    System.out.println();
    //return player1;
    return player2;
    }//end move method
    public void init (Boolean color)
    public void inform (int i)
    public String name()
    return "malook";
    }//end player1 class
    PlayGame class which contains all the functionality.........................................................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class PlayGame
    //Player player1;
    //Player player2;
    int [][]ConnectFourArray;
    boolean status;
    int winner;
    int player1;
    int player2;
    public PlayGame()
    //this.player1 = player1;
    //this.player2 = player2;
    public void StartGame()
    try{
    // int X = 0, Y = 0;
    //int value;
    int cup0,cup1,cup2,cup3,cup4,cup5,cup6;
    cup0=5;cup1=5;cup2=5;cup3=5;cup4=5;cup5=5;cup6=5;
    int[][] ConnectFourArray = new int[6][7];
    int num1, num2;
    for(int limit=21;limit!=0;limit--)
    BufferedReader selecter = new BufferedReader (new InputStreamReader(System.in));
    String column1;
    System.out.println();
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    System.out.println ("Please Select a column of 0 through 6 ");
    column1 = selecter.readLine();
    num1= Integer.parseInt(column1);
    System.out.println();
    if (num1==0){
    ConnectFourArray[cup0][0]=1;
    cup0=cup0-1;
    else if (num1==1){
    ConnectFourArray[cup1][1]=1;
    cup1=cup1-1;
    else if (num1==2){
    ConnectFourArray[cup2][2]=1;
    cup2=cup2-1;
    else if (num1==3){
    ConnectFourArray[cup3][3]=1;
    cup3=cup3-1;
    else if (num1==4){
    ConnectFourArray[cup4][4]=1;
    cup4=cup4-1;
    else if (num1==5){
    ConnectFourArray[cup5][5]=1;
    cup5=cup5-1;
    else if (num1==6){
    ConnectFourArray[cup6][6]=1;
    cup6=cup6-1;
    System.out.println();
    BufferedReader selecter2 = new BufferedReader (new InputStreamReader(System.in));
    String column2;
    System.out.println();
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    System.out.println ("Please Select a column of 0 through 6 ");
    column1 = selecter.readLine();
    num1= Integer.parseInt(column1);
    System.out.println();
    if (num1==0){
    ConnectFourArray[cup0][0]=2;
    cup0=cup0-1;
    else if (num1==1){
    ConnectFourArray[cup1][1]=2;
    cup1=cup1-1;
    else if (num1==2){
    ConnectFourArray[cup2][2]=2;
    cup2=cup2-1;
    else if (num1==3){
    ConnectFourArray[cup3][3]=2;
    cup3=cup3-1;
    else if (num1==4){
    ConnectFourArray[cup4][4]=2;
    cup4=cup4-1;
    else if (num1==5){
    ConnectFourArray[cup5][5]=2;
    cup5=cup5-1;
    else if (num1==6){
    ConnectFourArray[cup6][6]=2;
    cup6=cup6-1;
    System.out.println();
    System.out.println();
    catch (Exception E){
    System.out.println("Error with input");
    System.out.println("Would you like to play again");
    try{
    String value;
    BufferedReader reader = new BufferedReader (new InputStreamReader(System.in));
    // Scanner scan = new Scanner(System.in);
    System.out.println("Enter yes to play or no to quit");
    // value = scan.nextLine();
    // String value2;
    value = reader.readLine();
    //value2 = reader.readLine();
    if (value.equals("yes"))
    System.out.println("Start again");
    StartGame(); // calling the StartGame method to play a game once more
    else if (value.equals("no"))
    System.out.println("No more games to play");
    // System.exit(0);
    else
    System.exit(0);
    System.out.println();
    catch (Exception e){
    System.out.println("Error with input");
    finally
    System.out.println(" playing done");
    //StartGame();
    //check for horizontal win
    public int hasWon()
    int status = 0;
    for (int row=0; row<6; row++)
    for (int col=0; col<4; col++)
    if (ConnectFourArray[col][row] != 0 &&
    ConnectFourArray[col][row] == ConnectFourArray[col+1][row] &&
    ConnectFourArray[col][row] == ConnectFourArray[col+2][row] &&
    ConnectFourArray[col][row] == ConnectFourArray[col+3][row])
    //status = true;//int winner;
    if(status == player1)
    System.out.println("Player 1 is the winner");
    else if(status == player2)
    System.out.println("Player 2 is the winner" );
    }//end inner for loop
    }// end outer for loop
    } // end method Winner
    return status;
    }//end class
    ClassConnectFour which designs the board........................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class ClassConnectFour
    //Player player1;
    //Player player2;
    public ClassConnectFour()
    //this.player1 = player1;
    public void DrawBoard()
    int[][] ConnectFourArray = new int[6][7] ;
    for ( int row=0; row < ConnectFourArray.length; row++ ){
    System.out.print("Row " + row + ": ");
    for ( int col=0; col < ConnectFourArray[row].length; col++ )
    System.out.print( ConnectFourArray[row][col] + " ");
    System.out.println();
    System.out.println();
    }//end class
    TestConnetFour class which uses most of the above class..................
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    public class TestConnectFour
    public static void main(String[] args)
    ClassConnectFour cf = new ClassConnectFour();
    cf.DrawBoard();
    Player1 player1 = new Player1();
    Player2 player2 = new Player2();
    player1.move();
    player2.move();
    System.out.println("Number 1 belongs to player " + player1.name());
    System.out.println("Number 2 belongs to player " + player2.name());
    PlayGame pg = new PlayGame();
    pg.StartGame();
    pg.hasWon();
    //pg.Play();
    //System.out.println(player.name());
    //System.out.println(player2.name());
    }// end main
    }//end classI am sorry for all this junk code but I only understand it this way. Your urgent help is required. Looking forward to your reply.
    Thanks in advance.
    Koonda

  • Urgent Help Required Please

    Hello,
    I have the following code
    public class StudentRecords {
       private Hashtable recordHolder;   //Holds marks for collection of students
                                         //Maps students to their marks
       private int noAssignments;        //Number of marks associated with each student
       public StudentRecords(int noAssignments){
          //Argument is the number of assignments for the course
          recordHolder = new Hashtable();
       public Enumeration getStudentNames(){
          //Returns with an enumeration of student names who do the course
          return recordHolder.elements();
       public int getMark(String studentName, int assignmentNo){
          //Returns with the mark for the student studentName on assignment assignmentNo
          Hashtable studentDetails = (Hashtable)recordHolder.get(studentName);
          String assignmentNoStr = studentDetails.get(String.valueOf(assignmentNo)).toString();
          return Integer.parseInt(assignmentNoStr);
       public int getNoOfAssignments()
          //Returns with the number of assignments associated with the course
          return 10;
       public int getAverage(String studentName){
          //Returns average of marks associated with studentName
          Hashtable studentDetails = (Hashtable)recordHolder.get(studentName);
          System.out.println("studentDetails " +studentDetails);
          int total = 0;
          int countAssignments = 0;
          Enumeration enum = studentDetails.elements();
          while(enum.hasMoreElements())
              countAssignments++;
              String mark = enum.nextElement().toString();
              int mark2 = Integer.valueOf(mark).intValue();
              total = total+mark2;
          return total/countAssignments;
       public void createStudentRecord(String studentName){
          //Create a student record which associates a student with the marks for his/her assignments
          if(!recordHolder.contains(studentName))
            //System.out.println("Creating record for " +studentName);
            recordHolder.put(studentName, new Hashtable());
       public void addMark(String studentName, int assignmentNo, int mark){
          //Add the mark given by mark for assignmentNo to the students record associated with studentName
          Hashtable assignments = (Hashtable)recordHolder.get(studentName);
          String assignment = String.valueOf(assignmentNo);
          String markStr = String.valueOf(mark);
           // new record
           assignments.put(assignment, markStr);
       public String toString()
          return recordHolder.toString();
    }Now i have a SAX parser class that is suppose to populate the StudentRecords object. Once this is done I need to output the details into a HTML file using a PrintWriter ( this I can do) but how the hell do I populate my object with this SAX parser.
    Here is my SAX class
    public class MarksProcessor extends HandlerBase{
      public static void main(String[] args){
          //Main method
          try
              MarksProcessor mp = new MarksProcessor();
              Class loadedClass = Class.forName("com.ibm.xml.parser.SAXDriver");
              Parser xParser = (Parser)loadedClass.newInstance();
              xParser.setDocumentHandler(mp);
              xParser.setErrorHandler(mp);
              xParser.parse("Classmarks.txt");
          catch(Exception e)
            e.printStackTrace();
      public MarksProcessor()
       public void error(SAXParseException se){
          //Executed when a serious error occurs in processing the XML source
          System.out.println("Error: Problem with XML "+se.getMessage());
       public void warning(SAXParseException se){
          //Executed when a minor problem occurs when processing the XML source
          System.out.println("Warning: Problem with XML "+se.getMessage());
       public void startDocument() throws SAXException{
          //Executed when the XML document is first executed
          System.out.println("Document started");
       public void startElement(String elementName, AttributeList al) throws SAXException
          System.out.println("End ELEMENT = "+ elementName);
       public void endElement(String elementName) throws SAXException{
          //Executed when the end of an element is encountered
          System.out.println("End ELEMENT = "+ elementName);
       public void endDocument() throws SAXException{
         //Executed when processing is finished
         System.out.println("Document finished " +records.toString());
       public void characters(char[] chars, int start, int length)throws SAXException
              System.out.println(new String(chars, start, length));
    }Here is the DTD
    <STUDENTLIST>
    <STUDENTMARK>
    <STUDENTNAME>Dobbs</STUDENTNAME>
    <ASSIGNMENTNO>1</ASSIGNMENTNO>
    <MARK>12</MARK>
    </STUDENTMARK>
    <STUDENTMARK>
    <STUDENTNAME>Wilkinson</STUDENTNAME>
    <ASSIGNMENTNO>1</ASSIGNMENTNO>
    <MARK>28</MARK>
    </STUDENTMARK>
    <STUDENTMARK>
    <STUDENTNAME>Wilkinson</STUDENTNAME>
    <ASSIGNMENTNO>2</ASSIGNMENTNO>
    <MARK>44</MARK>
    </STUDENTMARK>
    <STUDENTMARK>
    <STUDENTNAME>Roberts</STUDENTNAME>
    <ASSIGNMENTNO>1</ASSIGNMENTNO>
    <MARK>77</MARK>
    </STUDENTMARK>
    <STUDENTMARK>
    <STUDENTNAME>Roberts</STUDENTNAME>
    <ASSIGNMENTNO>2</ASSIGNMENTNO>
    <MARK>80</MARK>
    </STUDENTMARK>
    <STUDENTMARK>
    <STUDENTNAME>Roberts</STUDENTNAME>
    <ASSIGNMENTNO>3</ASSIGNMENTNO>
    <MARK>50</MARK>
    </STUDENTMARK>
    <STUDENTMARK>
    <STUDENTNAME>Wilkinson</STUDENTNAME>
    <ASSIGNMENTNO>3</ASSIGNMENTNO>
    <MARK>60</MARK>
    </STUDENTMARK>
    <STUDENTMARK>
    <STUDENTNAME>Thomas</STUDENTNAME>
    <ASSIGNMENTNO>1</ASSIGNMENTNO>
    <MARK>45</MARK>
    </STUDENTMARK>
    <STUDENTMARK>
    <STUDENTNAME>Thomas</STUDENTNAME>
    <ASSIGNMENTNO>3</ASSIGNMENTNO>
    <MARK>90</MARK>
    </STUDENTMARK>
    <STUDENTMARK>
    <STUDENTNAME>Dobbs</STUDENTNAME>
    <ASSIGNMENTNO>2</ASSIGNMENTNO>
    <MARK>12</MARK>
    </STUDENTMARK>
    <STUDENTMARK>
    <STUDENTNAME>Thomas</STUDENTNAME>
    <ASSIGNMENTNO>2</ASSIGNMENTNO>
    <MARK>45
    </MARK>
    </STUDENTMARK>
    <STUDENTMARK>
    <STUDENTNAME>Dobbs</STUDENTNAME>
    <ASSIGNMENTNO>3</ASSIGNMENTNO>
    <MARK>12</MARK>
    </STUDENTMARK>
    </STUDENTLIST>
    The other problem is that I have to know how many assignments there are before I create any StudentREcords object.
    Please help. I am desperate and this paper has to be finished in the next day or two.
    Thanks alot.

    You have to keep track of what the parser reads as it goes through the document. Most of the work will be done in the endElement() method, as you don't have all the information for an element until that's called. Here's a rough draft:public String currentElement;
    public StringBuffer currentElementValue;
    public String currentStudentName;
    public String currentAssignmentNo;
    public void startElement(String elementName, AttributeList al) throws SAXException
      currentElement = elementName;
      currentElementValue = new StringBuffer();
    public void endElement(String elementName) throws SAXException
      if (currentElement.equals("STUDENTNAME")
        currentStudentName = currentElementValue.toString();
        createStudentRecord(currentStudentName);
      if (currentElement.equals("ASSIGNMENTNO")
        currentAssignmentNo = currentElementValue.toString();
      if (currentElement.equals("MARK")
        addMark(currentStudentName, Integer.parseInt(currentAssignmentNo), Integer.parseInt(currentElementValue.toString());
    public void characters(char[] chars, int start, int length)throws SAXException
      currentElementValue.append(chars, start, length);
    }PC&#178;

  • URGENT HELP REQUIRED!

    I am having problems implementing a username validaion bean for my login system. Every time I click my login icon on my main JSP page the login JSP page does not appear except one of the error JSP pages.
    How can I correct this problem?
    Does the code below look correct?
    Below is the codes for the Username Validation Bean :
    LOGIN.JSP
    <%@ page import="java.io.*"%>
    <%@ page import="java.util.*"%>
    <%@ page import="java.sql.*"%>
    <%@ page import="com.mysql.jdbc.*"%>
    <%@ page errorPage="badLogin.jsp"%>
    <%@ page import="gcd.UserNameValidationBean"%>
    <%
    Class.forName("com.mysql.jdbc.Driver");
    java.sql.Connection connection=java.sql.DriverManager.getConnection("jdbc:mysql://localhost/gcdBB_db");
    java.sql.Statement statement = connection.createStatement();
    Enumeration parameters = request.getParameterNames();
    if(parameters.hasMoreElements())
    String usernameValue = request.getParameter("username");
    String passwordValue = request.getParameter("password");
    statement.executeUpdate("INSERT INTO users (username,password) VALUES ('"+usernameValue+"','"+passwordValue+"')");
    %>
    GOODLOGIN.JSP
    <%@ page errorPage="badLogin.jsp"%>
    <%@ page import="gcd.UserNameValidationBean"%>
    <% UserNameValidationBean validationBean = new UserNameValidationBean();
    if(request.getParameter("username")!=null)
    validationBean.validateUserNameBean(request.getParameter("username"));
    %>
    <%=request.getParameter("username")%>
    USERNAMEVALIDATIONBEAN.JAVA
    package gcd;
    public class UserNameValidationBean
    public UserNameValidationBean(){}
    public boolean validateUserName(String userName) throws InvalidUserNameException
    if(userName.length() < 32)
    throw new InvalidUserNameException("User Name Invalid: " + userName);
    return true;
    INVALIDUSERNAMEEXCEPTION.JAVA
    package gcd;
    public class InvalidUserNameException extends Exception
    public InvalidUserNameException(String message)
    super(message);
    I need urgent help to get this working!

    Here is code for badLogin.jsp and badLoginWithExceptonObject:
    BADLOGIN.JSP
    <HTML><HEAD><TITLE>Login Failure</TITLE></HEAD>
    <BODY bgcolor="#FF9900">
    <H1></H1>
    <font face="Arial" size="3">Sorry but you either entered an incorrect username
    or password </font>
    <P><font face="Arial" size="3">Try Again</font>
    </BODY></HTML>
    BADLOGINWITHEXCEPTIONOBJECT.JSP
    <HTML><HEAD><TITLE>Check User Login Against Parameters</TITLE></HEAD>
    <BODY bgcolor="#FF9900">
    <%@ page isErrorPage = "true"%>
    <P><font face="Arial" size="3">Error =</font> <%= exception.getMessage()%> <% PrintWriter writer = new PrintWriter(out); %>
    <P><font face="Arial" size="3">Stack =</font> <% exception.printStackTrace(writer); %>
    <P><font face="Arial" size="3">Try Again</font>
    </BODY></HTML>

  • Urgent Help Required - Video Not playing on IE11 and Firefox

    Hi,
    I need Urgent Help , I am trying to Play this Presentation on IE 11 and Firefox and it doesn't play the Video part which is FLV and f4v formats.
    I have been googeling it but couldn't find a solution so far ,Can anyone please help , its really urgent as I am done with the Project ,and this is the last bit which I have been struggling with for a while now.
    Here is the HTML Code I am using :
    <----------------------------------------------------------------------------------------- ----------------------------------------------------------------->
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
      <title>index</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <style type="text/css" media="screen">
      html, body { height:100%; background-color: #ffffff;}
      body { margin:0; padding:0; overflow:hidden; }
      #flashContent { width:100%; height:100%; }
      </style>
    </head>
    <body>
      <div id="flashContent">
       <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="800" height="600" id="index" align="middle">
        <param name="movie" value="index.swf" />
        <param name="quality" value="high" />
        <param name="bgcolor" value="#ffffff" />
        <param name="play" value="true" />
        <param name="loop" value="true" />
        <param name="wmode" value="window" />
        <param name="scale" value="showall" />
        <param name="menu" value="true" />
        <param name="devicefont" value="false" />
        <param name="salign" value="" />
        <param name="allowScriptAccess" value="sameDomain" />
        <!--[if !IE]>-->
        <object type="application/x-shockwave-flash" data="index.swf" width="800" height="600">
         <param name="movie" value="index.swf" />
         <param name="quality" value="high" />
         <param name="bgcolor" value="#ffffff" />
         <param name="play" value="true" />
         <param name="loop" value="true" />
         <param name="wmode" value="window" />
         <param name="scale" value="showall" />
         <param name="menu" value="true" />
         <param name="devicefont" value="false" />
         <param name="salign" value="" />
         <param name="allowScriptAccess" value="sameDomain" />
        <!--<![endif]-->
         <a href="http://www.adobe.com/go/getflash">
          <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
         </a>
        <!--[if !IE]>-->
        </object>
        <!--<![endif]-->
       </object>
      </div>
    </body>
    </html>
    <----------------------------------------------------------------------------------------- ----------------------------------------------------------------->

    Any Help in this Regards will be highly appreciated

  • Urgent : Help required for logical comparison of two 2GB files.

    Large files need to be compared depending on Business logic. No byte to byte comparison to be done. It would require reference of data written at the start of the file at some other later part of the file too while comparing two files. File needs to be stored in memory while comparison is done. Kindly suggest some way out which would give best performance. Memory limitations are 256 MB RAM.

    File needs to be stored in memory while comparison is done.
    Memory limitations are 256 MB RAM.You have 4 GB of data. You have 256 MB of RAM to put it in. Obviously one of those two assumptions has to be changed. By the way, what is the XML connection for this question?

  • Deserialization error !!!Urgent help required!!!

    hi,
    I have a GUI screen developed by Java Swings. It has 5 checkboxes say A, B, C, D, E.
    Now depending on the users choice, the values of these checkboxes is sent as an xml
    file to the soapServer as shown below.
    <A="yes" B="no" C="yes" D="yes" E="no">
    Now there is some processing on the generated xml files on server. It reads these atrributes and performs certain functions.
    Also while retrieving back the xml file from SoapServer on GUI screen, there is an option
    which asks the location of stored XML file and then it gets the xml file and displays the
    Checkboxes accordingly. The GUI screen is succesfully displayed.
    Now my query is that I have added another attribute checkbox say "F", The GUI screen
    sucesfully sends the XML file and then the processing on xml file is fine. But when I try
    to retrieve the xml file, The GUI screen is not displayed but this is what the error that I encounter.
    at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:218)
    at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:646)
    at org.apache.axis.Message.getSOAPEnvelopeMessage.java:424)
    at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
    at org.apache.axis.client.AxisClient.invoke(AxisClient.java:173)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2735)
    at org.apache.axis.client.Call.invoke(Call.java:2718)
    at org.apache.axis.client.Call.invoke(Call.java:2394)
    at org.apache.axis.client.Call.invoke(Call.java:2317)
    at org.apache.axis.client.Call.invoke(Call.java:1774)
    I would be extremely grateful if you could help me out with this situation.

    >
    >
    at
    org.apache.axis.encoding.DeserializationContextImpl.pa
    rse(DeserializationContextImpl.java:218)
    at
    org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.ja
    va:646)
    at
    org.apache.axis.Message.getSOAPEnvelopeMessage.java:42
    4)
    at
    org.apache.axis.handlers.soap.MustUnderstandChecker.in
    voke(MustUnderstandChecker.java:62)
    at
    org.apache.axis.client.AxisClient.invoke(AxisClient.ja
    va:173)
    at
    org.apache.axis.client.Call.invokeEngine(Call.java:273
    5)
    at
    org.apache.axis.client.Call.invoke(Call.java:2718)
    at
    org.apache.axis.client.Call.invoke(Call.java:2394)
    at
    org.apache.axis.client.Call.invoke(Call.java:2317)
    at
    org.apache.axis.client.Call.invoke(Call.java:1774)What do you expect us to help? Where's the ******* error message?

  • Urgent help required related to login management

    Dear Friends,
    I have a requirement in which i am stuck.
    i would like to explain with a example
    The requirement is a unique login in a web application.
    Say a user has logged in with a name [  tom ] on machine 1.
    Now the user with the name [ tom ] should be allowed to be logged in from other machine say machine 2 and only if the user with [ tom ] has logged off from machine 1 then only we can log in with the user name
    [ tom ] from on machine 2.
    How is it possible in a web application using jsp servlets and form beans.
    Thanks in advance and replies are invited . Its a urgent matter.

    Hi Raj,
    The best solution what i think would be is as follows
    Every infotype will have a customer include starts with CI_P* which gives the capacity to include the new customer fields.
    Eg : for P0001 it is CI_P0001.
    we need to create a custom screen to handle the custom field. You can check the table T582C for the custom screens.Then your new custom screen is included to the infotypes in the above said table.
    Once the Customer include is enhanced and added a field, then we need to go and do the field level configuration to make sure that the  your new field appears when you go to specific infotype in PA30.
    Make sure the custom field is a Input field. If it is not the Input field you BDC will fail.
    Hope this helps. If so reward.
    Thanks
    Shyam

  • Can anyone help me edit the xml in Feedburner?

    I successfully resubmitted my podcast to Itunes so that now it only takes the podcasts, and all six episodes are there.  Yay!
    Problem is now that it shows it created by "[email protected]"
    I can see just where that is in the xml feed, but when I try to edit it, nothing happens.
    also the website sends it just to the page for podcasts, but that's ok as the tabs are all at the top and anyone who wants to can click ont he tabs to read more. And I think having it link to the entire blog was part of the problem in the first place. I'm just concerned about the "noreply" thing.
    Here is the podcast on itunes:
    http://itunes.apple.com/us/podcast/new-york-irish-arts/id435952770
    The offending line in the xml is this:
    <managingEditor>[email protected] (Gwen Orel)</managingEditor>
        <lastBuildDate>Wed
    But I don't know how to get in there to change it.  Help....

    As far as I can deduce you have created the podcast using Blogger's online service, then submitted the feed URL they give you to Feedburner: the Feedburner feed, which has been submitted to iTunes, is at
    http://feeds.feedburner.com/blogspot/IWRRu
    Both Blogger and Feedeburner create and host the feed themselves: it's not possibile for you to edit this directly. You have to make any required changes in Blogger.
    There is a bit of a mystery over the offending entry. That area on the iTunes Store should be populated from the 'itunes:author' tag; there is such a tag, containing just your name. ITunes does not, in theory, read the 'managingEditor' tag, so why it's displaying the contents of this tag I can't say. It's all something you would have to take up with Blogger: but these free service come at the price of accepting their way of doing things and one of the things which is liable to happen is that they like links back to their own site. That one is a bit odd, though.

  • Urgent - encrypt and decrypt the single field (String)

    Hi,
    I want to create Java program which can encrypt and decrypt the single field (String). Can you please pass me the code. I am new to the Java and my technical background is not from Java. Appreciate your speedy response.
    You can directly reach me at [email protected]
    --Akshay                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Welcome to the Developer Community! We'd like you to get the most out of your experience at the Forums. Please keep in mind that the many of the developers who help you are working for a living, and all of them are providing you with free advice. It is only fair for you to do some homework first prior to posting. Here are some suggestions from the developer community to the newest members. To avoid wasting fellow members' time unnecesarily, please use the following checklist before posting a question:
    * Search before Posting: Especially if you are in a hurry, you may find that the question has already been asked and answered during the long history of the Forums.
    * Know the basics: Read this FAQ and the basic trails of the Java Tutorial (like Getting Started or Learning the Java Language). If you don't understand the question you are posing, you may not understand the answers.
    * Be thorough and precise: Proofread your question before posting. Describe the steps that you have taken. The more effort you put into researching and describing your problem, the more likely you will get a sincere effort in return.
    * Post a subject line that describes the problem: Experts in your subject may skim right past subject lines like "Urgent" and "Need help ASAP". Use keywords about the technologies instead.
    * Post a problem, not an assignment: Break your assignment down into specific problems that you can ask for help with. Dorm hall lounges may be a better resource if you have a last minute, "urgent" demand for solutions to homework problems.
    -- From the [Java Forums FAQ|http://developers.sun.com/resources/forumsFAQ.html#Getting]

Maybe you are looking for

  • Unable to open raw files in lightroom from my nikon d5300

    I have recently bought a nikon d5300 camera and cannot open any raw files using elements 12 or lightroom 5.3 which are both recommended for the new camera and its raw formats?

  • Firefox sync not working correctly

    I set up sync and used my favorite gmail address (sun-). It seems I should have used the gmail address I set up my google/gmail account with ( allu-) Now it seems I have sync on my computer, and my tablet, but I'm not sure. I know this sounds weird,

  • Lightroom will now allow EDIT in photoshop CC or CS6

    From lightroom the EDIT functions are graded out and can not Edit in either photoshop or CC Can import photos directly to CS6 or Photoshop CC but not from Lightroom Have version 5.6 lIghtroom and 2014 2.1

  • Hiding private contact and other private information

    I have used a Palm PDA for years and depend on its ability to hide private contacts and private information while having those not marked private visible.  (To view the private information one must enter a password.) I am trying to migrate from using

  • SSRS - Interactive sorting based on aggregate function

    Hi, I'm trying to add interactive sorting to one of the columns in my tablix. The soring should be based on the LAST visit date of my child grouping. However interactive sorting is not compatible with aggregate functions apparently. I'm using the fol