Help me debug jdbc code

hi
can anyone help me debug my code? no compilation errors or exceptions thrown. but it's not working like i want it to
createAccount() calls insertAccount() which calls getNextID() which calls selectNextID()
this should create a new account, with an account id selected from the db and incremented +1. so if i create 100 accounts, it should number accounts 1-100, the lastkey table in the db should have a value 100 for account_lastkey when i'm done.
what happens is that 100 accounts are created, all with account number 0. somehow my getNextID() and selectNextID() methods are not working. please help
   * createAccount is used by administrator to add a new Account
   * in the system.
   * @param newAccount AccountEntryStruct containing data for new account
   * @return int the new unique Account ID
   * @exception com.kafein.idl.exceptions.DataValidationException
  public int createAccount(AccountEntryStruct newAccount) throws
    DataValidationException {
    validateData (newAccount); // throws DataValidationException;
    int accountID = 0;     
    // Create new Account.
    Account anAccount = new Account(accountID,
                        newAccount.userName,
                        newAccount.userEmail,
                        newAccount.creditCardType,
                        newAccount.creditCardNumber,
                        newAccount.creditCardExpirationDate.year,
                        newAccount.creditCardExpirationDate.month,
                        newAccount.userPassword,
                        newAccount.initialBalance);
    // Insert here / call method insertAccount() pass it in an account object
    // or call manager object - accountmanager.put()
    // Insert Account into Database
    try {
        insertAccount(anAccount);
    catch(Exception e) {
           e.printStackTrace();       
    accounts.put(accountID,anAccount);
    return accountID;
   * getNextID is used to generate a unique ID.
   * @return int an Account ID
  protected synchronized int getNextID() {
    int nextAccountID=0;
    try {
         nextAccountID = selectNextID();
    catch(Exception e) {
           e.printStackTrace();       
    return nextAccountID;
   * jdbc related methods
  private int selectNextID() throws Exception {
       int account_lastkey;
       try {
            Statement statement = connection.createStatement();
            ResultSet rs = statement.executeQuery(
                "Select ACCOUNT_LASTKEY from LASTKEY");
            System.out.println("Account Lastkey");
            //while (rs != null && rs.next()) {
             rs.next();
                account_lastkey = rs.getInt(1);
                System.out.println(account_lastkey);
            connection.commit();
            statement.close();
           //return account_lastkey;
           return account_lastkey;
        } catch(Exception e) {
            System.err.println("System Exception in selectNextID");
            System.err.println(e);
            throw e;
   * insertAccount is used to insert a new Account in the Database
   * @param int AccountID
   * @return AccountStruct containing data for the existing Account
  private void insertAccount(Account anAccount) throws Exception {
          AccountStruct anAccountStruct = anAccount.getAccountStruct();  
     String  acct_username    = anAccountStruct.userName;
        String  acct_useremail = anAccountStruct.userEmail;
     String  acct_cc_type = anAccountStruct.creditCardType;
        String  acct_cc_number = anAccountStruct.creditCardNumber;
     int acct_cc_expyr = anAccountStruct.creditCardExpirationDate.year;
        int acct_cc_expmo = anAccountStruct.creditCardExpirationDate.month;
        String  acct_userpassword = anAccountStruct.userPassword;
        float     acct_userbalance = anAccountStruct.accountBalance;
        int     acct_id = getNextID();
     try {
            System.out.println("Inserting data...");
            connection.setAutoCommit(false);
         // Calculate Start time
            Log.debug("Starting data insertion ( 1" +
                " row) into ACCOUNT table..");
            long startTime = System.currentTimeMillis();
            preparedStatement = connection.prepareStatement(
                "INSERT INTO ACCOUNT (ACCT_ID, ACCT_USERNAME, ACCT_USEREMAIL, ACCT_CC_TYPE, ACCT_CC_NUMBER, " +
                "ACCT_CC_EXPYR, ACCT_CC_EXPMO, ACCT_USERPASSWORD, ACCT_USERBALANCE) VALUES ( ?, ?, ?, ?, ?, ? , ?, ?, ?)");
                //acct_id  = 1000;
                preparedStatement.setInt(1, acct_id);
                preparedStatement.setString(2, acct_username);
                preparedStatement.setString(3, acct_useremail);
                preparedStatement.setString(4, acct_cc_type);
                preparedStatement.setString(5, acct_cc_number);
                preparedStatement.setInt(6, acct_cc_expyr);
                preparedStatement.setInt(7, acct_cc_expmo);
                preparedStatement.setString(8, acct_userpassword);
                preparedStatement.setFloat(9, acct_userbalance);
          preparedStatement.executeUpdate();
                connection.commit();
            preparedStatement = connection.prepareStatement(
                "UPDATE LASTKEY SET ACCOUNT_LASTKEY = ?");
            preparedStatement.setInt(1, acct_id);
          preparedStatement.executeUpdate();
                connection.commit();
         System.out.println("1 account created.");
            preparedStatement.close();
            long stopTime = System.currentTimeMillis();
            Log.debug("Account table load complete.");
            Log.debug("Load time = " +
                               ((stopTime - startTime)/(1000f)) + " seconds");
            Log.debug("Data insertion complete");
        } catch(Exception e) {
            System.err.println("System Exception in loadData");
            System.err.println(e);
            throw e;
 

thank you for responding!
well, i tried changine the line in createAccount() from int accountID=0; to intaccountID=1111;
this does not create 100 accounts with id 1111 - it still creates 100 accounts with id 0, so that's why, even though this method definitely needs work, i don't think that this is the line that's causing identical id's of 0 to be generated.

Similar Messages

  • Picking problem.Can anyone help me debug my code?

    Can someone help me debug my code?
    I try to pick a ColorCube,
    but when I pick a ColorCube in my scene,
    I get the following error message:
    Exception occurred during Behavior execution:
    javax.media.j3d.CapabilityNotSetException: GeometryArray: no capability to get v
    ertex count
    at javax.media.j3d.GeometryArray.getVertexCount(GeometryArray.java:581)
    at com.sun.j3d.utils.picking.PickResult.intersect(PickResult.java:654)
    at com.sun.j3d.utils.picking.PickResult.generateIntersections(PickResult
    .java:635)
    at com.sun.j3d.utils.picking.PickResult.numIntersections(PickResult.java
    :422)
    at com.sun.j3d.utils.picking.PickTool.pickGeomAllSortedIntersect(PickToo
    l.java:854)
    at com.sun.j3d.utils.picking.PickTool.pickGeomClosestIntersect(PickTool.
    java:915)
    at com.sun.j3d.utils.picking.PickTool.pickClosest(PickTool.java:566)
    at SimpleBehaviorApp$SimpleBehavior.processStimulus(SimpleBehaviorApp.ja
    va:119)
    at javax.media.j3d.BehaviorScheduler.doWork(BehaviorScheduler.java:172)
    at javax.media.j3d.J3dThread.run(J3dThread.java:250)
    when i try to run the following code:
    import java.applet.Applet;
    import java.awt.BorderLayout;
    import java.awt.Frame;
    import java.awt.GraphicsConfiguration;
    import com.sun.j3d.utils.applet.MainFrame;
    import com.sun.j3d.utils.geometry.ColorCube;
    import com.sun.j3d.utils.picking.*;
    import com.sun.j3d.utils.universe.SimpleUniverse;
    import javax.media.j3d.*;
    import javax.vecmath.*;
    import javax.swing.JOptionPane;
    import java.awt.event.*;
    import java.util.Enumeration;
    // SimpleBehaviorApp renders a single ColorCube
    // that rotates when any key is pressed.
    public class SimpleBehaviorApp extends Applet
    BranchGroup objRoot;
    Canvas3D canvas3D;
    public SimpleBehaviorApp()
    setLayout(new BorderLayout());
    GraphicsConfiguration config =
    SimpleUniverse.getPreferredConfiguration();
    canvas3D = new Canvas3D(config);
    add("Center", canvas3D);
    BranchGroup scene = createSceneGraph();
    // SimpleUniverse is a Convenience Utility class
    SimpleUniverse simpleU = new SimpleUniverse(canvas3D);
    simpleU.getViewingPlatform().setNominalViewingTransform();
    simpleU.addBranchGraph(scene);
    } // end of SimpleBehaviorApp (constructor)
    public BranchGroup createSceneGraph()
    // Create the root of the branch graph
    objRoot = new BranchGroup();
    objRoot.setCapability(BranchGroup.ALLOW_PICKABLE_READ);
    objRoot.setCapability(BranchGroup.ALLOW_PICKABLE_WRITE);
    objRoot.setCapability(BranchGroup.ENABLE_PICK_REPORTING);
    objRoot.setCapability(BranchGroup.ALLOW_AUTO_COMPUTE_BOUNDS_READ);
    objRoot.setCapability(BranchGroup.ALLOW_AUTO_COMPUTE_BOUNDS_WRITE);
    ColorCube ca=new ColorCube(0.4);
    ca.setCapability(ColorCube.ALLOW_PICKABLE_READ);
    ca.setCapability(ColorCube.ALLOW_PICKABLE_WRITE);
    ca.setCapability(ColorCube.ALLOW_GEOMETRY_READ);
    ca.setCapability(ColorCube.ALLOW_GEOMETRY_WRITE);
    ca.setCapability(ColorCube.ENABLE_PICK_REPORTING);
    ca.setCapability(ColorCube.ALLOW_BOUNDS_READ);
    ca.setCapability(ColorCube.ALLOW_AUTO_COMPUTE_BOUNDS_READ);
    ca.setPickable(true);
    objRoot.addChild(ca);
    SimpleBehavior myRotationBehavior = new SimpleBehavior(objRoot,canvas3D);
    myRotationBehavior.setSchedulingBounds(new BoundingSphere());
    objRoot.addChild(myRotationBehavior);
    // Let Java 3D perform optimizations on this scene graph.
    objRoot.compile();
    return objRoot;
    } // end of CreateSceneGraph method of SimpleBehaviorApp
    //�������OSimpleBehavior�����@���������������u��
    public class SimpleBehavior extends Behavior
    private TransformGroup targetTG;
    private Transform3D rotation = new Transform3D();
    private WakeupCondition wCond;
    private PickCanvas pickCanvas;
    // create SimpleBehavior
    public SimpleBehavior(BranchGroup targetBG,Canvas3D canvas3D)
    wCond=new WakeupOnAWTEvent(MouseEvent.MOUSE_PRESSED);
    pickCanvas=new PickCanvas(canvas3D,targetBG);
    pickCanvas.setTolerance(5.0f);
    pickCanvas.setMode(PickCanvas.GEOMETRY_INTERSECT_INFO);
    public void initialize()
    // set initial wakeup condition
    this.setSchedulingBounds(new BoundingSphere(new Point3d(),300));
    this.wakeupOn(wCond);
    public void processStimulus(Enumeration criteria)
    PickResult pickResult;
    MouseEvent event=(MouseEvent)((WakeupOnAWTEvent) criteria.nextElement()).getAWTEvent()[0];
    pickCanvas.setShapeLocation(event);
    Point3d eyePos=pickCanvas.getStartPosition();
    if(pickCanvas.pickClosest()!=null)
    pickResult=pickCanvas.pickClosest();
    Node node=pickResult.getObject();
    PickTool.setCapabilities(node,PickTool.INTERSECT_FULL);
    else
    JOptionPane.showMessageDialog(null,"pickCanvas.pickClosest()������");
    this.wakeupOn(wCond);
    } // end of class SimpleBehavior
    public static void main(String[] args)
    Frame frame = new MainFrame(new SimpleBehaviorApp(), 256, 256);
    } // end of main (method of SimpleBehaviorApp)
    } // end of class SimpleBehaviorApp

    Hi Tinyuh,
    ColorCube?? I learnt thru mistakes. YEPThe following code creates a pickable colorcube.. it works for me!
         public BranchGroup addObject(Vector3d vector)
              BranchGroup branch = new BranchGroup();
              branch.setCapability(BranchGroup.ENABLE_PICK_REPORTING);
              branch.setCapability(BranchGroup.ALLOW_DETACH);
              TransformGroup trans = new TransformGroup();
              trans.setBounds(new BoundingSphere());
              Transform3D t3d = new Transform3D();
              t3d.setTranslation(vector);
              trans.setTransform(t3d);
              branch.addChild(trans);
              ColorCube cube = new ColorCube(0.5d);
              cube.setCollidable(true);
              cube.setCapability(Shape3D.ALLOW_GEOMETRY_READ);
              cube.setCapability(Shape3D.ALLOW_GEOMETRY_WRITE);
                    cube.setCapability(Shape3D.ALLOW_COLLIDABLE_READ);
              cube.setPickable(true);
              trans.addChild(cube);
              return branch;

  • Please help me debug this code!

    HELP! I can't figure out where I'm going wrong. Thank you.
    import java.lang.Math.*;
    import java.io.*;
    public class Feature_Recognizer {
         Vertices vertices;   /* storage bin for vertices*/
         Edges edges;         /* storage bin for edges*/
         Faces faces;         /* storage bin for faces*/
         /*** Reads file and stores data into vertices, edges, and faces bins ***/
         void readFile(String file)
              BufferedReader inputFile = null; /*start reading the input file*/
              String[] info;
              String temp;
              /*need to fix io exceptions in java.lang
               * They need to be caught or declared to be thrown*/
              try{
                   inputFile = new BufferedReader(new FileReader(file));
              catch (FileNotFoundException e){
                   System.out.println("File named"+file+"does not exist");
                   return;
              catch (IOException e){
                   System.out.println("IO Exception.  Error reading from:"+file);
                   return;
                  /*begin reading in data array, set into vertices/edges/faces*/                         
                   inputFile.readLine();                                   /* will skip comments in input files*/
                   temp = inputFile.readLine();                            /* store number of vertices*/
                   vertices = new Vertices(Integer.parseInt(temp.trim())); /* initialize the vertices based on data array*/
                   inputFile.readLine();                                   /* will skip comments in input files*/
                   /* store vertices*/
                   int i=0;
                   while(i++<vertices.total)
                        temp = inputFile.readLine();
                        info = temp.split(" ");
                        vertices.addVertex(Double.parseDouble(info[0]),Double.parseDouble(info[1]),Double.parseDouble(info[2]));
                   inputFile.readLine();                             /* will skip comments in input files*/
                   temp = inputFile.readLine();                      /* store number of edges*/
                   edges = new Edges(Integer.parseInt(temp.trim())); /* initialize the edges based on the data array*/
                   inputFile.readLine();                             /* will skip comments in input files*/
                   /* store edges*/
                   int i1=0;
                   while(i1++<edges.total)
                        temp = inputFile.readLine();
                        info = temp.split(" ");
                        edges.addEdge(vertices.getVertex(Integer.parseInt(info[0])),
                             vertices.getVertex(Integer.parseInt(info[1])),
                             Integer.parseInt(info[2]));
                   inputFile.readLine();                             /* will skip comments in input files*/
                   temp = inputFile.readLine();                      /* store number of faces*/
                   faces = new Faces(Integer.parseInt(temp.trim())); /* initialize faces based on the data array*/
                   inputFile.readLine();                             /* will skip comments in input files*/
                   /* store faces*/
                   int i2=0;
                   while(i2++<faces.total)
                        /* input # of edges*/
                        temp = inputFile.readLine();
                        faces.addFace(Integer.parseInt(temp.trim()));
                        /* input faces*/
                        temp = inputFile.readLine();
                        info = temp.split(" ");
                        int j=0;
                        while(j++<faces.getFace(i2).Edge_Totals)
                             if(Integer.parseInt(info[j]) < 0)
                                  faces.getFace(i2).edges.addEdge(edges.getEdge(Math.abs(Integer.parseInt(info[j]))),true);
                             else
                                  faces.getFace(i2).edges.addEdge(edges.getEdge(Math.abs(Integer.parseInt(info[j]))),false);
                        /* input normal vector*/
                        temp = inputFile.readLine();
                        info = temp.split(" ");
                        int j1=0;
                        while(j1++<3)
                             faces.getFace(i2).normal[j1] = Integer.parseInt(info[j1]);
                   /***possibly place another IO exception in here
                   catch (IOException e){
                   System.out.println("IO Exception");
                   return;
         /*** State Classes: edge, face, vertex ***/
         /* Nested Edge object class*/
         class Edge{
                   int identity,           /* identity of edge*/
                        type;               /* concave or convex?*/
                   Vertices vertices;      /* vertices that make up the edge*/
                   Faces faces;            /* faces corresponding to the edge*/
                   double length;          /* length of edge*/
                   /* Edge class constructor*/
                   Edge(int IDENTITY, Vertex A, Vertex B, int TYPE)
                        identity = IDENTITY;
                        vertices = new Vertices(2);
                        vertices.addVertex(A);
                        vertices.addVertex(B);
                        type = TYPE;
                        faces = new Faces(2);
                   /* Length_Calculator will compute the length of edge*/
                 void Length_Calculator()
                        length = Math.pow( (vertices.getVertex(2).x - vertices.getVertex(1).x)*(vertices.getVertex(2).x - vertices.getVertex(1).x)
                                 + (vertices.getVertex(2).y - vertices.getVertex(1).y)*(vertices.getVertex(2).y - vertices.getVertex(1).y)
                                  + (vertices.getVertex(2).z - vertices.getVertex(1).z)*(vertices.getVertex(2).z - vertices.getVertex(1).z)
                                 , .5 );
                   /* getFaces finds the faces which are related to the edge
                   (returns the runtime class of an object)*/
                 void getFaces()
                        int i=1;
                        while( i++ <=Feature_Recognizer.this.faces.total){
                             int j=1;
                             while(     j++<=Feature_Recognizer.this.faces.getFace(i).Edge_Totals){
                                  if(identity == Feature_Recognizer.this.faces.getFace(i).edges.getEdge(j).identity){
                                       faces.addFace(Feature_Recognizer.this.faces.getFace(i));
         /* Edges object class (Edge bin)nested Edges Class*/
         class Edges
                   int index,       /* current index in array*/
                        total;       /* total number of edges*/
                   Edge[] edges;    /* actual edges bin*/
                   boolean[] sign;  /* positive or negative (for face object)*/
                   /* Edges class constructor*/
                   Edges(int Edge_Totals)
                        index = 0;
                        total = Edge_Totals;
                        edges = new Edge[Edge_Totals];
                        sign = new boolean[Edge_Totals];
                   /* method to add an already existing Edge object*/
                   void addEdge(Edge e)
                        edges[index++] = e;
                   /* method to an already existing Edge object*/
                   /* and state if it is negative or positive (for faces only)*/
                   void addEdge(Edge e, boolean isNegative)
                        sign[index] = isNegative;
                        edges[index++] = e;
                   /* method to create and add an Edge object*/
                   void addEdge(Vertex a, Vertex b, int type)
                        edges[index++] = new Edge(index,a,b,type);
                   /* returns the Edge corresponding to its identity*/
                   Edge getEdge(int identity)
                        return edges[identity-1];
                   /* finds the lengths and faces of each Edge in the bin*/
                   void Edge_Stats()
                        int i=0;
                        while(i++<total){
                             edges.Length_Calculator();
                             edges[i].getFaces();
         /* Face object class nested face class*/
         class Face
                   int identity, /* edge identity*/
                        Edge_Totals; /* number of edges that make up the face*/
                   Edges edges; /* edges that make up the face*/
                   int[] normal; /* the vector of the normal to the face*/
                   /* Face class constructor*/
                   Face(int IDENTITY, int numE)
                        identity = IDENTITY;
                        Edge_Totals = numE;
                        edges = new Edges(numE);
                        normal = new int[3];
         /* Faces object class (Face bin)nested faces class*/
         class Faces
                   int index, /* current index in array*/
                        total; /* total number of Faces*/
                   Face[] faces; /* actual faces bin*/
                   /* Faces class constructor*/
                   Faces(int numFaces)
                        index = 0;
                        total = numFaces;
                        faces = new Face[numFaces];
                   /* method to sum an already existing Face object*/
                   void addFace(Face f)
                        faces[index++] = f;
                   /* method to create and sum a Face object*/
                   void addFace(int numE)
                        faces[index++] = new Face(index,numE);
                   /* returns the Face corresponding to its identity*/
                   Face getFace(int identity)
                        return faces[identity-1];
         /* Vertex object class nested vertex class*/
         class Vertex
                   int identity; /* vertex identity*/
                   double x,y,z; /* coordinates*/
                   /* Vertex class constructor*/
                   Vertex(int IDENTITY, double X, double Y, double Z)
                        identity = IDENTITY;
                        x = X;
                        y = Y;
                        z = Z;
              /* Vertices object class (Vertex bin)nested vertices bin*/
         class Vertices
                   int index, /* current index in array*/
                        total; /* total number of vertices*/
                   Vertex[] points; /* actual Vertex bin*/
                   /* Vertices class constructor*/
                   Vertices(int numVertices)
                        index = 0;
                        total = numVertices;
                        points = new Vertex[numVertices];
                   /* method to add an already existing Vertex object*/
                   void addVertex(Vertex v)
                        points[index++] = v;
                   /* method to create and add a Vertex object*/
                   void addVertex(double x, double y, double z)
                        points[index++] = new Vertex(index,x,y,z);
                   /* returns the Vertex corresponding to it's identity*/
                   Vertex getVertex(int identity)
                        return points[identity-1];
    /* displays each edge's type based on data array and the corresponding faces to that edge*/
         void printEdges_Found(){
              String shape;
              System.out.println("Edge\tType\tFaces");
              int i=0;
              while(i++<edges.total){
                   if(edges.getEdge(i).type == 0)
                        shape = "Concave";
                   if(edges.getEdge(i).type == 1)
                        shape = "Convex";
                   else
                        println("Input file must have 0 or 1 for shape type");
                   System.out.println(i + "\t" + shape + "\t" + edges.getEdge(i).faces.getFace(1).identity
                                       + ", " + edges.getEdge(i).faces.getFace(2).identity + "\t");
              System.out.println();
         /* VRML output file maker*/
         void VRML_Output(String file)
              PrintStream outputFile = null;
                   outputFile = new PrintStream(new FileOutputStream(file));
              outputFile.println("#VRML V2.0 utf8");
              outputFile.println("\tShape{");
              outputFile.println("\t\tgeometry IndexedFaceSet{");
              outputFile.println("\t\t\tcoord Coordinate{");
              outputFile.print("\t\t\t\tpoint[  ");
              int i=0;
              while(i++<vertices.total){
                   if(i > 0)
                        if(i%4 == 0) {
                             outputFile.println("\n");
                             outputFile.print("\t\t\t\t\t");
                   outputFile.print(vertices.getVertex(i+1).x + " " + vertices.getVertex(i+1).y
                                       + " " + vertices.getVertex(i+1).z);
                   if(i != vertices.total-1)
                        outputFile.print(",");
              outputFile.println("]");
              outputFile.println("\t\t\t}");
              outputFile.print("\t\t\tcoordIndex[");
              int i3=1;
              while(i3++<=faces.total){
                   int j2=0;
                   while(j2++<faces.getFace(i3).edges.total){
                        if(faces.getFace(i3).edges.sign[j2])
                             outputFile.print(faces.getFace(i3).edges.getEdge(j2+1).vertices.getVertex(1).identity-1 + ", ");
                        else
                             outputFile.print(faces.getFace(i3).edges.getEdge(j2+1).vertices.getVertex(2).identity-1 + ", ");
                   outputFile.println("-1");
                   if(i != faces.total)
                        outputFile.print("\t\t\t\t ");
              outputFile.println("\t\t\t]");
              outputFile.println("\t\t}");
              outputFile.println("\t}");
              outputFile.close();
         /*** feature recognition step:***/
         /* finds the slots*/
         void Slot_Finder()
              int i=1;
                   while(i++<=edges.total){
                   double L=0.0, W=0.0, H=0.0;
                   if(edges.getEdge(i).type == 0) {
                        int vertexID = edges.getEdge(i).vertices.getVertex(1).identity;
                        int j=1;
                        while(j++<=edges.total)
                             if(vertexID == edges.getEdge(j).vertices.getVertex(1).identity || vertexID == edges.getEdge(j).vertices.getVertex(2).identity){
                                  if(edges.getEdge(j).vertices.getVertex(1).z - edges.getEdge(j).vertices.getVertex(2).z != 0)
                                       H = edges.getEdge(j).length;
                                  else
                                       if(edges.getEdge(j).length > L){
                                            W = L;
                                            L = edges.getEdge(j).length;
                                       else
                                            W = edges.getEdge(j).length;
                        System.out.println("A slot was found at edge #" + i + " with length " + L + ", width " + W + " and height " + H);
         /* finds the bases*/
         void Base_Finder()
              int i=1;
              while(i++<=faces.total)
                   if(faces.getFace(i).normal[2] == -1)
                        double L, W;
                        if (faces.getFace(i).edges.getEdge(1).length >= faces.getFace(i).edges.getEdge(2).length )
                             L = faces.getFace(i).edges.getEdge(1).length; W = faces.getFace(i).edges.getEdge(2).length;
                        else
                             L = faces.getFace(i).edges.getEdge(2).length; W = faces.getFace(i).edges.getEdge(1).length;
                        System.out.println("A base was found at face #" + i + " with length " + L + " and width " + W);
    /* finds the ribs*/
         void Rib_Finder()
              int i=1;
              while(i++<=faces.total){
                   if(faces.getFace(i).normal[2] == 1) {
                        double L, W;
                        if ( faces.getFace(i).edges.getEdge(1).length >= faces.getFace(i).edges.getEdge(2).length ){
                             L = faces.getFace(i).edges.getEdge(1).length; W = faces.getFace(i).edges.getEdge(2).length;
                        else {
                             L = faces.getFace(i).edges.getEdge(2).length; W = faces.getFace(i).edges.getEdge(1).length;
                        if(W < 1.5 && faces.getFace(i).edges.getEdge(1).type == 1 && faces.getFace(i).edges.getEdge(2).type == 1)
                             System.out.println("A rib was found at face #" + i + " with length " + L + " and width " + W);
         /*** main program***/
         public static void main(String[] args) {
                   Feature_Recognizer a = new Feature_Recognizer();
                   a.readFile(args[0]);
                   a.edges.Edge_Stats();
                   a.Edges_Found();
                   a.VRML_Output(args[1]);
                   a.Slot_Finder();
                   a.Base_Finder();
                   a.Rib_Finder();
         }/*main ends here*/

    Try formatting your code better. Or use an auto formatter.
    You have too many '}' before this statement delete one.
    There is no such package as java.lang.Math
    You have about 4 more bugs to fix to get it to compile.
    Nearly there.

  • Please help me debug my code

    Hi guys! Kindly Check my codes. I'm having a hard time to debug it. I have the same records on the first 2 rows. 
      DATA: BEGIN OF lt_skills OCCURS 0,
                  qid TYPE hrobjid,
                  qkid TYPE hrobjid,
                  qgrp TYPE stext,
                  qname     TYPE stext,
                  scale_id TYPE     scale_id,
                  adatanr TYPE hradatanr,
                  pstext     TYPE profc_text,
                  rating     TYPE rating.
      DATA: END OF lt_skills.
    Qualification Name                 - QID, QNAME
      SELECT DISTINCT x~objid
                      y~stext
                      x~adatanr
         INTO (lt_skills-qid,
               lt_skills-qname,
               lt_skills-adatanr)
        FROM HRP1001 as x JOIN HRP1000 as y
               ON xobjid = yobjid
               AND xotype = yotype
               AND xotjid = yotjid
               AND xplvar = yplvar
        WHERE y~langu = 'E'
         AND x~sobid = employee_no
          AND x~plvar = '01'
         AND x~subty = 'B032'
          AND x~otype = 'Q'.
    Qualification Group                - QKID, QGRP
        IF lt_skills-qid IS NOT INITIAL.
          SELECT SINGLE x~objid
                        y~stext
           INTO (lt_skills-qkid,
                 lt_skills-qgrp)
          FROM HRP1001 as x JOIN HRP1000 as y
                 ON xobjid = yobjid
                 AND xotype = yotype
         WHERE y~langu = 'E'
            AND x~sobid = lt_skills-qid
           AND x~subty = 'BO30'
            AND y~otype = 'QK'.
    SCALE                         -  SCALE
          IF lt_skills-qkid IS NOT INITIAL.
            SELECT SINGLE scale
            INTO lt_skills-scale_id
            FROM HRP1033
            WHERE objid = lt_skills-qkid
              AND  otype = 'QK'.
    RATING                               - RATING
            IF lt_skills-scale_id IS NOT INITIAL.
              SELECT SINGLE chara
              INTO lt_skills-rating
              FROM HRPAD31
              WHERE adatanr = lt_skills-adatanr.
    PROFICIENCY                      - PROFICIENCY TXT
              IF lt_skills-rating IS NOT INITIAL.
                SELECT SINGLE pstext
                INTO lt_skills-pstext
                FROM T77TP
                WHERE langu = 'E'
                AND scale_id = lt_skills-scale_id
                AND rating = lt_skills-rating.
                IF sy-subrc EQ 0.
                  APPEND lt_skills.
                  CLEAR lt_skills.
                ENDIF.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDSELECT.
    Move Internal Table to SKILLS
      DATA:         limit TYPE string,
            qgroup TYPE string.
      READ TABLE lt_skills.
      LOOP AT lt_skills.
        CASE lt_skills-scale_id.
    SKILLS
          WHEN '9' OR '10'.
            skills-qid = lt_skills-qid.
            skills-qname = lt_skills-qname.
            skills-scale_id  = lt_skills-scale_id.
            IF sy-subrc IS NOT INITIAL.
              APPEND skills.
              CLEAR skills.
            ENDIF.
        ENDCASE.
      ENDLOOP.
    THE OUTPUT:
          7    Entries                                                                               
    QNAME                QID      SCALE_ID    
    Layout               50000372 00000009    
    Layout               50000372 00000009    
    Cutting              50000373 00000009    
    Machining            50000374 00000009    
    Assembly             50000375 00000009    
    Pipe Installation    50000376 00000009    
    Welding/Gouging      50000380 00000010   
    THANKS!

    Hi,
    The duplicate entries could be coming from the first SELECT on HRP1001.. You can get rid of duplicate entries as follows..
    sort skills by qid qname scale_id.
    delete adjacent duplicates from skills.
    Regards,
    Suresh Datti

  • Help needed in this code

    Hi guys, I need help in debugging this code I made, which is a GUI minesweeper. Its extremely buggy...I particularly need help fixing the actionListener part of the code as everytime I press a button on the GUI, an exception occurs.
    help please!
    package minesweeperGUI;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class MinesweeperGUI implements ActionListener
         //Declaration of attributes
         static int length = 0;
         JMenuItem menuItemNew = new JMenuItem();
         JRadioButtonMenuItem rbEasy = new JRadioButtonMenuItem();
         JRadioButtonMenuItem rbHard = new JRadioButtonMenuItem();
         JMenuItem menuItemExit = new JMenuItem();
         JButton buttonReset = new JButton();
         JButton buttonGrid[][] = null;
         JFrame frame = new JFrame();
         int getBombsTotal = 0;
         JLabel setBombsLabel = new JLabel();
         int a = 0;
         int b = 0;     
         //No constructor created. Uses default constructor
         //Create the menu bar
         public JMenuBar newMenuBar()
              //Sets up the menubar
              JMenuBar menuBar = new JMenuBar();
              //Sets up the Game menu with choice of new, grid size, and exit
              JMenu menu = new JMenu ("Game");
              menuBar.add (menu);
              menuItemNew = new JMenuItem ("New");
              menuItemNew.addActionListener (this);
              menu.add (menuItemNew);
              menu.addSeparator();
              //Sets up sub-menu for grid size with choice of easy and hard radio buttons
              JMenu subMenu = new JMenu ("Grid Size");
              rbEasy = new JRadioButtonMenuItem ("Easy: 5x5 grid");
              rbEasy.addActionListener (this);
              subMenu.add (rbEasy);
              rbHard = new JRadioButtonMenuItem ("Hard: 10x10 grid");
              rbHard.addActionListener (this);
              subMenu.add (rbHard);
              menu.add (subMenu);
              menu.addSeparator();
              menuItemExit = new JMenuItem ("Exit");
              menuItemExit.addActionListener (this);
              menu.add (menuItemExit);
              return menuBar;
         //Setting up of Bomb Grid
         public int [][] setGrid (int length)
              int grid[][] = null;
              grid = new int[length][length];
              for (int i = 0; i < length; i++)
                   for (int j = 0; j < length; j++)
                        grid[i][j] = ((int)Math.round(Math.random() * 10))% 2;
              return grid;     
         //Setting up of the of the graphical bomb grid
         public JButton[][] setButtonGrid (int length)
              JButton buttonGrid[][] = null;
              buttonGrid = new JButton[length][length];
              for (int i = 0; i < length; i++)
                   for (int j = 0; j < length; j++)
                        buttonGrid[i][j] = new JButton();
              return buttonGrid;
         //Setting up of a way to count the total number of bombs in the bomb grid
         public int getBombsTotal (int length, int setGrid[][])
              int bombsTotal = 0;
              for (int i = 0; i < length; i++)
                   for (int j = 0; j < length; j++)
                        if (setGrid[i][j] == 1)
                             bombsTotal += 1;
              return bombsTotal;
         //Create a label for number of bombs left
         public JLabel setBombsLabel (int getBombsTotal)
              JLabel bombsLabel = new JLabel(String.valueOf (getBombsTotal) + " Bombs Left");
              return bombsLabel;
         //Setting up a way to count the number of bombs around a button
         public String setBombs (int length, int setGrid[][], int x, int y)
              int bombs[][] = new int[length][length];
              String bombsString = null;
              for (int i = 0; i < length; i++)
                   for (int j = 0; j < length; j++)
                        if (i == 0 && j == 0)
                             bombs[i][j] = setGrid[i][j+1] + setGrid[i+1][j] +
                                  setGrid[i+1][j+1];
                        else if (i ==0 && j == (length - 1))
                             bombs[i][j] = setGrid[i][j-1] + setGrid[i+1][j-1] +
                                  setGrid[i+1][j];
                        else if (i == (length - 1) && j == 0)
                             bombs[i][j] = setGrid[i-1][j] + setGrid[i-1][j+1] +
                                  setGrid[i][j+1];
                        else if (i == (length - 1) && j == (length - 1))
                             bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
                                  setGrid[i][j-1];
                        else if (i == 0 && j != 0 && j != (length - 1))
                             bombs[i][j] = setGrid[i][j-1] + setGrid[i][j+1] +
                                  setGrid[i+1][j-1] + setGrid[i+1][j] +
                                  setGrid[i+1][j+1];
                        else if (i == (length - 1) && j != 0 && j != (length - 1))
                             bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
                                  setGrid[i-1][j+1] + setGrid[i][j-1] +
                                  setGrid[i][j+1];
                        else if (i != 0 && i != (length - 1) && j == 0)
                             bombs[i][j] = setGrid[i-1][j] + setGrid[i-1][j+1] +
                                  setGrid[i][j+1] + setGrid[i+1][j] +
                                  setGrid[i+1][j+1];
                        else if (i != 0 && i != (length - 1) && j == (length - 1))
                             bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
                                  setGrid[i][j-1] + setGrid[i+1][j-1] +
                                  setGrid[i+1][j];
                        else
                             bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
                                  setGrid[i-1][j+1] + setGrid[i][j-1] +
                                  setGrid[i][j+1] + setGrid[i+1][j-1] +
                                  setGrid[i+1][j] + setGrid[i+1][j+1];
              bombsString = String.valueOf (bombs[x][y]);
              return bombsString;
         //create the panel for the bombs label and reset button
         public JPanel newTopPanel(int length)
              int setGridNew [][] = null;
              setGridNew = new int[length][length];
              int getBombsTotalNew = 0;
              JLabel setBombsLabelNew = new JLabel();
              setGridNew = setGrid (length);
              getBombsTotalNew = getBombsTotal (length, setGridNew);
              setBombsLabelNew = setBombsLabel (getBombsTotalNew);
              JPanel topPanel = new JPanel ();
              topPanel.setLayout (new BorderLayout (50,50));
              JLabel bombsLabel = new JLabel ();
              bombsLabel = setBombsLabelNew;     
              topPanel.add (bombsLabel, BorderLayout.WEST);
              buttonReset = new JButton("Reset");
              buttonReset.addActionListener (this);
              topPanel.add (buttonReset, BorderLayout.CENTER);
              return topPanel;
         //create the panel for the play grids
         public JPanel newBottomPanel(int length)
              JButton setButtonGridNew[][] = null;
              setButtonGridNew = new JButton [length][length];
              setButtonGridNew = setButtonGrid (length);
              JPanel bottomPanel = new JPanel ();
              bottomPanel.setLayout (new GridLayout (length, length));
              buttonGrid = new JButton[length][length];          
              for (a = 0; a < length; a++)
                   for (b = 0; b < length; b++)
                        buttonGrid[a] = setButtonGridNew[a][b];
                        buttonGrid[a][b].addActionListener (this);
                        bottomPanel.add (buttonGrid[a][b]);
              return bottomPanel;
         //Overiding of abstract method actionPerformed
         public void actionPerformed(ActionEvent e)
              if (e.getSource() == menuItemNew)
                   launchFrame(length);
              else if (e.getSource() == menuItemExit)
                   frame.setVisible (false);
                   System.exit(0);
              else if (e.getSource() == rbEasy)
                   length = 5;
                   launchFrame(length);
              else if (e.getSource() == rbHard)
                   length = 10;
                   launchFrame(length);     
              else if (e.getSource() == buttonReset)
                   launchFrame(length);
              else if (e.getSource() == buttonGrid[a][b])
                   int setGridNew [][] = null;
                   setGridNew = new int[length][length];               
                   JButton bombButton [][] = null;
                   bombButton = new JButton [length][length];
                   String bombString [][] = null;
                   bombString = new String[length][length];
                   setGridNew = setGrid (length);               
                   bombString[a][b] = setBombs (length, setGridNew, a, b);
                   bombButton[a][b] = new JButton (bombString[a][b]);
                   if (setGridNew[a][b] == 0)
                        buttonGrid[a][b] = bombButton[a][b];
                        getBombsTotal--;
                        JLabel setBombsLabelNew = new JLabel();
                        setBombsLabelNew = setBombsLabel (getBombsTotal);
                   else if (setGridNew[a][b] == 1 )
                        buttonGrid[a][b] = new JButton("x");
                        JOptionPane.showMessageDialog (null, "Game Over. You hit a Bomb!");
                        System.exit(0);     
         //create the content pane
         public Container newContentPane(int length)
              JPanel topPanel = new JPanel();
              JPanel bottomPanel = new JPanel();          
              topPanel = newTopPanel(length);
              bottomPanel = newBottomPanel (length);
              JPanel contentPane = new JPanel();
              contentPane.setOpaque (true);
              contentPane.setLayout (new BorderLayout(50,50));
              contentPane.add (topPanel, BorderLayout.NORTH);
              contentPane.add (bottomPanel, BorderLayout.CENTER);
              return contentPane;
         public void launchFrame (int length)
              //Makes sure we have nice window decorations
              JFrame.setDefaultLookAndFeelDecorated(true);          
              //Sets up the top-level window     
              frame = new JFrame ("Minesweeper");
              //Exits program when the closed button is clicked
              frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
              JMenuBar menuBar = new JMenuBar();
              Container contentPane = new Container();
              menuBar = newMenuBar();
              contentPane = newContentPane (length);
              //Sets up the menu bar and content pane
              frame.setJMenuBar (menuBar);
              frame.setContentPane (contentPane);
              //Displays the window
              frame.pack();
              frame.setVisible (true);
         public static void main (String args[])
              //Default length is 5
              length = 5;
              MinesweeperGUI minesweeper = new MinesweeperGUI();
              minesweeper.launchFrame(length);

    hi, thanks. that removed the exception; although now the buttons action listener won't work :(
    here is the revised code:
    To anyone out there, can you guys run this code and help me debug it?
    I'm really desperate as this is a school project of mine and the deadline is 7 hours away. I have already been working on it for 3 days, but the program is still very buggy.
    thanks!
    /* Oliver Ian C. Wee 04-80112
    * CS12 MHRU
    * Machine Problem 2
    package minesweeperGUI;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class MinesweeperGUI implements ActionListener
         //Declaration of attributes
         static int length = 0;
         JMenuItem menuItemNew = new JMenuItem();
         JRadioButtonMenuItem rbEasy = new JRadioButtonMenuItem();
         JRadioButtonMenuItem rbHard = new JRadioButtonMenuItem();
         JMenuItem menuItemExit = new JMenuItem();
         JButton buttonReset = new JButton();
         JButton buttonGrid[][] = null;
         JFrame frame = new JFrame();
         int getBombsTotal = 0;
         JLabel setBombsLabel = new JLabel();
         int a = 0;
         int b = 0;
         //No constructor created. Uses default constructor
         //Create the menu bar
         public JMenuBar newMenuBar()
              //Sets up the menubar
              JMenuBar menuBar = new JMenuBar();
              //Sets up the Game menu with choice of new, grid size, and exit
              JMenu menu = new JMenu ("Game");
              menuBar.add (menu);
              menuItemNew = new JMenuItem ("New");
              menuItemNew.addActionListener (this);
              menu.add (menuItemNew);
              menu.addSeparator();
              //Sets up sub-menu for grid size with choice of easy and hard radio buttons
              JMenu subMenu = new JMenu ("Grid Size");
              ButtonGroup bg = new ButtonGroup();
              rbEasy = new JRadioButtonMenuItem ("Easy: 5x5 grid");
              bg.add (rbEasy);
              rbEasy.addActionListener (this);
              subMenu.add (rbEasy);
              rbHard = new JRadioButtonMenuItem ("Hard: 10x10 grid");
              bg.add (rbHard);
              rbHard.addActionListener (this);
              subMenu.add (rbHard);
              menu.add (subMenu);
              menu.addSeparator();
              menuItemExit = new JMenuItem ("Exit");
              menuItemExit.addActionListener (this);
              menu.add (menuItemExit);
              return menuBar;
         //Setting up of Bomb Grid
         public int [][] setGrid (int length)
              int grid[][] = null;
              grid = new int[length][length];
              for (int i = 0; i < length; i++)
                   for (int j = 0; j < length; j++)
                        grid[i][j] = ((int)Math.round(Math.random() * 10))% 2;
              return grid;     
         //Setting up of the of the graphical bomb grid
         public JButton[][] setButtonGrid (int length)
              JButton buttonGrid[][] = null;
              buttonGrid = new JButton[length][length];
              for (int i = 0; i < length; i++)
                   for (int j = 0; j < length; j++)
                        buttonGrid[i][j] = new JButton();
              return buttonGrid;
         //Setting up of a way to count the total number of bombs in the bomb grid
         public int getBombsTotal (int length, int setGrid[][])
              int bombsTotal = 0;
              for (int i = 0; i < length; i++)
                   for (int j = 0; j < length; j++)
                        if (setGrid[i][j] == 1)
                             bombsTotal += 1;
              return bombsTotal;
         //Create a label for number of bombs left
         public JLabel setBombsLabel (int getBombsTotal)
              JLabel bombsLabel = new JLabel("  " +String.valueOf (getBombsTotal) + " Bombs Left");
              return bombsLabel;
         //Setting up a way to count the number of bombs around a button
         public String setBombs (int length, int setGrid[][], int x, int y)
              int bombs[][] = new int[length][length];
              String bombsString = null;
              for (int i = 0; i < length; i++)
                   for (int j = 0; j < length; j++)
                        if (i == 0 && j == 0)
                             bombs[i][j] = setGrid[i][j+1] + setGrid[i+1][j] +
                                  setGrid[i+1][j+1];
                        else if (i ==0 && j == (length - 1))
                             bombs[i][j] = setGrid[i][j-1] + setGrid[i+1][j-1] +
                                  setGrid[i+1][j];
                        else if (i == (length - 1) && j == 0)
                             bombs[i][j] = setGrid[i-1][j] + setGrid[i-1][j+1] +
                                  setGrid[i][j+1];
                        else if (i == (length - 1) && j == (length - 1))
                             bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
                                  setGrid[i][j-1];
                        else if (i == 0 && j != 0 && j != (length - 1))
                             bombs[i][j] = setGrid[i][j-1] + setGrid[i][j+1] +
                                  setGrid[i+1][j-1] + setGrid[i+1][j] +
                                  setGrid[i+1][j+1];
                        else if (i == (length - 1) && j != 0 && j != (length - 1))
                             bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
                                  setGrid[i-1][j+1] + setGrid[i][j-1] +
                                  setGrid[i][j+1];
                        else if (i != 0 && i != (length - 1) && j == 0)
                             bombs[i][j] = setGrid[i-1][j] + setGrid[i-1][j+1] +
                                  setGrid[i][j+1] + setGrid[i+1][j] +
                                  setGrid[i+1][j+1];
                        else if (i != 0 && i != (length - 1) && j == (length - 1))
                             bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
                                  setGrid[i][j-1] + setGrid[i+1][j-1] +
                                  setGrid[i+1][j];
                        else
                             bombs[i][j] = setGrid[i-1][j-1] + setGrid[i-1][j] +
                                  setGrid[i-1][j+1] + setGrid[i][j-1] +
                                  setGrid[i][j+1] + setGrid[i+1][j-1] +
                                  setGrid[i+1][j] + setGrid[i+1][j+1];
              bombsString = String.valueOf (bombs[x][y]);
              return bombsString;
         //create the panel for the bombs label and reset button
         public JPanel newTopPanel(int length)
              int setGridNew [][] = null;
              setGridNew = new int[length][length];
              int getBombsTotalNew = 0;
              JLabel setBombsLabelNew = new JLabel();
              setGridNew = setGrid (length);
              getBombsTotalNew = getBombsTotal (length, setGridNew);
              setBombsLabelNew = setBombsLabel (getBombsTotalNew);
              JPanel topPanel = new JPanel ();
              topPanel.setLayout (new BorderLayout (20,20));
              JLabel bombsLabel = new JLabel ();
              bombsLabel = setBombsLabelNew;     
              topPanel.add (bombsLabel, BorderLayout.WEST);
              buttonReset = new JButton("Reset");
              buttonReset.addActionListener (this);
              topPanel.add (buttonReset, BorderLayout.CENTER);
              return topPanel;
         //create the panel for the play grids
         public JPanel newBottomPanel(int length)
              JButton setButtonGridNew[][] = null;
              setButtonGridNew = new JButton [length][length];
              setButtonGridNew = setButtonGrid (length);
              JPanel bottomPanel = new JPanel ();
              bottomPanel.setLayout (new GridLayout (length, length));
              buttonGrid = new JButton[length][length];          
              for (int i = 0; i < length; i++)
                   for (int j = 0; j < length; j++)
                        buttonGrid[i][j] = setButtonGridNew[i][j];
                        buttonGrid[i][j].addActionListener (this);
                        bottomPanel.add (buttonGrid[i][j]);
              return bottomPanel;
         //Overiding of abstract method actionPerformed
         public void actionPerformed(ActionEvent e)
              if (e.getSource() == menuItemNew)
                   closeFrame();
                   launchFrame(length);
              else if (e.getSource() == menuItemExit)
                   frame.setVisible (false);
                   System.exit(0);
              else if (e.getSource() == rbEasy)
                   closeFrame();
                   length = 5;
                   launchFrame(length);
              else if (e.getSource() == rbHard)
                   closeFrame();
                   length = 10;
                   launchFrame(length);     
              else if (e.getSource() == buttonReset)
                   closeFrame();
                   launchFrame(length);
              else if (e.getSource() == buttonGrid[a])
                   int setGridNew [][] = null;
                   setGridNew = new int[length][length];               
                   JButton bombButton [][] = null;
                   bombButton = new JButton [length][length];
                   String bombString [][] = null;
                   bombString = new String[length][length];
                   setGridNew = setGrid (length);               
                   for (int i = 0; i < length; i++)
                        for (int j = 0; j < length; j++)
                             bombString[i][j] = setBombs (length, setGridNew, i, j);
                             bombButton[i][j] = new JButton (bombString[i][j]);
                   if (setGridNew[a][b] == 0)
                        buttonGrid[a][b] = bombButton[a][b];
                        getBombsTotal--;
                        JLabel setBombsLabelNew = new JLabel();
                        setBombsLabelNew = setBombsLabel (" " String.valueOf (getBombsTotal) " Bombs Left");
                   else if (setGridNew[a][b] == 1 )
                        buttonGrid[a][b] = new JButton("x");
                        JOptionPane.showMessageDialog (null, "Game Over. You hit a Bomb!");
                        System.exit(0);     
         //create the content pane
         public Container newContentPane(int length)
              JPanel topPanel = new JPanel();
              JPanel bottomPanel = new JPanel();          
              topPanel = newTopPanel(length);
              bottomPanel = newBottomPanel (length);
              JPanel contentPane = new JPanel();
              contentPane.setOpaque (true);
              contentPane.setLayout (new BorderLayout(5,5));
              contentPane.add (topPanel, BorderLayout.NORTH);
              contentPane.add (bottomPanel, BorderLayout.CENTER);
              return contentPane;
         public void closeFrame ()
              frame = new JFrame ("Minesweeper");
              frame.dispose();
         public void launchFrame (int length)
              //Makes sure we have nice window decorations
              JFrame.setDefaultLookAndFeelDecorated(true);          
              //Sets up the top-level window     
              frame = new JFrame ("Minesweeper");
              //Exits program when the closed button is clicked
              frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
              JMenuBar menuBar = new JMenuBar();
              Container contentPane = new Container();
              menuBar = newMenuBar();
              contentPane = newContentPane (length);
              //Sets up the menu bar and content pane
              frame.setJMenuBar (menuBar);
              frame.setContentPane (contentPane);
              //Displays the window
              frame.pack();
              frame.setVisible (true);
         public static void main (String args[])
              //Default length is 5
              length = 5;
              MinesweeperGUI minesweeper = new MinesweeperGUI();
              minesweeper.launchFrame(length);

  • Exception in query execution through JDBC code

    Hi all,
    I am getting the following error when I am trying to use JDBC in a web dynpro application. I need to execute select query on table XI_AF_MSG.
    java.sql.SQLException: Invalid object name 'BC_DDDBTABLERT'
    When I tried to debug the code, I came to know that connection is getting done successfully but error comes when I try to execute the query.
    Can anyone help me to solve the problem?
    Regards,
    Bhargav

    Sure I can show my code.
    try {
         //        Get the database connection
              InitialContext dbInitContext = new InitialContext();
              String dbName = "jdbc/SAP***DB";  //datasourcename
              DataSource dataSource = (DataSource) dbInitContext.lookup(dbName);
              Connection conn = dataSource.getConnection();
              str=str" Connection is done successfully. "dataSource.toString();
              messageMgr.reportSuccess(str);
              String SelectStmt = "Select * from XI_AF_MSG";
         //        Prepare the SQL statements
         str=str+" before preparing statement";
                   messageMgr.reportSuccess(str);
              Statement stmt = conn.createStatement();
              str=str+" statement is prepared.";
                        messageMgr.reportSuccess(str);
         //        Execute the Query
              ResultSet resultSet = stmt.executeQuery(SelectStmt);
              str=str+"query is executed.";
                        messageMgr.reportSuccess(str);
    catch(Exception e)
    As you can see in the code, I have created messages at several points. When I execute the application, i can see message "statement is prepared" before exception is thrown. It means, connection is getting established and statement is also getting created but query is not getting executed.
    Regards,
    Bhargav

  • MSI Big Bang Xpower II did not post - Debug LED Code #67

        
    I need HELP...!
    I have a problem my board did not post , did not start and i have the DEBUG LED CODE # 67 displayed.
    There is my build
    MSI Big Bang Xpower II X79 LGA2011
    Intel Core i7 3820 LGA2011 Processor
    Corsair Cooling Hydro Series H100 CPU Cooler System LGA2011
    G.SKILL Ripjaws Z Series memory (F3-12800CL-32GBZL) DDR3 1600 PC3-12800 - CL10-10-10-30 (8192MB X 4) - 32GIG located in DIMM 1-3-5-7
    Gigabyte GTX570 OC Edition video card in slot PCI-E2
    Western Digital Velociraptor 300GB 2.5" SATA 3.0Gb/s 10,000 RPM
    LG BH12LS35 Blu-Ray Writer 12X BD-R 16X
    Ultra LSP-750 Power Supply
    Cooler Master HAF X EATX Tower Case
    When I put the power on, the power supply activated fans and drives spin, all the LEDs on the motherboard light up but nothing appears on the screen.
    No video signal at all and the computer stop and restrart every 15 seconds. When these reset occurs there is no beep on the speaker , nothing at all, no flashing screen either, nothing.
    The DEBUG LED display a sequence of flashing numbers 19 - 60 - 19- 60 - 67 and stop showing still the number # 67 for about ten seconds and then he reset again.
    I carefully followed the instruction manual for the installation, I installed the memory modules in slots 1 3 5 7, i put my video card in slot PCI-E2. all the power wire are connected correctly 1 x 24 pins ATX, 2 x 8 pins ATX, 1 X 6 pins , all the wire from the front panel are correctly connected to the m-connector in JFP1 & 2.
    Did i forget something, I don’t know what the debug led code # 67 exactly mean and what i have to do to fix-it
    Someone has an idea what is wrong or have any suggestion to solve this issue.
     Thank's all for your help.

     
    I followed some advice to remove the memory modules and this is actually caused by the use of memory but you will see I still have a curious bug.
    I referred to the instructions manual to the letter for the choice of DIMM SLOT to put the memory module in single, double, triple and quad channels.
    If I install 1 memory module in the DIMM SLOT  1 to operate in single channel, everything is normal and the motherboard  POST normally and show  the SETUP SCREEN.
    If I install 2 memory modules in  DIMM SLOT  1 & 3 to run in dual channel, everything is normal and the motherboard  POST normally and show  the SETUP SCREEN.
    If I install three memory modules in DIMM SLOT 1 - 3 - 5 to run in triple channel, everything is normal and the motherboard POST normally and show  the SETUP SCREEN.
    As soon as I install four DIMMs modules mémoiredans SLOT 1 - 3 - 5 - 7 to run in quad channel, the motherboard  freezes and does NOT POST and show  code 67 on the debug led and has reset itself every 20 seconds.
    I tried all my RAM modules alternately in both single channel and everything works normally.
    I did the same thing in rotation for both dual and triple channel and everything is still normal with all fourth memory modules individually.
     As soon as I put a fourth memory module it freezes and displays the code 67 or L9 dependent side as you look. 
    So my bug is my motherboard MSI Big Bang Xpower II do  not want  to work in quad channel.
    Do you have any idea where I should look for, is a setting in the BIOS  , I have flashed the bios to the latest version V1.5
    I included the screenshot of the BIOS to see if you can  notice something wrong. 
    Thank you

  • Help in debugging BADI_FDCB_SUBBAS03 (transaction FB60)

    Hi Gurus,
    I need some
    help in debugging BADI_FDCB_SUBBAS03.
    Screen Enhancement 3 on FDCB Basic Data Screen (010, 510)
    I have created a new BADI   "YTESTBADI"   in transaction SE19
    using the Definition "BADI_FDCB_SUBBAS03"
    The below 2 methods are available.
    PUT_DATA_TO_SCREEN_OBJECT
    GET_DATA_FROM_SCREEN_OBJECT
    I have been trying to debug
    using statement "BREAK-POINT" , but was not successful.
    <b>Am I using the correct procedure for
    enhancing FB60  "Enter Incoming Invoices"  transaction?
    Can someone help me out?</b>
    Thanks,
    Aby Jacob

    Hi All,
    I am trying out the below suggestion from a previous posting.
    <u>Can I have any userexit to populate date for FB60 & FB65 ?</u>
    <b>
    OBBH is customizing transaction, after running it u should see a view with company code:
    - do a doubleclick on your company code;
    - go to ITEM LINE level
    - Choose the substitution of your company (if there are more subst than one)
    - Create a new step
    - In the Prerequisite u insert a filter on SYST-TCODE
    - In the Substitution check if your field can be replaced, if it can't, create a routine to replace it.</b>
    I am also closing this thread.
    Thanks to all who have read/responded
    Aby Jacob

  • SoS, windows freezing when debugging jni code

    Somebody Help!!!!
    I am desperately trying to debug JNI code with MSDEV debugger.
    This is a flow:
    1. I run the java application from Msdev. Visual 6.0
    2. Insert a breakpoint in the first native method.
    3. The program successfully stops in the breakpoint.
    4. The "next" debugger command freezes WINDOWS :(
    I have tried all last jdk2 releases starting from 1.3 till 1.5.
    Any ideas ?
    10000000x in advance

    Cross-post:
    Duplicate post:
    http://forum.java.sun.com/thread.jspa?threadID=604754
    @OP: QUIT IT!

  • What transactions are helpful in debugging performance of a program

    What transactions help in debugging performance related issues of a custom program?

    Hi.... Gopal...,
         First rectify the errors and warning in ur program with...
    > SLIN -> Extended program Check
    > SCID -> Code Inspecter
        Then Analyze the performance level of ur program with...
    > SE30 -> Runtime analysis
        There you can study the actions of ur statements with Tracing the statements with...
    > ST05 -> SQL Trace
        Then do the modifications according to the issues...,
    Thank you,
    Naveen.I

  • Tools to debug AGAL code for shaders

    Hello,
    Those last few days I was working on some AGAL code, to create some shaders.
    But I sometimes encounter some problems when it comes to debug my code...
    Especially to know what is the current value of ft0 or ft0.x, etc.
    So, my question is :
    Do you know some tools; or tips, to debug your shaders ?
    It would be so cool to share about it
    I've heard about PIX in this blog post : http://jpauclair.net/2011/03/01/zombietycoon-molehill-session-at-flashgamingsummit/
    But It doesn't seem to work with our browser... So bad ! I may be wrong somewhere
    Thanks a lot per advance !

    You can use PIX fairly easily with Molehill - i'm not sure how to get it working in the web browser, but if you use a standalone player it's easy. Of course, you'll need to be running on a PC and have molehill using the directX9 driver for this to work.
    Grab the Unofficial Standalone Player here: http://blog.ascensionsystems.ca/?p=147
    Then grab the latest DirectX SDK and fire up PIX for windows. You just need to point it at the standalone player, and configure the command-line argument path to your swf, and you're in business.
    Tips on how to use PIX: http://msdn.microsoft.com/en-us/library/ee417184(v=vs.85).aspx
    You can debug shader code, individual pixels, draw timings, buffer contents, and so much more - very helpful stuff. It's also nice to be able to see what the molehill implementation is doing behind the scenes.

  • Can somebody help me with this code?

    Can anyone help me with this code? My problem is that i can't
    seem to position this form, i want to be able to center it
    vertically & horizontally in a div either using CSS or any
    other means.
    <div id="searchbar"><!--Search Bar -->
    <div id="searchcart">
    <div class="serchcartcont">
    <form action='
    http://www.romancart.com/search.asp'
    name="engine" target=searchwin id="engine">
    <input type=hidden value=????? name=storeid>
    <input type=text value='' name=searchterm>
    <input type=submit value='Go'> </form>
    </div>
    </div>
    <div class="searchcont">Search For
    Products:</div>
    </div><!-- End Search Bar -->
    Pleasssssseeeeeeee Help
    Thanks

    Hi,
    Your form is defined in a div named "serchcartcont", you can
    use attributes like position and align of the div to do what you
    want to do. But there are two more dives above this dive, you will
    have define the height width of these before you can center align
    the inner most div. If you are not defining the height & width
    then by default it decide it automatically to just fit the content
    in it.
    Hope this helps.
    Maneet
    LeXolution IT Services
    Web Development
    Company

  • HT201372 used this to make a bootable copy for a new hard drive installation. copied the install find but gave error code 110 when making the disk bootable.. Any help in what this code is

    Used createinstallmedis to make a copy of the Mavericks app for use in a new hard drive install.. Copied find but gave error code 110 and failed to make the flash drive bootable.. Any help in what errror code means?

    Did you partition and format the flash drive first? See the following:
    Make Your Own Mavericks, Mountain/Lion Installer
    After downloading the installer you must first save the Install Mac OS X application. After the installer downloads DO NOT click on the Install button. Go to your Applications folder and make a copy of the installer. Move the copy into your Downloads folder. Now you can click on the Install button. You must do this because the installer deletes itself automatically when it finishes installing.
       2. Get a USB flash drive that is at least 8 GBs. Prep this flash drive as follows:
    Open Disk Utility in your Utilities folder.
    After DU loads select your flash drive (this is the entry with the mfgr.'s ID and size) from the leftside list. Under the Volume Scheme heading set the number of partitions from the drop down menu to one. Set the format type to Mac OS Extended (Journaled.) Click on the Options button, set the partition scheme to GUID then click on the OK button. Click on the Partition button and wait until the process has completed.
    Select the volume you just created (this is the sub-entry under the drive entry) from the left side list.
    Click on the Erase tab in the DU main window.
    Set the format type to Mac OS Extended (Journaled.) Click on the Options button, check the button for Zero Data and click on OK to return to the Erase window.
    Click on the Erase button. The format process can take up to an hour depending upon the flash drive size.
    Make your own Mavericks flash drive installer using the Mavericks tool:
    Mavericks has its own built-in installer maker you use via the Terminal:
    You will need a freshly partitioned and formatted USB flash drive with at least 8GBs. Leave the name of the flash drive at the system default, "Untitled." Do not change this name. Open the Terminal in the Utilities folder. Copy this command line after the prompt in the Terminal's window:
    sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction
    Press RETURN. Enter your admin password when prompted. It will not be echoed to the screen so be careful to enter it correctly. Press RETURN, again.
    Wait for the process to complete which will take quite some time.

  • Need some help in debugging this exported script

    Below is DDL generated by visio forward engineering tool . The example below consists of 2 test tables with one foreign key.
    Forward engineering generated DDL script
    IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Table1]') AND type in (N'U'))
    DROP TABLE [dbo].[Table1]
    GO
    CREATE TABLE [dbo].[Table1] (
    [test] CHAR(10) NOT NULL
    , [test2] CHAR(10) NULL
    GO
    ALTER TABLE [dbo].[Table1] ADD CONSTRAINT [Table1_PK] PRIMARY KEY CLUSTERED (
    [test]
    GO
    GO
    IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Table2]') AND type in (N'U'))
    DROP TABLE [dbo].[Table2]
    GO
    CREATE TABLE [dbo].[Table2] (
    [test2] CHAR(10) NOT NULL
    GO
    ALTER TABLE [dbo].[Table2] ADD CONSTRAINT [Table2_PK] PRIMARY KEY CLUSTERED (
    [test2]
    GO
    GO
    ALTER TABLE [dbo].[Table1] WITH CHECK ADD CONSTRAINT [Table2_Table1_FK1] FOREIGN KEY (
    [test2]
    REFERENCES [dbo].[Table2] (
    [test2]
    GO
    GO
    When i converted this DDL script using scratch editor the migration tool gave some errors can anyone help me to resolve below
    DECLARE
    v_temp NUMBER(1, 0) := 0;
    BEGIN
    BEGIN
    SELECT 1 INTO v_temp
    FROM DUAL
    WHERE EXISTS ( SELECT *
    FROM objects
    WHERE OBJECT_ID_ = NULL/*TODO:OBJECT_ID(N'[OPS].[Table1]')*/
    AND TYPE IN ( N'U' )
    EXCEPTION
    WHEN OTHERS THEN
    NULL;
    END;
    IF v_temp = 1 THEN
    TRUNCATE TABLE Table1;
    END IF;
    END;
    CREATE TABLE Table1
    test CHAR(10) NOT NULL,
    test2 CHAR(10)
    ALTER TABLE Table1
    ADD
    CONSTRAINT Table1_PK PRIMARY KEY( test );
    --SQLDEV:Following Line Not Recognized
    DECLARE
    v_temp NUMBER(1, 0) := 0;
    BEGIN
    BEGIN
    SELECT 1 INTO v_temp
    FROM DUAL
    WHERE EXISTS ( SELECT *
    FROM objects
    WHERE OBJECT_ID_ = NULL/*TODO:OBJECT_ID(N'[OPS].[Table2]')*/
    AND TYPE IN ( N'U' )
    EXCEPTION
    WHEN OTHERS THEN
    NULL;
    END;
    IF v_temp = 1 THEN
    TRUNCATE TABLE Table2;
    END IF;
    END;
    CREATE TABLE Table2
    test2 CHAR(10) NOT NULL
    ALTER TABLE Table2
    ADD
    CONSTRAINT Table2_PK PRIMARY KEY( test2 );
    --SQLDEV:Following Line Not Recognized
    ALTER TABLE Table1
    ADD
    CONSTRAINT Table2_Table1_FK1 FOREIGN KEY( test2 ) REFERENCES Table2 (test2)
    --SQLDEV:Following Line Not Recognized
    ;

    Pl do not post duplicates - Need some help in debugging this script

  • Pulling the condition records - help in the ABAP code -urgent!!!!!

    hi folks,
    I need some urgent help here..
    I have discussed this portion before in the forum  but there are some changes and I need some help here.
    The code goes like this....
    select knumv kschl kbetr kwert
      from konv into table cdata
         for all entries in bodyitab21
        where konv~knumv = bodyitab21-knumv
                     and konv~kwert > 0.
    I am successfully pulling the data into cdata here..
    I need to check for various condition types that are around 100. I need to split them into two types because some condition types containe just pricing values while some others have values in % (but the value not stored in that format) To do the extra coding I have use two differetn case statements and that's what i have done here.
    <b>My probelm is I will have to check for each condition type, if the 'kwert' field has some value in it pull the data  and there is a condition text associcated to it in the table 'T685T' that needs to be pulled into the itab.
    This process has to be done for every condition type.</b>Given this scenario how can i do it?
        loop at cdata  into wac.
        case wac-kschl.
             when 'ZRAT' OR 'ZAGR'  OR 'ZRCR' OR 'Y098' OR 'Y007' OR 'ZREW' OR 'Y106' OR 'ZTSR' OR 'Y127' OR 'Y125' OR 'Y126' OR 'Y124' OR 'Y157' OR 'Y092' OR 'Y085' OR 'Y090' OR 'ZMZD' OR 'Y215' OR 'Y214' OR 'Y111' OR 'ZC$D' OR 'ZAUD' OR 'ZTHX' OR 'ZCOL'
    OR 'ZCFE' OR ZSPA' OR 'ZBOX' OR 'ZCOR' OR 'Y130' OR 'ZBOR'
    OR 'Y108' OR 'ZFPP' OR 'Y204' OR 'Y200' OR 'Y202' OR 'Y201' OR 'Y203' OR 'Y002' OR 'ZSCR' OR 'Y128' OR 'Y100' OR 'ZABS' OR 'ZSMG' OR 'ZFRE' OR 'ZREC' OR 'ZCOM' OR 'ZPMG' OR 'BEMG' OR 'ZDTI' OR'ZBET'.
    <b>***** the first set of these condition types have just values</b>     if wac-kbetr = ' ' AND wac-kwert = ' '.
                   continue.
                 else.
                  p = wac-kbetr.
                  i = p.
                  c = i.
                  MOVE c to w_accitab-zrate.
                     MOVE wac-kbetr to w_accitab-zrate.
                  MOVE wac-kwert to w_accitab-zsubtotal.
                endif.
        when 'ZSED' OR 'ZRFQ' OR 'ZIMP' OR 'ZERR'
         OR 'ZECD' 'ZAC1' OR 'ZAC%' OR 'ZAC2' OR 'ZSED' OR 'ZRFQ' OR 'ZIMP' OR 'ZERR' OR 'ZECD' 'ZQUD' OR 'ZEMP' OR 'Y101' OR 'Y012' OR 'ZCHU' OR 'Y054' OR 'Y065' OR 'Y066' OR 'Y067' OR 'Y068' OR 'Y069' OR 'Y096'
    OR 'Y103' OR 'Y010' OR 'Y070' OR 'Y071' OR
    'Y072' OR 'Y073' OR 'Y074' OR 'Y075' OR 'Y076'
    OR 'Y077' OR 'Y078' OR 'Y079' OR 'Y156' OR OR 'Y148'
    OR 'Y102' OR 'Y205' OR 'Y206' OR 'Y207' OR 'Y208' OR
    'Y209' OR 'Y213' OR 'Y210' OR 'Y211' OR 'Y212' OR 'Z%DS'
    OR 'Z%DO' OR 'Y113' OR 'Y151' OR 'Y152' OR 'Y153' OR
    'Y154' OR 'Y155' OR 'Y147' OR'Z%PB' OR 'Y142' OR 'Y131'
    OR 'Y141' OR 'Y149' OR 'ZDEO' OR 'Z%DR' OR 'Y115' OR
    'Y116' OR 'Y095' OR 'Y084' OR 'ZSA$' OR 'ZSA%' OR
    'ZPA$' OR 'ZPA%'.
    the second set of these condition types have just values that has to be converted into %.
               if wac-kbetr = ' ' AND wac-kwert = ' '.
                clear w_accitab-zrate.
                continue.
              else.
                p = wac-kbetr.
                p = p / 10.
                if p < 1.
                  rate+0(1) = '-'.
                endif.
                if i = 0.
                  clear w_accitab-zrate.
                 else.
                i = p.
                c = i.
                shift c right deleting trailing '-'.
                concatenate rate c '%' into rate.
                condense rate no-gaps.
                     MOVE wac-kbetr to w_accitab-zrate.
                MOVE rate to w_accitab-zrate.
                clear rate.
                MOVE wac-kwert to w_accitab-zsubtotal.
              endif.
            endif.
    Thanks alot in advance.
    Santhosh

    Maybe this will help you,  otherwise I'm missing something.
    [code]
    data: begin of wac,
          kschl type t685t-kschl,
          vtext type t685t-vtext,
          end of wac.
    case wac-kschl.
    when 'ZRAT' or 'ZAGR' or 'ZRCR' or 'Y098' or 'Y007' or 'ZREW' or 'Y106'
    or 'ZTSR' or 'Y127' or 'Y125' or 'Y126' or 'Y124' or 'Y157' or 'Y092' or
      'Y085' or 'Y090' or 'ZMZD' or 'Y215' or 'Y214' or 'Y111' or 'ZC$D' or
         'ZAUD' or 'ZTHX' or 'ZCOL' or 'ZCFE' or 'ZSPA' or 'ZBOX' or 'ZCOR'
    or 'Y130' or 'ZBOR' or 'Y108' or 'ZFPP' or 'Y204' or 'Y200' or 'Y202' or
      'Y201' or 'Y203' or 'Y002' or 'ZSCR' or 'Y128' or 'Y100' or 'ZABS' or
         'ZSMG' or 'ZFRE' or 'ZREC' or 'ZCOM' or 'ZPMG' or 'BEMG' or 'ZDTI'
            or'ZBET'.
    Some code
      when 'ZSED' or 'ZRFQ' or 'ZIMP' or 'ZERR'
    or 'ZECD' or 'ZAC1' or 'ZAC%' or 'ZAC2' or 'ZSED' or 'ZRFQ' or 'ZIMP' or
      'ZERR' or 'ZECD' or 'ZQUD' or 'ZEMP' or 'Y101' or 'Y012' or 'ZCHU' or
      'Y054' or 'Y065' or 'Y066' or 'Y067' or 'Y068' or 'Y069' or 'Y096'
      or 'Y103' or 'Y010' or 'Y070' or 'Y071' or
      'Y072' or 'Y073' or 'Y074' or 'Y075' or 'Y076'
      or 'Y077' or 'Y078' or 'Y079' or 'Y156' or 'Y148'
      or 'Y102' or 'Y205' or 'Y206' or 'Y207' or 'Y208' or
      'Y209' or 'Y213' or 'Y210' or 'Y211' or 'Y212' or 'Z%DS'
      or 'Z%DO' or 'Y113' or 'Y151' or 'Y152' or 'Y153' or
      'Y154' or 'Y155' or 'Y147' or'Z%PB' or 'Y142' or 'Y131'
      or 'Y141' or 'Y149' or 'ZDEO' or 'Z%DR' or 'Y115' or
      'Y116' or 'Y095' or 'Y084' or 'ZSA$' or 'ZSA%' or
      'ZPA$' or 'ZPA%'.
    Some code
    endcase.
    select single vtext into wac-vtext from t685t
                  where spras = sy-langu
                    and kschl = wac-kschl.
    write:/ wac-kschl, wac-vtext.
    [/code]
    Regards,
    Rich Heilman

Maybe you are looking for