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.

Similar Messages

  • Please help me debug this program unit!!!!!

    dear sir,
    i tried diligently to find and to debug this tiny program unit,although my observation to the coding rules of the packages ,compilation error still occur.
    therefore,kindly i'm asking you sir to learn me how to correct it.
    thank you.
    create or replace package test_pack is
    type emp_table_type is table of emp.sal%type
    index by binary_integer;
    emp_list emp_table_type;
    function test_sal
    (v_sal in emp.sal%type)
    return emp_table_type;
    end test_pack;
    create or replace package body test_pack is
    temp emp.sal%type;
    cursor emp_cursor is
    select sal from emp;
    i number :=1;
    j number :=1;
    function test_sal
    (v_sal in emp.sal%type)
    return emp_table_type
    is
    open emp_cursor;
    loop
    fetch emp_cursor into temp;
    if temp < v_sal then
    emp_list(i):=temp;
    bms_output.put_line('rowcount i='||emp_cursor%rowcount);
    dbms_output.put_line('iterator i='||i);
    i:=i+1;
    else
    dbms_output.put_line('rowcount j='||emp_cursor%rowcount);
    dbms_output.put_line('iterator j='||j);
    j:=j+1;
    end if;
    if emp_cursor%notfound then
    dbms_output.put_line('cursor closed...');
    close emp_cursor;
    return emp_list;
    exit;
    end if;
    end loop;
    end test_pack;

    You can use "show err" to show the errors after compilation errors occur:
    SQL> create or replace package test_pack is
      2    type emp_table_type is table of emp.sal%type index by binary_integer;
      3    emp_list emp_table_type;
      4    function test_sal(v_sal in emp.sal%type) return emp_table_type;
      5  end test_pack;
      6  /
    Package is aangemaakt.
    SQL> create or replace package body test_pack is
      2    temp emp.sal%type;
      3    cursor emp_cursor is
      4    select sal from emp;
      5    i number :=1;
      6    j number :=1;
      7
      8    function test_sal
      9    (v_sal in emp.sal%type)
    10    return emp_table_type
    11    is
    12      open emp_cursor;
    13      loop
    14        fetch emp_cursor into temp;
    15        if temp < v_sal then
    16          emp_list(i):=temp;
    17          bms_output.put_line('rowcount i='||emp_cursor%rowcount);
    18          dbms_output.put_line('iterator i='||i);
    19          i:=i+1;
    20        else
    21          dbms_output.put_line('rowcount j='||emp_cursor%rowcount);
    22          dbms_output.put_line('iterator j='||j);
    23          j:=j+1;
    24        end if;
    25        if emp_cursor%notfound then
    26          dbms_output.put_line('cursor closed...');
    27          close emp_cursor;
    28          return emp_list;
    29          exit;
    30        end if;
    31      end loop;
    32  end test_pack;
    33  /
    Waarschuwing: package-body is aangemaakt met compilatiefouten.
    SQL> show err
    Fouten voor PACKAGE BODY TEST_PACK:
    LINE/COL ERROR
    14/7     PLS-00103: Symbool "FETCH" aangetroffen terwijl een van de
             volgende werd verwacht:
             constant exception <een ID>
             <een scheidingsteken-ID tussen dubbele aanhalingstekens>
             table LONG_ double ref char time timestamp interval date
             binary national character nchar
    32/5     PLS-00103: Symbool "TEST_PACK" aangetroffen terwijl een van de
             volgende werd verwacht:
             ;To make your program compile, add a begin and end and fix the typo (in bold):
    SQL> create or replace package body test_pack is
      2    temp emp.sal%type;
      3    cursor emp_cursor is
      4    select sal from emp;
      5    i number :=1;
      6    j number :=1;
      7
      8    function test_sal
      9    (v_sal in emp.sal%type)
    10    return emp_table_type
    11    is
    12    begin
    13      open emp_cursor;
    14      loop
    15        fetch emp_cursor into temp;
    16        if temp < v_sal then
    17          emp_list(i):=temp;
    18          dbms_output.put_line('rowcount i='||emp_cursor%rowcount);
    19          dbms_output.put_line('iterator i='||i);
    20          i:=i+1;
    21        else
    22          dbms_output.put_line('rowcount j='||emp_cursor%rowcount);
    23          dbms_output.put_line('iterator j='||j);
    24          j:=j+1;
    25        end if;
    26        if emp_cursor%notfound then
    27          dbms_output.put_line('cursor closed...');
    28          close emp_cursor;
    29          return emp_list;
    30          exit;
    31        end if;
    32      end loop;
    33    end;
    34  end test_pack;
    35  /
    Package-body is aangemaakt.
    SQL> declare
      2    t test_pack.emp_table_type;
      3  begin
      4    t := test_pack.test_sal(2000);
      5    for i in 1..t.count
      6    loop
      7      dbms_output.put_line(t(i));
      8    end loop;
      9  end;
    10  /
    rowcount i=1
    iterator i=1
    rowcount i=2
    iterator i=2
    rowcount i=3
    iterator i=3
    rowcount j=4
    iterator j=1
    rowcount i=5
    iterator i=4
    rowcount j=6
    iterator j=2
    rowcount j=7
    iterator j=3
    rowcount j=8
    iterator j=4
    rowcount j=9
    iterator j=5
    rowcount i=10
    iterator i=5
    rowcount i=11
    iterator i=6
    rowcount i=12
    iterator i=7
    rowcount j=13
    iterator j=6
    rowcount i=14
    iterator i=8
    rowcount i=14
    iterator i=9
    cursor closed...
    800
    1600
    1250
    1250
    1500
    1100
    950
    1300
    1300
    PL/SQL-procedure is geslaagd.To fix the bug of the last iteration and put the variables in the sections they belong:
    SQL> create or replace package test_pack is
      2    type emp_table_type is table of emp.sal%type index by binary_integer;
      3    function test_sal(v_sal in emp.sal%type) return emp_table_type;
      4  end test_pack;
      5  /
    Package is aangemaakt.
    SQL> create or replace package body test_pack
      2  is
      3    function test_sal(v_sal in emp.sal%type) return emp_table_type
      4    is
      5      emp_list emp_table_type;
      6      temp emp.sal%type;
      7      cursor emp_cursor is select sal from emp;
      8      i number :=1;
      9      j number :=1;
    10    begin
    11      open emp_cursor;
    12      loop
    13        fetch emp_cursor into temp;
    14        if emp_cursor%notfound then
    15          dbms_output.put_line('cursor closed...');
    16          exit;
    17        end if;
    18        if temp < v_sal then
    19          emp_list(i):=temp;
    20          dbms_output.put_line('rowcount i='||emp_cursor%rowcount);
    21          dbms_output.put_line('iterator i='||i);
    22          i:=i+1;
    23        else
    24          dbms_output.put_line('rowcount j='||emp_cursor%rowcount);
    25          dbms_output.put_line('iterator j='||j);
    26          j:=j+1;
    27        end if;
    28      end loop;
    29      close emp_cursor;
    30      return emp_list;
    31    end;
    32  end test_pack;
    33  /
    Package-body is aangemaakt.
    SQL> declare
      2    t test_pack.emp_table_type;
      3  begin
      4    t := test_pack.test_sal(2000);
      5    for i in 1..t.count
      6    loop
      7      dbms_output.put_line(t(i));
      8    end loop;
      9  end;
    10  /
    rowcount i=1
    iterator i=1
    rowcount i=2
    iterator i=2
    rowcount i=3
    iterator i=3
    rowcount j=4
    iterator j=1
    rowcount i=5
    iterator i=4
    rowcount j=6
    iterator j=2
    rowcount j=7
    iterator j=3
    rowcount j=8
    iterator j=4
    rowcount j=9
    iterator j=5
    rowcount i=10
    iterator i=5
    rowcount i=11
    iterator i=6
    rowcount i=12
    iterator i=7
    rowcount j=13
    iterator j=6
    rowcount i=14
    iterator i=8
    cursor closed...
    800
    1600
    1250
    1250
    1500
    1100
    950
    1300
    PL/SQL-procedure is geslaagd.To be really efficient and not care about looping, using counters and dbms_output, and assuming the emp table won't ever be a big table (else use the LIMIT clause):
    SQL> create or replace package body test_pack
      2  is
      3    function test_sal(v_sal in emp.sal%type) return emp_table_type
      4    is
      5      emp_list emp_table_type;
      6    begin
      7      select sal bulk collect into emp_list
      8        from emp
      9       where sal < v_sal
    10      ;
    11      return emp_list;
    12    end;
    13  end;
    14  /
    Package-body is aangemaakt.
    SQL> declare
      2    t test_pack.emp_table_type;
      3  begin
      4    t := test_pack.test_sal(2000);
      5    for i in 1..t.count
      6    loop
      7      dbms_output.put_line(t(i));
      8    end loop;
      9  end;
    10  /
    800
    1600
    1250
    1250
    1500
    1100
    950
    1300
    PL/SQL-procedure is geslaagd.Hope it helps.
    Regards,
    Rob.

  • Please help me with this code, can't figure it out!!!!! Please!!!!!!

    class Vehicles
    public String name="<unnamed>";
    Vehicles Ferrari1=new Vehicles();
    Vehicles Honda1=new Vehicles();
    Vehicles Toyota1=new Vehicles();
    Ferrari.nameFor="Ferrari";
    Honda.nameFor="Honda";
    Toyota.nameFor="Toyota";
    public void main(String[]args)
    System.out.println("Hello Folks!");
    System.out.println(Ferrari.name);
    System.out.println(Honda.name);
    System.out.println(Toyota.name);
    System.out.println("Bye Now!");
    It always says i am missing an indentifier in line 6-8 when i complie. Please help somebody!!!

    class Vehicles
    public String name = "unnamed";
    Vehicles Ferrari=new Vehicles();
    public void main(String[]args)
    System.out.println("Hello Folks!");
    Vehicles Ferrari=new Vehicles();
    System.out.println(Ferrari.name);
    System.out.println("Bye Now!");

  • Please help me correct this code

    Hi, I have to develop a Java applications that converts a positive number from base 10 to another base. It has to prompt the user to enter the number to be converted an the base to be converted into. After conversion is completed, the program should ask for another conversion. The program would run in a loop until the user would decide to end it. In case of an error entry as a base less than 2, the program should warn the user about the type of error and ask the user to re-enter the values. At the nd of the program, provide a statistic with how many conversions the user has done.
    Please look at code below, and see where i went wrong, i can't seem to figure out the formula for conversions.
    import java.io.*;
    public class Class1
         public static void main (String[] args)throws IOException
              int num=0;
              int base=0;
              int result;
              int rem;
              int arr[]=new int[20];
              int count=0;
              boolean prompt= true;
              for(int i=0; i<arr.length; i++)
                             while(prompt)
              //int i=0     ;
              String s;
              int x;
              BufferedReader aa =
                             new BufferedReader(new InputStreamReader(System.in));
              System.out.println("Enter a positive number for the conversion:");
              s = aa.readLine();
              num = Integer.parseInt(s);
                   System.out.println("Enter the base number that you want to convert your number:");
                   s=aa.readLine();
                   base = Integer.parseInt(s);
                   if(base >= 2)
                        if(num > 0)
                        {   rem= num%base;
                             num=num/base;
                             arr=rem;
                             System.out.println("The converted number is: " + arr[i]);
                             System.out.print("Would you like to go on (yes/no)?");
                             s=aa.readLine();
                             prompt= s.equalsIgnoreCase("no");
                             count++;
                             //i++;     
                        else
                             System.out.println("The number must be greater that 0, please enter an other number!!");
                   else
                        System.out.println("The base number is not the appropriate,must be greater of two!!");
                   //promt the user if he/she wants to continiue or not
                   System.out.println("You have used the conversion thingy " count " times, You Freak!");
                   System.in.read();

    Since I have already started this I will try to make the conversion work. ( usually I do not like to to other people's homework ).
    import java.io.*;
    public class Class1
         static char[] theDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
         public static void main (String[] args)throws IOException
              int num=0;
              int base=0;
              int result;
              int rem;
              String arr[]=new String[20];
              int count=0;
              boolean prompt= true;
              for(int i=0; i<arr.length && prompt; i++)     {
                   while(prompt) {
                        String s;
                        int x;
                        BufferedReader aa =
                        new BufferedReader(new InputStreamReader(System.in));
                        System.out.println("Enter a positive number for the conversion:");
                        s = aa.readLine();
                        num = Integer.parseInt(s);
                        System.out.println("Enter the base number that you want to convert your number:");
                        s=aa.readLine();
                        base = Integer.parseInt(s);
                        if( base >= 2 && base < 17 ) {
                             if (num > 0)     {
                                  s = "";
                                  while ( num > 0 ) {
                                       rem= num%base;
                                       s = theDigits[rem] + s;
                                       num=num/base;
                                  arr[count] = new String(s);
                                  count++;
                                  //promt the user if he/she wants to continiue or not
                                  System.out.println("The converted number is: " + s + " base " + base );
                                  System.out.print("Would you like to go on (yes/no)?");
                                  s=aa.readLine();
                                  prompt= s.equalsIgnoreCase("yes");
                             else
                                  System.out.println("The number must be greater that 0, please enter an other number!!");
                        else
                             System.out.println("The base number is not the appropriate,must be greater of two and lower of 17!!");
              System.out.println("You have used the conversion thingy " +count +" times, You Freak!");
              System.in.read();
    }kurt

  • PLEASE HELP ME WITH THIS CODE I NEED A NAV BAR ASAP!!!!

    The code is below I just want a simple navigation bar that when I click on biography it takes me to the biography page and so on...I even tried the "href" nothing works I try it in live view and it doesnt work I try it out of live view and it still doesnt work Im using DW CS5 This page was made using a DW template but I changed it around to fit my liking
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>WebIntersect &Bull;Find ElizabethVictoria</title>
    <style type="text/css">
    <!--
    body {
    background: #000;
    margin: 0;
    padding: 0;
    color: #FCCFDD;
    background-color: #000;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 100%;
    line-height: 1.4;
    /* ~~ Element/tag selectors ~~ */
    ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
    padding: 0;
    margin: 0;
    h1, h2, h3, h4, h5, h6, p {
    margin-top: 0;  /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */
    padding-right: 15px;
    padding-left: 15px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */
    color: #FCCFDD;
    font-weight: bold;
    text-align: center;
    a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
    border: none;
    color: #000;
    /* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
    a:link {
    color:#808080;
    text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
    a:visited {
    color: #FCCFDD;
    text-decoration: underline;
    a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
    text-decoration: none;
    color: #FCCFDD;
    /* ~~ this container surrounds all other divs giving them their percentage-based width ~~ */
    .container {
    width: 80%;
    max-width: 1260px;/* a max-width may be desirable to keep this layout from getting too wide on a large monitor. This keeps line length more readable. IE6 does not respect this declaration. */
    min-width: 780px;/* a min-width may be desirable to keep this layout from getting too narrow. This keeps line length more readable in the side columns. IE6 does not respect this declaration. */
    background: #000;
    margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout. It is not needed if you set the .container's width to 100%. */
    /* ~~ the header is not given a width. It will extend the full width of your layout. It contains an image placeholder that should be replaced with your own linked logo ~~ */
    .header {
    background: #000;
    color: #FCCFDD;
    .sidebar1 {
    float: left;
    width: 20%;
    padding-bottom: 10px;
    background-color: #000;
    background-image: url(images/Untitled-6.gif);
    background-repeat: no-repeat;
    .content {
    padding: 10px 0;
    width: 60%;
    float: left;
    .sidebar2 {
    float: left;
    width: 20%;
    padding: 10px 0;
    background-color: #000;
    background-image: url(images/Untitled-6.gif);
    /* ~~ This grouped selector gives the lists in the .content area space ~~ */
    .content ul, .content ol {
    padding: 0 15px 15px 40px; /* this padding mirrors the right padding in the headings and paragraph rule above. Padding was placed on the bottom for space between other elements on the lists and on the left to create the indention. These may be adjusted as you wish. */
    /* ~~ The navigation list styles (can be removed if you choose to use a premade flyout menu like Spry) ~~ */
    ul.nav {
    list-style: none; /* this removes the list marker */
    border-top: 1px solid #666; /* this creates the top border for the links - all others are placed using a bottom border on the LI */
    margin-bottom: 15px; /* this creates the space between the navigation on the content below */
    ul.nav li {
    border-bottom: 1px solid #666; /* this creates the button separation */
    ul.nav a, ul.nav a:visited { /* grouping these selectors makes sure that your links retain their button look even after being visited */
    padding: 5px 5px 5px 15px;
    display: block; /* this gives the link block properties causing it to fill the whole LI containing it. This causes the entire area to react to a mouse click. */
    text-decoration: none;
    background: #8090AB;
    color: #000;
    ul.nav a:hover, ul.nav a:active, ul.nav a:focus { /* this changes the background and text color for both mouse and keyboard navigators */
    background: #6F7D94;
    color: #FFF;

    Where is your html code? or better yet a link to your site in question.

  • Please help me with this code

    hi to all experts ,
    my requirement is print a barcode..The first part is an alv with two editable fields when user checks the checkbox and changes the second coloumn that no of prints are to be printed ....everything is fine but the problem is if suppose first 3 checkboxes are checked and qty to print is 3 for each .So the total no of prints should be 9 which im able to see in the print preview ......but the problem is when after seeing the print preview when we are back to the alv screen and uncheck one checkbox so now the pages should be 6 but it is still 9 what could be the problem here is my code since i cannot post full im sending in parts.......any help will greatly apprieciated ..........................thanks
    TYPE-POOLS: slis.
    *TYPES DECLARATIONS
    TYPES:BEGIN OF ty_output,
    cbox(1)  TYPE c,"selection checkbox
    menge1 TYPE char16,"QUANTITY TO PRINT
    mblnr  TYPE mkpf-mblnr,"MATERIAL DOCUMENT NUMBER
    bwart  TYPE mseg-bwart,"MOVEMENT TYPE
    btext  TYPE t156t-btext,"MOVEMENT TYPE DESCRIPTION
    matnr  TYPE mseg-matnr,"MATERIAL NUMBER
    maktx  TYPE makt-maktx,"MATERIAL DESCRIPTION
    menge2 TYPE mseg-menge,"QUANTITY
    meins  TYPE mseg-meins,"BASE UNIT OF MEASUREMENT
    werks TYPE mseg-werks,"PLANT
    lgort TYPE mseg-lgort,"STORAGE LOCATION
    ebeln TYPE mseg-ebeln,"PO DOCUMENT NUMBER
    lifnr TYPE mseg-lifnr,"VENDOR
    bldat TYPE mkpf-bldat,"DOCUMENT DATE
    budat TYPE mkpf-budat,"POSTING DATE
    usnam TYPE mkpf-usnam,"USER ID
    xblnr TYPE mkpf-xblnr,"MATERIAL SLIP
    END OF   ty_output.
    TYPES : BEGIN OF ty_data,
    menge TYPE mseg-menge,"QUANTITY
    mblnr TYPE mkpf-mblnr,"MATERIAL DOCUMENT NUMBER
    bwart TYPE mseg-bwart,"MOVEMENT TYPE
    matnr TYPE mseg-matnr,"MATERIAL NUMBER
    meins TYPE mseg-meins,"BASE UNIT OF MEASUREMENT
    werks TYPE mseg-werks,"PLANT
    lgort TYPE mseg-lgort,"STORAGE LOCATION
    ebeln TYPE mseg-ebeln,"PO DOCUMENT NUMBER
    lifnr TYPE mseg-lifnr,"VENDOR
    bldat TYPE mkpf-bldat,"DOCUMENT DATE
    budat TYPE mkpf-budat,"POSTING DATE
    usnam TYPE mkpf-usnam,"USER ID
    xblnr TYPE mkpf-xblnr,"MATERIAL SLIP
            END   OF ty_data.
    TYPES: BEGIN OF ty_btext,
       btext TYPE t156t-btext,
       bwart TYPE t156-bwart,
           END   OF ty_btext.
    TYPES : BEGIN OF ty_maktx,
              maktx TYPE makt-maktx,
              matnr TYPE makt-matnr,
            END OF  ty_maktx.
    TYPES: BEGIN OF ty_mard,
             matnr TYPE mard-matnr,
             lgpbe TYPE mard-lgpbe,
          END OF ty_mard.
    *INTERNAL TABLES
    DATA: it_output  TYPE  STANDARD TABLE OF ty_output,
          it_data     TYPE STANDARD TABLE OF ty_data,
          it_btext    TYPE STANDARD TABLE OF ty_btext,
          it_maktx    TYPE STANDARD TABLE OF ty_maktx,
          it_fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv,
          it_events   TYPE STANDARD TABLE OF slis_alv_event,
          it_header   TYPE  slis_t_listheader,
          it_smart    TYPE STANDARD TABLE OF zmm_im_001_struc,
          it_mard     TYPE STANDARD TABLE OF ty_mard.
    *WORK AREAS
    DATA: wa_output   TYPE  ty_output,
          wa_data     TYPE  ty_data,
          wa_btext    TYPE  ty_btext,
          wa_maktx    TYPE  ty_maktx,
          wa_fieldcat TYPE  slis_fieldcat_alv,
          wa_events   TYPE  slis_alv_event,
          wa_header   TYPE  slis_listheader,
          wa_smart    LIKE LINE OF it_smart,
          wa_layout   TYPE  slis_layout_alv,
          wa_mard     TYPE  ty_mard.
    *FLAGS AND CONSTANTS
    DATA: fl_sel TYPE flag.
    DATA: fl_del TYPE flag,
          gv_count TYPE i.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:
      so_mblnr FOR  mkpf-mblnr,
      so_bwart FOR  mseg-bwart,"MOVEMENT TYPE
      so_bldat FOR  mkpf-bldat,"DOCUMENT DATE
      so_budat FOR  mkpf-budat,"POSTING DATE
      so_matnr FOR  mseg-matnr,"MATERIAL ID
    so_meins FOR  mseg-meins,"BASE UNIT OF MEASUREMENT
      so_werks FOR  mseg-werks,"PLANT
      so_lgort FOR  mseg-lgort,"STORAGE LOCATION
      so_lifnr FOR  mseg-lifnr,"VENDOR
      so_xblnr FOR  mkpf-xblnr,"MATERIAL SLIP
      so_ebeln FOR  mseg-ebeln,"PURCHASE DOC
      so_usnam FOR  mkpf-usnam.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2
       WITH FRAME TITLE text-002.
    PARAMETERS : 1x3 RADIOBUTTON GROUP
                  grp1 DEFAULT 'X',
                 2x4 RADIOBUTTON GROUP
                 grp1.
    SELECTION-SCREEN END OF BLOCK b2.
    *SELECTION-SCREEN BEGIN OF LINE.
    *SELECTION-SCREEN COMMENT 1(82) text-007.
    *SELECTION-SCREEN COMMENT 89(4) text-008.   " First part of your comment
    *SELECTION-SCREEN END OF LINE.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_mblnr-low.
    *GETTING F4 HELP FOR THE
    >FIELD MBLNR( MATERIAL DOCUMENT NUMBER)
      PERFORM get_f4val .
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_mblnr-high.
    GETTING F4 HELP FOR THE
    FIELD MBLNR( MATERIAL DOCUMENT NUMBER)
      PERFORM get_f4val .
    AT SELECTION-SCREEN.
      PERFORM valid_bwart.
      PERFORM valid_selscreen.
    if no records are found displaying an error message
      IF sy-dbcnt EQ 0.
        MESSAGE e003(zmimr012).
      ENDIF.
    START-OF-SELECTION.
    PERFORM get_data.
      PERFORM populate_data.
      PERFORM get_fcat.
      PERFORM get_events.
      PERFORM populate_events.
      PERFORM get_layout.
      PERFORM display_alv.
    Refresh : it_output,
             it_data,
             it_smart.
    *&      Form  GET_DATA
    FORM get_data .
      SELECT  b~menge
              a~mblnr
              b~bwart
              b~matnr
              b~meins
              b~werks
              b~lgort
              b~ebeln
              b~lifnr
              a~bldat
              a~budat
              a~usnam
              a~xblnr
      INTO CORRESPONDING
        FIELDS OF TABLE it_data
      FROM    mkpf AS a
      INNER JOIN  mseg AS b ON
            amblnr = bmblnr
        AND amjahr = bmjahr
      WHERE  a~mblnr  IN so_mblnr
      AND    b~bwart  IN so_bwart
      AND    b~bwart  IN ('101', '105')
      AND    a~bldat  IN so_bldat
      AND    a~budat  IN so_budat
      AND    b~matnr  IN so_matnr
      AND    b~matnr  NE space
      AND    b~werks  IN so_werks
      AND    b~lgort  IN so_lgort
      AND    b~ebeln  IN so_ebeln
      AND    b~lifnr  IN so_lifnr
      AND    a~xblnr  IN so_xblnr
      AND    a~usnam  IN so_usnam.
        SELECT btext
               bwart
                FROM t156t
                INTO TABLE it_btext
                FOR ALL ENTRIES IN it_data
                WHERE spras EQ 'EN'
                  AND bwart   = it_data-bwart
                  AND sobkz   = ''
                  AND kzbew   = 'B'
                  AND kzzug   = ''
                  AND kzvbr   = ''.
        SELECT maktx
               matnr
             FROM makt INTO
             TABLE it_maktx
             FOR ALL ENTRIES IN it_data
             WHERE matnr EQ it_data-matnr
             AND  spras EQ 'E'.
        SELECT matnr
               lgpbe
               FROM mard INTO
               TABLE it_mard
               FOR ALL ENTRIES IN it_data
          WHERE matnr EQ it_data-matnr
           AND  werks EQ it_data-werks
           AND  lgort EQ it_data-lgort.
    ENDIF.
    ENDFORM.                    " GET_DATA
    *&      Form  GET_F4VAL
    FORM get_f4val .
      TYPES : BEGIN OF ly_mblnr,
                mblnr TYPE mkpf-mblnr,
              END OF  ly_mblnr.
      DATA: lc_mblnr   TYPE dfies-fieldname
               VALUE 'MBLNR',
             lc_s_mblnr TYPE help_info-dynprofld
                        VALUE 'SO_MBLNR-LOW',
             lc_dynnr
              TYPE sy-dynnr VALUE '1000',
             lc_repid   TYPE sy-repid.
      DATA: lt_mblnr TYPE STANDARD
               TABLE OF ly_mblnr,
            lv_mblnr TYPE ly_mblnr,
            lt_return TYPE STANDARD TABLE OF
              ddshretval WITH HEADER LINE.
      CLEAR:lt_mblnr[],lv_mblnr,lt_return[],lt_return.
      SELECT mblnr FROM mkpf
        INTO TABLE lt_mblnr.
      SORT lt_mblnr.
      DELETE ADJACENT DUPLICATES FROM lt_mblnr.
      lc_repid = sy-repid.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield        = lc_mblnr
          value_org       = 'S'
          dynpprog        = lc_repid
          dynpnr          = lc_dynnr
          dynprofield     = lc_s_mblnr
        TABLES
          value_tab       = lt_mblnr
          return_tab      = lt_return
        EXCEPTIONS
          parameter_error = 1
          no_values_found = 2
          OTHERS          = 3.
      IF sy-subrc <> 0.
      ELSE.
        lc_mblnr = lt_return-fieldval.
      ENDIF.
    ENDFORM.                                                    " GET_F4VAL
    Edited by: mozam khan on Feb 28, 2009 4:39 AM

    *&      Form  PF_STATUS
    FORM pf_status_set USING
            ex_tab TYPE  slis_t_extab .
      SET PF-STATUS 'ZMIMR012_GUI' EXCLUDING ex_tab.
    ENDFORM. " PF_STATUS
    *&      Form  user_command
          text
    FORM user_command USING r_ucomm TYPE sy-ucomm
                        rs_selfield TYPE slis_selfield  .
      DATA: p_ref1 TYPE REF TO cl_gui_alv_grid.
      CASE r_ucomm .
        WHEN 'EXEC' .
          CLEAR p_ref1.
          IF p_ref1 IS INITIAL.
            CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
              IMPORTING
                e_grid = p_ref1.
          ENDIF.
          IF p_ref1 IS NOT INITIAL.
            CALL METHOD p_ref1->check_changed_data.
          ENDIF.
          LOOP AT it_output INTO wa_output WHERE cbox EQ 'X'.
            READ TABLE it_mard INTO wa_mard WITH KEY matnr = wa_output-matnr.
            IF sy-subrc EQ 0.
              wa_smart-lgpbe = wa_mard-lgpbe.
            ENDIF.
            wa_smart-matnr =  wa_output-matnr.
            wa_smart-maktx =  wa_output-maktx.
            wa_smart-meins =  wa_output-meins.
            wa_smart-bldat =  wa_output-bldat.
            wa_smart-no_cop = wa_output-menge1.
            APPEND wa_smart TO it_smart.
            CLEAR: wa_smart,wa_output.
          ENDLOOP.
    CALL METHOD p_ref1->REFRESH_TABLE_DISPLAY.
         CHECK fl_del NE 'X'.
          IF 1x3 = 'X'.
            PERFORM print_smartform1x3.
          ELSE.
            PERFORM print_smartform2x4.
          ENDIF.
       WHEN 'SEL_ALL'.
         fl_sel = 'X'." setting up the flag for all selection.
         PERFORM sel_rec.
         rs_selfield-refresh = 'X'.
       WHEN  'DES_ALL'.
         fl_del = 'X'.
         PERFORM del_sel.
         rs_selfield-refresh = 'X'.
      ENDCASE.
    ENDFORM.                    " user_command
    " top_of_page
    *&      Form  display_alv
    FORM display_alv .
      DATA: l_repid TYPE sy-repid.
      l_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = l_repid
         i_callback_pf_status_set          = 'PF-STATUS_SET'
         i_callback_user_command           = 'USER_COMMAND'
        I_CALLBACK_TOP_OF_PAGE            = 'top_of_page'
         i_callback_html_top_of_page       = 'HTML_TOP_OF_PAGE'
        I_CALLBACK_HTML_END_OF_LIST       = ' '
        I_STRUCTURE_NAME                  =
        I_BACKGROUND_ID                   = ' '
        I_GRID_TITLE                      =
        I_GRID_SETTINGS                   =
          is_layout                         = wa_layout
          it_fieldcat                       = it_fieldcat
        IT_EXCLUDING                      =
        IT_SPECIAL_GROUPS                 =
        IT_SORT                           =
        IT_FILTER                         =
        IS_SEL_HIDE                       =
        I_DEFAULT                         = 'X'
        I_SAVE                            = ' '
        IS_VARIANT                        =
          it_events                         = it_events
        IT_EVENT_EXIT                     =
        IS_PRINT                          =
        IS_REPREP_ID                      =
        I_SCREEN_START_COLUMN             = 0
        I_SCREEN_START_LINE               = 0
        I_SCREEN_END_COLUMN               = 0
        I_SCREEN_END_LINE                 = 0
        I_HTML_HEIGHT_TOP                 = 0
        I_HTML_HEIGHT_END                 = 0
        IT_ALV_GRAPHICS                   =
        IT_HYPERLINK                      =
        IT_ADD_FIELDCAT                   =
        IT_EXCEPT_QINFO                   =
        IR_SALV_FULLSCREEN_ADAPTER        =
      IMPORTING
        E_EXIT_CAUSED_BY_CALLER           =
        ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = it_output
       EXCEPTIONS
         program_error                     = 1
         OTHERS                            = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " display_alv
    *&      Form  get_layout
    FORM get_layout .
      wa_layout-box_fieldname         =  'CBOX' .
      wa_layout-box_tabname           =  'IT_OUTPUT'.
      wa_layout-colwidth_optimize     =  'X'.
    ENDFORM.                    " get_layout
    " print_smartform_1x3
    *&      Form  valid_bwart
          text
    -->  p1        text
    <--  p2        text
    FORM valid_bwart .
      TYPES:BEGIN OF ly_bwart,
              bwart TYPE mseg-bwart,
            END OF ly_bwart.
      DATA:it_bwart TYPE TABLE OF ly_bwart WITH  HEADER LINE.
      IF so_bwart[] IS NOT INITIAL.
        SELECT  bwart FROM mseg INTO TABLE it_bwart
                  FOR ALL ENTRIES IN so_bwart[]
                WHERE bwart <= so_bwart-high AND bwart => so_bwart-low.
        LOOP AT it_bwart.
          IF it_bwart-bwart NE '101' OR it_bwart-bwart NE '105' .
            CONTINUE.
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " valid_bwart
    *&      Form  print_smartform2x4
          text
         -->P_WA_SMART  text
         -->P_IT_SMART  text
    FORM print_smartform1x3.
      DATA : fm_name TYPE rs38l_fnam,
             control_parameters TYPE ssfctrlop,
             wa_job_output_info TYPE ssfcrescl,
             ssfcompin TYPE ssfcompin,
             ssfcompop TYPE  ssfcompop.
      ssfcompin-dialog = 'X'.
      CALL FUNCTION 'SSF_OPEN'
      EXPORTING
        ARCHIVE_PARAMETERS       =
        USER_SETTINGS            = 'X'
        MAIL_SENDER              =
        MAIL_RECIPIENT           =
        MAIL_APPL_OBJ            =
        OUTPUT_OPTIONS           =
         control_parameters       = control_parameters
      IMPORTING
        JOB_OUTPUT_OPTIONS       =
       EXCEPTIONS
         formatting_error         = 1
         internal_error           = 2
         send_error               = 3
         user_canceled            = 4
         OTHERS                   = 5
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = 'ZMM_IM_001'
          variant            = ' '
          direct_call        = ' '
        IMPORTING
          fm_name            = fm_name
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          OTHERS             = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      control_parameters-no_open = 'X'.
      control_parameters-no_close = 'X'.
      LOOP AT it_smart INTO wa_smart.
        IF wa_smart-no_cop IS NOT INITIAL.
          MOVE wa_smart-no_cop TO gv_count.
        ENDIF.
        DO  gv_count TIMES.
          CALL FUNCTION fm_name
            EXPORTING
          ARCHIVE_INDEX              =
          ARCHIVE_INDEX_TAB          =
          ARCHIVE_PARAMETERS         =
              control_parameters         = control_parameters
          MAIL_APPL_OBJ              =
          MAIL_RECIPIENT             =
          MAIL_SENDER                =
              output_options             = ssfcompop
          USER_SETTINGS              = 'X'
              wa_display                 = wa_smart
        IMPORTING
          DOCUMENT_OUTPUT_INFO       =
          JOB_OUTPUT_INFO            =
          JOB_OUTPUT_OPTIONS         =
           EXCEPTIONS
             formatting_error           = 1
             internal_error             = 2
             send_error                 = 3
             user_canceled              = 4
             OTHERS                     = 5
          IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
        ENDDO.
        CLEAR gv_count.
        CLEAR   :   wa_smart.
      ENDLOOP.
      CALL FUNCTION 'SSF_CLOSE'
        IMPORTING
          job_output_info  = wa_job_output_info
        EXCEPTIONS
          formatting_error = 1
          internal_error   = 2
          send_error       = 3
          OTHERS           = 4.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " print_smartform2x4
    *&      Form  print_smartform2x4
          text
    -->  p1        text
    <--  p2        text
    FORM print_smartform2x4 .
      DATA : fm_name TYPE rs38l_fnam,
             control_parameters TYPE ssfctrlop,
             wa_job_output_info TYPE ssfcrescl,
             ssfcompin TYPE ssfcompin,
             ssfcompop TYPE ssfcompop.
      ssfcompin-dialog = 'X'.
      CALL FUNCTION 'SSF_OPEN'
       EXPORTING
        ARCHIVE_PARAMETERS       =
        USER_SETTINGS            = 'X'
        MAIL_SENDER              =
        MAIL_RECIPIENT           =
        MAIL_APPL_OBJ            =
        OUTPUT_OPTIONS           =
          control_parameters       = control_parameters
      IMPORTING
        JOB_OUTPUT_OPTIONS       =
       EXCEPTIONS
         formatting_error         = 1
         internal_error           = 2
         send_error               = 3
         user_canceled            = 4
         OTHERS                   = 5
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = 'ZMM_IM_002'
          variant            = ' '
          direct_call        = ' '
        IMPORTING
          fm_name            = fm_name
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          OTHERS             = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      control_parameters-no_open = 'X'.
      control_parameters-no_close = 'X'.
      LOOP AT it_smart INTO wa_smart.
        IF wa_smart-no_cop IS NOT INITIAL.
          MOVE wa_smart-no_cop TO gv_count.
        ENDIF.
        DO  gv_count TIMES.
          CALL FUNCTION fm_name
            EXPORTING
          ARCHIVE_INDEX              =
          ARCHIVE_INDEX_TAB          =
          ARCHIVE_PARAMETERS         =
              control_parameters         = control_parameters
          MAIL_APPL_OBJ              =
          MAIL_RECIPIENT             =
          MAIL_SENDER                =
           OUTPUT_OPTIONS             = ssfcompop
          USER_SETTINGS              = 'X'
              wa_display                 = wa_smart
        IMPORTING
          DOCUMENT_OUTPUT_INFO       =
          JOB_OUTPUT_INFO            =
          JOB_OUTPUT_OPTIONS         =
           EXCEPTIONS
             formatting_error           = 1
             internal_error             = 2
             send_error                 = 3
             user_canceled              = 4
             OTHERS                     = 5
          IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
        ENDDO.
        CLEAR: gv_count.
      ENDLOOP.
      CALL FUNCTION 'SSF_CLOSE'
        IMPORTING
          job_output_info  = wa_job_output_info
        EXCEPTIONS
          formatting_error = 1
          internal_error   = 2
          send_error       = 3
          OTHERS           = 4.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " print_smartform2x4
    *&      Form  valid_selscreen
          text
    -->  p1        text
    <--  p2        text
    FORM valid_selscreen .
      SELECT  b~menge
              a~mblnr
              b~bwart
              b~matnr
              b~meins
              b~werks
              b~lgort
              b~ebeln
              b~lifnr
              a~bldat
              a~budat
              a~usnam
              a~xblnr
      INTO CORRESPONDING
        FIELDS OF TABLE it_data
      FROM    mkpf AS a
      INNER JOIN  mseg AS b ON
            amblnr = bmblnr
        AND amjahr = bmjahr
      WHERE  a~mblnr  IN so_mblnr
      AND    b~bwart  IN so_bwart
      AND    b~bwart  IN ('101', '105')
      AND    a~bldat  IN so_bldat
      AND    a~budat  IN so_budat
      AND    b~matnr  IN so_matnr
      AND    b~matnr  NE space
      AND    b~werks  IN so_werks
      AND    b~lgort  IN so_lgort
      AND    b~ebeln  IN so_ebeln
      AND    b~lifnr  IN so_lifnr
      AND    a~xblnr  IN so_xblnr
      AND    a~usnam  IN so_usnam.
    ENDFORM.                    " valid_selscreen
    *&      Form  sel_rec
          text
    -->  p1        text
    <--  p2        text
    FORM sel_rec .
      DATA: lv_tabix TYPE sy-tabix.
      LOOP AT  it_output INTO wa_output.
        lv_tabix = sy-tabix.
        wa_output-cbox = 'X'.
        MODIFY it_output FROM wa_output TRANSPORTING cbox.
        CLEAR: wa_output.
      ENDLOOP.
    ENDFORM.                    " sel_rec

  • 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

  • Please, Help me check this code

    public Data class{
    private static void new(){
    PreparedStatement ps = conn.prepareStatement("INSERT INTO Members " +
    "VALUES(?, ?, ?, ?)");
    ps.setString(1, "14");
    ps.setString(2, "Mike");
    ps.setString(3, "Nwabikwo");
    ps.setString(4, "14/10/2008");
    ps.executeUpdate();
    public static void main(String [] arg){
    new();
    Where conn is a Connection object that connects to JDBC-ODBC
    When I tried to run it, I expect it to update the Database but it does not
    and no exception is reported.
    Please, tell me where the problem is.

    Phemmy wrote:
    public Data class{
    private static void new(){
    PreparedStatement ps = conn.prepareStatement("INSERT INTO Members " +
    "VALUES(?, ?, ?, ?)");
    ps.setString(1, "14");
    ps.setString(2, "Mike");
    ps.setString(3, "Nwabikwo");
    ps.setString(4, "14/10/2008");
    ps.executeUpdate();
    public static void main(String [] arg){
    new();
    Where conn is a Connection object that connects to JDBC-ODBC
    When I tried to run it, I expect it to update the Database but it does not
    and no exception is reported.
    Please, tell me where the problem is.it's because you don't commit the update and close your Connection properly. you don't close any resources correctly, so your code is flawed in every way.
    you save a date as a string? awful. make a date a date.
    %

  • Please help me with this code. Newbie here!

    Hi all,
    Below is a sample from the project that I am doing now. Would someone be so kind as to tell me how come the internal frame doesn't appear and the compiler keeps returning an error pointing to "setContentPane(mainDeskTop);"?
    Thanks in advance.
    package myprojects.xmlquery;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class XMLQuery extends Frame {
    public XMLQuery() {
    super("XMLQuery"); //Don't know what is this statement for?
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    dispose();
    System.exit(0);
    JDesktopPane mainDeskTop;
    mainDeskTop = new JDesktopPane(); //a specialized layered pane
    JInternalFrame frame = new JInternalFrame("test",true,true,true,true);
    frame.setSize(100,100);
    frame.setLocation(0,0);
    frame.setVisible(true); //set frame visible
    mainDeskTop.add(frame);
    try {
    frame.setSelected(true);
    } catch (java.beans.PropertyVetoException e) {}
    setContentPane(mainDeskTop);
    public static void main(String args[]) {
    System.out.println("Starting XMLQuery...");
    XMLQuery mainFrame = new XMLQuery();
    mainFrame.setSize(400, 400);
    mainFrame.setTitle("XMLQuery");
    mainFrame.setVisible(true);

    Extend JFrame instead of Frame.
    Denis

  • Please help me optimize this code..

    i have already checked the indexes of the tables and used the primary keys.
    r_datum-sign = gco_sign_i.
      r_datum-low  = docdate_from.
      IF NOT docdate_to IS INITIAL.
        r_datum-option = gco_option_bt.
        r_datum-high   = docdate_to.
      ELSE.
        r_datum-option = gco_option_eq.
      ENDIF.
      APPEND r_datum.
      CLEAR r_datum.
      r_vbeln-sign = gco_sign_i.
      r_vbeln-low  = docnum_from.
      IF NOT docnum_to IS INITIAL.
        r_vbeln-option = gco_option_bt.
        r_vbeln-high   = docnum_to.
      ELSE.
        r_vbeln-option = gco_option_eq.
      ENDIF.
      APPEND r_vbeln.
      CLEAR r_vbeln.
      process_web_rset salesgroup
                       r_vkgrp
                       gco_sign_i
                       gco_option_eq.
    * Get Total (Confirmed) Qty
      PERFORM get_valid_itemcateg TABLES gr_pstyv.
    * Header
      SELECT   vbak~vbeln
               vbkd~inco1
               vbak~erdat
               vbak~gueen
               vbak~ernam
               vbkd~bstkd
               vbak~kunnr
      APPENDING CORRESPONDING FIELDS OF TABLE lt_hdr
      FROM  vbak INNER JOIN vbkd
      ON  vbak~vbeln EQ vbkd~vbeln
      WHERE vbak~vbeln IN r_vbeln
                    AND  vbak~erdat IN r_datum
                    AND  vbak~vkgrp IN r_vkgrp
                    AND  vbak~kunnr EQ customer
                    AND  vbkd~posnr EQ lv_posnr
      SORT lt_hdr BY vbeln.
      LOOP AT lt_hdr.
    * Customer Name
        SELECT SINGLE  kna1~name1
                 INTO  lv_cusname
                 FROM  kna1
                 WHERE kna1~kunnr EQ lt_hdr-kunnr.
        MOVE lt_hdr-vbeln TO listing-sa.
        MOVE lt_hdr-ernam TO listing-ordered_thru.
        MOVE lt_hdr-bstkd TO listing-po.
        MOVE lt_hdr-kunnr TO listing-customer.
        MOVE lv_cusname TO listing-customer_name.
        MOVE lt_hdr-erdat TO listing-date_created.
        MOVE lt_hdr-gueen TO listing-valid_until.
    CONCATENATE lt_hdr-erdat+6(2) lt_hdr-erdat+4(2) lt_hdr-erdat+0(4) INTO
                       listing-date_created SEPARATED BY '.'.
    CONCATENATE  lt_hdr-gueen+6(2) lt_hdr-gueen+4(2) lt_hdr-gueen+0(4) INTO
                                listing-valid_until SEPARATED BY '.'.
    * Get Mode of Sale
        IF lt_hdr-inco1 EQ 'FOB'.
          listing-incoterms = co_inco1.
        ELSEIF lt_hdr-inco1 EQ 'CIF'.
          listing-incoterms = co_inco2.
        ENDIF.
    * Get Status
        SELECT SINGLE  bezei
                 FROM  tvbst JOIN vbuk
                   ON  tvbst~statu EQ vbuk~gbstk
                 INTO  listing-status
                WHERE  tbnam      EQ co_tbnam
                  AND  spras      EQ co_spras
                  AND  fdnam      EQ co_fdnam
                  AND  vbuk~vbeln EQ listing-sa.
    * Get Ship to party
        SELECT SINGLE  name1
                 FROM  vbpa INNER JOIN kna1
                   ON  vbpa~kunnr = kna1~kunnr
                 INTO  listing-ship_to
                WHERE  vbeln EQ listing-sa
                  AND  posnr EQ lv_posnr
                  AND  parvw EQ 'WE'.
    * Get Plant
        SELECT SINGLE  vbap~werks
                       t001w~name1
                 FROM  vbap INNER JOIN t001w
                   ON  vbap~werks EQ t001w~werks
                 INTO (listing-plant,
                       listing-plant_text)
                WHERE  vbap~vbeln EQ listing-sa
    * Items
        SELECT SINGLE
              a~matnr
              a~pstyv
              b~bmeng
              b~vrkme
      INTO (lv_matnr,
      lv_pstyv,
      lv_bmeng,
      lv_vrkme)
        FROM  vbap AS a INNER JOIN vbep AS b
          ON  a~vbeln = b~vbeln
         AND  a~posnr = b~posnr
       WHERE  a~vbeln = lt_hdr-vbeln
       AND a~posnr EQ co_posnr
       AND a~pstyv IN gr_pstyv
    * Use zshowitem to identify items for display on SO
        lv_convvl = 1.
    *   Convert Quantity
        PERFORM check_conversion USING: lv_bmeng
                                        listing-total_uom
                                        lv_pstyv
                                        lv_vrkme
                                   lv_matnr.  "<<CR002-DEVK944861 ins
        IF listing-total_uom IS INITIAL.
          MOVE lv_vrkme TO listing-total_uom.
        ENDIF.
        IF listing-total_uom IS INITIAL.
          MOVE lv_vrkme TO listing-total_uom.
        ENDIF.
        vl_sum1 = vl_sum1 + lv_bmeng.
    *    ENDLOOP.
        listing-total_qty = vl_sum1.
        REFRESH lv_itab.
        CLEAR: vl_sum1,
               vl_sum2.
    * Scheduling Agreement Item and Served Qty
        SELECT SINGLE
                b~vbeln AS vbeln2
                b~rfmng
                b~meins
      INTO (lv_vbeln2,
            lv_rfmng,
            lv_meins)
          FROM  vbap AS a INNER JOIN vbfa AS b
          ON a~vbeln EQ b~vbelv
          AND a~posnr EQ b~posnv
         WHERE a~vbeln = lt_hdr-vbeln
         AND a~pstyv IN gr_pstyv
         AND b~vbtyp_n EQ co_vbtyp_n.
        IF sy-subrc EQ 0.
    *   Goods Issue Status per Item
          SELECT SINGLE  wbstk
                   FROM  vbuk
                   INTO  vl_drstatus
                  WHERE  vbeln = lv_vbeln2.
    *   Convert Quantity
          PERFORM check_conversion USING: lv_rfmng
                                          listing-served_uom
                                          lv_pstyv
                                          lv_meins
                                   lv_matnr. " <<CR002-DEVK944861 ins
    *   Pass Value
          IF listing-served_uom IS INITIAL.
            MOVE lv_meins TO listing-served_uom.
          ENDIF.
          vl_served_qty = vl_served_qty + lv_rfmng.
          CLEAR: lt_scheditm,
                 vl_drstatus,
                 vl_sum3,
                 vl_meins.
        ENDIF.
        listing-served_qty = vl_served_qty.
        CLEAR vl_served_qty.
    * Append List
        APPEND listing.
        CLEAR: lt_hdr,
               lv_itab,
               lt_scheditm,
               listing,
               vl_datum1,
               vl_datum2,
               vl_sum1,
               vl_sum2,
               vl_sum3.
      ENDLOOP.
      IF sy-subrc <> 0.
        CALL FUNCTION 'BALW_BAPIRETURN_GET2'
             EXPORTING
                  type   = 'W'
                  cl     = 'ZECOM'
                  number = 000
             IMPORTING
                  return = return.
      ELSE.
        CALL FUNCTION 'BALW_BAPIRETURN_GET2'
             EXPORTING
                  type   = 'S'
                  cl     = 'ZECOM'
                  number = 001
             IMPORTING
                  return = return.
      ENDIF.
    ENDFUNCTION.

    As mentioned by others avoid into corresponding fields.
    If you have to join vbak/vbkd then at least try to use
    Sales Organization
    Distribution Channel
    Division
    FOr customer name do n ot select for each document, select for all entries in lt_hdr_aux before the loop where lt_hdr_aux[] = lt_hdr[] with adjacent duplicates by customer deleted and then in the loop use read instead.
    Don't use inner joins on vbap to other tables instead select vbap information for all documents selected and then read.
    etc etc
    Use st05 to review which table accesses are giving you a problem and concentrate first on those taking into account
    - not to retrieve data multiple times e.g. is customer is cust1 for deoc1 and for doc 10 then only retrieve once as detailed above.
    - optimise the actual select statement - no into corresponding, using keys etc

  • 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);

  • Please help me transform this C++ code to java code....

    guys...please help me transform this C++ code to java code....please try to explain the code..thanks
    [program]
    #include <stdio.h>
    #define ALIVE 1
    #define DEAD 0
    #define SZ 33
    int stschk (int ,int );
    main()
    int s[SZ][SZ], i, j;
    for (i=0; i<sz; i++ ) s[0] = DEAD;
    for (j=0; j<sz; j++ ) s[0][j] = DEAD;
    s[0][1] = ALIVE;
    for (i=0; i<sz-1; i++) {
    for ( j=1;j<sz;j++ ) {
    s[i][j] = stschk(s[i][j-1],s[i+1][j];
    if(s[i][j-1]==ALIVE) printf("*");
    else printf(" ");
    printf("\n");
    int stschk(int s1,int s2)
    if(((s1==DEAD)&&(s2==ALIVE))||
    ((s1==ALIVE)&&(s2==DEAD))) return ALIVE;
    else return DEAD;

    Being picky, that's not C++, that's C. Standard headers in C++ dont' have .h after them, loop variables are scoped with the for, you use constants rather than #defines, etc..
    C and C++ both don't initialise arrays by default; you'd have to write an initialiser to get it to zero out the array:
        int s[sz][sz] = {};gcc will insert a call to memset to zero the array.
    If the author was assuming that the array was zeroed out, there would be no point zeroing the first row and column.
    The code reads values which haven't been initialised. If you mark such values explicitly undefined, and change the program to report an error when undefined, then you get several cases where the program makes such report.
    So either it' s a primitive random number generator (some random number generators use uninitialised memory as a source of randomness), or it's buggy, or it's processing undefined data and throwing away the result. Either way, it cannot be directly be ported to Java if the undefined values (which are limited to a small area of the ouput) are significant.

  • I brought a iTunes card and the the code on the back is not there it has faded away can u please help me with this problem

    i brought a iTunes card and the the code on the back is not there it has faded away can u please help me with this problem

    Hi Daniel ...
    Try here > iTunes Store: Invalid, inactive, or illegible codes

  • 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.

  • I have upgraded My leopard to Mountain lion 10.7 via snow leapeard. Now My itunes is not working properly nor I able to install google chrome successfully. Please help me in this occasion. I am facing following messages.

    Hello Team,
    I have upgraded My leopard to Mountain lion 10.7 via snow leapeard. Now My itunes is not working properly nor I able to install google chrome successfully. Please help me in this occasion.
    Also, I am not being able to upgrade Mac OS X 10.7 to 10.7.4 or letest for lion.
    I am facing following messages when I open itunes ( I down loaded and install new for 10.7)
    Process:         iTunes [463]
    Path:            /Applications/iTunes.app/Contents/MacOS/iTunes
    Identifier:      com.apple.iTunes
    Version:         10.7 (10.7)
    Build Info:      iTunes-10702101~1
    Code Type:       X86-64 (Native)
    Parent Process:  launchd [273]
    Date/Time:       2012-10-22 23:33:07.226 +0200
    OS Version:      Mac OS X 10.7 (11A390)
    Report Version:  8
    Interval Since Last Report:          4918 sec
    Crashes Since Last Report:           2
    Per-App Crashes Since Last Report:   2
    Anonymous UUID:                      3DE933E2-7A48-4840-91F4-7DC466ED9C26
    Crashed Thread:  0
    Exception Type:  EXC_BREAKPOINT (SIGTRAP)
    Exception Codes: 0x0000000000000002, 0x0000000000000000
    Application Specific Information:
    dyld: launch, loading dependent libraries
    @executable_path/../Frameworks/iPodUpdater.framework/Versions/A/iPodUpdater
    Dyld Error Message:
      Library not loaded: @executable_path/../Frameworks/iPodUpdater.framework/Versions/A/iPodUpdater
      Referenced from: /Applications/iTunes.app/Contents/MacOS/iTunes
      Reason: unsafe use of @executable_path in /Applications/iTunes.app/Contents/MacOS/iTunes with restricted binary
    Binary Images:
           0x102a96000 -        0x103c36fff  com.apple.iTunes (10.7 - 10.7) <0CC47E12-134F-A9E1-7E4F-3EAC797C3050> /Applications/iTunes.app/Contents/MacOS/iTunes
        0x7fff62696000 -     0x7fff626cb1ff  dyld (195 - ???) <71093406-21CF-3DBE-A001-802259ED5300> /usr/lib/dyld
    Model: MacBook4,1, BootROM MB41.00C1.B00, 2 processors, Intel Core 2 Duo, 2.4 GHz, 2 GB, SMC 1.31f1
    Graphics: Intel GMA X3100, GMA X3100, Built-In, 144 MB
    Memory Module: BANK 0/DIMM0, 1 GB, DDR2 SDRAM, 667 MHz, 0xAD00000000000000, 0x48594D503131325336344350362D59352020
    Memory Module: BANK 1/DIMM1, 1 GB, DDR2 SDRAM, 667 MHz, 0xAD00000000000000, 0x48594D503131325336344350362D59352020
    AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x88), Broadcom BCM43xx 1.0 (5.10.131.36.5)
    Bluetooth: Version 2.5.0b13, 2 service, 12 devices, 2 incoming serial ports
    Network Service: AirPort, AirPort, en1
    Serial ATA Device: FUJITSU MHY2160BH, 160.04 GB
    Parallel ATA Device: MATSHITADVD-R   UJ-867
    USB Device: Built-in iSight, apple_vendor_id, 0x8501, 0xfd400000 / 2
    USB Device: USB Receiver, 0x046d  (Logitech Inc.), 0xc52f, 0x1d100000 / 2
    USB Device: Bluetooth USB Host Controller, apple_vendor_id, 0x8205, 0x1a100000 / 2
    USB Device: Apple Internal Keyboard / Trackpad, apple_vendor_id, 0x022a, 0x5d200000 / 3
    USB Device: IR Receiver, apple_vendor_id, 0x8242, 0x5d100000 / 2
    And Google chrome just keep loading the page for hours and nothing is appear on its browser. But safari and firefox working absolutly fine.
    In addition, I have reboot computer as well but it never worked. Please help me in this occasion.
    Eagerly waiting for your response on this issue.
    Best Regards,

    You need to upgrade your copy of MS Office. You're using a version that is 8 years old (at least). You can buy Office 2011, which will work. You could also get a copy of Pages from the App Store, which is cheaper and will open Word files (though not perfectly). Or you could get a free Office clone, like OpenOffice or LibreOffice.

Maybe you are looking for

  • I-Pod is synced with another I-Tunes libary

    Hi. I'm having troubles with my i-pod classic (120 GB). My i-pod was synced with my Windows XP verion of i-tunes but i had a computer crash and had to install Windows 7 and could not de-authorised my pod before starting installing Windows 7. After i

  • Jpg: Open a copy in PS without adjustments - why still .jpg?

    Hi, I apologize if this has been asked before but I couldn't find anything on this issue: My problem is that I usually shoot jpgs and often have to edit some files in photoshop. I would like to edit a copy of the original photo, but without any chang

  • Query on pricing

    Dear all How to include a new field catalogue- [pack size] for selecting fields in condition table(v/03). As pricing is based on pack size how to get the new field. Regards Sandeep Bhowmick

  • Using iPhone w/ iPod speakers/dock?

    I have the altec lansing inMotion speakers and i'm wondering if I can use this with my iphone? http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore.woa/wa/RSLID?mco=A21 59DEC&nplm=TC690ZM/A anyone know whether it is safe to use?

  • OIM: Hide provisioned roles/responsibilities in the modify provisioned resource request dataset

    Hi, We are provisioning Oracle E-Business Suite R12 through EBS UM connector. Is there a way where we can either hide the already provisioned EBS roles/responsibilities in the available list of roles/responsibilities or move these under Selected Resp