Manhattan distance Greedy search

Hi all,
I am developing a program to solve the 8 puzzle using the greedy search.
I have two 2D arrays(sorry about the code) -
public static          int [][] Start ={
                         { 5,4,0 },
{ 6,1,8 },
          { 7,3,2 }};
public static          int [][] Goal = {
                         { 1,2,3 },
               { 8,0,4 },
                    { 7,6,5 }};
I have found where the 0 is and using the outline of the Greedy search, I am moving the tiles in such a vay that It brings the tiles nearer to its goal state. I am moving the Zero and saving the two new Temporary arrays. I now need to run the two arrays through the Manhatten Distance function to find out which is the best to use and then I am going to save the best choice as my new Start array and keep looping through again and again until I have found my goal state!!
I no its long winded but its the only way I understand!!
My problem is that I can not figure out how to enter the temporary arrays into the Manhattan Function to figure out which is best??
I would greatly appreciate any help!!
Here is my source code --
import java.io.*;
public class Puzzle
               public static          int [][] tempStart1 = new int[3][3];
               public static          int [][] tempStart2 = new int[3][3];
               public static          int [][] Start ={
                                                  { 5,4,0 },
                                                  { 6,1,8 },
                    { 7,3,2 }};
               public static          int [][] Goal = {
                                                  { 1,2,3 },
                              { 8,0,4 },
                                   { 7,6,5 }};
          public static int i,j,x,y;
               public Puzzle()
          public static void main(String [] args)
                    printArray();
                    findBlank();
     public static void printArray(){
               System.out.println("Start State");
               for( int i =0; i< 3; i++){
               for( int j =0; j< 3; j++){
          System.out.print(Start[i][j]);
                    System.out.println("");
               System.out.println("\n");
               System.out.println("Goal State");
               for( int x =0; x< 3; x++){
               for( int y =0; y< 3; y++){
          System.out.print(Goal[x][y]);
                    System.out.println("");
     public static void findBlank(){
               for( int i =0; i< 3; i++){
               for( int j =0; j< 3; j++){
               if ( Start[i][j] == 0){
                         System.out.println("\n");
                         System.out.println("Blank Tile Found at : - ");
                         if (Start[i][j] == Start[0][0])
                         System.out.println("0,0");
                         if (Start[i][j] == Start[0][1])
                         System.out.println("0,1");
                         if (Start[i][j] == Start[0][2])
                         System.out.println("0,2");
                         swap(Start, 0, 2, 0, 1, 1, 2);
                         if (Start[i][j] == Start[1][0])
                         System.out.println("1,0");
                         if (Start[i][j] == Start[1][1])
                         System.out.println("1,1");
                         if (Start[i][j] == Start[1][2])
                         System.out.println("1,2");
                         if (Start[i][j] == Start[2][0])
                         System.out.println("2,0");
                         if (Start[i][j] == Start[2][1])
                         System.out.println("2,1");
                         if (Start[i][j] == Start[2][2])
                         System.out.println("2,2");
          public static void swap( int array[][], int currentPos1, int currentPos2, int FirstMove1, int FirstMove2, int secMove1, int secMove2){
                    int hold;
                    int tempCurrNumber1a = currentPos1;
                    int tempCurrNumber2a = currentPos2;
                    int tempCurrNumber1b = currentPos1;
                    int tempCurrNumber2b = currentPos2;
                    for( int x =0; x< 3; x++){
                    for( int y =0; y< 3; y++){
                              tempStart1[x][y] = array[x][y];
                              tempStart2[x][y] = array[x][y];
                    hold = tempStart1[tempCurrNumber1a][tempCurrNumber2a];
                    tempStart1[tempCurrNumber1a][tempCurrNumber2a] = tempStart1[FirstMove1][FirstMove2];
                    tempStart1[FirstMove1][FirstMove2] = hold;
                    System.out.print("\n");
                    for( int x =0; x< 3; x++){
                              for( int y =0; y< 3; y++){
                              System.out.print(tempStart1[x][y]);
                                   System.out.println("");
                    hold = tempStart2[tempCurrNumber1b][tempCurrNumber2b];
                                        tempStart2[tempCurrNumber1b][tempCurrNumber2b] = array[secMove1][secMove2];
                                        tempStart2[secMove1][secMove2] = hold;
                                        System.out.print("\n");
                                        for( int x =0; x< 3; x++){
                                                  for( int y =0; y< 3; y++){
                                                  System.out.print(tempStart2[x][y]);
                                                       System.out.println("");
                                   // Manhatten (|X - X'| + |Y - Y'|).

Cross-post:
http://forum.java.sun.com/thread.jsp?forum=54&thread=459075&tstart=0&trange=15

Similar Messages

  • Greedy Search implementation for the Map of Romania

    hi folks!im totally new to Java / Linux and the U.S!!I have slight knowledge of c# though.Can anyone point me towards the right direction for this problem?The famous Romania map is killin me ;)
    Was given only 5 days for this assignment.Pl help me with this and eventually my grades :)
    Thank you for reading...
    Problem: Implement a greedy search in Java, given the map of Romania.. The
    goal state is Bucharest.
    You are not to visit the same city twice.
    Provide the search trees.
    Try three initial states.
    Evaluate your solutions.
    Use the Romania map with Straight Line distances.
    Map of Romania :: https://kirankonathala.sslpowered.com/kirankonathala.com/AI/MapOfRomania.jpg
    Straight Line Distances :: https://kirankonathala.sslpowered.com/kirankonathala.com/AI/straightLineDistances.JPG

    HI Guys!Pl comment on this code -- Is it a good practice to build the tree as described here??my friend provided me this.can't we avoid hashmaps?
    Pl comment...
    class GreedySearch
         public static void main(String a[]){
              HashMap stateMap = new HashMap();
              ArrayList stateList = new ArrayList();// this list is used to get the city name based on the user input          
              State arad = new State("Arad",366);
              arad.addNextState("Timisoara",329,118);
              arad.addNextState("Sibiu",253,140);
              arad.addNextState("Zerind",374,75);
              State bucharest = new State("Bucharest",0);
              bucharest.addNextState("Glurglu",77,90);
              bucharest.addNextState("Urziceni",80,85);
              bucharest.addNextState("Fagaras",176,211);          
              bucharest.addNextState("Pitesti",100,101);          
              State cralova = new State("Cralova",160);
              cralova.addNextState("Pitesti",100,138);
              cralova.addNextState("Rimnicu",193,146);
              cralova.addNextState("Dobreta",242,120);
              State dobreta = new State("Dobreta",242);
              dobreta.addNextState("Cralova",160,120);
              dobreta.addNextState("Mehadia",241,75);          
              State eforle = new State("Eforle",161);
              eforle.addNextState("Hirsova",151,86);     
              State fagaras = new State("Fagaras",176);
              fagaras.addNextState("Bucharest",0,211);
              fagaras.addNextState("Sibiu",253,99);
              State glurglu = new State("Glurglu",77);
              glurglu.addNextState("Bucharest",0,90);
              State hirsova = new State("Hirsova",151);
              hirsova.addNextState("Urziceni",80,98);
              hirsova.addNextState("Eforle",161,86);     
              State iasi = new State("Iasi",226);
              iasi.addNextState("Vaslui",199,92);
              iasi.addNextState("Neamt",234,87);
              State lugoj = new State("Lugoj",244);
              lugoj.addNextState("Mehadia",241,70);
              lugoj.addNextState("Timisoara",329,111);
              State mehadia = new State("Mehadia",241);
              mehadia.addNextState("Dobreta",242,75);
              mehadia.addNextState("Lugoj",244,70);
              State neamt = new State("Neamt",234);
              neamt.addNextState("Iasi",226,87);
              State oradea = new State("Oradea",380);
              oradea.addNextState("Sibiu",253,151);
              oradea.addNextState("Zerind",374,71);          
              State pitesti = new State("Pitesti",100);
              pitesti.addNextState("Bucharest",0,101);
              pitesti.addNextState("Cralova",160,138);
              pitesti.addNextState("Rimnicu",193,97);
              State rimnicu = new State("Rimnicu",193);
              rimnicu.addNextState("Sibiu",253,80);
              rimnicu.addNextState("Pitesti",100,97);
              rimnicu.addNextState("Cralova",160,146);
              State sibiu = new State("Sibiu",253);
              sibiu.addNextState("Fagaras",176,99);
              sibiu.addNextState("Rimnicu",193,80);
              sibiu.addNextState("Arad",366,140);
              sibiu.addNextState("Oradea",380,151);
              State timisoara = new State("Timisoara",329);
              timisoara.addNextState("Lugoj",244,111);
              timisoara.addNextState("Arad",366,118);
              State urziceni = new State("Urziceni",80);
              urziceni.addNextState("Bucharest",0,85);
              urziceni.addNextState("Hirsova",151,98);
              urziceni.addNextState("Vaslui",199,142);
              State vaslui = new State("Vaslui",199);
              vaslui.addNextState("Urziceni",80,142);
              vaslui.addNextState("Iasi",226,92);
              State zerind = new State("Zerind",374);
              zerind.addNextState("Arad",366,75);
              zerind.addNextState("Oradea",380,71);
              stateMap.put("Arad",arad);
              stateMap.put("Cralova",cralova);
              stateMap.put("Dobreta",dobreta);
              stateMap.put("Eforle",eforle);
              stateMap.put("Fagaras",fagaras);
              stateMap.put("Glurglu",glurglu);
              stateMap.put("Hirsova",hirsova);
              stateMap.put("Iasi",iasi);
              stateMap.put("Lugoj",lugoj);
              stateMap.put("Mehadia",mehadia);
              stateMap.put("Neamt",neamt);
              stateMap.put("Oradea",oradea);
              stateMap.put("Pitesti",pitesti);
              stateMap.put("Rimnicu",rimnicu);
              stateMap.put("Sibiu",sibiu);
              stateMap.put("Timisoara",timisoara);
              stateMap.put("Urziceni",urziceni);
              stateMap.put("Vaslui",vaslui);
              stateMap.put("Zerind",zerind);
              stateList.add("Arad");// this list is used to get the city name based on the user input
              stateList.add("Cralova");
              stateList.add("Dobreta");
              stateList.add("Eforle");
              stateList.add("Fagaras");
              stateList.add("Glurglu");
              stateList.add("Hirsova");
              stateList.add("Iasi");
              stateList.add("Lugoj");
              stateList.add("Mehadia");
              stateList.add("Neamt");
              stateList.add("Oradea");
              stateList.add("Pitesti");
              stateList.add("Rimnicu");
              stateList.add("Sibiu");
              stateList.add("Timisoara");
              stateList.add("Urziceni");
              stateList.add("Vaslui");
              stateList.add("Zerind");
              System.out.println(" 1) Arad \n 2) Cralova\n 3) Dobreta\n 4) Eforle\n 5) Fagaras\n 6) Glurglu\n"
              +" 7) Hirsova\n 8) Iasi\n 9) Lugoj\n 10) Mehadia\n 11) Neamt\n 12) Oradea\n 13) Pitesti\n"
              +" 14) Rimnicu\n 15) Sibiu\n 16) Timisoara\n 17) Urziceni\n 18) Vaslui \n 19) Zerind\n ");
              System.out.print("Enter the starting State: ");

  • Implement a greedy search in java

    Implement a greedy serch in java for the map of romania .goal state is bucharest.
    1.not to visit the same city twice
    2.give the search trees
    3.try 3 initial states

    No. Do it yourself. This is a help forum, not a "here's my requirements do it for me" forum.

  • Manhatten Distance java  Help

    Hi all,
    I am developing a program to solve the 8 puzzle using the greedy search.
    I have two 2D arrays(sorry about the code) -
    public static int [][] Start ={
    { 5,4,0 },
    { 6,1,8 },
    { 7,3,2 }};
    public static int [][] Goal = {
    { 1,2,3 },
    { 8,0,4 },
    { 7,6,5 }};
    I have found where the 0 is and using the outline of the Greedy search, I am moving the tiles in such a vay that It brings the tiles nearer to its goal state. I am moving the Zero and saving the two new Temporary arrays. I now need to run the two arrays through the Manhatten Distance function to find out which is the best to use and then I am going to save the best choice as my new Start array and keep looping through again and again until I have found my goal state!!
    I no its long winded but its the only way I understand!!
    My problem is that I can not figure out how to enter the temporary arrays into the Manhattan Function to figure out which is best??
    I would greatly appreciate any help!!
    Here is my source code --
    import java.io.*;
    public class Puzzle
    public static int [][] tempStart1 = new int[3][3];
    public static int [][] tempStart2 = new int[3][3];
    public static int [][] Start ={
    { 5,4,0 },
    { 6,1,8 },
    { 7,3,2 }};
    public static int [][] Goal = {
    { 1,2,3 },
    { 8,0,4 },
    { 7,6,5 }};
    public static int i,j,x,y;
    public Puzzle()
    public static void main(String [] args)
    printArray();
    findBlank();
    public static void printArray(){
    System.out.println("Start State");
    for( int i =0; i< 3; i++){
    for( int j =0; j< 3; j++){
    System.out.print(Start[j]);
    System.out.println("");
    System.out.println("\n");
    System.out.println("Goal State");
    for( int x =0; x< 3; x++){
    for( int y =0; y< 3; y++){
    System.out.print(Goal[x][y]);
    System.out.println("");
    public static void findBlank(){
    for( int i =0; i< 3; i++){
    for( int j =0; j< 3; j++){
    if ( Start[j] == 0){
    System.out.println("\n");
    System.out.println("Blank Tile Found at : - ");
    if (Start[j] == Start[0][0])
    System.out.println("0,0");
    if (Start[j] == Start[0][1])
    System.out.println("0,1");
    if (Start[j] == Start[0][2])
    System.out.println("0,2");
    swap(Start, 0, 2, 0, 1, 1, 2);
    if (Start[j] == Start[1][0])
    System.out.println("1,0");
    if (Start[j] == Start[1][1])
    System.out.println("1,1");
    if (Start[j] == Start[1][2])
    System.out.println("1,2");
    if (Start[j] == Start[2][0])
    System.out.println("2,0");
    if (Start[j] == Start[2][1])
    System.out.println("2,1");
    if (Start[j] == Start[2][2])
    System.out.println("2,2");
    public static void swap( int array[][], int currentPos1, int currentPos2, int FirstMove1, int FirstMove2, int secMove1, int secMove2){
    int hold;
    int tempCurrNumber1a = currentPos1;
    int tempCurrNumber2a = currentPos2;
    int tempCurrNumber1b = currentPos1;
    int tempCurrNumber2b = currentPos2;
    for( int x =0; x< 3; x++){
    for( int y =0; y< 3; y++){
    tempStart1[x][y] = array[x][y];
    tempStart2[x][y] = array[x][y];
    hold = tempStart1[tempCurrNumber1a][tempCurrNumber2a];
    tempStart1[tempCurrNumber1a][tempCurrNumber2a] = tempStart1[FirstMove1][FirstMove2];
    tempStart1[FirstMove1][FirstMove2] = hold;
    System.out.print("\n");
    for( int x =0; x< 3; x++){
    for( int y =0; y< 3; y++){
    System.out.print(tempStart1[x][y]);
    System.out.println("");
    hold = tempStart2[tempCurrNumber1b][tempCurrNumber2b];
    tempStart2[tempCurrNumber1b][tempCurrNumber2b] = array[secMove1][secMove2];
    tempStart2[secMove1][secMove2] = hold;
    System.out.print("\n");
    for( int x =0; x< 3; x++){
    for( int y =0; y< 3; y++){
    System.out.print(tempStart2[x][y]);
    System.out.println("");
    // Manhatten (|X - X'| + |Y - Y'|).

    Stop crossposting. http://forum.java.sun.com/thread.jsp?forum=31&thread=459073

  • Find driving distance between two points without using API by use of Lat & Long?

    Using Google geocode API : http://maps.googleapis.com/maps/api/geocode/xml?address=thane&sensor=true
    We performed get distance between search criteria entered by user and all related clubs by lat & long  stored at db.
    2. Two different points such as  
    (origin: Lat1 & Long1) and (destination: Lat2 & Long2)
    We tried for to get distance between these two points,
     (Lat2 & Long2) to (Lat1 & Long1)
    But distance which we get by calculation is simple straight line distance 
    Origin Destination
    (Lat1 & Long1) (Lat2 & Long2)
    3. This is not driving distance as google shows in exact Km
    4. For that Google provide another API (distancematrix API)
    http://maps.googleapis.com/maps/api/distancematrix/xml?origins=Thane&sensor=true&destinations=khopat&mode=driving&language=en%20-%20EN
    5. But there is limit for DistanceMatrix-Service without ClientID and client key
    100 elements per query.
    100 elements per 10 seconds.
    2 500 elements per 24 hour period.
    But as element request exceeds it shows : OVER_QUERY_LIMIT error  
    6. In case of Client ID and Client key
    In Distance Matrix 100 000 elements per 24 hour period,a maximum of 625 elements per query and a maximum of 1 000 elements per 10 seconds.
    As per this one there is option to get purchase these API but basic question is remain same for us if we are requesting single origin and multiple destination then how element calculation done by google?
    But in document google says :
    Elements
    The information about each origin-destination pairing is returned in an element entry. An element contains the following fields:
    Status: See Status Codes for a list of possible status codes.
    Duration: The duration of this route, expressed in seconds (the value field) and as text. The textual representation is localized according to
    the query's language parameter.
    Distance: The total distance of this route, expressed in meters (value) and as text. The textual value uses the unit system specified with the
    unit parameter of the original request, or the origin's region.

    Any information that you see in a google map webpage can be retrieved using the API.  The best way of finding the tags on the webpage is to manually perform the query using an IE webpage.   Then capture the source and save to a file so you
    can use a text editor to look at results.  I often on a webpage use the menu : View -  Source and then copy the source to a text file.
    jdweng

  • Regular Expressions: Greedy vs Non-Greedy

    Guys, I just can't explain and find any explanation in the doc for such a behaviour:
    SQL> with t as (select 'the 1 january of the year 2007' str from dual)
      2  select regexp_substr(str,'.*?[[:digit:]][ ][[:alpha:]]+.*') substr1,
      3         regexp_substr(str,'.*?[[:digit:]][ ][[:alpha:]]+.*$') substr2
      4  from t
      5  /
    SUBSTR1       SUBSTR2
    the 1 january the 1 january of the year 2007
    SQLthe first part of a pattern is '.*?' - non-greedy seacrh for combination of any symbols.
    It is followed by 1 digit, then 1 space then a consequent greedy combination of alpha characters
    an the last part of the mask is '.*' in the first case and '.*$' in the second.
    The only difference in '$' in the end.
    AFAIK '.*' in the first case should stand for GREEDY search of a combination of any symbols.
    So in my opinion if '.*' stands in the end of the mask it should be equivalent to '.*$',
    but somehow it becomes NON-GREEDY.
    I just can't explain why.
    Can anyone help?
    Thanks.
    PS
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE     10.2.0.1.0     Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    SQL

    This doesn't make any sense at all to me either. The only thing I did find that could explain it is at:
    http://download.oracle.com/docs/cd/B14117_01/server.101/b10759/functions116.htm#SQLRF06303
    match_parameter is a text literal that lets you change the default matching behavior of the function. You can specify one or more of the following values for match_parameter:
    'n' allows the period (.), which is the match-any-character character, to match the newline character. If you omit this parameter, the period does not match the newline character.
    So maybe since the . doesn't match newline and $ does?

  • Hunt the Wumpus

    Hey, I'm pretty new to Java (since September actually) and have been give this assignment in school to create the game, Hunt the Wumpus. Honestly I have no idea of where to start with this. Can anyone lead me in the right direction. Thanks. Below are the instructions that were given to do this.
    Backstory
    The first programming assignment for the course CPS 109 Computer Science I is to implement a real dinosaur and the original grandfather of our modern computer games, Hunt the Wumpus. Despite being rather lame by today's gaming standards, this game is hopefully an educational topic to serve as your first programming project.
    Wumpus is a game played on a maze which for our purposes is a rectangular grid of rooms. From each room it is possible to move to any of the adjacent rooms in north, west, south and east, unless you are at the edge of the grid to that direction. The maze is dark, so in each room you can see only that room, but you can't see through the doors what the adjacent rooms might contain.
    You are a brave explorer armed with a bow and a quiver of arrow to search the maze for the pile of gold that is rumored to be hidden in one of the rooms. You enter the maze at the entrance room at the coordinates (1,1), and win the game if you successfully find the gold and manage to return to the same entrance alive. If you enter the room where the pile of gold is located, you automatically pick it up.
    Beware, though, since the maze is also a home for the mythical monster known as the Wumpus! Wumpus is rather stupid and bestial and pretty much just moves randomly around the maze. If you and Wumpus happen to meet at the same room, game is over for you, since you are no match for the Wumpus in close quarters combat. Your only chance of survival is to either avoid the Wumpus or to kill him with a well-aimed shot from your trusty bow.
    To shoot, pick any of the four directions and hope for the best. When you shoot, your arrow will fly through three rooms to that direction and then hit the stone floor, shattering to useless shards. If the Wumpus happens to be in any of those three rooms on the path of the arrow, he is hit and he dies.
    Classes and methods to write
    In this project, you need to write two classes called WumpusGrid and WumpusGame. The first class simulates the Wumpus world, while the second class implements the interface. The class WumpusGrid should have whatever private fields and methods you need, and the following public methods:
    void startNewGame(int width, int height, int arrows)
    Starts a new game and initializes the grid to the given width and height so that the player is in the room (1,1) and carries arrows arrows. Wumpus and the pile of gold are placed in random rooms in the grid, but not in the room (1,1).
    boolean isGameOn()
    Returns true if the player has not yet died or successfully completed his task, otherwise returns false.
    int getArrowCount()
    Returns the number of arrows that the player is currently carrying in his quiver.
    boolean isCarryingGold()
    Returns true or false depending on whether player is currently carrying the gold.
    int getX()
    Returns the x-coordinate of the room that the player is currently in.
    int getY()
    Returns the y-coordinate of the room that the player is currently in.
    String moveWumpus()
    If Wumpus is alive, moves the Wumpus from the room that he is currently in to a randomly chosen adjacent room in one of the four directions. This method returns a message string:
    If Wumpus moves to the same room as the player, the game ends and the message is �The Wumpus eats you!�
    If the Manhattan distance (find out yourself what this is) between Wumpus and player is one, the message is �You can smell the putrid breath of the Wumpus!�
    If the Manhattan distance between Wumpus and player is two, the message is �You can hear the Wumpus slouching nearby!�
    If the Manhattan distance between Wumpus and player is three, the message is �You can sense the Wumpus lurking nearby!�
    String movePlayer(int dx, int dy)
    Moves the player from his current room (x,y) to the adjoining room (x+dx, y+dy), unless that move would take him outside the grid, or it is not the case that one of the parameters is zero while the other is -1 or +1. The method returns a message string:
    If the player moves to the same room as the living Wumpus, the game ends and the message is �The Wumpus catches you and dismembers you!�
    If the player moves to the same room as the dead Wumpus, the message is �The carcass of the Wumpus lies on the ground.�
    If the player moves to a room that has the pile of gold in it, he picks it up and the message is �You have found the treasure that you are looking for!�
    If the player is carrying the gold and moves to the room (1,1) so that Wumpus is not there, the game ends and the message is �You survived to bring the gold back home and live rich and happy for the rest of your life!�
    Otherwise, the message is �This room is dark and empty.�
    String shootArrow(int dx, int dy)
    Shoots one arrow to the direction specified by dx and dy, as in the previous method. The method returns a message string:
    If the player has no arrows left, the message is �You want to shoot, but your quiver is empty!�
    If the player shoots and hits nothing, the message is �The arrow flies into the darkness.�
    If the player shoots and hits the Wumpus, the Wumpus dies and the message is �You hear the Wumpus scream horribly and then collapse to the ground!�
    The class WumpusGame allows the human user to play this game over a textual console interface. This game should proceed in turns so that each turn, the game outputs the current coordinates of the player and the number of arrows in his quiver, and asks him what he wants to do. The possible answers are either �n�, �e�, �s�, �w� to move to the given direction, �sn�, �se�, �ss�, �sw� to shoot an arrow to the given direction, or �q� to quit the game. The message that the action produces is shown to the player, and then it is Wumpus's turn to move. This is repeated until the player either dies, quits or wins the game. Whatever way the game ends, the program should ask the player if he wants to play a new game, and exit if he answers no.
    The class WumpusGame must have the main method for the game to run as a standalone application, and whatever other methods you wish to put there to implement the game functionality of the previous paragraph.
    If you want to, you can also write a class Position that stores a pair of (x,y) coordinates, with methods to calculate the position to a given direction, and use objects of this class to represent and store the positions of player, Wumpus and gold.

    Thanks very much for telling me how to post a question. As you know I'm new here, so I don't know the procedure of things around here. I know how to create an interface, but I was wondering if I'm going about this wrong. This is just what I have to make the "player" on the game interface.
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.geom.Ellipse2D;
    import javax.swing.JPanel;
    import javax.swing.JComponent;
    public class WumpusGrid extends JComponent
        //Creates the explorer the player is going to use.
        public void paintComponent(Graphics g)
            //Recover Graphics2D
            Graphics2D g2 = (Graphics2D) g;           
            //Draws the brave explorer.
            Ellipse2D.Double man = new Ellipse2D.Double(1,1,5,5);
            g2.setColor(Color.RED);
            g2.fill(man);
    }This is what I have for the game interface.
    import javax.swing.JFrame;
    public class WumpusGame
        public static void main(String[] args)
            JFrame frame = new JFrame();
            frame.setSize(200,200);
            frame.setLocation(100,100);       
            frame.setTitle("Hunt the Wumpus");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            WumpusGrid component = new WumpusGrid();
            frame.add(component);
            frame.setVisible(true);
    }

  • Ignoring whitespace in regular expression

    Dear all,
    could anyone advice me how Oracle evaluate the following query:
    SQL> select regexp_substr('Baba black','b[a-z]+ [a-z]+',1,1,'x') from dual;
    REGEX
    blackI thought it would return 'ba', but instead it returns 'black'. How come 'ba' in the first word isn't detected by the pattern?
    Best regards,
    Val

    Hi, Val,
    Valerie Debonair wrote:
    Dear all,
    could anyone advice me how Oracle evaluate the following query:
    SQL> select regexp_substr('Baba black','b[a-z]+ [a-z]+',1,1,'x') from dual;
    REGEX
    blackI thought it would return 'ba', but instead it returns 'black'. How come 'ba' in the first word isn't detected by the pattern?Aside from case-sensitivity, that expression would never return a 2-character string, because you're looking for at least 3 characacters:
    'b[a-z]+ [a-z]+'
    1 2      3(1) the letter b
    (2) any letter(s)
    (3) any letter(s) again
    If you want Non-Greedy searching (where the + sign matches as little as possible, not as much as possible) us +? instead of +
    SELECT      REGEXP_SUBSTR ( 'Baba black'
                    , 'b[a-z]+? [a-z]+?'
                    , 1
                    , 1
                    , 'xi'
    FROM      dual;Ouptut:
    REG
    BabYou could get the same results by explicitly saying you want exactly 2 characters after the 'b', like this:
    SELECT      REGEXP_SUBSTR ( 'Baba black'
                    , 'b[a-z]{2}'
                    , 1
                    , 1
                    , 'xi'
    FROM      dual;

  • Oracle 10gR2 WebService Call-In & Call-Out via PL/SQL (Step-by-Step Guide)

    Hi Everyone,
    This guide is for those of you who tried to Call-In and Call-Out WebService via Oracle 10gR2 using PL/SQL but failed a couple of times, re-installed a couple of times and retry, got it to work but don't know what made it work scenarios.
    Hope this helps ;-)
    Thanks,
    Henry Wu
    Instructions on how to use Oracle10gR2 Webservice Call-Out feature (Oracle JAX-RPC DII - Dynamic Invocation (DII) APIs)
    PREREQUISITE
    =================================================================
    1. Download Oracle Database 10g Release 2 (10.2.0.1.0) (ZIP, ~655MB)
    http://www.oracle.com/technology/software/products/database/oracle10g/htdocs/10201winsoft.html
    http://download.oracle.com/otn/nt/oracle10g/10201/10201_database_win32.zip
    1.1 Choose Enterprise Edition
    2. Download 10.1.3.1 Callout Utility for 10g (R1 +R2) RDBMS (ZIP, ~13MB)
    http://download.oracle.com/technology/sample_code/tech/java/jsp/dbws-callout-utility-10131.zip
    2.1 Extract to C:\oracle\product\10.2.0\db_1\dbws_callout_utility_10131
    3. Download OC4J Standalone - Oracle Containers for J2EE (OC4J) 10g Release 3 (10.1.3.3) (ZIP, ~93MB; Pure Java—runs on all certified platforms)
    http://www.oracle.com/technology/software/products/ias/index.html (Download Site)
    http://download.oracle.com/otn/java/oc4j/101330/oc4j_extended_101330.zip
    3.1 Extract to C:\oracle\product\10.2.0\db_1\oc4j_extended_101330
    STEP-BY-STEP PROCEDURES
    =================================================================
    1. Prepare the database
    1.1 Connect to SYS account (or any account that can connect as SYSDBA)
    1.2 alter system set shared_pool_size=96M scope=both
    1.3 alter system set java_pool_size=80M scope=both
    1.4 ALTER USER SCOTT ACCOUNT UNLOCK;
    1.5 ALTER USER SCOTT IDENTIFIED BY "tiger";
    1.6 ALTER USER SCOTT QUOTA UNLIMITED ON USERS;
    1.7 GRANT PUBLIC TO SCOTT;
    1.8 GRANT Create Public Synonym TO SCOTT;
    2. Load Oracle SOAP client to SCOTT (for Oracle 10g Release 2 Database)
    2.1 Commands
    2.1.1 Open command prompt (cmd.exe)
    2.1.2 loadjava -u scott/tiger -r -v -f -genmissing -s -grant public C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\webservices\lib\soap.jar C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\lib\dms.jar C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\jlib\javax-ssl-1_1.jar C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home\lib\servlet.jar C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home\lib\mail.jar C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home\lib\activation.jar C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home\lib\http_client.jar C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home\lib\ejb.jar
    2.1.3 It will take around 3 minutes and you will see "something" like the following when it completes (count may not be exact) :
    Classes Loaded: 909
    Resources Loaded: 75
    Sources Loaded: 0
    Published Interfaces: 0
    Classes generated: 0
    Classes skipped: 0
    Synonyms Created: 984
    Errors: 0
    2.1.3 Close this command prompt
    3. Load Oracle JAX-RPC client to SYS (for Oracle 10g Release 2 Database)
    3.1 Commands
    3.1.1 Open command prompt (cmd.exe)
    3.1.2 loadjava -u sys/oracle -r -v -f -genmissing -s -grant public C:\oracle\product\10.2.0\db_1\dbws_callout_utility_10131\sqlj\lib\dbwsclientws.jar C:\oracle\product\10.2.0\db_1\dbws_callout_utility_10131\sqlj\lib\dbwsclientdb102.jar
    3.1.2.1 It will take around 15 minutes and you will see "something" like following when it completes (count may not be exact) :
    Classes Loaded: 4027
    Resources Loaded: 81
    Sources Loaded: 0
    Published Interfaces: 0
    Classes generated: 61
    Classes skipped: 0
    Synonyms Created: 4108
    Errors: 0
    3.1.3 Close this command prompt
    4. Execute UTL_DBWS packages to SYS (for Oracle 10g Release 2 Database)
    4.1 Commands
    4.1.1 Connect to SYS account only
    4.1.2 Execute the following (in TOAD you should execute them as Script, press the "thunder" button)
    4.2.1 @"C:\oracle\product\10.2.0\db_1\dbws_callout_utility_10131\sqlj\lib\utl_dbws_decl.sql"
    4.2.2 @"C:\oracle\product\10.2.0\db_1\dbws_callout_utility_10131\sqlj\lib\utl_dbws_body.sql"
    4.2.3 CREATE PUBLIC SYNONYM utl_dbws FOR sys.utl_dbws;
    5. Call-out a free Web Service using SCOTT
    5.1 Commands
    5.1.1 Connect to user SCOTT with password of TIGER
    5.1.2 Copy and Paste the following "Anonymous Block" (sample #1) and execute it :
    5.1.2.1 It sould return "PL/SQL DII client return ===> Redwood City"
    declare
    service_ utl_dbws.SERVICE;
    call_ utl_dbws.CALL;
    service_qname utl_dbws.QNAME;
    port_qname utl_dbws.QNAME;
    operation_qname utl_dbws.QNAME;
    string_type_qname utl_dbws.QNAME;
    retx ANYDATA;
    retx_string VARCHAR2(1000);
    retx_double number;
    retx_len number;
    params utl_dbws.ANYDATA_LIST;
    l_input_params utl_dbws.anydata_list;
    l_result ANYDATA;
    l_namespace VARCHAR2(1000);
    begin
    -- open internet explorer and navigate to http://webservices.imacination.com/distance/Distance.jws?wsdl
    -- search for 'targetNamespace' in the wsdl
    l_namespace := 'http://webservices.imacination.com/distance/Distance.jws';
    -- search for 'service name' in the wsdl
    service_qname := utl_dbws.to_qname(l_namespace, 'DistanceService');
    -- this is just the actual wsdl url
    service_ := utl_dbws.create_service(HTTPURITYPE('http://webservices.imacination.com/distance/Distance.jws?wsdl'), service_qname);
    -- search for 'portType name' in the wsdl
    port_qname := utl_dbws.to_qname(l_namespace, 'Distance');
    -- search for 'operation name' in the wsdl
    -- there will be a lot, we will choose 'getCity'
    operation_qname := utl_dbws.to_qname(l_namespace, 'getCity');
    -- bind things together
    call_ := utl_dbws.create_call(service_, port_qname, operation_qname);
    -- default is 'FALSE', so we make it 'TRUE'
    utl_dbws.set_property(call_, 'SOAPACTION_USE', 'TRUE');
    -- search for 'operation soapAction' under <wsdl:operation name="getCity">
    -- it is blank, so we make it ''
    utl_dbws.set_property(call_, 'SOAPACTION_URI', '');
    -- search for 'encodingstyle' under <wsdl:operation name="getCity">
    utl_dbws.set_property(call_, 'ENCODINGSTYLE_URI', 'http://schemas.xmlsoap.org/soap/encoding/');
    -- search for 'binding style'
    utl_dbws.set_property(call_, 'OPERATION_STYLE', 'rpc');
    -- search for 'xmlns:xs' to know the value of the first parameter
    -- under <wsdl:message name="getCityResponse"> you will see the line <wsdl:part name="getCityReturn" type="xsd:string" />
    -- thus the return type is 'string", removing 'xsd:'
    string_type_qname := utl_dbws.to_qname('http://www.w3.org/2001/XMLSchema', 'string');
    -- in the line <wsdl:operation name="getCity" parameterOrder="zip">
    -- the parameterOrder is 'zip', thus we put in 'zip'
    -- the 'ParameterMode.IN' is used to specify that we will be passing an "In Parameter" to the web service
    -- the 'ParameterMode.IN' is a constant variable in the sys.utl_dbws package
    utl_dbws.add_parameter(call_, 'zip', string_type_qname, 'ParameterMode.IN');
    utl_dbws.set_return_type(call_, string_type_qname);
    -- supply the In Parameter for the web service
    params(0) := ANYDATA.convertvarchar('94065');
    -- invoke the web service
    retx := utl_dbws.invoke(call_, params);
    -- access the returned value and output it to the screen
    retx_string := retx.accessvarchar2;
    dbms_output.put_line('PL/SQL DII client return ===> ' || retx_string);
    -- release the web service call
    utl_dbws.release_service(service_);
    end;
    5.1.3 Copy and Paste the following "Anonymous Block" (sample #2) and execute it :
    5.1.3.1 It should return "PL/SQL DII client return ===> twelve thousand three hundred and forty five"
    declare
    service_ utl_dbws.SERVICE;
    call_ utl_dbws.CALL;
    service_qname utl_dbws.QNAME;
    port_qname utl_dbws.QNAME;
    operation_qname utl_dbws.QNAME;
    string_type_qname utl_dbws.QNAME;
    retx ANYDATA;
    retx_string VARCHAR2(1000);
    retx_double number;
    retx_len number;
    params utl_dbws.ANYDATA_LIST;
    l_input_params utl_dbws.anydata_list;
    l_result ANYDATA;
    l_namespace VARCHAR2(1000);
    begin
    -- open internet explorer and navigate to http://www.dataaccess.com/webservicesserver/numberconversion.wso?WSDL
    -- search for 'targetNamespace' in the wsdl
    l_namespace := 'http://www.dataaccess.com/webservicesserver/';
    -- search for 'service name' in the wsdl
    service_qname := utl_dbws.to_qname(l_namespace, 'NumberConversion');
    -- this is just the actual wsdl url
    service_ := utl_dbws.create_service(HTTPURITYPE('http://www.dataaccess.com/webservicesserver/numberconversion.wso?WSDL'), service_qname);
    -- search for 'portType name' in the wsdl
    port_qname := utl_dbws.to_qname(l_namespace, 'NumberConversionSoap');
    -- search for 'operation name' in the wsdl
    -- there will be a lot, we will choose 'NumberToWords'
    operation_qname := utl_dbws.to_qname(l_namespace, 'NumberToWords');
    -- bind things together
    call_ := utl_dbws.create_call(service_, port_qname, operation_qname);
    -- default is 'FALSE', so we make it 'TRUE'
    utl_dbws.set_property(call_, 'SOAPACTION_USE', 'TRUE');
    -- search for 'operation soapAction' under <operation name="NumberToWords">
    -- it is blank, so we make it ''
    utl_dbws.set_property(call_, 'SOAPACTION_URI', '');
    -- search for 'encodingstyle'
    -- cannot find xml tag 'encodingstyle', so we just use the following as the generic encoding style
    utl_dbws.set_property(call_, 'ENCODINGSTYLE_URI', 'http://schemas.xmlsoap.org/soap/encoding/');
    -- search for 'binding style'
    -- although 'document' was used, it produced an error, thus we will use 'rpc'
    -- this value is generally only 'document' or 'rpc'
    utl_dbws.set_property(call_, 'OPERATION_STYLE', 'rpc');
    -- search for 'xmlns:xs' to know the value of the first parameter
    -- under <xs:element name="NumberToWords"> you will see the line <xs:element name="ubiNum" type="xs:unsignedLong" />
    -- thus the return type is 'unsignedlong', removing 'xs:'
    -- however, upon testing, using 'unsignedlong' produced an error, while 'string' did not, so we will use 'string'
    string_type_qname := utl_dbws.to_qname('http://www.w3.org/2001/XMLSchema', 'string');
    -- under <xs:element name="NumberToWords"> you will see the line <xs:element name="ubiNum" type="xs:unsignedLong" />
    -- the element name is 'ubiNum', thus we put in 'ubiNum'
    -- the 'ParameterMode.IN' is used to specify that we will be passing an "In Parameter" to the web service
    -- the 'ParameterMode.IN' is a constant variable in the utl_dbws package
    utl_dbws.add_parameter(call_, 'ubiNum', string_type_qname, 'ParameterMode.IN');
    utl_dbws.set_return_type(call_, string_type_qname);
    -- supply the In Parameter for the web service
    params(0) := ANYDATA.convertvarchar('12345');
    -- invoke the web service
    retx := utl_dbws.invoke(call_, params);
    -- access the returned value and output it to the screen
    retx_string := retx.accessvarchar2;
    dbms_output.put_line('PL/SQL DII client return ===> ' || retx_string);
    -- release the web service call
    utl_dbws.release_service(service_);
    end;
    NOTES AND REFERENCES
    =================================================================
    This detailed step-by-step guide was produced with the following guide http://www.oracle.com/technology/sample_code/tech/java/jsp/callout_users_guide.htm
    I could still not load Oracle JAX-RPC client to SCOTT (step 4) as it produces an error. See the following for more details :
    http://forums.oracle.com/forums/thread.jspa?threadID=633219&tstart=0
    Also, I could not consume some of the other free Web Services out there for reasons I don't know, hope someone can help clarify. See the following for more details :
    http://forums.oracle.com/forums/thread.jspa?threadID=630733&tstart=0
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    Instructions on how to use Oracle10gR2 Webservice Call-In feature
    PREREQUISITE
    =================================================================
    1. Download Oracle Database 10g Release 2 (10.2.0.1.0) (ZIP, ~655MB)
    http://www.oracle.com/technology/software/products/database/oracle10g/htdocs/10201winsoft.html
    http://download.oracle.com/otn/nt/oracle10g/10201/10201_database_win32.zip
    1.1 Choose Enterprise Edition
    2. Download OC4J Standalone - Oracle Containers for J2EE (OC4J) 10g Release 3 (10.1.3.3) (ZIP, ~93MB; Pure Java—runs on all certified platforms)
    http://www.oracle.com/technology/software/products/ias/index.html (Download Site)
    http://download.oracle.com/otn/java/oc4j/101330/oc4j_extended_101330.zip
    2.1 Extract to C:\oracle\product\10.2.0\db_1\oc4j_extended_101330
    STEP-BY-STEP PROCEDURES
    =================================================================
    1. Connect to SYS account and create user STORE
    CREATE USER store IDENTIFIED BY store;
    GRANT connect, resource TO store;
    2. Connect to Oracle using the user STORE and password STORE
    CONNECT store/store;
    3. Execute the following objects for this excercise
    CREATE SEQUENCE order_sq;
    CREATE TABLE product_types (
    product_type_id INTEGER
    CONSTRAINT product_types_pk PRIMARY KEY,
    name VARCHAR2(10) NOT NULL
    CREATE TABLE products (
    product_id INTEGER
    CONSTRAINT products_pk PRIMARY KEY,
    product_type_id INTEGER
    CONSTRAINT products_fk_product_types
    REFERENCES product_types(product_type_id),
    name VARCHAR2(30) NOT NULL,
    description VARCHAR2(50),
    price NUMBER(5, 2)
    CREATE TABLE customers (
    customer_id INTEGER
    CONSTRAINT customers_pk PRIMARY KEY,
    first_name VARCHAR2(10) NOT NULL,
    last_name VARCHAR2(10) NOT NULL,
    dob DATE,
    phone VARCHAR2(12)
    CREATE TABLE orders (
    order_id INTEGER
    CONSTRAINT orders_pk PRIMARY KEY,
    product_id INTEGER
    CONSTRAINT purchases_fk_products
    REFERENCES products(product_id),
    customer_id INTEGER
    CONSTRAINT purchases_fk_customers
    REFERENCES customers(customer_id),
    quantity INTEGER NOT NULL
    INSERT INTO customers (
    customer_id, first_name, last_name, dob, phone
    ) VALUES (
    1, 'John', 'Brown', '01-JAN-1965', '800-555-1211'
    INSERT INTO product_types (
    product_type_id, name
    ) VALUES (
    1, 'Book'
    INSERT INTO products (
    product_id, product_type_id, name, description, price
    ) VALUES (
    1, 1, 'Modern Science', 'A description of modern science', 19.95
    COMMIT;
    CREATE OR REPLACE PACKAGE dbfunc AS
    FUNCTION place_order (
    p_product_id INTEGER,
    p_customer_id INTEGER,
    p_quantity INTEGER
    RETURN VARCHAR2;
    END dbfunc;
    CREATE OR REPLACE PACKAGE BODY dbfunc AS
    FUNCTION place_order (
    p_product_id INTEGER,
    p_customer_id INTEGER,
    p_quantity INTEGER
    RETURN VARCHAR2 IS
    v_customer_count INTEGER;
    v_product_count INTEGER;
    v_order_id INTEGER;
    BEGIN
    -- count the number of products with the
    -- supplied p_product_id (should be 1 if the product exists)
    SELECT COUNT(*)
    INTO v_product_count
    FROM products
    WHERE product_id = p_product_id;
    IF v_product_count = 0 THEN
    RETURN 'No such product';
    END IF;
    -- count the number of customers with the
    -- supplied p_customer_id (should be 1)
    SELECT COUNT(*)
    INTO v_customer_count
    FROM customers
    WHERE customer_id = p_customer_id;
    IF v_customer_count = 0 THEN
    RETURN 'No such customer';
    END IF;
    -- get the next value from orders_sq
    SELECT order_sq.nextval
    INTO v_order_id
    FROM dual;
    -- place the order
    INSERT INTO orders (
    order_id, product_id, customer_id, quantity
    ) VALUES (
    v_order_id, p_product_id, p_customer_id, p_quantity
    COMMIT;
    RETURN 'Order placed with id of ' || v_order_id;
    EXCEPTION
    WHEN OTHERS THEN
    ROLLBACK;
    RETURN 'Order not placed';
    END place_order;
    END dbfunc;
    4. Install and Configure OC4J
    4.1 Change Directory
    4.1.1 Open command prompt (cmd.exe)
    4.1.2 CD C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\bin
    4.2 Configure Environment variables (type in command prompt)
    4.2.1 set JAVA_HOME=C:\oracle\product\10.2.0\db_1\jdk
    4.2.2 set ORACLE_HOME=C:\oracle\product\10.2.0\db_1\oc4j_extended_101330
    4.3 Starting OC4J for the first time
    4.3.1 oc4j -start
    4.3.2 If this is not your first time to "start" oc4j, go to step 4.3.4
    4.3.3 Set oc4jadmin password (use the password "oracle" w/o the quotation marks)
    08/03/21 17:13:54 Set OC4J administrator's password (password text will not be displayed as it is entered)
    Enter password:
    Confirm password:
    Confirm password: The password for OC4J administrator "oc4jadmin" has been set.
    08/03/21 17:14:01 The OC4J administrator "oc4jadmin" account is activated.
    4.3.4 OC4J has started if you see the message :
    08/03/21 17:14:16 Oracle Containers for J2EE 10g (10.1.3.3.0) initialized
    4.3.5 Leave this command prompt open
    4.4 Configure Data Source
    4.4.1 Open a new command prompt via the cmd.exe command
    4.4.2 type "hostname" and then press enter
    4.4.3 Keep this command prompt open for later use
    4.4.4 Open Windows Explorer and navigate to the folder C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home\config
    4.4.5 Open the file data-sources.xml
    4.4.6 Modify and Save the file so that it will look something like the following :
    4.4.6.1 Note that "hpv2710us" is my hostname found in step 4.4.2
    4.4.6.2 Note that "ORCLDEV" is the name of my Oracle Instance. (Default installation uses ORCL only)
    <connection-pool name="Example Connection Pool">
    <connection-factory factory-class="oracle.jdbc.pool.OracleDataSource"
    user="store"
    password="store"
    url="jdbc:oracle:thin:@//hpv2710us:1521/ORCLDEV">
    </connection-factory>
    </connection-pool>
    4.4.7 Close the text editor
    4.4.8 Close the Windows Explorer
    4.4.9 Close this command prompt (type exit)
    5. Publishing a PL/SQL Package as a Database Web Service
    5.1 Create the config.xml file
    5.1.1 Open Notepad.exe
    5.1.2 Copy and Paste the following :
    5.1.2.1 Note that "hpv2710us" is my hostname found in step 4.4.2
    5.1.2.2 Note that "ORCLDEV" is the name of my Oracle Instance. (Default installation uses ORCL only)
    <web-service>
    <display-name>PLSQL Web Service</display-name>
    <description>PLSQL Sample</description>
    <destination-path>./dbfunc.ear</destination-path>
    <temporary-directory>/tmp</temporary-directory>
    <context>/plsqlsample</context>
    <stateless-stored-procedure-java-service>
    <jar-generation>
    <schema>store/store</schema>
    <db-url>jdbc:oracle:thin:@hpv2710us:1521:ORCLDEV</db-url>
    <prefix>db.func.place.order</prefix>
    <db-pkg-name>dbfunc</db-pkg-name>
    </jar-generation>
    <uri>/dbfunc</uri>
    <database-JNDI-name>jdbc/OracleDS</database-JNDI-name>
    </stateless-stored-procedure-java-service>
    <wsdl-gen>
    <wsdl-dir>wsdl</wsdl-dir>
    <option name="force">true</option>
    <option name="httpServerURL">http://localhost:8888</option>
    </wsdl-gen>
    <proxy-gen>
    <proxy-dir>proxy</proxy-dir>
    <option name="include-source">true</option>
    </proxy-gen>
    </web-service>
    5.1.3 Save file as config.xml in the directory C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home\config
    5.1.3.1 Note it should be config.xml and not config.txt
    5.1.4 Close the text editor
    5.2 Publish dbfunc Oracle Package as a Web Service
    5.2.1 Open a new command prompt via the cmd.exe command
    5.2.2 CD C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home
    5.2.3 mkdir ear
    5.2.4 CD ear
    5.2.5 set ORACLE_HOME=C:\oracle\product\10.2.0\db_1\oc4j_extended_101330
    5.2.6 set CLASSPATH=.;%ORACLE_HOME%\webservices\lib\wsdl.jar;%ORACLE_HOME%\lib\xmlparserv2.jar;%ORACLE_HOME%\soap\lib\soap.jar
    5.2.7 java -jar %ORACLE_HOME%\webservices\lib\WebServicesAssembler.jar -config C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home\config\config.xml
    Please wait ...
    STORE.DBFUNC
    5.2.8 java -jar %ORACLE_HOME%\j2ee\home\admin_client.jar deployer:oc4j:localhost:23791 oc4jadmin oracle -deploy -file C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home\ear\dbfunc.ear -deploymentName dbfunc
    08/03/21 17:46:23 Notification ==>Application Deployer for dbfunc COMPLETES. Operation time: 296 msecs
    5.2.9 java -jar %ORACLE_HOME%\j2ee\home\admin_client.jar deployer:oc4j:localhost:23791 oc4jadmin oracle -bindWebApp -appname dbfunc -webModuleName dbfunc_web
    5.2.10 java -jar %ORACLE_HOME%\j2ee\home\admin_client.jar deployer:oc4j:localhost:23791 oc4jadmin oracle -bindAllWebApps -appname dbfunc
    5.2.11 Close this command prompt (type exit)
    6. Test dbfunc Web Service
    6.1 Restart OC4J
    6.1.1 Open the command prompt you used to start OC4J in step 4.1.1/4.3.1
    6.1.2 In the keyboard, hit Ctrl+C
    6.1.2.1 Type "Y" and then hit Enter
    08/03/21 18:02:51 Shutting down OC4J...
    Terminate batch job (Y/N)? Y
    6.1.2.2 Note that the command prompt should still be open
    6.1.2.2.1 If you accidentally closed the command prompt just do the following
    6.1.2.2.1.1 Do 4.1.1 to 4.2.2 and then proceed to 6.1.3
    6.1.3 oc4j -start
    Starting OC4J from C:\oracle\product\10.2.0\db_1\oc4j_extended_101330\j2ee\home...
    08/03/21 18:07:57 Oracle Containers for J2EE 10g (10.1.3.3.0) initialized
    6.1.4 Leave this command prompt open
    6.2 Use the Web Service to "Order an Item"
    6.2.1 Connect to Oracle using the user STORE and password STORE
    6.2.2 select * from orders
    6.2.2.1 Zero row should return
    6.2.3 Open Internet Explorer
    6.2.4 Navigate to http://localhost:8888/plsqlsample/dbfunc
    6.2.5 Input the following :
    6.2.5.1 param0 value: 1
    6.2.5.2 param1 value: 1
    6.2.5.3 param2 value: 10
    6.2.6 Click the Invoke button
    6.2.7 A pop-up window will appear having the following contents :
    <?xml version="1.0" encoding="UTF-8" ?>
    - <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    - <SOAP-ENV:Body>
    - <ns1:placeOrderResponse xmlns:ns1="http://db.func.place.order/dbfunc.wsdl" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <return xsi:type="xsd:string">Order placed with id of 1</return>
    </ns1:placeOrderResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    6.2.8 Go back to SQLPLUS or Toad and execute "select * from orders" again
    6.2.8.1 There should be one row
    ORDER_ID, PRODUCT_ID, CUSTOMER_ID, QUANTITY
    1, 1, 1, 10
    NOTES AND REFERENCES
    =================================================================
    This detailed step-by-step guide was produced with the following article by Jason Price http://www.oracle.com/technology/pub/articles/price_10gws.html

    Success!!!
    I had to grant this permissions:
    call dbms_java.grant_permission( 'WS_TEST', 'SYS:java.lang.RuntimePermission', 'getClassLoader', '' );
    call dbms_java.grant_permission( 'WS_TEST', 'SYS:java.lang.RuntimePermission', 'accessClassInPackage.sun.util.calendar', '' );
    call dbms_java.grant_permission( 'WS_TEST', 'SYS:java.lang.RuntimePermission', 'setFactory', '' )
    call dbms_java.grant_permission( 'WS_TEST', 'SYS:java.util.PropertyPermission', 'HTTPClient.socket.idleTimeout', 'write' );
    call dbms_java.grant_permission( 'WS_TEST', 'SYS:java.net.SocketPermission', 'localhost', 'resolve' );
    call dbms_java.grant_permission( 'WS_TEST', 'SYS:java.net.SocketPermission', '127.0.0.1:8084', 'connect,resolve' );
    As I wrote earlier, WS_TEST is my user into which I load JAX-RPC client. Note that, if you load JAX-RPC client into user another than SYS, you have NOT to use -s -grant public option (wassam wrote about this too). Another thing is that I (finally) didn't load OC4J. To consume WebService I use utl_dbws.invoke(call_Handle CALL, request SYS.XMLTYPE) function.
    voytec001

  • Introduction to regular expressions ... last part.

    Continued from Introduction to regular expressions ... continued., here's the third and final part of my introduction to regular expressions. As always, if you find mistakes or have examples that you think could be solved through regular expressions, please post them.
    Having fun with regular expressions - Part 3
    In some cases, I may have to search for different values in the same column. If the searched values are fixed, I can use the logical OR operator or the IN clause, like in this example (using my brute force data generator from part 2):
    SELECT data
      FROM TABLE(regex_utils.gen_data('abcxyz012', 4))
    WHERE data IN ('abc', 'xyz', '012');There are of course some workarounds as presented in this asktom thread but for a quick solution, there's of course an alternative approach available. Remember the "|" pipe symbol as OR operator inside regular expressions? Take a look at this:
    SELECT data
      FROM TABLE(regex_utils.gen_data('abcxyz012', 4))
    WHERE REGEXP_LIKE(data, '^(abc|xyz|012)$')
    ;I can even use strings composed of values like 'abc, xyz ,  012' by simply using another regular expression to replace "," and spaces with the "|" pipe symbol. After reading part 1 and 2 that shouldn't be too hard, right? Here's my "thinking in regular expression": Replace every "," and 0 or more leading/trailing spaces.
    Ready to try your own solution?
    Does it look like this?
    SELECT data
      FROM TABLE(regex_utils.gen_data('abcxyz012', 4))
    WHERE REGEXP_LIKE(data, '^(' || REGEXP_REPLACE('abc, xyz ,  012', ' *, *', '|') || ')$')
    ;If I wouldn't use the "^" and "$" metacharacter, this SELECT would search for any occurence inside the data column, which could be useful if I wanted to combine LIKE and IN clause. Take a look at this example where I'm looking for 'abc%', 'xyz%' or '012%' and adding a case insensitive match parameter to it:
    SELECT data
      FROM TABLE(regex_utils.gen_data('abcxyz012', 4))
    WHERE REGEXP_LIKE(data, '^(abc|xyz|012)', 'i')
    ; An equivalent non regular expression solution would have to look like this, not mentioning other options with adding an extra "," and using the INSTR function:
    SELECT data
      FROM (SELECT data, LOWER(DATA) search
              FROM TABLE(regex_utils.gen_data('abcxyz012', 4))
    WHERE search LIKE 'abc%'
        OR search LIKE 'xyz%'
        OR search LIKE '012%'
    SELECT data
      FROM (SELECT data, SUBSTR(LOWER(DATA), 1, 3) search
              FROM TABLE(regex_utils.gen_data('abcxyz012', 4))
    WHERE search IN ('abc', 'xyz', '012')
    ;  I'll leave it to your imagination how a complete non regular example with 'abc, xyz ,  012' as search condition would look like.
    As mentioned in the first part, regular expressions are not very good at formatting, except for some selected examples, such as phone numbers, which in my demonstration, have different formats. Using regular expressions, I can change them to a uniform representation:
    WITH t AS (SELECT '123-4567' phone
                 FROM dual
                UNION
               SELECT '01 345678'
                 FROM dual
                UNION
               SELECT '7 87 8787'
                 FROM dual
    SELECT t.phone, REGEXP_REPLACE(REGEXP_REPLACE(phone, '[^0-9]'), '(.{3})(.*)', '(\1)-\2')
      FROM t
    ;First, all non digit characters are beeing filtered, afterwards the remaining string is put into a "(xxx)-xxxx" format, but not cutting off any phone numbers that have more than 7 digits. Using such a conversion could also be used to check the validity of entered data, and updating the value with a uniform format afterwards.
    Thinking about it, why not use regular expressions to check other values about their formats? How about an IP4 address? I'll do this step by step, using 127.0.0.1 as the final test case.
    First I want to make sure, that each of the 4 parts of an IP address remains in the range between 0-255. Regular expressions are good at string matching but they don't allow any numeric comparisons. What valid strings do I have to take into consideration?
    Single digit values: 0-9
    Double digit values: 00-99
    Triple digit values: 000-199, 200-255 (this one will be the trickiest part)
    So far, I will have to use the "|" pipe operator to match all of the allowed combinations. I'll use my brute force generator to check if my solution works for a single value:
    SELECT data
      FROM TABLE(regex_utils.gen_data('0123456789', 3))
    WHERE REGEXP_LIKE(data, '^(25[0-5]|2[0-4][0-9]|[01]?[0-9]{1,2})$') 
    ; More than 255 records? Leading zeros are allowed, but checking on all the records, there's no value above 255. First step accomplished. The second part is to make sure, that there are 4 such values, delimited by a "." dot. So I have to check for 0-255 plus a dot 3 times and then check for another 0-255 value. Doesn't sound to complicated, does it?
    Using first my brute force generator, I'll check if I've missed any possible combination:
    SELECT data
      FROM TABLE(regex_utils.gen_data('03.', 15))
    WHERE REGEXP_LIKE(data,
                       '^((25[0-5]|2[0-4][0-9]|[01]?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]{1,2})$'
    ;  Looks good to me. Let's check on some sample data:
    WITH t AS (SELECT '127.0.0.1' ip
                 FROM dual
                UNION 
               SELECT '256.128.64.32'
                 FROM dual            
    SELECT t.ip
      FROM t WHERE REGEXP_LIKE(t.ip,
                       '^((25[0-5]|2[0-4][0-9]|[01]?[0-9]{1,2})\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]{1,2})$'
    ;  No surprises here. I can take this example a bit further and try to format valid addresses to a uniform representation, as shown in the phone number example. My goal is to display every ip address in the "xxx.xxx.xxx.xxx" format, using leading zeros for 2 and 1 digit values.
    Regular expressions don't have any format models like for example the TO_CHAR function, so how could this be achieved? Thinking in regular expressions, I first have to find a way to make sure, that each single number is at least three digits wide. Using my example, this could look like this:
    WITH t AS (SELECT '127.0.0.1' ip
                 FROM dual
    SELECT t.ip, REGEXP_REPLACE(t.ip, '([0-9]+)(\.?)', '00\1\2')
      FROM t
    ;  Look at this: leading zeros. However, that first value "00127" doesn't look to good, does it? If you thought about using a second regular expression function to remove any excess zeros, you're absolutely right. Just take the past examples and think in regular expressions. Did you come up with something like this?
    WITH t AS (SELECT '127.0.0.1' ip
                 FROM dual
    SELECT t.ip, REGEXP_REPLACE(REGEXP_REPLACE(t.ip, '([0-9]+)(\.?)', '00\1\2'),
                                '[0-9]*([0-9]{3})(\.?)', '\1\2'
      FROM t
    ;  Think about the possibilities: Now you can sort a table with unformatted IP addresses, if that is a requirement in your application or you find other values where you can use that "trick".
    Since I'm on checking INET (internet) type of values, let's do some more, for example an e-mail address. I'll keep it simple and will only check on the
    "[email protected]", "[email protected]" and "[email protected]" format, where x represents an alphanumeric character. If you want, you can look up the corresponding RFC definition and try to build your own regular expression for that one.
    Now back to this one: At least one alphanumeric character followed by an "@" at sign which is followed by at least one alphanumeric character followed by a "." dot and exactly 3 more alphanumeric characters or 2 more characters followed by a "." dot and another 2 characters. This should be an easy one, right? Use some sample e-mail addresses and my brute force generator, you should be able to verify your solution.
    Here's mine:
    SELECT data
      FROM TABLE(regex_utils.gen_data('a1@.', 9))
    WHERE REGEXP_LIKE(data, '^[[:alnum:]]+@[[:alnum:]]+(\.[[:alnum:]]{3,4}|(\.[[:alnum:]]{2}){2})$', 'i'); Checking on valid domains, in my opinion, should be done in a second function, to keep the checks by itself simple, but that's probably a discussion about readability and taste.
    How about checking a valid URL? I can reuse some parts of the e-mail example and only have to decide what type of URLs I want, for example "http://", "https://" and "ftp://", any subdomain and a "/" after the domain. Using the case insensitive match parameter, this shouldn't take too long, and I can use this thread's URL as a test value. But take a minute to figure that one out for yourself.
    Does it look like this?
    WITH t AS (SELECT 'Introduction to regular expressions ... last part. URL
                 FROM dual
                UNION
               SELECT 'http://x/'
                 FROM dual
    SELECT t.URL
      FROM t
    WHERE REGEXP_LIKE(t.URL, '^(https*|ftp)://(.+\.)*[[:alnum:]]+(\.[[:alnum:]]{3,4}|(\.[[:alnum:]]{2}){2})/', 'i')
    Update: Improvements in 10g2
    All of you, who are using 10g2 or XE (which includes some of 10g2 features) may want to take a look at several improvements in this version. First of all, there are new, perl influenced meta characters.
    Rewriting my example from the first lesson, the WHERE clause would look like this:
    WHERE NOT REGEXP_LIKE(t.col1, '^\d+$')Or my example with searching decimal numbers:
    '^(\.\d+|\d+(\.\d*)?)$'Saves some space, doesn't it? However, this will only work in 10g2 and future releases.
    Some of those meta characters even include non matching lists, for example "\S" is equivalent to "[^ ]", so my example in the second part could be changed to:
    SELECT NVL(LENGTH(REGEXP_REPLACE('Having fun with regular expressions', '\S')), 0)
      FROM dual
      ;Other meta characters support search patterns in strings with newline characters. Just take a look at the link I've included.
    Another interesting meta character is "?" non-greedy. In 10g2, "?" not only means 0 or 1 occurrence, it means also the first occurrence. Let me illustrate with a simple example:
    SELECT REGEXP_SUBSTR('Having fun with regular expressions', '^.* +')
      FROM dual
      ;This is old style, "greedy" search pattern, returning everything until the last space.
    SELECT REGEXP_SUBSTR('Having fun with regular expressions', '^.* +?')
      FROM dual
      ;In 10g2, you'd get only "Having " because of the non-greedy search operation. Simulating that behavior in 10g1, I'd have to change the pattern to this:
    SELECT REGEXP_SUBSTR('Having fun with regular expressions', '^[^ ]+ +')
      FROM dual
      ;Another new option is the "x" match parameter. It's purpose is to ignore whitespaces in the searched string. This would prove useful in ignoring trailing/leading spaces for example. Checking on unsigned integers with leading/trailing spaces would look like this:
    SELECT REGEXP_SUBSTR(' 123 ', '^[0-9]+$', 1, 1, 'x')
      FROM dual
      ;However, I've to be careful. "x" would also allow " 1 2 3 " to qualify as valid string.
    I hope you enjoyed reading this introduction and hope you'll have some fun with using regular expressions.
    C.
    Fixed some typos ...
    Message was edited by:
    cd
    Included 10g2 features
    Message was edited by:
    cd

    Can I write this condition with only one reg expr in Oracle (regexp_substr in my example)?I meant to use only regexp_substr in select clause and without regexp_like in where clause.
    but for better understanding what I'd like to get
    next example:
    a have strings of two blocks separated by space.
    in the first block 5 symbols of [01] in the second block 3 symbols of [01].
    In the first block it is optional to meet one (!), in the second block it is optional to meet one (>).
    The idea is to find such strings with only one reg expr using regexp_substr in the select clause, so if the string does not satisfy requirments should be passed out null in the result set.
    with t as (select '10(!)010 10(>)1' num from dual union all
    select '1112(!)0 111' from dual union all --incorrect because of '2'
    select '(!)10010 011' from dual union all
    select '10010(!) 101' from dual union all
    select '10010 100(>)' from dual union all
    select '13001 110' from dual union all -- incorrect because of '3'
    select '100!01 100' from dual union all --incorrect because of ! without (!)
    select '100(!)1(!)1 101' from dual union all -- incorrect because of two occurencies of (!)
    select '1001(!)10 101' from dual union all --incorrect because of length of block1=6
    select '1001(!)10 1011' from dual union all) --incorrect because of length of block2=4
    select '10110 1(>)11(>)0' from dual union all)--incorrect because of two occurencies of (>)
    select '1001(>)1 11(!)0' from dual)--incorrect because (!) and (>) are met not in their blocks
    --end of test data

  • Automatically update 2 dimensional array based on list content

    Suppose I have a simple class named SimplePoint
    class SimplePoint
    public int x { get; set; }
    public int y { get; set; }
    Next I create an ObservableCollection of the class and bind it to a WPF DataGrid via XAML.
    Each SimplePoint has a distance to each other SimplePoint int the list, resulting in a matrix. The distance from point a to b can be different from the distance from point b to a (ie. different route).Distances should be editable.
    I wonder how I can create a class, that can automatically keep track of changes in the ObservableCollection<SimplePoint>. When a new SimplePoint is added, one row and one column should be added to the distances matrix. When a SimpePoint is removed,
    the appropriate entries in the matrix should be removed. Later I also wish to store and retrieve all the info to and from an XML via serialization.
    So this list:
    point1
    point2
    point3
    Would yield a 3x3 matrix of distances.
    Searching a lot did not yield results, though I am unsure if I looked for the right thing. I cannot get my head around how to organize this internally. Maybe something like ObservableCollection<ObservableCollection<SimplePoint>>, but then how
    to maintain that, and how to bind it to a DataGrid... Any ideas?

    Hi mennowo,
    >> that can automatically keep track of changes in the ObservableCollection<SimplePoint>. When a new SimplePoint is added, one row and one column should be added to the distances matrix
    I would recommend that you can use ObservableCollection<T>.CollectionChanged event:
    https://msdn.microsoft.com/en-us/library/ms653375(v=vs.110).aspx
    This event will be triggered when items are added, removed, changed, moved, or the entire list is refreshed. In this event, you can easily add item into the distances matrix as you wish.
    Here is a simple sample:
    public ObservableCollection<SimplePoint> DemoSource { get; set; }
    public MainWindow()
    InitializeComponent();
    DemoSource = new ObservableCollection<SimplePoint>();
    DemoSource.CollectionChanged += MyItemsSource_CollectionChanged;
    DemoSource.Add(new SimplePoint() { x = 1, y = 1 });
    DemoSource.Add(new SimplePoint() { x = 2, y = 2 });
    DemoSource.Add(new SimplePoint() { x = 3, y = 3 });
    this.DataContext = this;
    private void MyItemsSource_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
    if (e.NewItems != null)
    foreach (SimplePoint item in e.NewItems)
    //Add this item into the distances matrix
    if (e.OldItems != null)
    foreach (SimplePoint item in e.OldItems)
    //Do something for old items
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Content based image retrieval using Oracle Multimedia

    I'm doing a thesis in which I'm trying to improve content based image retrieval, and using Oracle 11g Multimedia and I'm hoping to do CBIR system based on signature generated by Multimedia.
    To do my application I'm using  this documentation http://fildz.developpez.com/tutoriel/oracle-java/ordimage/
    Now I need to have an idea about the technique used to generate signature. In this link https://community.oracle.com/message/618866#618866, i find some indications like : texture histograms, global color, the Manhattan distance... so i look for a clear and rich documentation about generated signature in CBIR using Oracle 11g.
    Thank you

    The details in that thread is the only information that can be shared.
    Melli
    Oracle Multimedia

  • PayPal and a shipping calculator... or Webassist

    I wrote a very simple web store for my wife, at www.direct2usales.com which uses PayPal for a shopping cart (her sales are seasonal, so a merchant account via authorize.net doesn't work, since there are monthly fees even if there are no sales)
    The one drawback to PayPal is that it does not allow for shipping by weight & distance calculations
    Searching this forum, I do not find any way to do such in Dreamweaver... but I did find mention of http://www.webassist.com/php-scripts-and-solutions/powerstore/ as a pre-built solution that will allow her to continue using PayPal... with one example site in their gallery that uses powerstore
    Has anyone here used powerstore?
    Comments... good or bad... about the product?
    Especially comments about using powerstore with PayPal
    Thanks, John

    Hi John
    You could program your own shipping calculator, see - http://www.adobe.com/devnet/dreamweaver/articles/shipping_charges.html.
    PZ

  • Help in finding a regex pattern

    Dear all REGEX Gurus. 
    We have a comma separated string like this:
    132, 143, "222, 144, abc", 227, 888, "222#55#ab"
    As you might have guessed, this comes from excel when we save as CSV file, and when one of the columns in excel has the value 222,144,abc. So excel itself puts " at beginning and end.
    Now we want to split it based on ',' like this:
    132
    143
    222,144,abc
    227
    888
    222#55#ab
    So what we thought is to use a REGEX to find a pattern that has anything beginning with ", ending with ", and has a comma (,) in between. We'd replace that comma with a special character.
    System seems to perform greedy search if i search like this ",".
    I tried this:
    "([^"]+)" -> this works that it gives me all values within quotes. But I want only those which have a comma in them.
    So in above, i do not want 222#55#ab to come.
    Tried various combinations, but not able to get it work.
    Can someone advise please how to achieve it?
    Thanks in adv.

    Hi,
    I am in 4.6 version and dont have the facility to regex it for you.
    Just wrote a sample code, if useful then use it.
    DATA:lv_string(100) TYPE c.
    DATA:lv_len TYPE i.
    TYPES:BEGIN OF ty,
          field(100) TYPE c,
          END OF ty.
    DATA:it TYPE TABLE OF ty.
    FIELD-SYMBOLS:<fs> TYPE ty.
    lv_string = '132, 143, "222, 144, abc", 227, 888, "222#55#ab"'.
    CONDENSE lv_string NO-GAPS.
    SPLIT lv_string AT '"' INTO TABLE it.
    CLEAR lv_string.
    LOOP AT it ASSIGNING <fs>.
      IF <fs> IS INITIAL.
        delete it index sy-tabix.
        CONTINUE.
      ENDIF.
      lv_len = strlen( <fs> ) - 1.
      IF ( <fs>+lv_len(1) CA '"' ) OR ( <fs>+lv_len(1) CA ',' ).
        <fs>+lv_len(1) = ' '.
      ENDIF.
      IF ( <fs>+0(1) CA '"' ) OR ( <fs>+0(1) CA ',' ).
        <fs>+0(1) = ' '.
      ENDIF.
      CONDENSE <fs>.
      WRITE:/ <fs>.
    ENDLOOP.

  • Spot healing brush in PSE4

    I understand that the spot healing brush is supposed to pick up pixels right next to the area you are healing. When I try to use it, it picks up pixels from quite far away from the area. Am i doing something wrong?

    The distance it searches is based on big the brush is. Use a smaller brush and it will search a proportionately closer area.

Maybe you are looking for

  • How to restrict Material Class in Sales Contract Doc

    Hi, I need to restrict Material Class in Sales order based on Item catagory, Material group4 and Sales contract Document type. If the above 3 fields having a particular value then the system should restrict all the other classes of that material and

  • Mountain Lion won't install on mid-2010 iMac with Snow Leopard

    Using the same Apple ID I used to purchase Mountain Lion on my Mac Pro, I signed into the Mac App Store on my iMac and downloaded Mountain Lion with no issues.  The iMac is running 10.6.8. When I launch the ML installer and accept the terms, the inst

  • Convert flat file to IDOC

    Hi SAP Gurus, I got a flat file containing all the info about IDOC, how can I use this file to generate an IDOC. Is there is any standard prog which takes the flat file & generate the IDOC. Flat file contains all info i.e control record, data. Thanks

  • Unable to initialize installer for CS5 after formatting hard drive.

    I just reformatted my computer's hard drive and I'm trying to re-install CS5, but every time I try to run the set-up for the installer it errors out with the message, "Installer faled to initialize. Please download Adobe Support Advisor to detect the

  • Function that zero out negative forecast in APO DP (SCM 4.0)

    Hi,   I tried to look for a thread about the above function but I have no luck.  Would you kindly share a light if you have come accross negative number being generated automatically? (no macro is set up for negating forecast) This is the note that I