BOOLEAN IN FORTE MAPPING TO MS C++

I need to map some boolean data types from Tool to C++. Has anyone ever done
this before. If so,
how did you establish a one to one correspondence bewtween the boolean types
in
Forte and the boolean types in C++.
I am using Microsoft visual C++. According to the documentaion a tue value
has a value of -1.
and a false value has a value of 0.
BG

Hi,
Check these Notes:
Note 675939 - SAP Web AS 6.40 Installation on Windows: MS SQL Server
Note 795991 - J2EE deployment fails, memory error on db-side
Note 659468 - JDBC: Unspecified database error

Similar Messages

  • How to define the boolean - String value mapping for SelectBooleanCheckBox?

    I have a SelectBooleanCheckBox component whose value is bind to a bean property of type String.
    <af:selectBooleanCheckbox text="State" label="State" id="sbc1"
    value="#{viewScope.myBean.stateText}" autoSubmit="true"/>
    The expected value for the Bean property is "Accepted" (for true) and "Rejected" (for false).
    Currently, the component return String value "true" for checked and "false" for unchecked.
    How do I set up the component so the boolean value can map to my expected String value?

    Sumit,
    Thanks for the response.
    I read that post too. However, I don't have any binding in my case because the component is bind to a bean property instead of an attribute of a view object.
    Without the binding in the page definition, I can't find a place to define the mapping between the Boolean value and the expected String value.
    Pricilla

  • Forte Mapping of IDL

    I am having difficulty integrating an external Java client with a Fort&eacute; SO.
    The IDL provided by the Java programmers includes structures with 64 bit
    signed integers (IDL "long long" or Java long). Fort&eacute; does not seem to have
    an equivalent datatype (yes, I'm a Fort&eacute; rookie, but I have checked all
    available documentation). Corbagen chokes on it. I don't have to do
    anything with this data, but I do have to pass it along to another Java
    client (also using CORBA) and, possibly save in an SQL database. I may have
    to dummy this out as an array of 8 bytes of some kind and fix the endian
    differences myself (ugh!).
    Anybody got a better idea?
    Mike Lapeyre
    Troy, MI
    * Phone: +01-248-273-6331 (8-351)
    Fax: +01-248-273-1673
    * mailto: [email protected]

    Sun CC compiler has "-flags" command line option.
    If you know the meaning of Visual Age compiler flags you can easily map them to the
    Sun's compiler by using -flags:
    Let's say you are looking for the debug option:
    $ CC -flags | grep debug
    -g Compile for debugging
    -g0 Compile for debugging by dbx but allow inlining
    -xs Allow debugging without object (.o) files
    Of course some options are compiler/platform specific and will not have a direct equivalent.

  • Path Finder in a 2D Grid Map With Different Terrain Types

         I have been thinking for a while on path finding game algoritms and I can up with one idea witch I want to publish. The goal of my project is when I have a 2 dimensional grid map where squares can have different movement cost, like in Civilization II, to find the shortest way from one point in the map to another. I've used the Breathed First Search Engine. If you are not familiar to this search engine it is better to read about it first because I am not fcusing on it and I assume that you now how it works. You can read about it at the book "Practical Artificial Intelligence Programming in Java" writen by Mark Watson, witch is freely distributed at www.markwatson.com.
         Actually the idea of this 2D grid path finder is to use a third dimension witch have a size equal to the highest movement cost among all terrain types. This helps solving the problem with the different movement cost of the squates. By adding this abstract third dimension it is posible to use the Breadth First Search Engine.
         I this example the movementcost of a terrain type is always the same, no matter from witch square to with are you going (like in Civilization II but I haven't included roads or railroads). For example if you want to go from one square A to another square B with movement cost X (A and B are attached) you must go "up stairs" in the third dimension X - 1 times and then move to square B. But when you step on square B you are again at the lowest floor. So if you want to come back to the previous square A and it have movement cost Y first you must go floor Y and then jump in square A. And now you are again at the lowest floor at square A. When you move from one square to another you go always at the lowest floor. This is the way I handle with different movement costs.
         When you find the path to the goal point it is in 3 dimensions. So you must just project it in the 2D map and that's all you have the shortest path.
         I am sure this is not the best way to code this search engine but this is just the first scratch with no optimisation and so on. If I make a 100x100 randomly generated map it takes on my configuration(400Mhz Pentium II CPU with ASUS P2B MotherBoard on 100 MHz and 256 MB SD RAM on 133 MHz but because of my MB on 100MHz) around 1000 miliseconds (1000 miliseconds = 1 second) to find the shortest path from (1, 1) to (100, 100) witch is pretty good compare to the goTo function in Civilization II witch does not finds the shortest path at all and have made hundrets of gamers angry. This is amazing that nowadays there are so many games with bad path finding.
         This project includes:
    1. The PathFinder class witch does the jub.
    2. The Map class witch has a generator for a random map in it.
    3. The class TerrainType, every square on the map is based on this class.
    4. The class TerrainTypes witch is the set of all terrain types used in the map.
    5. The class PathFinderTest witch just test the path finder.
    To test this project put all files in one directory and run PathFinderTest.java.
    Map.java:
    import java.util.Vector;
    import java.util.Random;
    //This class just creates a random map and keeps it. I will not comment on this.
    class Map {
      //here is kept the information about the terrain types placed in the map. Where
      //every terrain type has a specific movement cost.
      private int[][] terrain;
      public TerrainTypes terrainTypes;
      private int landMass;
      private int width;
      private int height;
      private int highestMovementCost;
      public Map(int aWidth, int aHeight) {
        width = aWidth;
        height = aHeight;
        terrainTypes = new TerrainTypes();
        highestMovementCost = terrainTypes.getHighestMovementCost();
        terrain = new int[width][height];
        landMass = 0;
        generateRandomMap();
      public void clearGoalAndStartLocFromWater(int sx, int sy, int gx, int gy) {
        terrain[gx][gy] = 0;
        terrain[sx][sy] = 0;
      private void expandWater() {
        int waterConstant = 40;
        int waterExpansion = 2;
        int[][] moreWater = new int[width][height];
        Random randomizer = new Random();
        for (int t = 0; waterExpansion > t; t++) {
          for (int i = 0; i < width; i++) {
            for (int j = 0; j < height; j++) {
              if (i + 1 >= 0 && j >= 0 && i + 1 < width && j < height) {
                if (terrain[i + 1][j] != 4) {
                  if (randomizer.nextInt(waterConstant) == 0)
                    moreWater[i + 1][j] = 1;
              if (i + 1 >= 0 && j - 1 >= 0 && i + 1 < width && j - 1 < height) {
                if (terrain[i + 1][j - 1] != 4) {
                  if (randomizer.nextInt(waterConstant) == 0)
                    moreWater[i + 1][j - 1] = 1;
              if (i >= 0 && j - 1 >= 0 && i < width && j - 1 < height) {
                if (terrain[i][j - 1] != 4) {
                  if (randomizer.nextInt(waterConstant) == 0)
                    moreWater[i][j - 1] = 1;
              if (i - 1 >= 0 && j - 1 >= 0 && i - 1 < width && j - 1 < height) {
                if (terrain[i - 1][j - 1] != 4) {
                  if (randomizer.nextInt(waterConstant) == 0)
                    moreWater[i - 1][j - 1] = 1;
              if (i - 1 >= 0 && j >= 0 && i - 1 < width && j < height) {
                if (terrain[i - 1][j] != 4) {
                  if (randomizer.nextInt(waterConstant) == 0)
                    moreWater[i - 1][j] = 1;
              if (i - 1 >= 0 && j + 1 >= 0 && i - 1 < width && j + 1 < height) {
                if (terrain[i - 1][j + 1] != 4) {
                  if (randomizer.nextInt(waterConstant) == 0)
                    moreWater[i - 1][j + 1] = 1;
              if (i >= 0 && j + 1 >= 0 && i < width && j + 1 < height) {
                if (terrain[i][j + 1] != 4) {
                  if (randomizer.nextInt(waterConstant) == 0)
                    moreWater[i][j + 1] = 1;
              if (i + 1 >= 0 && j + 1 >= 0 && i + 1 < width && j + 1 < height) {
                if (terrain[i + 1][j + 1] != 4) {
                  if (randomizer.nextInt(waterConstant) == 0)
                    moreWater[i + 1][j + 1] = 1;
        for (int i = 0; i < width; i++) {
          for (int j = 0; j < height; j++) {
            if (moreWater[i][j] == 1) {
              terrain[i][j] = 4;
      private void generateRandomMap() {
        Random randomizer = new Random();
        for (int i = 0; i < width; i++) {
          for (int j = 0; j < height; j++) {
            if (randomizer.nextInt(3) == 1)
              terrain[i][j] = 0;
            else if (randomizer.nextInt(2) == 1)
              terrain[i][j] = 1;
            else if (randomizer.nextInt(2) == 1)
              terrain[i][j] = 3;
            else if (randomizer.nextInt(2) == 1)
              terrain[i][j] = 2;
            else if (randomizer.nextInt(2) == 1)
              terrain[i][j] = 2;
            else if (randomizer.nextInt(2) == 1)
              terrain[i][j] = 1;
            else if (randomizer.nextInt(2) == 1)
              terrain[i][j] = 3;
            else
              terrain[i][j] = randomizer.nextInt(5);
        expandWater();
        for (int i = 0; i < width; i++) {
          for (int j = 0; j < height; j++) {
            if (terrain[i][j] != 0)
              landMass++;
      public int getMapHeight() {
        return height;
      public int getMapWidth() {
        return width;
      public int getSquareID(int x, int y) {
        return terrain[x][y];
      public int getSquareMovementCost(int x, int y) {
        return terrainTypes.getMovementCost(terrain[x][y]);
    }PathFinder.java:
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.util.Vector;
    public class PathFinder {
      private BufferedReader consoleReader = new BufferedReader(new InputStreamReader(System.in));
      //The array t3D[][] represents the 2D square map where t3D.leght = map width
      //and t3D[x].lenght = map width (-1 < x < t3D.leght). The third dimension
      //is refered to the square's movement cost, witch is definite by terrain.
      //The fourth dimension will be with lenght = 3. When running the search engine
      //(expanding the explored squares) this 3 values will keep the position of
      //the previous square in 3 dimension, witch are width, height and the maximum
      //movement cost among all squares.
      private int[][][][] squares3DReference;
      //Keeps information witch squares are visited.
      private boolean[][][] visitedSquares;
      private Map map;
      //this is the queue used in the Breathed First Seatch.
      private Vector queue3D;
      //Here is saved the shortest path
      private Vector path2D;
      private int highestMovementCost;
      public PathFinder(Map aMap) {
        map = aMap;
        queue3D = new Vector();
        path2D = new Vector();
        squares3DReference = new int[map.getMapWidth()][map.getMapHeight()][][];
        visitedSquares = new boolean[map.getMapWidth()][map.getMapHeight()][];
        highestMovementCost = map.terrainTypes.getHighestMovementCost();
        buildAbstract3DTerrain();
      private void buildAbstract3DTerrain() {
        for (int x = 0; x < map.getMapWidth(); x++) {
          for (int y = 0; y <map.getMapHeight(); y++) {
            int movementCost = map.terrainTypes.getMovementCost(map.getSquareID(x, y));
            if ( movementCost > 0) {
              visitedSquares[x][y] = new boolean[highestMovementCost];
              squares3DReference[x][y] = new int[highestMovementCost][3];
              for (int z = 0; z < highestMovementCost; z++) {
                for (int t = 0; t < 3; t++) {
                  squares3DReference[x][y][z][t] = -1;
      private boolean isMoveValid(int x, int y, int z, int x2, int y2, int z2) {
        if ( x < 0 || y < 0 || z < 0 || x2 < 0 || y2 < 0 || z2 < 0 || x >= map.getMapWidth() || y >= map.getMapHeight() || z >= highestMovementCost ||  x2 >= map.getMapWidth() || y2 >= map.getMapHeight() || z2 >= highestMovementCost)
          return false;
        if (map.terrainTypes.getMovementCost(map.getSquareID(x2, y2)) < 1)
          return false;
        if (visitedSquares[x2][y2][z2])
          return false;
        if (x == x2 && y == y2)
          return true;
        else {
          if (z == map.terrainTypes.getMovementCost(map.getSquareID(x2, y2)) - 1)
            return true;
          else
            return false;
      private void clearPreviousSearchData() {
        queue3D.clear();
        path2D.clear();
        for (int x = 0; x < map.getMapWidth(); x++) {
          for (int y = 0; y < map.getMapHeight(); y++) {
            if (squares3DReference[x][y] != null) {
              for (int z = 0; z < highestMovementCost; z++) {
                visitedSquares[x][y][z] = false;
                for (int t = 0; t < 3; t++) {
                  squares3DReference[x][y][z][t] = -1;
      private Vector copyPath2D() {
        Vector path = new Vector();
        for (int i = 0; i < path2D.size(); i++) {
          path.add(path2D.get(i));
        return path;
      public Vector findPath(int sX, int sY, int gX, int gY) {
        int head = 0;
        int tail = 0;
        int x = sX;
        int y = sY;
        int z = 0;
        visitedSquares[x][y][z] = true;
        mainLoop: {
          while (tail <= head) {
            int[][] moves = getPosibleMoves(x, y, z);
            for (int i = 0; i < 9; i++) {
              if (moves[i] != null) {
                squares3DReference[moves[0]][moves[i][1]][moves[i][2]][0] = x;
    squares3DReference[moves[i][0]][moves[i][1]][moves[i][2]][1] = y;
    squares3DReference[moves[i][0]][moves[i][1]][moves[i][2]][2] = z;
    queue3D.add(moves[i]);
    if (moves[i][0] == gX && moves[i][1] == gY) {
    break mainLoop;
    visitedSquares[moves[i][0]][moves[i][1]][moves[i][2]] = true;
    head++;
    if (queue3D.size() == 0 || queue3D.size() == tail)
    break mainLoop;
    int[] nextInQueue = ((int[]) queue3D.get(tail));
    x = nextInQueue[0];
    y = nextInQueue[1];
    z = nextInQueue[2];
    tail++;
    if (squares3DReference[gX][gY][0][0] == -1) {
    clearPreviousSearchData();
    return path2D;
    fillpath2D(sX, sY, gX, gY);
    Vector path = copyPath2D();
    clearPreviousSearchData();
    return path;
    private int[][] getPosibleMoves(int x, int y, int z) {
    int[][] moves = new int[9][3];
    if (isMoveValid(x, y, z, x + 1, y, 0)) {
    moves[0][0] = x + 1;
    moves[0][1] = y;
    moves[0][2] = 0;
    else
    moves[0] = null;
    if (isMoveValid(x, y, z, x + 1, y - 1, 0)) {
    moves[1][0] = x + 1;
    moves[1][1] = y - 1;
    moves[1][2] = 0;
    else
    moves[1] = null;
    if (isMoveValid(x, y, z, x, y - 1, 0)) {
    moves[2][0] = x;
    moves[2][1] = y - 1;
    moves[2][2] = 0;
    else
    moves[2] = null;
    if (isMoveValid(x, y, z, x - 1, y - 1, 0)) {
    moves[3][0] = x - 1;
    moves[3][1] = y - 1;
    moves[3][2] = 0;
    else
    moves[3] = null;
    if (isMoveValid(x, y, z, x - 1, y, 0)) {
    moves[4][0] = x - 1;
    moves[4][1] = y;
    moves[4][2] = 0;
    else
    moves[4] = null;
    if (isMoveValid(x, y, z, x - 1, y + 1, 0)) {
    moves[5][0] = x - 1;
    moves[5][1] = y + 1;
    moves[5][2] = 0;
    else
    moves[5] = null;
    if (isMoveValid(x, y, z, x, y + 1, 0)) {
    moves[6][0] = x;
    moves[6][1] = y + 1;
    moves[6][2] = 0;
    else
    moves[6] = null;
    if (isMoveValid(x, y, z, x + 1, y + 1, 0)) {
    moves[7][0] = x + 1;
    moves[7][1] = y + 1;
    moves[7][2] = 0;
    else
    moves[7] = null;
    if (isMoveValid(x, y, z, x, y, z + 1)) {
    moves[8][0] = x;
    moves[8][1] = y;
    moves[8][2] = z + 1;
    else
    moves[8] = null;
    return moves;
    private void fillpath2D(int sX, int sY, int gX, int gY) {
    int[] gLoc = {gX, gY};
    path2D.add(gLoc);
    int x = gX;
    int y = gY;
    int z = 0;
    while (x != sX || y != sY) {
    int x2 = squares3DReference[x][y][z][0];
    int y2 = squares3DReference[x][y][z][1];
    int z2 = squares3DReference[x][y][z][2];
    x = x2;
    y = y2;
    z = z2;
    if (z == 0) {
    int[] loc = {x, y};
    path2D.insertElementAt(loc, 0);
    PathFinderTest.java
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.util.Vector;
    public class PathFinderTest {
      static BufferedReader consoleReader = new BufferedReader(new InputStreamReader(System.in));
      static Map map;
      static int startX;
      static int startY;
      static int goalX;
      static int goalY;
      public static void main(String[] args) throws Exception {
        System.out.print("Enter map size.\nx = ");
        int width = Integer.parseInt(consoleReader.readLine());
        System.out.print("y = ");
        int height = Integer.parseInt(consoleReader.readLine());
        System.out.print("Enter strting location.\nx = ");
        startX = Integer.parseInt(consoleReader.readLine()) - 1;
        System.out.print("y = ");
        startY = Integer.parseInt(consoleReader.readLine()) - 1;
        System.out.print("Enter goal location.\nx = ");
        goalX = Integer.parseInt(consoleReader.readLine()) - 1;
        System.out.print("y = ");
        goalY = Integer.parseInt(consoleReader.readLine()) - 1;
        if (goalX < 0 || goalY < 0 || startX < 0 || startY < 0 || goalX >= width || goalY >= height || startX >= width || startY >= height) {
          System.out.println("Invalid parameters found. Program will exit");
          System.exit(0);
        map = new Map(width, height);
        map.clearGoalAndStartLocFromWater(startX, startY, goalX, goalY);
        printSolution(new Vector());
        PathFinder pathFinder = new PathFinder(map);
        long before = System.currentTimeMillis();
        Vector path = pathFinder.findPath(startX, startY, goalX, goalY);
        long after = System.currentTimeMillis();
        long time = after - before;
        printSolution(path);
        if (path.size() == 0)
          System.out.println("No path found.");
        else
          System.out.println("Path found.");
        System.out.println("Finding the path took " + time + " milliseconds");
      static void printSolution(Vector path) {
        boolean[][] pathOnMap = new boolean[map.getMapWidth()][map.getMapHeight()];
        for (int i = 0; path.size() > i; i++) {
          int[] move = (int[]) path.get(i);
          pathOnMap[move[0]][move[1]] = true;
        for (int y = 0; y < map.getMapHeight(); y++) {
          for (int x = 0; x < map.getMapWidth(); x++) {
            System.out.print(" ");
            if (pathOnMap[x][y] == false)
              System.out.print(" ");
            else
              System.out.print("0");
            if (x == startX && y == startY)
              System.out.print("S");
            else if (x == goalX && y == goalY)
              System.out.print("G");
            else
              System.out.print(map.terrainTypes.getNameFirstLetter(map.getSquareID(x, y)));
          System.out.println();
        System.out.println();
    }TerrainType.java:
    public class TerrainType {
      private int movementCost;
      private String name;
      TerrainType(int aMovementCost, String aName) {
        movementCost = aMovementCost;
        name = aName;
      public int getMovementCost() {
        return movementCost;
      public String getName() {
        return name;
      public String getNameFirstLetter() {
        return name.substring(0, 1).toUpperCase();
    }TerrainTypes.java:
    import java.util.Vector;
    public class TerrainTypes {
      //Here are saved the terrain types with the map has. ElementAt 'i' in
      //setOfTypes is represented by the number in Map.terrain[x][y] witch is
      //equal to i, were x, y are random integer as soon as they do not
      //throw ArrayIndexOutOfBoundsException. Actually this is a coding to know
      //a specific square in the map to witch terrain type is refered in setOfTypes.
      private Vector setOfTypes;
      public TerrainTypes() {
        setOfTypes = new Vector();
        setOfTypes.add(new TerrainType(1, "Plains"));
        setOfTypes.add(new TerrainType(2, "Forst"));
        setOfTypes.add(new TerrainType(3, "Jungle"));
        setOfTypes.add(new TerrainType(4, "Mountain"));
        setOfTypes.add(new TerrainType(-1, "X"));
      public int getMovementCost(int i) {
        return ((TerrainType) setOfTypes.get(i)).getMovementCost();
      public String getName(int i) {
        return ((TerrainType) setOfTypes.get(i)).getName();
      public String getNameFirstLetter(int i) {
        return ((TerrainType) setOfTypes.get(i)).getNameFirstLetter();
      public int getHighestMovementCost() {
        int max = 1;
        for (int i = 0; setOfTypes.size() > i; i++) {
          int movementCost = ((TerrainType) setOfTypes.get(i)).getMovementCost();
          if ( movementCost > 0) {
            if (max < movementCost)
              max = movementCost;
        return max;
    }I hope this program will be helpful.
    Sogartar

    Why is such a smart guy like you not using A*
    It is a general known algorithm which will find the
    optimal solution in a finite search-space (within a minimal time).
    The calculation time for the A* algorithm is influenced by two parameters:
    1 - cumulative cost
    2 - minimal expected additional cost
    The calculation of these two costs has a great influence on the
    solution.
    I think the actual problems most games experience with shortest path calculatoin are
    1 - very little time to spent calculating the shortest path
    The quickest solution might be the best for the game
    If your solution takes 1 second for the calculation of a path for one element on the board (100x100)
    What would it take for the game to calculate the path for all elements controlled by the computer ??
    If the computer controls two players which each have 50 elements to control, it would take forever...
    Don't even consider the usage of a larger board (200x200 would take 4 seconds/element when
    algorithm has complexity O(n))
    2 - low priority.
    Users tend to forgive a bad shortest path-algorithm most of the time,
    but not a bad display, bad pictures,...
    This is why most shortest-path algorithms within games were
    developed as a depth first search,
    within some earlier games this was even developed as
    a rule which went straight to the endlocation and
    takes a right/left turn when blocked by water/wall/...
    So the actual steps you should take are:
    1 - develop a normal breath-first search (to get going)
    2 - develop a normal depth-first search (to compare speed and solution with)
    3 - develop a normal dijkstra algorithm (sometimes called A)
    4 - develop a best first algorithm (called A*)
    5 - develop other AI-algorithms building upon A* (tabu-search, limited memory A*,...)
    6 - develop some other AI-algorithms (Genetic Algorithms, Simulated Annealing,...)
    7 - compare and tweak/change all search-algorithms for
    7 - a - size of maps (small versus huge)
    7 - b - optimality of the solution
    7 - c - actual usage for your game
    8 - !!! very important !!!
    Share the developed path algorithms along with remarks about speed, map-size,...
    with the rest of us. I would be very interested in such library.
    kind regards,

  • Boolean in databases

    Can ayone tell me what's the easiest way to store 'boolean' values into a
    database?
    Most of the database types described in the data conversion tables of
    chapter 4 of "Accessing Databases" can only be selected into or inserted
    from a boolean value, but not both!
    TIA.
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Can ayone tell me what's the easiest way to store 'boolean' values into a
    database?convert the boolean value to an integer value an write it as
    a smallint (e.g.
    for ODBC) into the database.
    smallint is only 16 bit but you don't get a problem with the
    integerdata type
    because it's range is between 0 and 1
    e.g.
    convertBooleanToInteger(BooleanValue:boolean) : integer
    If BooleanValue then
    return(1);
    else
    return(0);
    end if;
    and
    convertIntegerToBoolean(IntegerValue:integer) : boolean
    If IntegerValue = 1 then
    return(TRUE);
    else
    return(FALSE);
    end if;There should be no need to convert it between an integer and a boolean.
    We read/write the boolean directly from/to the database. The database
    side is SMALLINT DEFAULT 0 NOT NULL and the forte attribute is boolean.
    Forte handles the conversion.
    Cheers
    David
    Lumley Technology
    ++61 9248 1356
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • Size of boolean primitive

    hi,
    in "Thinking in Java", Bruce Eckel writes that the size of the boolean primitive is not explicitly defined in Java (unlike int, long, etc.). He states that it is only specified to be able to take the literal values true and false.
    Is this correct and can anyone provide me with a reference (e.g., to the JLS, or similar)?
    thanks,
    Alan

    The JLS doesn't specify the "size" of anything, as far
    as I can see. But I suppose it depends on what you
    mean by "size"; the JLS does say that a "byte" is an
    8-bit integer, but it doesn't require an
    implementation to store it in any particular way (as
    far as I know). Likewise it says that a "boolean"
    represents a "logical quantity with two possible
    values", i.e. a single bit, but doesn't mandate how an
    implementation should store it.I was about to agree with DrClap (and was looking for the reference to support this); however...
    I looked in the specification for the Virtual Machine and found that the exact storage appears to be specified for every primitive except boolean, float, and double.
    3.3 Primitive Types and Values
    The primitive data types supported by the Java virtual machine are the numeric types, the boolean type (�3.3.4),1 and the returnAddress type (�3.3.3). The numeric types consist of the integral types (�3.3.1) and the floating-point types (�3.3.2). The integral types are:
    - byte, whose values are 8-bit signed two's-complement integers
    - short, whose values are 16-bit signed two's-complement integers
    - int, whose values are 32-bit signed two's-complement integers
    - long, whose values are 64-bit signed two's-complement integers
    - char, whose values are 16-bit unsigned integers representing Unicode characters (�2.1)
    The floating-point types are:
    - float, whose values are elements of the float value set or, where supported, the float-extended-exponent value set
    - double, whose values are elements of the double value set or, where supported, the double-extended-exponent value set
    The values of the boolean type encode the truth values true and false.
    The floating-point types are float and double, which are conceptually associated with the 32-bit single-precision and 64-bit double-precision format
    Apparently the boolean representation is only specified when mapping them to ints:
    The Java virtual machine encodes boolean array components using 1 to represent true and 0 to represent false. Where Java programming language boolean values are mapped by compilers to values of Java virtual machine type int, the compilers must use the same encoding.

  • Size of boolean datatype

    hi all,
    Can anyone tell me, how many bytes are taken by a boolean variable.
    Pls support ur answer.
    Also let me know, Is there any method in java to calculate the size of
    a particular datatype, like sizeof() in c/c++.
    Thanks in advance.

    Refer the following link
    http://www.cafeaulait.org/course/week2/02.html
    Yes, that website mentions 1 bit but as I said other
    sites mention other sizes. Just because you found it
    on that website doesn't mean it is true. Only the
    good people at sun know the truth.Ok, I will quote the VM specification which you have to adhere to if you implement a VM. As I said previously: The size is not specified in the JLS, but in the VM specification and you will not have a compatible VM if you aren't following it.:
    http://java.sun.com/docs/books/vmspec/2nd-edition/html/Overview.doc.html
    "3.3.4 The boolean Type
    Although the Java virtual machine defines a boolean type, it only provides very limited support for it. There are no Java virtual machine instructions solely dedicated to operations on boolean values. Instead, expressions in the Java programming language that operate on boolean values are compiled to use values of the Java virtual machine int data type.
    The Java virtual machine does directly support boolean arrays. Its newarray instruction enables creation of boolean arrays. Arrays of type boolean are accessed and modified using the byte array instructions baload and bastore.2
    The Java virtual machine encodes boolean array components using 1 to represent true and 0 to represent false. Where Java programming language boolean values are mapped by compilers to values of Java virtual machine type int, the compilers must use the same encoding. "
    Kaj

  • Serializing Java Boolean to AS

    Hi. I have a weirdest problem - my Boolean field are not deserialized property to AS Boolean variables. Namely it is always null fo rme. Simple Java boolean works fine, but not Boolean. I am not sure what to do. I was able to go around it until I had to return Map<String, Boolean> from my method. Any ideas, hints? It is more or less simple as that:
    JAVA:
    class A {
        private Boolean _Foo = Boolean.TRUE;
        private Map<String, Boolean> _Flags;
        public Boolean getFoo() { return _Foo; }
        public Map<String, Boolean> getFlags() { return _Flags; }
    AS:
    class A {
        private var foo:Boolean;
        private var flags:Object;

    There is no single way to serialize Objects to a stream so I'm not really sure what kind of answer you are expecting. I'm not sure that all serilizable Java Objects are serializable to XML in a generic way.
    Value types i.e. beans are pretty easily serialized and deserialized to XML, but the class definition of what you serialize may not be whatr you get when you deserialize the XML.

  • How to view the file content from the directory? getting Error:ORA-21560

    SQL> create directory READ_LOB_DIR as 'D:\Prj\Comm\Data';
    CREATE OR REPLACE Procedure READ_FILE_LOB IS
    -- Input Directory as specified in create directory
    l_dir CONSTANT VARCHAR2(30) := 'READ_LOB_DIR';
    -- Input File which is read word by word
    l_fil CONSTANT VARCHAR2(30) := 'testfile.txt';
    -- Separator Character between words is a BLANK (ascii = 32)
    l_seb CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(32));
    -- Character at the end of the file is NEWLINE (ascii = 10)
    l_sen CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(10));
    -- Pointer to the BFILE
    l_loc BFILE;
    -- Current position in the file (file begins at position 1)
    l_pos NUMBER := 1;
    -- Amount of characters have been read
    l_sum BINARY_INTEGER := 0;
    -- Read Buffer
    l_buf VARCHAR2(500);
    -- End of the current word which will be read
    l_end NUMBER;
    -- Return value
    l_ret BOOLEAN := FALSE;
    BEGIN
    -- Mapping the physical file with the pointer to the BFILE
    l_loc := BFILENAME(l_dir, l_fil);
    -- Check if the file exists
    l_ret := DBMS_LOB.FILEEXISTS(l_loc) = 1;
    IF (l_ret) THEN
    dbms_output.put_line('File ' || l_fil || ' in Directory ' || l_dir ||
    ' exists');
    -- Open the file in READ_ONLY mode
    DBMS_LOB.OPEN(l_loc, DBMS_LOB.LOB_READONLY);
    LOOP
    -- Calculate the end of the current word
    l_end := DBMS_LOB.INSTR(l_loc, l_seb, l_pos, 1);
    -- Process end-of-file
    IF (l_end = 0) THEN
    l_end := DBMS_LOB.INSTR(l_loc, l_sen, l_pos, 1);
    l_sum := l_end - l_pos - 1;
    DBMS_LOB.READ(l_loc, l_sum, l_pos, l_buf);
    dbms_output.put_line(UTL_RAW.CAST_TO_VARCHAR2(l_buf));
    EXIT;
    END IF;
    -- Read until end-of-file
    l_sum := l_end - l_pos;
    DBMS_LOB.READ(l_loc, l_sum, l_pos, l_buf);
    dbms_output.put_line(UTL_RAW.CAST_TO_VARCHAR2(l_buf));
    l_pos := l_pos + l_sum + 1;
    END LOOP;
    DBMS_LOB.CLOSE(l_loc);
    ELSE
    dbms_output.put_line('File ' || l_fil || ' in Directory ' || l_dir ||
    ' does not exist');
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('Error:' || SQLERRM);
    DBMS_LOB.CLOSE(l_loc);
    END;
    The Text file content is...
    Copyright 1996,2001 Oracle Corporation.     All Rights Reserved
    This file contains installation instructions for installing the
    Oracle8 ODBC Driver software.
    It is divided into four parts:
    o Part I: Summary of systems supported by Oracle8 ODBC client
    software
    Lists the platforms on which the Oracle8 ODBC Client software can
    be installed.
    o Part II: Oracle8 ODBC Driver software.
    Describes the files, and installation prerequisites for the Oracle8
    ODBC driver software.
    o Part III: Exploding the kit onto your system
    Describes how to explode the kit onto your system hard drive.
    o Part IV: Installation Instructions
    Describes how to install the Oracle8 ODBC driver.
    Part I: Systems supported by the Oracle8 client software
    You can install the ODBC client software on any of the following systems:
    o Windows 2000
    o Windows NT X86
    o Windows 95
    o Windows 98
    The Oracle8 ODBC Driver provides support for ODBC connections
    from Windows 2000, Windows NT, Windows 95, and Windows 98 systems
    to Oracle databases.
    o Part II: Oracle8 ODBC Driver software.
    Refer to the following files for information about the Oracle8 ODBC Driver:
    LICENSE.TXT - Oracle8 ODBC Driver License Agreement. Read carefully
    before installing and/or using this product. Enclosed in
    your software distribution kit.
    SQORA.HLP - A Window's Help file which is the primary reference
              manual for the Oracle8 ODBC Driver.
    ODBCRelnotes.WRI - The release notes for the Oracle8 ODBC Driver
    which contains information which may have not been
    included in the Help file.
    Installation Prerequisites
    See the Oracle8 ODBC Driver release notes (ODBCRelnotes.WRI),
    for a complete list of software products required and their versions.
    Time Required
    The installation of the Oracle8 ODBC Driver takes approximately 5
    minutes. The actual time may be shorter or longer, depending upon
    your hardware configuration.
    Disk Space Required
    The Oracle8 ODBC driver installation requires approximately 2
    megabytes of available storage space. The space required depends upon
    what files you already have installed. The installation procedure
    checks to see if you have enough available disk space. If you do not,
    the installation fails.
    Part III: Exploding the Kit onto your system
    Expand the self-extracting archive file onto your hard drive.
    C:\> ORA8174.EXE
    Part IV: Installation Instructions
    Oracle8 ODBC Driver 8.1.7.4.0
    This section assumes the following:
    1. MS Windows 2000, Windows NT, Windows 95 or Windows 98 is running.
    2. Oracle Universal Installer shipping with 8.1.7 has already been
    installed on your system.
    3. Part III has been completed.
    Software fixes:
    Refer to release notes (ODBCRelnotes.wri) for a complete list of
    Software fixes.
    Installation Instructions
    Once the self-extracting archive file ORA8174.EXE has been
    exploded it will create an installable directory structure
    onto your hard drive. Run the Oracle Universal Installer from
    your local drive.
    1. On the screen "File Locations" use the "Browse" button of
    the source path to choose the file 'products.jar' from the
    folder that ORA8174.EXE was extracted to. Choose 'Next'.
    2. You will receive a warning that some of the dependencies of
    this product are not found in the staging area. This warning
    is OK. The ODBC driver depends on the Net8 Client being already
    installed on the system. Answer 'Yes' to continue.
    Oracle is a registered trademark of Oracle Corporation.
    Microsoft, MS are registered trademarks of Microsoft Corporation.
    Microsoft Windows, Windows NT, Windows 95, Windows 98 and Open Database
    Connectivity are trademarks of Microsoft Corporation.
    All other trademarks and registered trademarks are the property
    of their respective owners.
    The output was...
    File testfile.txt in Directory READ_LOB_DIR exists
    Copyright
    1996,2001
    Oracle
    Corporation.     
    All
    Rights
    Reserved
    This
    file
    contains
    installation
    instructions
    for
    installing
    the
    Oracle8
    ODBC
    Driver
    software.
    It
    is
    divided
    into
    four
    parts:
    o
    Part
    I:
    Summary
    of
    systems
    supported
    by
    Oracle8
    ODBC
    client
    Error:ORA-21560: argument 2 is null, invalid, or out of range
    I want to diplay/view as per file content format from the file under that specified directory.
    Have any other method / any help or suggestions would be really appreciated.

    I changed the code like...
    CREATE OR REPLACE Procedure READ_FILE_LOB_tmp IS
    -- Input Directory as specified in create directory
    l_dir CONSTANT VARCHAR2(30) := 'READ_LOB_DIR';
    -- Input File which is read word by word
    l_fil CONSTANT VARCHAR2(30) := 'testfile.txt';
    -- Separator Character between words is a BLANK (ascii = 32)
    l_seb CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(32));
    -- Character at the end of the file is NEWLINE (ascii = 10)
    l_sen CONSTANT RAW(100) := UTL_RAW.CAST_TO_RAW(CHR(10));
    -- Pointer to the BFILE
    l_loc BFILE;
    -- Current position in the file (file begins at position 1)
    l_pos NUMBER := 1;
    -- Amount of characters have been read
    l_sum BINARY_INTEGER := 0;
    -- Read Buffer
    l_buf VARCHAR2(4000);
    -- End of the current word which will be read
    l_end NUMBER;
    -- Return value
    l_ret BOOLEAN := FALSE;
    BEGIN
    -- Mapping the physical file with the pointer to the BFILE
    l_loc := BFILENAME(l_dir, l_fil);
    -- Check if the file exists
    l_ret := DBMS_LOB.FILEEXISTS(l_loc) = 1;
    IF (l_ret) THEN
    dbms_output.put_line('File ' || l_fil || ' in Directory ' || l_dir ||
    ' exists');
    -- Open the file in READ_ONLY mode
    DBMS_LOB.OPEN(l_loc, DBMS_LOB.LOB_READONLY);
    LOOP
    -- Calculate the end of the current word
    l_end := DBMS_LOB.INSTR(l_loc, l_sen, l_pos, 1);
    -- Process end-of-file
    IF (l_end = 0) THEN
    EXIT;
    END IF;
    -- Read until end-of-file
    l_sum := l_end - l_pos;
    DBMS_LOB.READ(l_loc, l_sum, l_pos, l_buf);
    dbms_output.put_line(UTL_RAW.CAST_TO_VARCHAR2(l_buf));
    l_pos := l_pos + l_sum + 1;
    END LOOP;
    DBMS_LOB.CLOSE(l_loc);
    ELSE
    dbms_output.put_line('File ' || l_fil || ' in Directory ' || l_dir ||
    ' does not exist');
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line('Error:' || SQLERRM);
    DBMS_LOB.CLOSE(l_loc);
    END;
    Now its working fine with one addtional line...
    The file content is...
    This is My Content
    This is My Content
    This is My Content
    This is My Content
    This is My Content
    But The output was...
    File testfile.txt in Directory READ_LOB_DIR exists
    This is My Content
    This is My Content
    This is My Content
    This is My Content
    This is My Content
    here, i want to delete that additonal line...?

  • Exception [TOPLINK-6029] after upgrading from version 9.0.4.5 to 10.1.3.0.0

    In our project, we have made an upgrade to TopLink version 10.1.3.0.0. After replacing as much as possible deprecated Classes/methods, we get TopLink Exceptions when accessing attributes which are mapped via indirection. When TopLink tries to retrieve the reference records from the database, a [TOPLINK-6029] exception occurs. We do not execute a query with "readObject" but we only acces the attribute which is mapped via indirection.
    Exception-Stack:
    Exception [TOPLINK-6029] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.QueryException
    Exception-Beschreibung: Eine Referenzklasse muss angegeben werden.
    Abfrage: ReadObjectQuery()
         at oracle.toplink.exceptions.QueryException.referenceClassMissing(QueryException.java:858)
         at oracle.toplink.queryframework.ReadObjectQuery.checkDescriptor(ReadObjectQuery.java:198)
         at oracle.toplink.queryframework.ObjectLevelReadQuery.checkPrePrepare(ObjectLevelReadQuery.java:562)
         at oracle.toplink.queryframework.ObjectLevelReadQuery.isLockQuery(ObjectLevelReadQuery.java:1407)
         at oracle.toplink.internal.remote.RemoteValueHolder.isPessimisticLockingValueHolder(RemoteValueHolder.java:192)
         at oracle.toplink.internal.indirection.UnitOfWorkValueHolder.instantiateImpl(UnitOfWorkValueHolder.java:133)
         at oracle.toplink.internal.indirection.UnitOfWorkValueHolder.instantiate(UnitOfWorkValueHolder.java:217)
         at oracle.toplink.internal.indirection.DatabaseValueHolder.getValue(DatabaseValueHolder.java:61)
         at oracle.toplink.indirection.IndirectList.buildDelegate(IndirectList.java:184)
         at oracle.toplink.indirection.IndirectList.getDelegate(IndirectList.java:307)
         at oracle.toplink.indirection.IndirectList.toArray(IndirectList.java:646)
         at java.util.Collections.sort(Collections.java:158)
    With TopLink versio 9.0.4.5 everything works correctly.
    What could be the cause of this problem and what can we do to correct it.
    Regards,
    Hans.

    Hello James,
    Thanks for the quick answer!
    I have tested our program with the new TopLink version without making any change in the code, so definitely there a change in the behaviour in both TopLink versions. I have added the code where the descriptor and the onetomany mapping is created. I think the descriptor is ok, but the problem could have to do with the fact that in our program the business object is already registered in a unit of work.
    When I debug the situation in Eclipse and expand the IndirectList first on the original and afterwards on the clone, no exception occurs. When I directly expand the IndirectList in the clone the excpetion comes.
    // Descriptor creation
    private static Descriptor buildRentFunctionDescriptor()
    Descriptor desc = DescriptorLib.makeListDescriptor(RentFunction.class, RFU_TAB, RFU_TAB_KEY, RFU_PREFIX);
    DescriptorLib.addDirectToFieldMapping(desc, PropM.RentFun.KEY, RFU_TAB_KEY);
    DescriptorLib.addDirectToFieldMapping(desc, PropM.RentFun.NAME, RFU_TAB_NAME);
    DescriptorLib.addDirectToFieldMapping(desc, PropM.RentFun.ORDER, RFU_TAB_ORDER);
    DescriptorLib.addDirectToFieldMapping(desc, PropM.RentFun.RENT, RFU_TAB_RENT);
    DescriptorLib.addDirectToFieldMapping(desc, PropM.RentFun.ATYPE, RFU_TAB_ATYPE);
    DescriptorLib.addOneToManyMapping(desc, PropM.RentFun.HRENT, HistRent.class, HRE_TAB_LINK, true, true);
    DescriptorLib.addOneToOneMapping(desc, PropM.RentFun.PER, Period.class, RFU_TAB_PER, false, false);
    DescriptorLib.addOneToOneMapping(desc, PropM.RentFun.LEV, LocationLevel.class, RFU_TAB_LEV, false, false);
    DescriptorLib.addOneToOneMapping(desc, PropM.RentFun.ACC, Account.class, RFU_TAB_ACC, false, false);
    return desc;
    //Mapping creation
    public static OneToManyMapping addOneToManyMapping(Descriptor descriptor,
    String attributeName,
    Class referenceClass,
    String targetForeignKey,
    boolean useIndirection,
    boolean enableCascadingDelete)
    OneToManyMapping mapping = new OneToManyMapping();
    mapping.setAttributeName(attributeName);
    mapping.setReferenceClass(referenceClass);
    mapping.setTargetForeignKeyFieldName(targetForeignKey);
    if (useIndirection)
    mapping.useTransparentCollection();
    mapping.useCollectionClass(IndirectList.class);
    else
    mapping.dontUseIndirection();
    if (enableCascadingDelete)
    mapping.privateOwnedRelationship();
    descriptor.addMapping(mapping);
    return mapping;
    Maybe you could give some tips about how to deal with registering the business object in the unit of work in combination with attributes that use indirection.
    Regards,
    Hans
    Message was edited by:
    lammers1

  • Calling a method in a subclass?

    Hi, anyone an idea why method getInit() (in Applet class) isn't recognised in class Map?
    import java.awt.*;
    import java.awt.Color;
    import java.awt.event.*;
    import java.applet.*;
    import java.util.*;
    import javax.swing.*;
    public class Main extends Applet {
         public boolean initialized =true;
         Map map;
         World world = new World();
         public void init()
              Map = new map("map.jpg",0,0,world,this);
         public boolean getInit()
         { return initialized; }
    //class Map: method getInit() is not recognised???
    public class Map extends JPanel implements MouseListener
         private Image image;
         private World world;
    private int x,y;     
         private JPanel p = new JPanel();
         private JFrame frame = new JFrame();
         private Applet $applet;
         public Map(String name,int xp,int yp, World w, Applet a)
              $applet=a;
              x=xp;
              y=yp;
              world = w;
              MediaTracker media = new MediaTracker(this);
         image = Toolkit.getDefaultToolkit().getImage(name);
         media.addImage(image, 0);     
              try
                   { media.waitForID(0); }
         catch (Exception e) {}
         frame.getContentPane().add(this, BorderLayout.CENTER);
              frame.setSize(1100,750);
              frame.setLocation(0,0);
              frame.show();
              addMouseListener(this);
    public void paint(Graphics g)
         if($applet.getInit() == true ) //////...cannot resolve symbol...symbol : method getInit ()
              g.drawImage(image, x, y, this);
              world.displayWorld(g);
    public void mouseClicked(MouseEvent e)
         world.setStrength(10);
         repaint();

    when I try this, i get a null pointer exception @if(main.getInit()==true)
    public class Map extends JPanel implements MouseListener
    private Main main; ////instead of the horrible $applet :)
    public Map(String name,int xp,int yp, World w, Main m)
    main=m;
    public void paint(Graphics g)
    if(main.getInit() == true ) //////...cannot resolve symbol...symbol : method getInit ()
    g.drawImage(image, x, y, this);
    world.displayWorld(g);
    ps: new to java..., forgive me for asking dumb questions

  • How can I kill a thread.

    I have read the many threads about killing a thread but they dont answer the question I need to know.
    In class#1 I have the following snipet of code:
    for (int i=0; i < docs.size(); i++)
        try {
            boolean blncompleted = false;
         Map object = null;
            OntologyCreatorThread  ontThread = new OntologyCreatorThread ();
         ontThread.start();
         ontThread.join(15000); // Allow thread to process for up to 15 seconds.
         // If thread is still running, kill the thread.  I dont care about
         // clean up since its only using memory and cpu, no DB is ever touched.
         if (ontThread.getState().toString().equals("RUNNABLE")){
             ontThread.interrupt();
                ontThread.stop();
                // set flag to false
             blncompleted = false;
            else {
                // set flag to false and do a ton of other processing.
             blncompleted = false;
             object = ontThread.getObject();
        catch (Exception Ex){
            Ex.printStackTrace();
    In my thread I have the following:
    public class OntologyCreatorThread extends Thread {
        Map object = null;
        public OntologyCreatorThread(){
        public void run() {
           try {
             // The line below takes forever to run sometimes.
             object = functionCallToApi(stringOfText);
        public Map getObject() {
         return objects;
    If the thread takes to long to run I just want to kill it.
    I have tried interupt and stop and both dont work.  Inside the run method of the thread I call an external API
    which I pass a string of text.  I can not get into that code because its from a Off the shelf product that we dont
    have the code to.  If the call in the run method takes to long I want to just kill this thread in the main class(#1). 
    No matter what I do I cant get the damn thing to stop.
    The line below takes forever to run.
             object = functionCallToApi(stringOfText);
    Putting it in a while loop wont solve this problem because the processing is still taking place in the call to the api.
    Thanks in advanceMessage was edited by:
    Storm897

    Couple of things to consider:
    1. Note that Thread.interrupted() and t.isInterrupted() are very different methods. The former clears the interrupted status so that a subsequent call will return false. The latter does not affect the interrupt status on the thread.
    2. If your "atomic step one" catches an Exception, then you might be swallowing an InterruptedException. Basically the rule when a Thread is interrupted is that if it is in a blocking call, an InterruptedException is thrown. Otherwise, isInterrupted is set to true. So if you have blocking (I/O) calls in "atomic step one" and you're catching Exception, then it might be that the InterruptedException goes completely unnoticed.
    3. If "atomic step one" takes a long time and you really want to abort the thread instantly, then you need some kind of method for doing so--you need to program in safe "stopping points". For example:
    public class Helper implements Runnable {
       private boolean _continue = true;
       public void cancel() {
          _continue = false;
       public void run() {
          _continue = true;
          try {
             // Do something until in safe/stable state
             if(!_continue) return;
             // Do something until in safe/stable state
             if(!_continue) return;
             while(_continue) {
                 // process single record in large data set
                 // Safe to stop at the end of each loop
             if(!_continue) return;
             // Do something else . . . etc.
          } catch(InterruptedException ie) {
             _continue = false; // Unnecessary, but here for illustration
    }Casual programmers often don't care whether the thread stops safely or not, but it really is important especially if you are in the middle of some kind of transaction. That's why destroy(), cancel() et al are deprecated.

  • Can somebody help me with drop down box in STRUTS?

    Hi GURUs:
    I am doing a drop down box with Struts, and I have seen previous post on the forum regarding how to do that.
    Basically I have 2 classes
    InquiryAction and InquiryResult.jsp
    here is the code snippet from InquriyAction
    public class InquiryAction
        extends Action {
      public ActionForward execute(ActionMapping mapping,
                                   ActionForm actionForm,
                                   HttpServletRequest request,
                                   HttpServletResponse response) {
        InquiryForm form = (InquiryForm) actionForm;
        if ( request.getParameter("submitting") == null ) {
          return mapping.findForward("inquiry");
        /** @todo get parameters and do a search **/
        /** @todo put returned serviceResult or whatever into session/request **/
        ArrayList inquiryResults = new ArrayList();
        inquiryResults.add(new InquiryResultDisplayBean("005001", "00656992",
            "04/01/02", "104.15", "AD", "Name1", "Name2", "5"));
        inquiryResults.add(new InquiryResultDisplayBean("005001", "00729912",
            "04/02/22", "55.20", "GB", "Name2", "Name2", "7"));
        request.setAttribute("inquiryResults", inquiryResults);
        request.setAttribute("hasMore", new Boolean(true));
        return mapping.findForward("results");
    }and here is where I do the population of the drop down box in my JSP code
    <td class ='resultd'>
      <html:select property="PRKey"><logic:iterate id='transaction' collection='<%= request.getAttribute("inquiryResults") %>'>   
    <html : option value="<bean:write name='transaction' property='PRKey'/>" >           
         <bean:write name='transaction' property='PRKey'/>     
    </html:option>   
    </logic:iterate>
    </html:select>
    </td>                                 However when i test the JSP page on my local app server, i got the following error:
    javax.servlet.jsp.JspException: Cannot find bean under name org.apache.struts.taglib.html.BEAN
    at org.apache.struts.taglib.html.SelectTag.calculateMatchValues(SelectTag.java:301)
    at org.apache.struts.taglib.html.SelectTag.doStartTag(SelectTag.java:244)
    at jsp_servlet.__inquiryresults._jspService(__inquiryresults.java:544)
    I did bind the "inquiryResults" with an arrayList, can somebody tell me what is wrong? thanks...

    First: You can't nest tag library tags within tag library tags, unfortunately. So this:
    <html:option value="<bean:write name='transaction' property='PRKey'/>" > ...for example, is a no-go. You'd have to write it like this:
    <html:option value="<%= transaction.getPRKey() %>" > ...Second: The easiest way to do this is if the value and label properties of the InquiryResultDisplayBean objects are proper Java bean fields, meaning PRKey field has getPRKey() method. In that case, you can do this:
    <jsp:useBean id="inquiryResults" class="full.package.InquiryResultDisplayBean" scope="request" />
    <html:select property="PRKey">
    <html:options collection="inquiryResults" property="PRKey" labelProperty="PRKey"/>
    </html:select>

  • I need help with my remove method on a BST!

    Guys I need some help here, I have to create a remove method for a BST and below is my code:
    public boolean remove(OrderedMap map, K keyOfelementToRemove) {
              boolean result = false;
              if (root == null)
                   result = false;
              else {
                   MapNode curr = root;
                   MapNode prev = root;
                   while (curr.key.equals(keyOfelementToRemove) == false) {
                        prev = curr;
                        if (keyOfelementToRemove.compareTo(curr.key) < 0)
                             curr = curr.left;
                        else if (keyOfelementToRemove.compareTo(curr.key) > 0)
                             curr = curr.right;
                        if (curr == null)
                             break;
                   if (curr == null)
                        return result;
                   else if (curr == root && curr.left == null)
                        root = root.right;
                   else if (curr.left == null) {
                        if (curr.right == null)
                             curr = null;
                        else if (curr == prev.left)
                             prev = curr.right;
                        else if (curr == prev.right){
                             prev = curr.right;
                   else if (curr.left != null) {
                        MapNode temp = curr.left;
                        while (temp.right != null)
                             temp = temp.right;
                        K change = temp.key;
                        temp = null;
                        curr.key = change;
              size--;
              return result;
         }the algorithm that my instructor provides is:
    private boolean remove( BinaryTreeNode t, Comparable elementToRemove )
    Set result to false
    Traverse the tree t until elementToRemove is found. Use curr and prev to find the element
    leaving curr referring the node you want to remove. It may be the case that curr is null indicating
    that elementToRemove was not found. Now there are four cases to consider :
    Case 1: Not found
    return result (false)
    Case 2: The root is to be removed, but it has no left child.
    root = root's right subtree (assuming root refers the the root node in your BST)
    Case 3: The node is further down tree with no left child. Now must adjust one of the parent's links
    if curr is on the left side of prev,
    move parent's left link down to down to curr's right child
    else
    curr is on the right side of prev, so move parent's right down to down to curr's right child
    Case 4: curr has a left child.
    We can no longer ignore the left subtree. So find the maximum in the left subtree and
    move that object to the node referenced by curr . Then eliminate the maximum in the
    left subtree, which is now being reference from the original node to remove.
    however for case 3 and 4 it doesn't work, can someone please tell me why? I don't know where I made a mistake and I tried finding it but I still dont know

    I am sorry about the double post. I'll try not to do this again. My problem here seems to be that prev and curr aren't updating the BST outside this method, which means that it only changes locally but not permanently. I will post the code of the other headings:
    public class OrderedMap<K extends Comparable<K>, V> {
         private class MapNode {
              // Links to other BSTs
              private MapNode left;
              private MapNode right;
              ArrayList<V> temp1 = new ArrayList<V>();
              // The references to the key/value pair of the mapping
              private K key;
              @SuppressWarnings("unused")
              private V value;
              public MapNode(K theKey, V theValue) {
                   key = theKey;
                   value = theValue;
                   left = null;
                   right = null;
         } // end class MapNode
         private MapNode root;
         private int size;
         public OrderedMap() { // Create an empty tree
              root = null;
              size = 0;
         public int size() {
              return size;
         }

  • AS3 Unloading external SWF piling up problem

    I have two buttons on main SWF what loads and Unload two external SWFs back and forth.
    Also one timer function is calling external Screen saver SWF and unload the existing one when no interaction found.
    I am using unloadAndStop() function to unload the external SWFs.
    But after loading and unloading external SWFs, I am facing piling up or stack overflow problem.
    Any help will be highly appreciated.
    Thanks
    import flash.net.NetConnection;
    import flash.net.NetStream;
    import flash.media.Video;
    import flash.display.MovieClip;
    import caurina.transitions.*;
    import flash.utils.Timer;
    import flash.events.*;
    var myLoader_Map_1:Loader = new Loader();
    var myLoader_Map_2:Loader = new Loader();
    var myLoader_Screen_Saver:Loader = new Loader();
    var Ss:Boolean = false;
    var Maps:Boolean = true;
    //--------------------Screen Saver---------------------------------
    ScreenSaver();
      function ScreenSaver():void{
      var url:URLRequest = new URLRequest("screensaver.swf");
      myLoader_Screen_Saver.load(url); 
      addChild(myLoader_Screen_Saver);
      setChildIndex(myLoader_Screen_Saver, 1);
      Maps = false;
      Ss = true;
      function ScreenSaver_Unload():void{
      myLoader_Screen_Saver.unloadAndStop();
    //--------------------Map Buttons---------------------------------
    function MPstart():void{
      Tweener.addTween(MC_Maps_Btns,{alpha:1, x:778.25, y:1070.65, time:1, delay:1, transition:"easeOutCubic"});
      setChildIndex(MC_Maps_Btns, 2);
      MC_Maps_Btns.Btn_Map_1.visible = true;
      MC_Maps_Btns.Btn_Map_2.visible = true;
    function MPclose():void{
      Tweener.addTween(MC_Maps_Btns,{alpha:0, x:778.25, y:1179.85, time:1, transition:"easeOutCubic"});
    //--------------------Map 1 ---------------------------------
    MC_Maps_Btns.Btn_Map_1.addEventListener(MouseEvent.CLICK,OpenMap1);
      function OpenMap1(e:MouseEvent):void{
      var url:URLRequest = new URLRequest("Map_1.swf");
      myLoader_Map_1.load(url);
      myLoader_Map_1.alpha = 1;
      addChild(myLoader_Map_1);
      setChildIndex(myLoader_Map_1, 2);
      myLoader_Map_2.unloadAndStop();
      ScreenSaver_Unload();
      Maps = true;
      Ss = false;
      MC_Maps_Btns.Btn_Map_1.visible = false;
      MC_Maps_Btns.Btn_Map_2.visible = true;
    //--------------------Map 1 ---------------------------------
    MC_Maps_Btns.Btn_Map_2.addEventListener(MouseEvent.CLICK,OpenMap2);
      function OpenMap2(e:MouseEvent):void {
      var url:URLRequest = new URLRequest("Map_2.swf");
      myLoader_Map_2.load(url);
      myLoader_Map_2.alpha = 1;
      addChild(myLoader_Map_2);
      setChildIndex(myLoader_Map_2, 2);
      myLoader_Map_1.unloadAndStop();
      ScreenSaver_Unload();
      Maps = true;
      Ss = false;
      MC_Maps_Btns.Btn_Map_2.visible = false;
      MC_Maps_Btns.Btn_Map_1.visible = true;
    //--------------------Timer ---------------------------------
    var inactiveTime:int = 10000;
    var t:Timer = new Timer(inactiveTime);
    stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown1);
    t.addEventListener(TimerEvent.TIMER, onTimer);
    t.start();
      function onMouseDown1(e:MouseEvent):void {
      t.reset();
      t.start();
      trace("Interaction detected");
      function onTimer(e:TimerEvent):void {
      handleInactivity();
      function handleInactivity():void {
      trace('You\'re inactive.');
      if (Maps == true){
      myLoader_Map_1.unloadAndStop();
      myLoader_Map_2.unloadAndStop();
      else{
      trace("No Maps");
      if (Ss == false ){
      ScreenSaver();
      MPclose();
      else{
      trace("ScreenSaver already loaded");

    This is how I applied
    import flash.net.NetConnection;
    import flash.net.NetStream;
    import flash.media.Video;
    import flash.display.MovieClip;
    import caurina.transitions.*;
    import flash.utils.Timer;
    import flash.events.*;
    var myLoader_Map_1:Loader = new Loader();
    var myLoader_Map_2:Loader = new Loader();
    var myLoader_Screen_Saver:Loader = new Loader();
    var Ss:Boolean = false;
    var Maps:Boolean = true;
    //--------------------Screen Saver---------------------------------
    function unloadAllF():void{
    if(myLoader_Screen_Saver.content){
    myLoader_Screen_Saver.unloadAndStop();
    trace("ss unloaded");
    if(myLoader_Map_1.content){
    myLoader_Map_1.unloadAndStop();
    trace("map_1 unloaded");
    if(myLoader_Map_2.content){
    myLoader_Map_2.unloadAndStop();
    trace("map_2 unloaded");
    //etc
    ScreenSaver();
      function ScreenSaver():void{
      var url_ss:URLRequest = new URLRequest("screensaver.swf");
      unloadAllF();
      myLoader_Screen_Saver.load(url_ss); 
      addChild(myLoader_Screen_Saver);
      setChildIndex(myLoader_Screen_Saver, 1);
      Maps = false;
      Ss = true;
        function ScreenSaver_Unload():void{
      myLoader_Screen_Saver.unloadAndStop();
    //--------------------Map Buttons---------------------------------
    function MPstart():void{
      Tweener.addTween(MC_Maps_Btns,{alpha:1, x:778.25, y:1070.65, time:1, delay:1, transition:"easeOutCubic"});
      setChildIndex(MC_Maps_Btns, 2);
      MC_Maps_Btns.Btn_Map_1.visible = true;
      MC_Maps_Btns.Btn_Map_2.visible = true;
    function MPclose():void{
      Tweener.addTween(MC_Maps_Btns,{alpha:0, x:778.25, y:1179.85, time:1, transition:"easeOutCubic"});
    //--------------------Map 1 ---------------------------------
    MC_Maps_Btns.Btn_Map_1.addEventListener(MouseEvent.CLICK,OpenMap1);
      function OpenMap1(e:MouseEvent):void{
      var url_map_1:URLRequest = new URLRequest("Map_1.swf");
      unloadAllF();
      myLoader_Map_1.load(url_map_1);
      myLoader_Map_1.alpha = 1;
      addChild(myLoader_Map_1);
      setChildIndex(myLoader_Map_1, 2);
      myLoader_Map_2.unloadAndStop();
      ScreenSaver_Unload();
      Maps = true;
      Ss = false;
      MC_Maps_Btns.Btn_Map_1.visible = false;
      MC_Maps_Btns.Btn_Map_2.visible = true;
    //--------------------Map 1 ---------------------------------
    MC_Maps_Btns.Btn_Map_2.addEventListener(MouseEvent.CLICK,OpenMap2);
      function OpenMap2(e:MouseEvent):void {
      var url_map_2:URLRequest = new URLRequest("Map_2.swf");
      unloadAllF();
      myLoader_Map_2.load(url_map_2);
      myLoader_Map_2.alpha = 1;
      addChild(myLoader_Map_2);
      setChildIndex(myLoader_Map_2, 2);
      myLoader_Map_1.unloadAndStop();
      ScreenSaver_Unload();
      Maps = true;
      Ss = false;
      MC_Maps_Btns.Btn_Map_2.visible = false;
      MC_Maps_Btns.Btn_Map_1.visible = true;
    //--------------------Timer ---------------------------------
    var inactiveTime:int = 10000;
    var t:Timer = new Timer(inactiveTime);
    stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown1);
    t.addEventListener(TimerEvent.TIMER, onTimer);
    t.start();
      function onMouseDown1(e:MouseEvent):void {
      t.reset();
      t.start();
      trace("Interaction detected");
      function onTimer(e:TimerEvent):void {
      handleInactivity();
      function handleInactivity():void {
      trace('You\'re inactive.');
      if (Maps == true){
      myLoader_Map_1.unloadAndStop();
      myLoader_Map_2.unloadAndStop();
      else{
      trace("No Maps");
      if (Ss == false ){
      ScreenSaver();
      MPclose();
      else{
      trace("ScreenSaver already loaded");

Maybe you are looking for

  • ITunes 7, software 1.2 videos gone from iPod

    I recently updated to iTunes 7 so that i would be able to purchase and download a show from the music store. After my iPod was finished updating with the new software all of my shows were gone from my iPod except for the one i just bought. They are s

  • Samsung running on 3g won't switch to 4g?

    Was wondering if anyone had an issue with the samsung start on 4g, then go 3g and never go back to 4g? Doesn't it look like there is good signal for the LTE?         Channel: 119 P_REV Indicator: 6 PRL ID: 15010 Band Class Type: 0 ERI Version: 5 Dorm

  • Stopping iTunes 7 from disconnecting iPods?

    How do you stop iTunes 7 from disconnecting iPods after updating? I have two Nanos and two iPod 5th Gens connected to iTunes 7. After they sync, most of the iPods will disonnect from iTunes and it is usually random for which iPods connect/disconnect.

  • How do you convert .tiff to .mov?

    I am a radiologist and we are often creating education powerpoints showing interesting cases from CT or MRI. The files are usually in the form of .tiff. I would like to create a .mov file from multiple .tiff files to scroll through. That way I do not

  • Wiki's FAQ page

    Dear Wiki editors, Please feel free to visit the[ Wiki's FAQ page|https://wiki.sdn.sap.com/wiki/display/HOME/Wiki+FAQ] and find a lot of useful information. If you don't find the desired information there, please post your question as a thread in thi