Help NEEDED!!! - Quiz Program

Doing a Java project, writing a Quiz program basically got multiple screens and using a Buffered reader which loads a txt folder, at the moment it reads the questions and allows u to skip questions on all 4 buttons, i know need it to count up the correct answers and have a final score etc.
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.StringTokenizer;
import javax.swing.*;
public class Main extends JFrame implements ActionListener
     private JButton button, buttonAns1, buttonAns2, buttonAns3, buttonAns4;
     private JPanel panel, panelAns, panelAns1, panelAns2, panelAns3, panelAns4;
     private JLabel labelTitle, labelName, labelQ1;
     BufferedReader inFile;
     boolean start =true;
     String answer = null;
     int noOfQuestions = 0;
     Main myMain ;
     MusicQuiz myMusicQuiz;
     Levels myLevels;
     public Main()
          String name;
     name = JOptionPane.showInputDialog(null,"Please enter your Name!");     
          JOptionPane.showMessageDialog(null,"Welcome " + name);
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          Container c= getContentPane();
          setSize(700,600);
          panel = new JPanel();
panel.setLayout(new GridLayout(5,1));
panel.setSize(600,400);
          c.add(panel);
          labelTitle = new JLabel("MTV's Quiz Star");
          labelTitle.setHorizontalAlignment(JLabel.CENTER);
          panel.add(labelTitle);
          labelTitle.setFont(new Font("Tahoma",Font.BOLD,48));
          labelTitle.setForeground(Color.orange);
          labelName = new JLabel("User: "+ name);
          labelName.setHorizontalAlignment(JLabel.CENTER);
          panel.add(labelName);
          labelName.setFont(new Font("Tahoma",Font.BOLD,14));
          labelName.setForeground(Color.darkGray);
          labelQ1 = new JLabel("");
          labelQ1.setHorizontalAlignment(JLabel.CENTER);
          panel.add(labelQ1);
          labelQ1.setFont(new Font("Tahoma",Font.BOLD,24));
          labelQ1.setForeground(Color.darkGray);
          panelAns = new JPanel();
          panelAns.setLayout(new GridLayout(2,2));
          panelAns.setSize(600,400);
          panel.add(panelAns);
          buttonAns1 = new JButton("");
          buttonAns1.addActionListener(this);
          buttonAns1.setForeground(Color.darkGray);
          panelAns.add(buttonAns1);
          buttonAns2 = new JButton("");
          buttonAns2.addActionListener(this);
          buttonAns2.setForeground(Color.darkGray);
          panelAns.add(buttonAns2);
          buttonAns3 = new JButton("");
          buttonAns3.addActionListener(this);
          buttonAns3.setForeground(Color.darkGray);
          panelAns.add(buttonAns3);
          buttonAns4 = new JButton("");
          buttonAns4.addActionListener(this);
          buttonAns4.setForeground(Color.darkGray);
          panelAns.add(buttonAns4);
          setSize(600,400);
          show();
          countQuestions();
          readQuestions();
     public static void main(String[] args)
               Main myMain = new Main();
     public void countQuestions()
          try
               String line;
               inFile = new BufferedReader(new FileReader("Questions.txt"));
          try
               while ((line = inFile.readLine()) != null)
                    noOfQuestions++;
               inFile.close();
          catch(Exception e)
     catch (FileNotFoundException e)
          System.out.println("File - Questions.txt - File Not Found");
          private void readQuestions()
               int number = (int)(Math.random() * noOfQuestions);
               if(start == true)
               start = false;
          try
               inFile = new BufferedReader(new FileReader("Questions.txt"));
               String line = null;
               for(int loop =0;loop < number;loop++)
                    line= inFile.readLine();
               StringTokenizer parts = new StringTokenizer(line,"|");
               labelQ1.setText(parts.nextToken());
               buttonAns1.setText(parts.nextToken());
               buttonAns2.setText(parts.nextToken());
               buttonAns3.setText(parts.nextToken());
               buttonAns4.setText(parts.nextToken());
               answer = parts.nextToken();
               inFile.close();
          catch (Exception e)
          /* (non-Javadoc)
          * @see java.awt.event.ActionListeneractionPerformed(java.awt.event.ActionEvent)
          public void actionPerformed(ActionEvent arg0)
               if (arg0.getSource()==myMusicQuiz)
                    if(myMusicQuiz==null)
                         myMusicQuiz= new MusicQuiz();
                    else show();
               if (arg0.getSource()==myLevels)
                    if(myLevels==null)
                         myLevels= new Levels();
                    else show();
               if(arg0.getSource() == buttonAns1)
                    readQuestions();
               if(arg0.getSource() == buttonAns2)
                    readQuestions();
               if(arg0.getSource() == buttonAns3)
                    readQuestions();
               if(arg0.getSource() ==buttonAns4)
                    readQuestions();
}

In case you're wondering if someone is going to do it for you, I'd guess No. So if you're still sitting there on your hands you might want to do something about it instead.

Similar Messages

  • Help needed with program

    hi, i've got my program to work up to a point but it seems to be stuck in a for loop which i can't seem to get it out of, please help. Here's the code.
    System.out.print("How many processing machines do you require ?");
    NumberOfProcessMachines = new Integer (keyboardInput.readLine()).intValue();
    for (int i=0; i<NumberOfProcessMachines; i++){
    plant.addMachine("Processing", 20, 60, (float)JamRate);}
    System.out.print("How many packing machines do you require ?");
    NumberOfPackingMachines = new Integer (keyboardInput.readLine()).intValue();
    for (int i=0; i<NumberOfPackingMachines; i++){
    plant.addMachine("Packing", 10, 60, (float)JamRate);}
    System.out.print("How many machine connections do you require ?");
    NumberOfProcessMachines = new Integer (keyboardInput.readLine()).intValue();
    for (int i=0; i<NumberOfProcessMachines; i++){
    plant.addMachine("Processing", 20, 60, (float)JamRate);}
    for (int i=0; i<NumberOfPackingMachines; i++){
    int index = NumberOfProcessMachines;
    plant.addInputLine(plant.machine(i), plant.machine(index));
    plant.addInputLine(plant.machine(i), plant.machine(index));}
    I've initialised all the variables but it seems to be stuck in the loop where i input the number of MachineConnections

    Well, we can't very well see what's going wrong unless you give us the definition for whatever class "plant" is. Does addMachine() do anything non-trivial? Is NumberOfProcessMachines a scoped variable, or member? Working off that idea, include the declarations of NumberOfProcessMachines, NumberOfPackingMachines, and NumberOfProcessMach...
    hey, you used that one twice! Did you mean to do that?
    Also, "new Integer(...).intValue()" is computationally slower than and harder to read than
    "Integer.parseInt(...)"

  • Help Needed On Program! Please

    Alright, sorry for all these threads but they are totally different topics. Now, with this code I am just trying to count how many times each string has been shown (without repeating). It works for the most part but it is missing some for some reason. Here is an example of how it should be
    Input:
    "hello hello dog"
    Output:
    hello 2
    dog 1
    the printing I am not worried about right now. I just want the information to be in the arraylist "o" and "cc". Thanks
    for(int z=0;z<p.size();z++)
                  count=0;
                  for(int d=0;d<p.size();d++)
                      if(p.get(z).equals(p.get(d)))
                           count++;     
                           p.remove(d);
                   o.add(p.get(z));
                   cc.add(count);
               }Now like I said, the program works but I added a feature in the program to count the totals and it was off. I started with over 700 strings and after the program was done there were like 623 that got added.
    Thanks

    Ok.
    Heres is where I am at right now after those words of inspiration.
    for(int z=0;z<p.size();z++)
                  count=0;
                  for(int d=0;d<p.size();d++)
                      if(p.get(z).equals(p.get(d))&&(!p.get(z).equals("hold")))
                           count++;                       
                              p.set(d,"hold");
                   if(!p.get(z).equals("hold"))
                       o.add(p.get(z));
                        cc.add(count);
               }I am now getting all of the strings to pass through but I cant figure out a way to get "o" and "cc" into their arrays properly. The way it is now makes absolutly no sense because all the values are already "hold" so it cant pass the if statment. The problem now is I see my error but I just cant find a way around it.
    thanks a bunch. Yes I know I should be analyzing this a bit more before posting but I have to have this done by tomorrow and I am on limited time. Thanks for the help

  • Hi there, need help for this program...thx!

    Hi there guys,
    I have created this applet program that requires a user to login with a user no, and a password. I am using arrays as to store the defined variables,(as required by my project supervisor). My problem here is that when the arrays are declared in class validateUser(), the program would run fine, but i cant login and i get a NullPointerException error. if the arrays are located in actionPerformed, i get a 'cannot resolve symbol' error for the method 'get' and 'if (Admin.equals(admins.get(i).toString())) ' as well as 'if (Password.equals(passwordsget(i).toString())) '. I am not very effecient in java, hence the untidy program (and i have to admit, it isnt any good), so sorry for any inconvenience caused. Once agani thx in advance ;)
    here are my codings :
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.URL;
    import java.net.*;
    import javax.swing.*;
    import java.lang.*;
    import java.util.Vector;
    public class eg31662 extends Applet implements ActionListener
         Panel panel1, panel2, panel3, panel4, panel5;
         Button login, enter;
         Label inst, top, admin, pass, fieldlabel;
    TextField adminF, passF, field;
    String Admin, Password;
    Vector admins, passwords;
         Thread thread = null;
         boolean status = false;
              public class validateUser extends Applet
                   String[] admins = {"User1", "User2", "User3"};
                   String[] passwords = {"P1", "P2", "P2"};
         public void init()
              setLayout (new BorderLayout());
              panel1 = new Panel(new FlowLayout());
              panel2 = new Panel(new FlowLayout());
              //login button
              login = new Button("Login");
              //instruction
              inst = new Label("Please type in your User no. and the given password in order to proceed");
              //label
              top = new Label("Login login");
              admin = new Label("Admin No :");
              pass = new Label("Password :");
              //input textfields
              adminF = new TextField(8);
              passF = new TextField(10);
              passF.setEchoChar('*');
              panel1.setBackground(Color.gray);
              panel2.setBackground(Color.orange);
              panel2.add(admin);
              panel2.add(adminF);
              panel2.add(pass);
              panel2.add(passF);
              panel2.add(login);
              panel2.add(inst);
              panel1.add(top);
              add(panel1, BorderLayout.NORTH);
              add(panel2, BorderLayout.CENTER);
              login.addActionListener(this);
              setSize(500,400);
         void mainpage()
              boolean flag = true;
              setLayout (new BorderLayout());
              panel1 = new Panel(new FlowLayout());
              panel2 = new Panel(new FlowLayout());
              top = new Label("Welcome");
              enter = new Button("Enter");
              panel2.setBackground(Color.orange);
              panel1.setBackground(Color.gray);
              fieldlabel = new Label("Type something here :");
              field = new TextField(20);
              add(panel1, BorderLayout.NORTH);
              add(panel2, BorderLayout.CENTER);
              panel2.add(fieldlabel);
              panel2.add(field);
              enter.addActionListener(this);
         public void start() {
              if(thread == null) {
                   status = true;
         public void stop() {
              status = false;
         public void run() {
              while(status == true) {
                   try {
                        thread.sleep(50);
                   catch(InterruptedException ie) {
                   repaint();
              thread = null;
         public void actionPerformed(ActionEvent ev)
                   //String[] admins = {"User1", "User2", "User3"};
                   //String[] passwords = {"P1", "P2", "P3"};
              if(ev.getSource() == login)
                   Admin = adminF.getText();
                   Password = passF.getText();
              boolean ok = true;
              for (int i = 0; i < admins.size(); i++) {
              if (Admin.equals(admins.get(i).toString())) {
              if (Password.equals(passwords.get(i).toString())) {
              ok = true;
              this.setVisible(false);
              //break;
                             JOptionPane.showMessageDialog(null, "Welcome, u have successfully logged in");
                             mainpage();
              else {
              ok = false;
              else {
              ok = false;
              if (ok == false) {
                             JOptionPane.showMessageDialog(null,
                        "Incorrect Password or Admin No, Please Try Again",
                        "Access Denied",
                        JOptionPane.ERROR_MESSAGE);
              else {
              this.setVisible(false);
    }

    Hi, sorry to bring this thread up again, but this is actually a continuation from my previous posted program. Hope u guys can help me again!
    Right now i'm supposed to come up with a simple quiz program, which consists of the center panel displayin the question (in a pic format), and a textfield to enter the answer at the lower panel. this goes on for a couple of pages and once it is completed, the final page would display the total correct answers out of the number of questions, as well as the score in percentage form.
    The few(or many) problems taht i'm facing are :
    1)How do i save the answers that are typed in each textfieldAnd later on checked for the correct answer based on the array given?
    2)How do i go about doing the final score in percentage form and total of correct answers?
    3)I previously tried out using canvas, but it didnt seem to work. my questions(pictures) that are supposed to displayed in the center(canvas) produce nothing. How do i rectify that?
    i'm really sorry for the mess in the codings, hope this wouldnt be a hassle for any of u out there. Once again thanks in advance!
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.*;
    import java.net.URL;
    import java.net.*;
    import java.util.Vector;
    import javax.swing.*;
    import java.awt.image.*;
    import java.lang.*;
    import java.awt.Graphics;
    public class eg31662 extends Applet implements ActionListener
        Panel panel1, panel2, panel3, panel4, panel5;
        Button login, enter;
        Label inst, top, admin, pass, startLabel;
        TextField adminF, passF, field;
        String Admin, Password;
        Vector admins, passwords;
         //Quiz declarations
         TextField ansF1,ansF2,ansF3;
         Button startBut, next0, next1, finishB, previous1;
         Image q1, q2, q3;
         Image ques[] = new Image[2];
         boolean text = false;
         boolean checked = false;
         int correct = 0;
         String [] answer = new String [2];
         String [] solution = {"11", "22", "33"};
         boolean text = false;
         boolean sound = true;
         int red,green,blue;
         int question =0;
         int good = 0;
         boolean pause= false;
         boolean start = true;*/
        Thread thread = null;
        boolean status = false;
        public void init()
            validateUser();
            setLayout (new BorderLayout());
            panel1 = new Panel(new FlowLayout());
            panel2 = new Panel(new FlowLayout());
            panel3 = new Panel(new FlowLayout());
            //login button
            login = new Button("Login");
            //instruction
            inst = new Label("Please type in your UserName and the given " +
                             "password in order to proceed");
            //label
            top = new Label("Top Label");
            admin = new Label("User Name :");
            pass = new Label("Password :");
            //input textfields
            adminF = new TextField(8);
            passF = new TextField(10);
            passF.setEchoChar('*');
            panel1.setBackground(Color.gray);
            panel2.setBackground(Color.orange);
              panel3.setBackground(Color.gray);
            panel2.add(admin);
            panel2.add(adminF);
            panel2.add(pass);
            panel2.add(passF);
            panel2.add(login);
            panel3.add(inst);
            panel1.add(top);
            add(panel1, BorderLayout.NORTH);
            add(panel2, BorderLayout.CENTER);
            add(panel3, BorderLayout.SOUTH);
            login.addActionListener(this);
            setSize(500,400);
        private void validateUser()
            String[] adminData    = {"t", "User1", "User2", "User3"};
            String[] passwordData = {"t", "P1", "P2", "P3"};
            admins = new Vector();
            passwords = new Vector();
            for(int j = 0; j < adminData.length; j++)
                admins.add(adminData[j]);
                passwords.add(passwordData[j]);
        private void Mainpage()
            boolean flag = true;
            removeAll();  // remove all components from container
            panel1 = new Panel(new FlowLayout());
            panel2 = new Panel(new FlowLayout());
              panel3 = new Panel(new FlowLayout());
            top = new Label("Welcome");
            enter = new Button("Enter");
            panel2.setBackground(Color.orange);
            panel1.setBackground(Color.gray);
            panel3.setBackground(Color.gray);
            startLabel = new Label("Welcome! " +
                                          "Please click on the 'Start' button to begin the quiz ");
              startBut = new Button("Start");
              startBut.requestFocus();
              Dimension dim = getSize();
              startBut.setSize(50,20);
            add(panel1, BorderLayout.NORTH);
            add(panel2, BorderLayout.CENTER);
            add(panel3, BorderLayout.SOUTH);
            panel2.add(startLabel);
            panel2.add(startBut);
            startBut.addActionListener(this);
            validate();
            repaint();
        private void Quiz1()
              //quizCanvas = new Canvas();
            boolean flag = true;
            removeAll();  // remove all components from container
            panel1 = new Panel(new FlowLayout());
            panel2 = new Panel(new FlowLayout());
            panel3 = new Panel(new FlowLayout());
            panel1.setBackground(Color.gray);
            panel2.setBackground(Color.orange);
            panel3.setBackground(Color.gray);
            add(panel1, BorderLayout.NORTH);
            add(panel2, BorderLayout.CENTER);
            add(panel3, BorderLayout.SOUTH);
              q1 = getImage(getDocumentBase(), "1.gif");
              ques[0] = q1;
              //ques[1] = q2;
              //previous = new Button("<");
              next0 = new Button("Done");
            ansF1 = new TextField(25);
              next0.addActionListener(this);
              //quizCanvas.insert(ques1);
            //panel3.add(previous);
            panel3.add(next0);
            panel3.add(ansF1);
            //panel2.add("1.gif");
              ansF1.requestFocus();
              ansF1.setText("focussing");
            validate();
            repaint();
         public void Quiz2(){
            boolean flag = true;
            removeAll();  // remove all components from container
            panel1 = new Panel(new FlowLayout());
            panel2 = new Panel(new FlowLayout());
            panel3 = new Panel(new FlowLayout());
            panel1.setBackground(Color.gray);
            panel2.setBackground(Color.orange);
            panel3.setBackground(Color.gray);
            add(panel1, BorderLayout.NORTH);
            add(panel2, BorderLayout.CENTER);
            add(panel3, BorderLayout.SOUTH);
              q2 = getImage(getDocumentBase(), "2.gif");
              ques[1] = q2;
              next1 = new Button("Done");
            ansF2 = new TextField(25);
              next1.addActionListener(this);
            panel3.add(next1);
            panel3.add(ansF2);
              ansF2.requestFocus();
              ansF2.setText("focussing");
            validate();
            repaint();
         public void Quiz3(){
            boolean flag = true;
            removeAll();  // remove all components from container
            panel1 = new Panel(new FlowLayout());
            panel2 = new Panel(new FlowLayout());
            panel3 = new Panel(new FlowLayout());
            panel1.setBackground(Color.gray);
            panel2.setBackground(Color.orange);
            panel3.setBackground(Color.gray);
            add(panel1, BorderLayout.NORTH);
            add(panel2, BorderLayout.CENTER);
            add(panel3, BorderLayout.SOUTH);
              q3 = getImage(getDocumentBase(), "3.gif");
              ques[2] = q3;
              finishB = new Button("Finish");
            ansF3 = new TextField(25);
              finishB.addActionListener(this);
            panel3.add(finishB);
            panel3.add(ansF3);
              ansF3.requestFocus();
              ansF3.setText("focussing");
            validate();
            repaint();
        public void start() {
            if(thread == null) {
                status = true;
        public void stop() {
            status = false;
        public void actionPerformed(ActionEvent ev)
            boolean ok = true;
            if(ev.getSource() == login)
                Admin = adminF.getText();
                Password = passF.getText();
                for (int i = 0; i < admins.size(); i++) {
                    if (Admin.equals(admins.get(i).toString())) {
                        if (Password.equals(passwords.get(i).toString())) {
                            ok = true;
                            JOptionPane.showMessageDialog(null,
                                        "Welcome, u have successfully logged in");
                            Mainpage();
                            break;
                        else {
                            ok = false;
                    else {
                        ok = false;
                if (!ok) {
                    JOptionPane.showMessageDialog(null,
                                  "Incorrect Password or Admin No, Please Try Again",
                                  "Access Denied",
                                   JOptionPane.ERROR_MESSAGE);
            if(ev.getSource() == startBut)
                   Quiz1();
              if (ev.getSource () == next0) {
                   saveanswer();
                   Quiz2();
              if (ev.getSource () == next1) {
                   //saveanswer();
                   Quiz3();
              if (ev.getSource () == finishB) {
                   //saveanswer();
                   //checkanswer();
         /*class quizCanvas extends Canvas {
              private Image quest;
              public quizCanvas() {
                   this.quest = null;
              public quizCanvas(Image quest) {
                   this.quest = quest;
              public void insert(Image quest) {
                   this.quest=quest;
                   repaint();
              public void paint(Graphics g) {
         public void checkanswer() {
              if (!checked) {
              /*question = 0;
                   for (int a=1;a<16;a++) {
                        question++;*/
                        if (ansF1) {
                             if (answer[1].toUpperCase().equals(solution[1])) {
                                  correct++;
                        if (ansF2) {
                             if (answer[2].toUpperCase().equals(solution[2])) {
                                  correct++;
                        if (ansF3) {
                             if (answer[3].toUpperCase().equals(solution[3])) {
                                  correct++;
              checked = true;     }
         public void saveanswer() {
              if (text) {
                   if (!ansF1.getText().equals("")) {
                        answer [Quiz1] = ansF1.getText();
                   //answer2[question] = tf2.getText();
                   if (!ansF2.getText().equals("")) {
                        answer [] = ansF2.getText();
                   if (!ansF3.getText().equals("")) {
                        answer [] = ansF3.getText();
    }

  • Need some help with a program Please.

    Well, im new here, im new to java, so i need your help, i have to make a connect four program, my brother "Kind of" helped me and did a program for me, but the problem is i cant use some of those commands in the program and i have to replace them with what ive learned, so i will post the program and i will need your help to modify it for me.
    and for these programs, also i want help for:
    They have errors and i cant fix'em
    the commands that i've leaned:
    If statements, for loops, while loops,do while, strings, math classes, swithc statement, else if,logical operators,methods, one and two dimensional arrays.
    Thanx in advance,
    truegunner
    // Fhourstones 3.0 Board Logic
    // Copyright 2000-2004 John Tromp
    import java.io.*;
    class Connect4 {
    static long color[]; // black and white bitboard
    static final int WIDTH = 7;
    static final int HEIGHT = 6;
    // bitmask corresponds to board as follows in 7x6 case:
    // . . . . . . . TOP
    // 5 12 19 26 33 40 47
    // 4 11 18 25 32 39 46
    // 3 10 17 24 31 38 45
    // 2 9 16 23 30 37 44
    // 1 8 15 22 29 36 43
    // 0 7 14 21 28 35 42 BOTTOM
    static final int H1 = HEIGHT+1;
    static final int H2 = HEIGHT+2;
    static final int SIZE = HEIGHT*WIDTH;
    static final int SIZE1 = H1*WIDTH;
    static final long ALL1 = (1L<<SIZE1)-1L; // assumes SIZE1 < 63
    static final int COL1 = (1<<H1)-1;
    static final long BOTTOM = ALL1 / COL1; // has bits i*H1 set
    static final long TOP = BOTTOM << HEIGHT;
    int moves[],nplies;
    byte height[]; // holds bit index of lowest free square
    public Connect4()
    color = new long[2];
    height = new byte[WIDTH];
    moves = new int[SIZE];
    reset();
    void reset()
    nplies = 0;
    color[0] = color[1] = 0L;
    for (int i=0; i<WIDTH; i++)
    height[i] = (byte)(H1*i);
    public long positioncode()
    return 2*color[0] + color[1] + BOTTOM;
    // color[0] + color[1] + BOTTOM forms bitmap of heights
    // so that positioncode() is a complete board encoding
    public String toString()
    StringBuffer buf = new StringBuffer();
    for (int i=0; i<nplies; i++)
    buf.append(1+moves);
    buf.append("\n");
    for (int w=0; w<WIDTH; w++)
    buf.append(" "+(w+1));
    buf.append("\n");
    for (int h=HEIGHT-1; h>=0; h--) {
    for (int w=h; w<SIZE1; w+=H1) {
    long mask = 1L<<w;
    buf.append((color[0]&mask)!= 0 ? " @" :
    (color[1]&mask)!= 0 ? " 0" : " .");
    buf.append("\n");
    if (haswon(color[0]))
    buf.append("@ won\n");
    if (haswon(color[1]))
    buf.append("O won\n");
    return buf.toString();
    // return whether columns col has room
    final boolean isplayable(int col)
    return islegal(color[nplies&1] | (1L << height[col]));
    // return whether newboard lacks overflowing column
    final boolean islegal(long newboard)
    return (newboard & TOP) == 0;
    // return whether newboard is legal and includes a win
    final boolean islegalhaswon(long newboard)
    return islegal(newboard) && haswon(newboard);
    // return whether newboard includes a win
    final boolean haswon(long newboard)
    long y = newboard & (newboard>>HEIGHT);
    if ((y & (y >> 2*HEIGHT)) != 0) // check diagonal \
    return true;
    y = newboard & (newboard>>H1);
    if ((y & (y >> 2*H1)) != 0) // check horizontal -
    return true;
    y = newboard & (newboard>>H2); // check diagonal /
    if ((y & (y >> 2*H2)) != 0)
    return true;
    y = newboard & (newboard>>1); // check vertical |
    return (y & (y >> 2)) != 0;
    void backmove()
    int n;
    n = moves[--nplies];
    color[nplies&1] ^= 1L<<--height[n];
    void makemove(int n)
    color[nplies&1] ^= 1L<<height[n]++;
    moves[nplies++] = n;
    public static void main(String argv[])
    Connect4 c4;
    String line;
    int col=0, i, result;
    long nodes, msecs;
    c4 = new Connect4();
    c4.reset();
    BufferedReader dis = new BufferedReader(new InputStreamReader(System.in));
    for (;;) {
    System.out.println("position " + c4.positioncode() + " after moves " + c4 + "enter move(s):");
    try {
    line = dis.readLine();
    } catch (IOException e) {
    System.out.println(e);
    System.exit(0);
    return;
    if (line == null)
    break;
    for (i=0; i < line.length(); i++) {
    col = line.charAt(i) - '1';
    if (col >= 0 && col < WIDTH && c4.isplayable(col))
    c4.makemove(col);
    By the way im using Ready to program for the programming.

    You can't really believe that his brother did this
    for him...I did miss that copyright line at the beginning when
    I first looked it over, but you know, if it had been
    his brother, I'd be kinda impressed. This wasn't a
    25 line program. It actually would have required
    SOME thought. I doubt my brother woulda done that
    for me (notwithstanding the fact that I wouldn't need
    help for that program, and my brother isn't a
    programmer).I originally missed the comments at the top but when I saw the complexity of what was written then I knew that it was too advanced for a beginner and I relooked through the code and saw the comments.

  • Need help writing host program using LabView.

    Need help writing host program using LabView.
    Hello,
    I'm designing a HID device, and I want to write a host program using National Instrument's LabView. NI doesn't have any software support for USB, so I'm trying to write a few C dll files and link them to Call Library Functions. NI has some documentation on how to do this, but it's not exactly easy reading.
    I've written a few C console programs (running Win 2K) using the PC host software example for a HID device from John Hyde's book "USB by design", and they run ok. From Hyde's example program, I've written a few functions that use a few API functions each. This makes the main program more streamlined. The functions are; GetHIDPath, OpenHID, GetHIDInfo, Writ
    eHID, ReadHIC, and CloseHID. As I mentioned, my main program runs well with these functions.
    My strategy is to make dll files from these functions and load them into LabView Call Library Functions. However, I'm having a number of subtle problems in trying to do this. The big problem I'm having now are build errors when I try to build to a dll.
    I'm writing this post for a few reasons. First, I'm wondering if there are any LabView programmers who have already written USB HID host programs, and if they could give me some advice. Or, I would be grateful if a LabView or Visual C programmer could help me work out the programming problems that I'm having with my current program. If I get this LabView program working I would be happy to share it. I'm also wondering if there might already be any USB IHD LabView that I could download.
    Any help would be appreciated.
    Regards, George
    George Dorian
    Sutter Instruments
    51 Digital DR.
    Novato, CA 94949
    USA
    [email protected]
    m
    (415) 883-0128
    FAX (415) 883-0572

    George may not answer you.  He hasn't been online here for almost eight years.
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice

  • I have a licence code for Adobe CS6 Master Collection which I'm using for more  than a year, suddeny I am in trial mode (all programs)  an it seems that this code is not accepted anymore. Help needed!!

    I have a licence code for Adobe CS6 Master Collection which I'm using for more  than a year, suddeny I am in trial mode (all programs)  an it seems that this code is not accepted anymore. Help needed!!

    Chat Now button near the bottom for Activation and Deactivation problems may help
    http://helpx.adobe.com/x-productkb/policy-pricing/activation-deactivation-products.html

  • Need A Program Created (PLEASE HELP!!)

    Using Metroworks Codewarrior, I need a program that does the following.
    Design and develop a class and a driver application which simulate the operation of a Roman Numeral Claculator. Unfourtanetly for those doing the calculations in the Roman Republic and Empire, Arabic numbers with zero and column values had not caught on. Instead integers were represented begining with the digit of the highest value, ending with the one of lowest value using purely additive notation in which the value of a number was simply the sum of its digits. but we will stick with the original IIII for 4 etc:
    M 1000
    D 500
    C 100
    L 50
    X 10
    V 5
    I 1
    Input
    A) keyboard input of two numbers in roman numerals
    B) keyboard input of an arthimetic operator ( + - * /)
    output
    A) explanation of the program and the format for entering data
    B) prompts for the output
    C) final answer including original numerals operator and roman numeral result espressed in a message format
    processing requirements
    A) convert roman numerals into intergers perform appropriate arithmatic then convert the integer answer back into roman numerals
    B)input of a letter not roman numerals or operator other than those specified should not cause program to fail.
    if you complete please send the files as notepad files to the following email address
    [email protected]

    using purely additive notation in which the value of a number was simply
    the sum of its digits. but we will stick with the original IIII for 4 Bah.
    It is IV for 4.
    A) convert roman numerals into integers Since parsing actual roman numerals (where IV is 4, etc) is not part of the assignment - here's a c function that does exactly that. ;-pint roman(char *s)
      int result=0;
      int t;
      int h=0;
      int i = strlen(s);
        while(i) {
          switch(s[--i]) {
            case 'I': case 'i': t = 1; break;
            case 'V': case 'v': t = 5; break;
            case 'X': case 'x': t = 10; break;
            case 'L': case 'l': t = 50; break;
            case 'C': case 'c': t = 100; break;
            case 'D': case 'd': t = 500; break;
            case 'M': case 'm': t = 1000; break;
            default: t = 0;
          if (t<h) result -= t;
          else result += t;
          h = max(h,t);
        return result;
    please send the files as notepad files to the following email [email protected]
    No thanks.

  • Help me. i need a program to change movie format

    I need a program that will let me change my movie file to a type that will play on ipod. a free one please.

    Videora for Windows
    Handbrake for Mac
    cheers

  • Help needed for writing query

    help needed for writing query
    i have the following tables(with data) as mentioned below
    FK*-foregin key (SUBJECTS)
    FK**-foregin key (COMBINATION)
    1)SUBJECTS(table name)     
    SUB_ID(NUMBER) SUB_CODE(VARCHAR2) SUB_NAME (VARCHAR2)
    2           02           Computer Science
    3           03           Physics
    4           04           Chemistry
    5           05           Mathematics
    7           07           Commerce
    8           08           Computer Applications
    9           09           Biology
    2)COMBINATION
    COMB_ID(NUMBER) COMB_NAME(VARCHAR2) SUB_ID1(NUMBER(FK*)) SUB_ID2(NUMBER(FK*)) SUB_ID3(NUMBER(FK*)) SUBJ_ID4(NUMBER(FK*))
    383           S1      9           4           2           3
    384           S2      4           2           5           3
    ---------I actually designed the ABOVE table also like this
    3) a)COMBINATION
    COMB_ID(NUMBER) COMB_NAME(VARCHAR2)
    383           S1
    384           S2
    b)COMBINATION_DET
    COMBDET_ID(NUMBER) COMB_ID(FK**) SUB_ID(FK*)
    1               383          9
    2               383          4
    3               383          2
    4               383          3
    5               384          4
    6               384          2          
    7               384          5
    8               384          3
    Business rule: a combination consists of a maximum of 4 subjects (must contain)
    and the user is less relevant to a COMB_NAME(name of combinations) but user need
    the subjects contained in combinations
    i need the following output
    COMB_ID COMB_NAME SUBJECT1 SUBJECT2      SUBJECT3      SUBJECT4
    383     S1     Biology Chemistry      Computer Science Physics
    384     S2     Chemistry Computer Science Mathematics Physics
    or even this is enough(what i actually needed)
    COMB_ID     subjects
    383           Biology,Chemistry,Computer Science,Physics
    384           Chemistry,Computer Science,Mathematics,Physics
    you can use any of the COMBINATION table(either (2) or (3))
    and i want to know
    1)which design is good in this case
    (i think SUB_ID1,SUB_ID2,SUB_ID3,SUB_ID4 is not a
    good method to link with same table but if 4 subjects only(and must) comes
    detail table is not neccessary )
    now i am achieving the result by program-coding in C# after getting the rows from oracle
    i am using oracle 9i (also ODP.NET)
    i want to know how can i get the result in the stored procedure itsef.
    2)how it could be designed in any other way.
    any help/suggestion is welcome
    thanks for your time --Pradeesh

    Well I forgot the table-alias, here now with:
    SELECT C.COMB_ID
    , C.COMB_NAME
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID1) AS SUBJECT_NAME1
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID2) AS SUBJECT_NAME2
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID3) AS SUBJECT_NAME3
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID4) AS SUBJECT_NAME4
    FROM COMBINATION C;
    As you need exactly 4 subjects, the columns-solution is just fine I would say.

  • Help needed : Extension manager cs6 not listing products

    Help needed to Adobe extension manager cs6 to show all my cs6 products
    I downloaded Extension manager from here Adobe - Exchange : Download the Adobe Extension Manager
    My Computer windows xp 32bit
    My Photosop version cs6
    My Dreamweaver version cs6
    I installed photoshop here : C:\Program Files\Adobe\Adobe Dreamweaver CS6
    and my XManConfigfile
    <?xml version="1.0" encoding="UTF-8"?>
    <Configuration>
        <VariableForExMan>
            <Data key="$sharedextensionfolder">$shareddatafolder/Adobe/Dreamweaver CS6/$LOCALE/Configuration/Extensions</Data>
            <Data key="$dreamweaver">$installfolder</Data>
            <Data key="$dreamweaver/Configuration">$userdatafolder/Adobe/Dreamweaver CS6/$LOCALE/Configuration</Data>
            <Data key="$UserBinfolder">$userdatafolder/Adobe/Dreamweaver CS6/$LOCALE</Data>
            <Data key="NeedOperationNotification">true</Data>
            <Data key="QuitScript">dw.quitApplication()</Data>
            <Data key="SupportedInSuite">CS6</Data>
            <Data key="HostNameForCSXS">DRWV</Data>
            <Data key="ProductVersion">12.0</Data>
            <Data key="Bit">32</Data>
    <Data key="DefaultLocale">en_US</Data>
    </VariableForExMan> 
    </Configuration>
    Extension manager installed here : C:\Program Files\Adobe\Adobe Extension Manager CS6
    Photoshop Installed here: C:\Program Files\Adobe\Adobe Photoshop CS6
    and my XManConfigfile
    <?xml version="1.0" encoding="UTF-8"?>
    <Configuration>
        <VariableForExMan>
            <Data key="EmStorePath">$SharedRibsDataFolder/Adobe/Extension Manager</Data>
            <Data key="$photoshopappfolder">$installfolder</Data>
            <Data key="$pluginsfolder">$photoshopappfolder/Plug-Ins</Data>
            <Data key="$presetsfolder">$photoshopappfolder/Presets</Data>
            <Data key="$platform">Win</Data>
            <Data key="$actions">$presetsfolder/Actions</Data>
            <Data key="$blackandwhite">$presetsfolder/Black and White</Data>
            <Data key="$brushes">$presetsfolder/Brushes</Data>
            <Data key="$channelmixer">$presetsfolder/Channel Mixer</Data>
            <Data key="$colorbooks">$presetsfolder/Color Books</Data>
            <Data key="$colorrange">$presetsfolder/Color Range</Data>
            <Data key="$colorswatches">$presetsfolder/Color Swatches</Data>
            <Data key="$contours">$presetsfolder/Contours</Data>
            <Data key="$curves">$presetsfolder/Curves</Data>
            <Data key="$customshapes">$presetsfolder/Custom Shapes</Data>
            <Data key="$duotones">$presetsfolder/Duotones</Data>
            <Data key="$exposure">$presetsfolder/Exposure</Data>
            <Data key="$gradients">$presetsfolder/Gradients</Data>
            <Data key="$huesat">$presetsfolder/Hue Sat</Data>
            <Data key="$imagestatistics">$presetsfolder/Image Statistics</Data>
            <Data key="$keyboardshortcuts">$presetsfolder/Keyboard Shortcuts</Data>
            <Data key="$layouts">$presetsfolder/Layouts</Data>
            <Data key="$lenscorrection">$presetsfolder/Lens Correction</Data>
            <Data key="$levels">$presetsfolder/Levels</Data>
            <Data key="$liquifymeshes">$presetsfolder/Liquify Meshes</Data>
            <Data key="$menucustomization">$presetsfolder/Menu Customization</Data>
            <Data key="$optimizedcolors">$presetsfolder/Optimized Colors</Data>
            <Data key="$optimizedoutputSettings">$presetsfolder/Optimized Output Settings</Data>
            <Data key="$optimizedsettings">$presetsfolder/Optimized Settings</Data>
            <Data key="$patterns">$presetsfolder/Patterns</Data>
            <Data key="$reducenoise">$presetsfolder/Reduce Noise</Data>
            <Data key="$replacecolor">$presetsfolder/Replace Color</Data>
            <Data key="$scripts">$presetsfolder/Scripts</Data>
            <Data key="$selectivecolor">$presetsfolder/Selective Color</Data>
            <Data key="$shadowhighlight">$presetsfolder/Shadow Highlight</Data>
            <Data key="$smartsharpen">$presetsfolder/Smart Sharpen</Data>
            <Data key="$styles">$presetsfolder/Styles</Data>
            <Data key="$textures">$presetsfolder/Textures</Data>
            <Data key="$tools">$presetsfolder/Tools</Data>
            <Data key="$variations">$presetsfolder/Variations</Data>
            <Data key="$webphotogallery">$presetsfolder/Web Photo Gallery</Data>
            <Data key="$workspaces">$presetsfolder/Workspaces</Data>
            <Data key="$zoomify">$presetsfolder/Zoomify</Data>
         <Data key="$hueandsaturation">$presetsfolder/Hue and Saturation</Data>
         <Data key="$lights">$presetsfolder/Lights</Data>
         <Data key="$materials">$presetsfolder/Materials</Data>
         <Data key="$meshes">$presetsfolder/Meshes</Data>
         <Data key="$rendersettings">$presetsfolder/Render Settings</Data>
         <Data key="$volumes">$presetsfolder/Volumes</Data>
         <Data key="$widgets">$presetsfolder/Widgets</Data>
            <Data key="$localesfolder">$photoshopappfolder/Locales</Data>
            <Data key="$additionalplugins">$localesfolder/$LOCALE/Additional Plug-ins</Data>
            <Data key="$additionalpresets">$localesfolder/$LOCALE/Additional Presets</Data>
            <Data key="$localeskeyboardshortcuts">$localesfolder/$LOCALE/Additional Presets/$platform/Keyboard Shortcuts</Data>
            <Data key="$localesmenucustomization">$localesfolder/$LOCALE/Additional Presets/$platform/Menu Customization</Data>
            <Data key="$localesworkspaces">$localesfolder/$LOCALE/Additional Presets/$platform/Workspaces</Data>
            <Data key="$automate">$pluginsfolder/Automate</Data>
            <Data key="$digimarc">$pluginsfolder/Digimarc</Data>
            <Data key="$displacementmaps">$pluginsfolder/Displacement Maps</Data>
            <Data key="$effects">$pluginsfolder/Effects</Data>
            <Data key="$extensions">$pluginsfolder/Extensions</Data>
            <Data key="$fileformats">$pluginsfolder/File Formats</Data>
            <Data key="$filters">$pluginsfolder/Filters</Data>
            <Data key="$imagestacks">$pluginsfolder/Image Stacks</Data>
            <Data key="$importexport">$pluginsfolder/Import-Export</Data>
            <Data key="$measurements">$pluginsfolder/Measurements</Data>
            <Data key="$panels">$pluginsfolder/Panels</Data>
            <Data key="$parser">$pluginsfolder/Parser</Data>
         <Data key="$3dengines">$pluginsfolder/3D Engines</Data>
            <Data key="$lightingstyles">$pluginsfolder/Filters/Lighting Styles</Data>
            <Data key="$matlab">$photoshopappfolder/MATLAB</Data>
            <Data key="UserExtensionFolder">$photoshopappfolder</Data>
            <Data key="$photoshop">$UserDataFolder/Adobe/Adobe Photoshop CS6/Configuration</Data>
            <Data key="DisplayName">Photoshop CS6 32</Data>
            <Data key="ProductName">Photoshop32</Data>
            <Data key="FamilyName">Photoshop</Data>
            <Data key="ProductVersion">13.0</Data>
            <Data key="IconPath">Configuration/PS_exman_24px.png</Data>
            <Data key="SupportedInSuite">CS6</Data>
            <Data key="HostNameForCSXS">PHSP</Data>
            <Data key="Bit">32</Data>
        </VariableForExMan> 
    </Configuration>
                                                                        Please someone help me i cant install any photoshop extension because of this issue,,,

    Waiting for your reply ...thanks
    Here is the results
    I installed photoshopcs6 illustrator cs6 dreamweaver cs6 illustrator cs6 in the system , But nothing seems
    Result: BridgeTalk Diagnostics
      Info:
      Name = estoolkit-3.8
      Status = PUMPING
      Path
      Version = 2.0
      Build = ES 4.2.12
      Next serial number = 40
      Logging: = OFF
      Now = 15:55:49
      Messages:
      Message Version = 2.05
      Authentication = ON
      Digest = ON
      Thread: estoolkit-3.8#thread
      Avg. pump interval = 55ms
      Last pump = 62ms ago
      Ping: 7
      ECHO_REQUEST: ECHO_RESPONSE
      Timeout = undefined
      Handler = undefined
      STATUS: PUMPING
      Timeout = undefined
      Handler = undefined
      MAIN: MAIN
      Timeout = undefined
      Handler = installed
      LAUNCHED: LAUNCHED
      Timeout = undefined
      Handler = installed
      DIAGNOSTICS: DIAGNOSTICS
      Timeout = undefined
      Handler = installed
      INFO: INFO
      Timeout = undefined
      Handler = installed
      SETUPTIME: thread=0ms, left=16ms
      Timeout = undefined
      Handler = undefined
      Instances: 3
      estoolkit-3.8#dbg:
      msg[15:55:49]: 00000035
      @BT>Version = 2.05
      Target = estoolkit-3.8#dbg
      Sender = estoolkit-3.8#dbg
      Sender-ID = localhost:win3788
      Timeout = 15:55:50
      Type = Ignore
      Response-Request = Timeout
      Headers = (no headers)
      Timestamp = 15:55:49
      Serial-Number = 35
      Received = undefined
      Result = undefined
      Error = undefined
      Body = (empty)
      Incoming: 1
      Outgoing: 0
      Handler: 9
      ExtendScript = for all messages
      Error = for only msg #25
      Error = for only msg #27
      Error = for only msg #31
      Result = for only msg #35
      Error = for only msg #35
      Timeout = for only msg #35
      Result = for only msg #37
      Error = for only msg #37
      estoolkit-3.8#estk:
      msg[15:55:49]: 00000037
      @BT>Version = 2.05
      Target = estoolkit-3.8#estk
      Sender = estoolkit-3.8#dbg
      Sender-ID = localhost:win3788
      Timeout = 16:05:49
      Type = Debug
      Response-Request = Result Error
      Headers = (no headers)
      Timestamp = 15:55:49
      Serial-Number = 37
      Received = undefined
      Result = undefined
      Error = undefined
      Body: 107 bytes
      Text = <get-properties engine="main" object="$.global" exclude="undefined,builtin,prototype" all="true" max="20"/>
      Incoming: 1
      Outgoing: 0
      Handler: 1
      ExtendScript = for all messages
      estoolkit-3.8: (main)
      Incoming: 0
      Outgoing: 0
      Handler: 1
      ExtendScript = for all messages
      Targets: 1
      Connector = PCD
      Installed: 0
      Running: 0
      exman-6.0:
      Path = C:\Program Files\Adobe\Adobe Extension Manager CS6\Adobe Extension Manager CS6.exe
      Display Name = Adobe Extension Manager CS6
      MsgAuthentication = ON
      MsgDigest = ON
      ESTK = OFF
      BundleID = com.adobe.exman
      Status = (not running)
      ExeName = Adobe Extension Manager CS6.exe
      Installed: 1
      Running: 0
      Groups = (no groups defined)

  • HELP NEEDED PLEASE

    Hi everyone
    Programming help needed here. Any advice would be greatly appreciated!!!
    I have been assigned some work for a program called Processing 1.0 availale at http://processing.org/download
    I was give the 9 individual programs I needed to make however they were converted to Java files from .pde files. The program is based on Java but only runs .pde files and NOTHING else!
    I decompiled the files and got the source code, but it is a slight variation of the original someone made in processing, and needs some tidying to get it to run.
    I think the programs are very simple for a programmer, although I AM NOT.
    CODE is BELOW
    // Decompiled by DJ v3.10.10.93 Copyright 2007 Atanas Neshkov Date: 02/05/2009 13:15:00
    // Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version!
    // Decompiler options: packimports(3)
    // Source File Name: Assign2_1.java
    import processing.core.PApplet;
    public class Assign2_1 extends PApplet
    public Assign2_1()
    SquareSide = 20;
    Rank = Nums.length;
    Side = SquareSide * Rank;
    Green = color(0, 255, 0);
    Yellow = color(255, 255, 0);
    BG = Yellow;
    public void setup()
    size(Side, Side);
    background(BG);
    fill(Green);
    for(int i = 0; i < Rank; i++)
    rect(i * SquareSide, 0.0F, SquareSide, SquareSide * Nums);
    public static void main(String args[])
    PApplet.main(new String[] {
    "--bgcolor=#ece9d8", "Assign2_1"
    int Nums[] = {
    6, 14, 8, 9, 2, 3, 4, 2, 8, 3,
    9, 2, 0, 5
    int SquareSide;
    int Rank;
    int Side;
    int Green;
    int Yellow;
    int BG;
    Edited by: chevy1 on May 2, 2009 7:32 AM

    HELP NEEDED PLEASEShouting is a good way ensure you don't get help. Also you should give a meaningful subject.
    Any advice would be greatly appreciated!!!I suggest you ask a question after providing enough information to be able to answer it.
    Also use CODE tags when posting code as it make the code more readable.
    We are more likely to help people who are trying to learn Java rather than someone who might be looking for an easy way out of doing an assignment.

  • Help needed to run JSTL 1.1 in Tomcat 6.0.16

    Hi All,Help needed to run JSTL 1.1 in Tomcat 6.0.16. I am trying to run the example given in http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html The example tries to connect to MySQL database from JSP using JSTL and JNDI Datasource.I am running the example using Eclipse 3.4.2 using Sysdeo plugin to start and stop Tomcat server from Eclipse IDE.
    My web.xml file has <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
    </web-app>
    and test.jsp has proper taglib directives
    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    I have placed the jstl.jar and standard.jarof the jakarta-taglibs-standard-1.1.2.zip under E:\Deepa\workspace\DBTest\WebContent\WEB-INF\lib directory also placedcontext.xml file under E:\Deepa\workspace\DBTest\WebContent\META-INF and the content of context.xml is as below
    <Context path="/DBTest" docBase="DBTest"
    debug="5" reloadable="true" crossContext="true">
    <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
    maxActive="100" maxIdle="30" maxWait="10000"
    username="deepa" password="mysql" driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
    </Context>
    Now while running the example, Eclipse creates one DBTest.xml file under C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\Catalina\localhost
    which has the following line:
    <Context path="/DBTest" reloadable="true" docBase="E:\Deepa\workspace\DBTest" workDir="E:\Deepa\workspace\DBTest\work" />
    I am getting the following error when running http://localhost/DBTest/WebContent/test.jsp
    in Browser:
    <HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/sql cannot be resolved in either web.xml or the jar files deployed with this application
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
    org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:315)
    org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:148)
    org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:431)
    org.apache.jasper.compiler.Parser.parseDirective(Parser.java:494)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1444)
    org.apache.jasper.compiler.Parser.parse(Parser.java:138)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:154)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:315)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    In the Tomcat Server console, I am getting the following error:
    INFO: Server startup in 7295 ms
    May 20, 2009 6:36:48 AM org.apache.jasper.compiler.TldLocationsCache processWebDotXml
    WARNING: Internal Error: File /WEB-INF/web.xml not found
    May 20, 2009 6:36:48 AM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/sql cannot be resolved in either web.xml or the jar files deployed with this application
    what is the problem with my code?
    When running the same example, by creating a local server in Eclipse(creating new Server connection pointing to same Tomcat 6.0 installation) it runs fine without any error.

    Hi evnafets,
    Wow, very helpful information, great insight into working of Eclipse. Thanks a lot.
    I have one more question. I have a context.xml file under {color:#0000ff}E:\Deepa\workspace\DBTest\WebContent\META-INF{color} folder and that has the Resource element to connect to MySQL database:
    {code{color:#000000}}{color}<Context path="/DBTest" docBase="DBTest" debug="5" reloadable="true" crossContext="true">
    <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="deepa" password="mysql" driverClassName="com.mysql.jdbc.Driver"
    {color:#0000ff}url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>{color}
    {color:#0000ff}</Context>{color}As usual when running application in local Tomcat server of Eclipse, this data source works fine. But when I run the application on Tomcat, by starting Sysdeo plugin from Eclipse, the DBTest.xml file created in C:\Tomcat 6.0\conf\Catalina\localhost has the context entry as<Context path="/DBTest" reloadable="true" docBase="E:\Deepa\workspace\DBTest\WebContent" workDir="E:\Deepa\workspace\DBTest\work">
    </Context>The<Resource> element I have specified in the context.xml of \WebContent\META-INF folder is not taken into account by Tomcat and it gives the following error:May 21, 2009 5:20:04 AM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException_: Cannot create JDBC driver of class '' for connect URL 'null'"
    _at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(_QueryTagSupport.java:276_)
    at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(_QueryTagSupport.java:159_)
    at org.apache.jsp.test_jsp._jspx_meth_sql_005fquery_005f0(_test_jsp.java:113_)
    at org.apache.jsp.test_jsp._jspService(_test_jsp.java:66_)
    at org.apache.jasper.runtime.HttpJspBase.service(_HttpJspBase.java:70_)
    at javax.servlet.http.HttpServlet.service(_HttpServlet.java:717_)
    at org.apache.jasper.servlet.JspServletWrapper.service(_JspServletWrapper.java:374_)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(_JspServlet.java:342_)
    at org.apache.jasper.servlet.JspServlet.service(_JspServlet.java:267_)
    at javax.servlet.http.HttpServlet.service(_HttpServlet.java:717_)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(_ApplicationFilterChain.java:290_)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(_ApplicationFilterChain.java:206_)
    at org.apache.catalina.core.StandardWrapperValve.invoke(_StandardWrapperValve.java:233_)
    at org.apache.catalina.core.StandardContextValve.invoke(_StandardContextValve.java:191_)
    at org.apache.catalina.core.StandardHostValve.invoke(_StandardHostValve.java:128_)
    at org.apache.catalina.valves.ErrorReportValve.invoke(_ErrorReportValve.java:102_)
    at org.apache.catalina.core.StandardEngineValve.invoke(_StandardEngineValve.java:109_)
    at org.apache.catalina.connector.CoyoteAdapter.service(_CoyoteAdapter.java:286_)
    at org.apache.coyote.http11.Http11Processor.process(_Http11Processor.java:845_)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(_Http11Protocol.java:583_)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(_JIoEndpoint.java:447_)
    at java.lang.Thread.run(_Thread.java:619_)
    {code}
    So to overcome this error I had to place the <Resource> element in DBTest.xml under C:\Tomcat 6.0\conf\Catalina\localhost {color:#000000}and then it works fine. {color}{color:#ff0000}*Why is the context.xml file in META-INF not considered by Tomcat server using Sysdeo Plugin?*
    *Thanks,*
    *Deepa*{color}
    {color}
    Edited by: Deepa76 on May 26, 2009 9:32 PM

  • Help needed in setting up Japanese Database

    Hi there,
    Help needed in setting up Japanese Database.
    I created database with UTF8 character set on Sun Solaris O/S.
    Oracle version 8.1.7.
    I am accessing the DB through SQL*Plus (Windows client).
    I downloaded the Japanese font on client side and also set the NLS_LANG environment variable to Japanese_Japan.UTF8. Still, I am not able to view Japanese characters. O/S on client side is Windows 2000 professional (English). Is O/S (client) need to be Japanese O/S? When I try to retrieve sysdate, its displaying in Japanese but not all characters in Japanese. Can anyone help me out how to set up the client and is there any parameters to be setup at server side? I also tried to insert japanese characters into table through client, but it displaying as "?????" characters. Any help in this regard is appreciated.
    Thanks in advance,
    -Shankar

    lol
    your program is working just fine.
    do you know what accept does? if not read below.
    serversocket.accept() is where java stops and waits for a (client)socket to connect to it.
    only after a socket has connected wil the program continue.
    try putting the accept() in its own little thread and let it wait there while your program continues in another thread

  • EDI IDOC generation for interface with Vendor software help needed.

    EDI IDOC help needed.
    We are NOT an EDI shop, but have a project to output data to Sales Force.com
    Sales Force requests IDOC output - eg. 810 Outbound Invoice.
    We will need to do a historical load of Orders/Quotes/Invoices from the past 2 years.
    Is there a function module or series of FM's that are used to generate the E2EDKxxxxx type segments?
    I have been testing using the IDOC_OUTPUT_INVOIC and IDOC_OUTPUT_ORDRSP FM's, but they generate segments begining with E1EDKxxxxx.
    Basicall we have a report program that the user enteres in the date range of Order/Quotes/Invoices they wish to extract, the the program needs to output a flat file (.txt) on the server which is then picked up by Sales Force.com.
    Also, is there a way to have in the Partner Profile a generic Partner under the "Type KU" that can be used for all orders/invoices so I don't have to create a KU Partner Type for each and every Sold-To customer we have?
    I am very new to EDI so any help would be greatly appreciated.
    Thanks.
    Scott.

    Hi Scott,
    We will need to do a historical load of Orders/Quotes/Invoices from the past 2 years.
    I know it's very tempting to use an interface for such loads if you anyhow have to create one. However, often the volume alone speaks against interface usage for such scenarios.
    Is there a function module or series of FM's that are used to generate the E2EDKxxxxx type segments? I have been testing using the IDOC_OUTPUT_INVOIC and IDOC_OUTPUT_ORDRSP FM's, but they generate segments begining with E1EDKxxxxx.
    Well, the E2* segments basically reflect the external name of the IDoc segment, whereas the function modules you're referring to basically just create an internal version of the IDoc. Once the IDoc framework then passes the IDocs to the partner, the segment names usually (depends on how the IDocs are passed on) get converted to their external name. If there are multiple versions of a segment, then the version number will be appended to the segment name.
    Note that IDoc segment definitions are only partially stored in the data dictionary. If you want to see all versions you should always use transaction WE31 to look at segments. There you can also see for example for E1EDK01 the several versions and when you then use in SE37 function module SEGMENT_EXTERNAL_NAME_GET you will see what SAP produces as the external name for segment E1EDK01. This function module is basically the one that handles the segment name translations.
    Ignore the comments for subsystem, this is basically an option in SAP to possibly trigger further external tools (e.g. mapping etc.) for handling the outbound IDocs.
    Again, the funny thing is that via the WE30 transaction, if i put in INVOIC02 as the Obj. name and see the segments, i can see that E2EDK01 there is a version 005, but if i go to SE11 and put in E2EDK01005 structure line and i get a "not found". We just have up to E2EDK01002.
    In the old days SAP used to generate E1, E2 and E3* structures in the data dictionary (SE11). The E1* structure reflected the character type representation of an IDoc segment, whereas the other two (definition and documentation) contained actual references to data elements (e.g. if you used a quantity field). However, in newer releases those dictionary structures (E2* & E3*) are no longer generated, because they're superfluous (meta data defined via WE31 is sufficient).
    Cheers, harald

Maybe you are looking for