Help needed in geocoding through sdo_gcdr.geocode_addr_all

Hi all,
I am using the below SQL for the same. I am able to use the below query
SELECT SDO_GCDR.GEOCODE('GEOSAMPLE',SDO_KEYWORDARRAY('CALIFORNIA PACIFIC MEDICAL CTR', 'US','92306'), 'US', 'DEFAULT') FROM DUAL;
but now I want to use geocode_addr_all but I am not sure which arguments I need to provide to GEOCODE-ADDR_ALL and SDO_KEYWORDARRAY? Is sdo_keywordarray is compulsory to have argument?
SELECT sdo_gcdr.geocode_addr_all('GEOSAMPLE', SDO_GEO_ADDR(0, SDO_KEYWORDARRAY(), '',
'BUCHANAN ST', NULL, NULL, 'SAN FRANCISCO', NULL, 'CA', 'US', '94115', NULL, '94115', NULL, '2333', NULL, NULL, 'F', 'F',
NULL, NULL, 'L', 0, 23599031, '??????????B281CP?', 4, 'DEFAULT', -122.43097, 37.79138), 15) FROM DUAL ;
I searched on the net but didn't find a java example for same. All about documentation only that is not clear how to use it. Please provide me some way or any useful link for the same.
Thanks.

1.
Earlier the code was using the below query
SELECT G.GC.LONGITUDE, G.GC.LATITUDE, G.GC.MATCHCODE FROM (SELECT SDO_GCDR.GEOCODE(?, SDO_KEYWORDARRAY(?,?,?,?,?,?,?,?,?,?),?,?) GC FROM DUAL) G
Now I need to get all the matching addresses for a single input. So I changed the query into the ...
SELECT sdo_gcdr.geocode_addr_all('GEOSAMPLE', SDO_GEO_ADDR(0, SDO_KEYWORDARRAY(5, 'E', '9th', 'Street', '', 'Kansas City', '', '', 'MO', '67530'), NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, 'DEFAULT', 0, 0), 15) GC FROM DUAL ;
So I am planning to create a SDO_KEYWORDARRAY same as the earlier code and will use into the new query. Rest of the argument to SDO_GEO_ADDR I will place NULL. Is that correct or you suggest something else.
2. http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14255/sdo_geocode_concepts.htm#CIHGGJCG
This link is giving the idea about each argument of SDO_KEYWORDARRAY and according to this link it is describing 9 parameters. So is this the real number of arguments and sequence for our SDO_KEYWORDARRAY? If yes, then what format we are using in the above query having 10 arguments? and arguments are in sequence also as per the above link!!!
Even this query is also valid SDO_KEYWORDARRAY('CALIFORNIA PACIFIC MEDICAL CTR', 'US','92306') but again confusion in the argument?
3.
Second query, I will get the result in the below form...
MDSYS.SDO_ADDR_ARRAY('MDSYS.SDO_GEO_ADDR(0),'null','null','null','null','KANSAS CITY','null','MO','US','64105','null','null','null','null','null','null','F','F','null','null','L',0,344973778,'??????????B281C??',10,'DEFAULT',-94.58302,39.10295,'???31131110??002?')','MDSYS.SDO_GEO_ADDR(0),'null','null','null','null','KANSAS CITY','null','MO','US','64164','null','null','null','null','null','null','F','F','null','null','L',0,780357721,'??????????B281C??',10,'DEFAULT',-94.64491,39.31105,'???31131110??002?')','MDSYS.SDO_GEO_ADDR(0),'null','null','null','null','KANSAS CITY','null','MO','US','64161','null','null','null','null','null','null','F','F','null','null','L',0,344805784,'??????????B281C??',10,'DEFAULT',-94.46238,39.16317,'???31131110??002?')','MDSYS.SDO_GEO_ADDR(0),'null','null','null','null','KANSAS CITY','null','MO','US','64012','null','null','null','null','null','null','F','F','null','null','L',0,344983779,'??????????B281C??',10,'DEFAULT',-94.54999,38.83666,'???31131110??002?')','MDSYS.SDO_GEO_ADDR(0),'null','null','null','null','KANSAS CITY','null','MO','US','64105','null','null','null','null','null','null','F','F','null','null','L',0,344973778,'??????????B281C??',10,'DEFAULT',-94.58302,39.10295,'???31131110??002?')')
How you will parse each address to get logitude/latitude? Will you do it through Java code or through SQL only without using pl-sql.
4. Will you suggest any java book that is using all these things?
Thanks a lot.
Edited by: 848242 on Apr 1, 2011 2:32 AM

Similar Messages

  • I have Acrobat Pro 9.0. Am happy with it since I only have occasional need. Haven't updated it. Is there a way to do this? Do I need toy go through updates sequentially if they are available? Thanks for any help.

    I have Acrobat Pro 9.0. Am happy with it since I only have occasional need. Haven't updated it. Is there a way to do this? Do I need to
    go through updates sequentially if they are available? Thanks for any help.

    Hi Spiral Geronimo,
    It is always recommended to update the software to its latest updates. I would suggest you to update your Acrobat 9 to its latest updates. You can download the updates from the link below:
    http://helpx.adobe.com/acrobat/kb/update-patch-acrobat-reader-7.html

  • HT4623 I have updated my iphone with the current software but it is showing you need to connect to  of itunes to activate your phone, when i did that it is continuously showing an error.please help me to get through.

    I have updated my iphone with the current software but it is showing you need to connect to  of itunes to activate your phone, when i did that it is continuously showing an error.please help me to get through.
    Kindly Activate my phone.

    Rajan Gupta wrote:
    ...it is continuously showing an error.
    See here  >  http://support.apple.com/kb/TS3424
    Also see this discussion.
    https://discussions.apple.com/message/21189708

  • Help needed for using BASIC authentication through JDBCRealm

    Help needed.
    Hello,
    I am doing a degree project, so far it works fine in my local machine, I need to try it on my virtual hosting (as it is a live server).
    My project requires JDBCRealm, that is BASIC authentication loading access data from mysql database. Normally this setup can be done in Server.xml file, because my Tomcat hosting is a virtual one, I only have permission to access the web.xml file.
    My question is: is it possible to get it done in an alternative way? In web.xml? Some properties file maybe?
    Thank you very much.

    You can set this up for your context using META-INF/context.xml instead of working with server.xml.
    Make a directory called META-INF under your webapp ( it'll be at the same level as WEB-INF ). Under this, add a context.xml with all your context specific configuration including the realm. A sample is below
    <?xml version="1.0" encoding="UTF-8"?>
    <Context path="/myApp" reloadable="true">
        <Realm
            className="org.apache.catalina.realm.JDBCRealm"            
            driverName="com.microsoft.jdbc.sqlserver.SQLServerDriver"         
            connectionURL="jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=myDB;SelectMethod=Cursor;"
            connectionName="username" connectionPassword="password"
            digest="MD5" userTable="users" userNameCol="userid" userCredCol="userpassword"
            userRoleTable="user_roles" roleNameCol="rolename"
        />
    </Context>Hope this helps.
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    ----------------------------------------------------------------

  • Help Needed REP-1800 Formatter error VGS-1701 Not enough memory

    Hi. Gents
    Help needed
    I’m working on a Report, it gets some 2 million records and the report pages are approximately 52,000
    It works fine if the pages are lesser then 48,000 or the data is less let say one and half a million, the problem occurs only after 48000 + pages formatted.
    Report is generated successfully when trying to go to the last page it throw an error.
    REP-1800 Formatter error
    VGS-1701 Not enough memory
    I have already gone through the metalink DOC Id 95505.1 as well as OTN
    But all in vain,
    Any comments or help much appreciated.
    Details are:
    Reports 6i (Clients/Server) on Windows platform
    (Windows XP Professional with SP 2)
    Database: Oracle9i Enterprise Edition Release 9.2.0.5.0
    Computer:
    Pentium(R) 4, CPU 3.00GHz, 1 GB of RAM
    Still 20 GB free space
    Thanks & Regards

    I don't see the point in making a report with more than 48,000 pages, I think Al Gore will not be happy when you start printing it...
    The problem might be caused by the fact that Reports needs to format all output at once, and then even 1GB of memory will probably be not enough. Formatting all pages at once is needed if you use pagination with displaying total number of pages. If you have this, try to get that out of the report definition and try again.

  • Help needed in setting up Japanese Database

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

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

  • Help needed in Query design

    Hello Query experts,
    I have the following data in my DSO.
    Char1      date                      Kf1     KF2
    a           01.01.2011              10       20
    a           03.01.2011              50       70
    a           05.01.2011                5       10
    b           02.01.2011              20        25
    b           05.01.2011              10        15
    b           06.01.2011               5         15
    Now, I need to design a query to produce the following result:
    Char1      date                      Kf1     KF2     KF3(KF2-KF1)        KF4
    a           01.01.2011              10       20             10                     10
    a           03.01.2011              50       70             20                     30 [KF3+Prev(KF4)]
    a           05.01.2011                5       10              5                      35
    b           02.01.2011              20       25              5                       5
    b           05.01.2011              10       15              5                      10
    b           06.01.2011               5        15             10                     20
    Can anybody help me achieve this through a BI Query?
    Thanks and regards,
    Jashua

    HI,
    I think kf3 can easily be created at query level itself without writing complex logic..As far as i understand your requirement kf3 is a differnce of kf2 and kf1.
    so jst make local formula and in that put kf2-kf1.it will give you the desired output for kf3.
    Kf4 i need to think,i will update you soon

  • Help needed in Workflow Email Notification

    Hi,
    I am new to workflow. I am creating a notification process in Oracle Apps 11i to send an email notification to users who registered for some training. Now how can I send an email notification to each user as the list of users can be huge i.e. > 200 . Do I need to loop through and send a notification to each user one by one or is there a way to achieve this by just sending one notification to all the users and if I send one notification to all the users how can I make sure when a user gets an email he/she don't see other users email addresses.
    Any help is appreciated.
    Thanks

    Thanks can you please tell me what will be the datatype of l_user_list.
    It's a VARCHAR2 list of users, separated by a space or comma.
    Now before creating AdHocUser do I need to check in WF_USERS table if the user with the same email address is already there then don't create that user and just add it to a l_user_list.
    Yes - you will need to have a user record first before you can add them to the role.
    If adding user to l_user_list how to make sure I am adding the right user to send notification to as there may be some other user with same name but different email that I don't want to send notification to. I only want to create a AdHocUser only if name and email address both are not already in the WF_USERS. e.g. lets say if there is a user John Doe with email [email protected] who previously attended some training. Now comes another user John Doe with email id [email protected] and is attending the current training. How do I make sure notification only goes [email protected] as he registered for this training not to [email protected] who previously attended some other training.
    How do you identify which user has registered for training - you could check email address, or use the Apps user name which is unique. Whatever you are using to determine who is registering, you will need to determine what the link is back to the user record in WF_USERS.
    Now as this procedure runs every 24 hrs then everytime it runs do I need to create a new AdHocRole and what should I name it as it can't be hardcoded. As I only want to send an email to the users registered in the current training how do I make sure notification does not go to some other user with the same name with different email who is not registered in the current training.
    If the job runs once every 24 hours, then you could use the same role each time, and clear out the users in the role before repopulating them. If not, when you create the new role (which is what I would do) every time the job runs, then store the name of the role in an item attribute, and then reference that in the notification so that the new role is notified each time. Don't forget to set an expiration date for your ad-hoc roles, though, and run a purge job periodically to get rid of the old roles that are no longer required.
    Also wf_directory.CreateAdHocUser and create a user list should be in a loop and create an adhoc role and notification will be outside the loop.
    What are drawbacks of if in a loop I just create a AdHocUser and then send notification one by one to each user rather than creating a role and in the end send one notification. Basically if there are 200 hundred users loop runs 200 times and each time notification goes.
    If you notify each individual user, then you will have a large number of notifications that are being sent - extra records in the WF_NOTIFICATIONS table, extra records on the queue which the mailer uses etc. etc. If you notify a role, then there is only one record to process.
    If it were me, I would build an ad-hoc role each time, and populate that role with the correct users, and notify the role. I would NOT be sending 200 separate notifications when one would suffice.
    HTH,
    Matt

  • Help needed, Createing Dynamic User input

    Hello,
    I am attempting to create some dynamic user input by "predicting" what the user requires in a text box.
    For example if the user enters "Smi" I have a select list pop up which gives the user all options that begin with "Smi".
    I am able to achieve the popups but the interface is quite jerky and not terribly responsive I am trying to solve this by using a thread which starts and stops when new input is received but it is still not quite right.
    The program uses a Sorted TreeSet to hold the data (I thought this would give me a quick search time) and a simple interface at this stage.
    Any help would be fantastic
    Thanks in advance :P
    import java.io.*;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.text.*;
    import java.util.*;
       /** This program represents part of a larger user interface for allowing the
       user to select data from a file or database.
       <p>
       When the program starts up, it will read in data from a given file, and hold
       it in some type of container allowing rapid access.
       <p>
       The user may then type in the first few letters of the surname of a person,
       and this program should immediately present in a popup dialog the names which
       match.  The user will be able to click on one of the names in the popup and
       that will cause all data about that person to be displayed in the JTextArea
       at the bottom of the window.
       <p>
       This program requires the FormLayout.class, FormLayout$Placement.class, and
       FormLayout$Constraint.class files in the same directory
       (folder) or in its classpath.  These is provided separately.
    class PartMatch extends JFrame implements Runnable
                        /** Close down the program. */
       JButton quitbtn;
                        /** Field for the surname. */
       JTextField namefld;
                        /** Full details of the person(s). */
       JTextArea  results;
                        /** Popup dialog to display the names and addresses which
                        match the leading characters given in namefld. */
       Chooser matches;
                      /** Default background color for a window. */
       final static  Color            defBackground = new Color(0xD0C0C0);
                      /** Default foreground color for a window. */
       final static  Color            defForeground = new Color(0x000000);
                      /** Default background color for a field */
       final static  Color            fldBackground = new Color(0xFFFFFF);
                      /** Default background color for a button */
       final static  Color            btnBackground = new Color(0xF0E0E0);
       final static  Color            dkBackground = new Color(0xB0A0A0);
                      /** Larger font */
       final static  Font bold = new Font("Helvetica", Font.BOLD, 30);
       TreeSet members;
       String input;
       String[] found;
       public static void main(String arg[])
          UIManager.put("TextField.background",fldBackground);
          UIManager.put("TextField.foreground",defForeground);
          UIManager.put("TextField.selectionBackground",btnBackground);
          UIManager.put("TextArea.background",fldBackground);
          UIManager.put("TextArea.foreground",defForeground);
          UIManager.put("TextArea.selectionBackground",btnBackground);
          UIManager.put("Panel.background",defBackground);
          UIManager.put("Label.background",defBackground);
          UIManager.put("Label.foreground",defForeground);
          UIManager.put("Button.background",btnBackground);
          UIManager.put("Button.foreground",defForeground);
          UIManager.put("CheckBox.background",defBackground);
          UIManager.put("ScrollBar.background",defBackground);
          UIManager.put("ScrollBar.thumb",btnBackground);
          UIManager.put("ComboBox.background",btnBackground);
          UIManager.put("ComboBox.selectionBackground",dkBackground);
          PartMatch trial = new PartMatch(arg);
       public PartMatch( String [] arg )
          super("Part Match");
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          Container cpane = getContentPane();
          FormLayout form = new FormLayout(cpane);
          JLabel lab1 = new JLabel("Fetch details") ;
          lab1.setFont( bold );
          form.setTopAnchor( lab1, 4 );
          form.setLeftAnchor( lab1, 4 );
          JLabel lab2 = new JLabel("Surname: ") ;
          form.setTopRelative( lab2, lab1, 4 );
          form.setLeftAlign( lab2, lab1 );
          namefld = new JTextField( 30 );
          form.setBottomAlign( namefld, lab2 );
          form.setLeftRelative( namefld, lab2, 4 );
          namefld.addCaretListener( new CaretListener()
             public void caretUpdate(CaretEvent e)
                 showMatches();
          quitbtn = new JButton( "Quit" );
          quitbtn.addActionListener( new ActionListener()
             public void actionPerformed(ActionEvent e)
                quitProcessing();
          form.setBottomAlign( quitbtn, namefld );
          form.setLeftRelative( quitbtn, namefld, 15 );
          results = new JTextArea( 10,50 );
          results.setEditable(false);
          JScrollPane jsp = new JScrollPane( results,
                                     JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                     JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED );
          form.setTopRelative( jsp, lab2, 6 );
          form.setLeftAlign( jsp, lab2 );
          form.setBottomAnchor( jsp, 5 );
          form.setRightAnchor( jsp, 5 );
          form.setRightAnchor( quitbtn, 5 );
          matches = new Chooser( this );
          //matches.setUndecorated(true);
          pack();
          setVisible(true);
          namefld.requestFocus();
          if (arg.length > 0) init(arg[0]);
          else init("triathlon.txt"); //<<<<<<<<<<<<<<<< Place the default filename here
          /** Called once only, at the end of the constructor, to read the data
            * from the membership file.
       public void init( String fname )
          members = new TreeSet();
           try {
               FileReader fr = new FileReader(new File (fname));
               Scanner scan = new Scanner(fr);
               trimember cmem;
               String cLine, eTag, memberNo, first, last, gender, yob, tel ,addr,
                       club;
               while(scan.hasNextLine())
                   cLine = scan.nextLine();
                   Scanner scan2 = new Scanner(cLine);
                   scan2.useDelimiter(";");
                   eTag = scan2.next().trim();
                   memberNo = scan2.next().trim();
                   first = scan2.next().trim();
                   last = scan2.next().trim();
                   gender = scan2.next().trim();
                   yob = scan2.next().trim();
                   tel = scan2.next().trim();
                   addr = scan2.next().trim();
                   club = scan2.next().trim();
                   cmem = new trimember(eTag, memberNo, first, last, gender, yob,
                           tel, addr, club);
                   members.add(cmem);
           catch (FileNotFoundException ex)
               results.append("Sorry can't find the input file\n");
               results.append("Please check file name and location and try again");
               ex.printStackTrace();
          /** Called every time there is a change in the contents of the text field
            * namefld.  It will first clear the text area.  It then needs to search
            * through the container of data to find all records where the surname
            * starts with the characters that have been typed.  The names and
            * addresses need to be set up as strings and placed in
            * an array of Strings.  This can be placed in the "matches" window and
            * displayed for the user, inviting one to be selected.
            * <p>
            * The performance of this is very important.  If necessary, it may be
            * necessary to run as a separate thread so that the user interface is
            * not delayed.  It is essential that the user be able to type letters at a
            * reasonable speed and not have the keystroke processing held up by
            * previous text.
       public void showMatches( )
           run();
                // First clear the text area
          //results.setText("");
                // Determine the leading characters of the surname that is wanted
                input = namefld.getText();
                // Locate the data for this name, and display each matching item
                //  in the JTextArea ...
                // Example of how to set the data in the popup dialog
          matches.list.setListData(found);
          matches.pack();   // resize the popup
                // set the location of the popup if it is not currently visible
          if ( ! matches.isVisible())
             Dimension sz = matches.getSize();
             Point mouse = getMousePosition();
             Point framepos = getLocation();
             int x=0, y=0;
             if (mouse == null)
                Point pt = results.getLocation();
                x = pt.x + 20 + framepos.x;
                y = pt.y + 20 + framepos.y;
             else
                x = mouse.x - 2 + framepos.x;
                y = mouse.y - 2 + framepos.y;
             matches.setLocation(x,y);
          matches.setVisible(true);
          namefld.requestFocus();
          /** Perform any final processing before closing down.
       public void quitProcessing( )
          // Any closing work.  Then
          System.exit(0);
        public void run()
            ArrayList<String> foundit = new ArrayList<String>();
            System.out.println(input);
            if(input != null)
            Iterator it = members.iterator();
            while(it.hasNext())
               trimember test = (trimember) it.next();
               if (test.last.startsWith(input))
                   foundit.add(test.last +", "+ test.first);
            found = new String[foundit.size()];
            for(int i=0; i<foundit.size();i++)
                found[i] = foundit.get(i);
         /** A window for displaying names and addresses from the data set which
          match the leading characters in namefld.
          <p>
          This will automatically pop down if the user moves the mouse out of the
          window.
          <p>
          It needs code added to it to respond to the user clicking on an item in
          the displayed list. */
       class Chooser extends JWindow
                /** To display a set of names and addresses that match the leading
                characters of the namefld text field. */
          public JList list = new JList();
          Chooser( JFrame parent )
             super( parent );
             Container cpane = getContentPane();
             cpane.addMouseListener( new MouseAdapter()
                public void mouseExited(MouseEvent e)
                   Chooser.this.setVisible(false);
             cpane.add("Center",list);
             list.addListSelectionListener( new ListSelectionListener()
                public void valueChanged(ListSelectionEvent e)
                   Chooser.this.setVisible(false);
                   System.out.println("ValueChanged");
                   // First clear the text area
                   results.setText("");
                   String in = (String) list.getSelectedValue();
                   System.out.println("Selected Value was : "+in);
                   String[] inlf = in.split(", ");
                   System.out.println("inlf[0]:"+inlf[0]+" inlf[1]:"+inlf[1]);
                   results.append("Surname \tFirst \teTag \tMemberNo \tSex \tYOB " +
                           "\tTel \tAddress \t\t\tClub\n");
                   Iterator it = members.iterator();
                   while(it.hasNext())
                       trimember test = (trimember) it.next();
                       if (test.last.equals(inlf[0])&&test.first.equals(inlf[1]))
                           results.append(test.toString()+"\n");
                   namefld.requestFocus();
          public class trimember implements Comparable
           String eTag;
           public String memberNo;
           public String first;
           public String last;
           String gender;
           String yob;
           String tel;
           String addr;
           String club;
           public trimember(String eT, String me, String fi, String la,
                   String ge, String yo, String te, String ad, String cl)
               eTag = eT;
               memberNo = me;
               first = fi;
               last = la;
               gender = ge;
               yob = yo;
               tel = te;
               addr = ad;
               club = cl;         
           //To String method to output string of details
           public String toString()
               return last + "\t" + first + "\t" + eTag + "\t" +
                       memberNo + "\t" + gender + "\t" + yob + "\t"+ tel + "\t" +
                       addr + "\t" + club;
           //Compare and sort on Last name
           public int compareTo(Object o)
               trimember com = (trimember) o;
               int lastCmp = last.compareTo(com.last);
               int firstCmp = first.compareTo(com.first);
               int memCmp = memberNo.compareTo(com.memberNo);
               if (lastCmp == 0 && firstCmp !=0)return firstCmp;
               else if (lastCmp==0&&firstCmp==0)return memCmp;
               else return lastCmp;
    }

    Please don't cross-post. It is considered very rude to do that here:
    http://forum.java.sun.com/thread.jspa?messageID=9953193

  • Help needed, Providing Dynamic User input

    Hello,
    I am attempting to create some dynamic user input by "predicting" what the user requires in a text box.
    For example if the user enters "Smi" I have a select list pop up which gives the user all options that begin with "Smi".
    I am able to achieve the popups but the interface is quite jerky and not terribly responsive I am trying to solve this by using a thread which starts and stops when new input is received but it is still not quite right.
    The program uses a Sorted TreeSet to hold the data (I thought this would give me a quick search time) and a simple interface at this stage.
    Any help would be fantastic
    Thanks in advance :P
    import java.io.*;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.text.*;
    import java.util.*;
       /** This program represents part of a larger user interface for allowing the
       user to select data from a file or database.
       <p>
       When the program starts up, it will read in data from a given file, and hold
       it in some type of container allowing rapid access.
       <p>
       The user may then type in the first few letters of the surname of a person,
       and this program should immediately present in a popup dialog the names which
       match.  The user will be able to click on one of the names in the popup and
       that will cause all data about that person to be displayed in the JTextArea
       at the bottom of the window.
       <p>
       This program requires the FormLayout.class, FormLayout$Placement.class, and
       FormLayout$Constraint.class files in the same directory
       (folder) or in its classpath.  These is provided separately.
    class PartMatch extends JFrame implements Runnable
                        /** Close down the program. */
       JButton quitbtn;
                        /** Field for the surname. */
       JTextField namefld;
                        /** Full details of the person(s). */
       JTextArea  results;
                        /** Popup dialog to display the names and addresses which
                        match the leading characters given in namefld. */
       Chooser matches;
                      /** Default background color for a window. */
       final static  Color            defBackground = new Color(0xD0C0C0);
                      /** Default foreground color for a window. */
       final static  Color            defForeground = new Color(0x000000);
                      /** Default background color for a field */
       final static  Color            fldBackground = new Color(0xFFFFFF);
                      /** Default background color for a button */
       final static  Color            btnBackground = new Color(0xF0E0E0);
       final static  Color            dkBackground = new Color(0xB0A0A0);
                      /** Larger font */
       final static  Font bold = new Font("Helvetica", Font.BOLD, 30);
       TreeSet members;
       String input;
       String[] found;
       public static void main(String arg[])
          UIManager.put("TextField.background",fldBackground);
          UIManager.put("TextField.foreground",defForeground);
          UIManager.put("TextField.selectionBackground",btnBackground);
          UIManager.put("TextArea.background",fldBackground);
          UIManager.put("TextArea.foreground",defForeground);
          UIManager.put("TextArea.selectionBackground",btnBackground);
          UIManager.put("Panel.background",defBackground);
          UIManager.put("Label.background",defBackground);
          UIManager.put("Label.foreground",defForeground);
          UIManager.put("Button.background",btnBackground);
          UIManager.put("Button.foreground",defForeground);
          UIManager.put("CheckBox.background",defBackground);
          UIManager.put("ScrollBar.background",defBackground);
          UIManager.put("ScrollBar.thumb",btnBackground);
          UIManager.put("ComboBox.background",btnBackground);
          UIManager.put("ComboBox.selectionBackground",dkBackground);
          PartMatch trial = new PartMatch(arg);
       public PartMatch( String [] arg )
          super("Part Match");
          setDefaultCloseOperation(EXIT_ON_CLOSE);
          Container cpane = getContentPane();
          FormLayout form = new FormLayout(cpane);
          JLabel lab1 = new JLabel("Fetch details") ;
          lab1.setFont( bold );
          form.setTopAnchor( lab1, 4 );
          form.setLeftAnchor( lab1, 4 );
          JLabel lab2 = new JLabel("Surname: ") ;
          form.setTopRelative( lab2, lab1, 4 );
          form.setLeftAlign( lab2, lab1 );
          namefld = new JTextField( 30 );
          form.setBottomAlign( namefld, lab2 );
          form.setLeftRelative( namefld, lab2, 4 );
          namefld.addCaretListener( new CaretListener()
             public void caretUpdate(CaretEvent e)
                 showMatches();
          quitbtn = new JButton( "Quit" );
          quitbtn.addActionListener( new ActionListener()
             public void actionPerformed(ActionEvent e)
                quitProcessing();
          form.setBottomAlign( quitbtn, namefld );
          form.setLeftRelative( quitbtn, namefld, 15 );
          results = new JTextArea( 10,50 );
          results.setEditable(false);
          JScrollPane jsp = new JScrollPane( results,
                                     JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                                     JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED );
          form.setTopRelative( jsp, lab2, 6 );
          form.setLeftAlign( jsp, lab2 );
          form.setBottomAnchor( jsp, 5 );
          form.setRightAnchor( jsp, 5 );
          form.setRightAnchor( quitbtn, 5 );
          matches = new Chooser( this );
          //matches.setUndecorated(true);
          pack();
          setVisible(true);
          namefld.requestFocus();
          if (arg.length > 0) init(arg[0]);
          else init("triathlon.txt"); //<<<<<<<<<<<<<<<< Place the default filename here
          /** Called once only, at the end of the constructor, to read the data
            * from the membership file.
       public void init( String fname )
          members = new TreeSet();
           try {
               FileReader fr = new FileReader(new File (fname));
               Scanner scan = new Scanner(fr);
               trimember cmem;
               String cLine, eTag, memberNo, first, last, gender, yob, tel ,addr,
                       club;
               while(scan.hasNextLine())
                   cLine = scan.nextLine();
                   Scanner scan2 = new Scanner(cLine);
                   scan2.useDelimiter(";");
                   eTag = scan2.next().trim();
                   memberNo = scan2.next().trim();
                   first = scan2.next().trim();
                   last = scan2.next().trim();
                   gender = scan2.next().trim();
                   yob = scan2.next().trim();
                   tel = scan2.next().trim();
                   addr = scan2.next().trim();
                   club = scan2.next().trim();
                   cmem = new trimember(eTag, memberNo, first, last, gender, yob,
                           tel, addr, club);
                   members.add(cmem);
           catch (FileNotFoundException ex)
               results.append("Sorry can't find the input file\n");
               results.append("Please check file name and location and try again");
               ex.printStackTrace();
          /** Called every time there is a change in the contents of the text field
            * namefld.  It will first clear the text area.  It then needs to search
            * through the container of data to find all records where the surname
            * starts with the characters that have been typed.  The names and
            * addresses need to be set up as strings and placed in
            * an array of Strings.  This can be placed in the "matches" window and
            * displayed for the user, inviting one to be selected.
            * <p>
            * The performance of this is very important.  If necessary, it may be
            * necessary to run as a separate thread so that the user interface is
            * not delayed.  It is essential that the user be able to type letters at a
            * reasonable speed and not have the keystroke processing held up by
            * previous text.
       public void showMatches( )
           run();
                // First clear the text area
          //results.setText("");
                // Determine the leading characters of the surname that is wanted
                input = namefld.getText();
                // Locate the data for this name, and display each matching item
                //  in the JTextArea ...
                // Example of how to set the data in the popup dialog
          matches.list.setListData(found);
          matches.pack();   // resize the popup
                // set the location of the popup if it is not currently visible
          if ( ! matches.isVisible())
             Dimension sz = matches.getSize();
             Point mouse = getMousePosition();
             Point framepos = getLocation();
             int x=0, y=0;
             if (mouse == null)
                Point pt = results.getLocation();
                x = pt.x + 20 + framepos.x;
                y = pt.y + 20 + framepos.y;
             else
                x = mouse.x - 2 + framepos.x;
                y = mouse.y - 2 + framepos.y;
             matches.setLocation(x,y);
          matches.setVisible(true);
          namefld.requestFocus();
          /** Perform any final processing before closing down.
       public void quitProcessing( )
          // Any closing work.  Then
          System.exit(0);
        public void run()
            ArrayList<String> foundit = new ArrayList<String>();
            System.out.println(input);
            if(input != null)
            Iterator it = members.iterator();
            while(it.hasNext())
               trimember test = (trimember) it.next();
               if (test.last.startsWith(input))
                   foundit.add(test.last +", "+ test.first);
            found = new String[foundit.size()];
            for(int i=0; i<foundit.size();i++)
                found[i] = foundit.get(i);
         /** A window for displaying names and addresses from the data set which
          match the leading characters in namefld.
          <p>
          This will automatically pop down if the user moves the mouse out of the
          window.
          <p>
          It needs code added to it to respond to the user clicking on an item in
          the displayed list. */
       class Chooser extends JWindow
                /** To display a set of names and addresses that match the leading
                characters of the namefld text field. */
          public JList list = new JList();
          Chooser( JFrame parent )
             super( parent );
             Container cpane = getContentPane();
             cpane.addMouseListener( new MouseAdapter()
                public void mouseExited(MouseEvent e)
                   Chooser.this.setVisible(false);
             cpane.add("Center",list);
             list.addListSelectionListener( new ListSelectionListener()
                public void valueChanged(ListSelectionEvent e)
                   Chooser.this.setVisible(false);
                   System.out.println("ValueChanged");
                   // First clear the text area
                   results.setText("");
                   String in = (String) list.getSelectedValue();
                   System.out.println("Selected Value was : "+in);
                   String[] inlf = in.split(", ");
                   System.out.println("inlf[0]:"+inlf[0]+" inlf[1]:"+inlf[1]);
                   results.append("Surname \tFirst \teTag \tMemberNo \tSex \tYOB " +
                           "\tTel \tAddress \t\t\tClub\n");
                   Iterator it = members.iterator();
                   while(it.hasNext())
                       trimember test = (trimember) it.next();
                       if (test.last.equals(inlf[0])&&test.first.equals(inlf[1]))
                           results.append(test.toString()+"\n");
                   namefld.requestFocus();
          public class trimember implements Comparable
           String eTag;
           public String memberNo;
           public String first;
           public String last;
           String gender;
           String yob;
           String tel;
           String addr;
           String club;
           public trimember(String eT, String me, String fi, String la,
                   String ge, String yo, String te, String ad, String cl)
               eTag = eT;
               memberNo = me;
               first = fi;
               last = la;
               gender = ge;
               yob = yo;
               tel = te;
               addr = ad;
               club = cl;         
           //To String method to output string of details
           public String toString()
               return last + "\t" + first + "\t" + eTag + "\t" +
                       memberNo + "\t" + gender + "\t" + yob + "\t"+ tel + "\t" +
                       addr + "\t" + club;
           //Compare and sort on Last name
           public int compareTo(Object o)
               trimember com = (trimember) o;
               int lastCmp = last.compareTo(com.last);
               int firstCmp = first.compareTo(com.first);
               int memCmp = memberNo.compareTo(com.memberNo);
               if (lastCmp == 0 && firstCmp !=0)return firstCmp;
               else if (lastCmp==0&&firstCmp==0)return memCmp;
               else return lastCmp;
    }Edited by: Roger on Nov 3, 2007 11:50 AM

    Please don't cross-post. It is considered very rude to do that here:
    http://forum.java.sun.com/thread.jspa?threadID=5233033&messageID=9953169#9953169

  • Please, Help NEED immediately, Radeon 9200 Ati on 23" hd cinema display??

    Hi you all expert, i definitely need some help here after searching through the site , i still couldn't find the solution. Currently i am operating an old G4 Mac 400 mhz , rage 128 pro, the salesman told me it will support the new 23" hd cinema flat panel display, which he fails me, and after checking up the system requirement the minimum should have been radeon 7500. Anyway, i am contemplating on purchasing a new ati 9200 radeon mac edition (within my budget) and would like to ask if it will support the new 23" hd display sitting in my living room. Please help, thanks a million!!!!!

    You should have no problem with this card running the 23'' Cinema. It will indeed

  • Internal Microphone "Not Plugged In". *No help needed anymore*

    edit: no help needed anymore
    Hello. My internal microphone stopped working ever since I stopped using the default Toshiba version of Windows 7.
    I have downloaded all the correct drivers for my Toshiba L750-BT4N22, especially the Conexant SmartAudio HD driver.
    My internal microphone shows up in sounds/hardware, but it says "Not Plugged In". Also, every once in a while my sound get's choppy when I "seek" or move fast through a video file.
    Could use some help, thanks.

    I seem to have fixed it, thanks.

  • How to use Column Formula in Answers? Help needed

    Hi all, I have a report requirement.
    I have a prompt.
    I need the column to be displayed based on a prompt value.
    For instance,
    Lets Say I have a report with two columns.
    Customer_name , amount
    wheere customer_name is a column from presentation catalog and Amount is the column I need to calculate based on prompt value.
    If prompt value = 'X' , Then, amount is calculated as: column1+column2
    If Prompt value = 'Y' I need amount = column3
    Where column 1, column2, column 3 are presentation columns.
    'Amount' is the column I need to show in the report.
    I believe this can be done in column formula in asnwers.but donot know How to do it.
    Can you help me in implementing this Please.
    Thanks a lot in advance for your time and help.

    Hi,
    First go through guided navigation concept.
    Follow these steps -
    1) Create two reports,one with Customer_name,amount(column1+column2) call it report1 and other with Customer_name , amount(column3) call it report2
    2) Now create one prompt with sql result and write sql query as below -
    SELECT CASE WHEN 1=0 THEN 'HELLO' ELSE 'X' END FROM SA.TABLE
    UNION ALL
    SELECT CASE WHEN 1=0 THEN 'WORLD' ELSE 'Y' END FROM SA.TABLE
    Use presentation variable.
    (If you are already having x and y in some column then no need to use sql result in prompt)
    3) Now edit dashboard and place two sections and place one report per one section(section1-report1)
    4) Now create one intermediate report with some dummy column and in fx place below code -
    CASE WHEN 1=0 THEN 'HI' ELSE 'X' END
    Apply filter on this column as equal to presentation variable.
    5) In section1 go to properties->guided navigation->select intermediate report that you created.
    Show this section if request returns rows.
    6) In section2 go to properties->guided navigation->select intermediate report that you created.
    Show this section if request returns nothing.
    Try to understand guided navigation functionality,that helps you lot.
    Hope this helps.
    Regards,
    Srikanth

  • Export help needed

    Hi
    I want to export a short film Ive made so it can be viewed on a pc and Quicktime doesn't seem to work. I have only very basic understanding of File formats so I may not have saved the files correctly.
    I have FCP studio and the film was shot in HDV, 16:9. Plays great on FCP. I exported as a quicktime file as HDV and as SD. The files Ive made play on the mac but not a pc and don't play widescreen on either i.e. picture appears squashed.
    Ultimatly id like to be able burn dvd's from the file.
    Any help greatly apreciated.
    Thanks
    Thomas

    If you want to burn a DVD, then choose: file/export/Using Compressor. Select a preset for DVD's there (using a 16:9 setting). Then burn the resulting files with DVD SP to a disk. No need to go through another conversion. In DVD SP, select the track of video in the outline after you've added it to a button, and enable all the User operations in the tab that's seen in the User operations tab. The resulting DVD will play on a PC, a Mac or a DVD player.
    Select 16:9 letterbox in the General Tab of that same stream. It will then fill a 16:9 screen or letterbox on a 4:3 set.
    Jerry

  • Help needed using adobe exportpdf

    The first time I used adobe export pdf it worked well. However the next time and every other time I try to convert a pdf doc to word docx I get the error message at the end of the uploading session. "pdf doc failed to export to m,icrosoft word.  There was an unexpected problem.
    Anyone overcome this problem?

    Hi Stacy
                   Thanks for that info.  I was aware of the 100MB limit but 
    your response made me think again and go back to the problem and this is 
    what I found. The first  pdf document I uploaded into Adobe export pdf was  43
    MB and it went through fine. when I looked at the conversion to Word  docx I
    found it had been transformed into 83MB.
    So the conversion (which was a children's book with lots of images in it) 
    resulted in an increase of MBs by a factor of 1.7.  
    The second pdf document I uploaded was 64MB and this failed. If I apply the
    1.7 factor then the Word docx I wanted was going to be 109MB and therefore
    over  the 100MB limit.
    I didn't know that converting pdf to word would increase the MB like that. 
    Why, I don't know so thanks for your help I've learnt something new.
    Cheers
                Garth
    In a message dated 07/10/2013 04:42:36 GMT Daylight Time, 
    [email protected] writes:
    Re:  Help needed using adobe exportpdf
    created by StacySison (http://forums.adobe.com/people/StacySison)  in 
    Adobe ExportPDF - View the full  discussion
    (http://forums.adobe.com/message/5740689#5740689)

Maybe you are looking for

  • Function module not working when used with 'In Background Task'

    hi, this is my code call function 'Z_IBD_FILL_ZINETACT'               in background task               destination  'SAPD220125'               tables                   it_net1 = it_net1                   it_net2 = it_net2                   it_net3 =

  • \Critical Use of variables in ODI

    Hi, I have a problem in which i have to use a filename which is dyanamic. so if my job is following: variable(containing dynamic name)--->interface everything runs fine but if variable(containing dynamic name)--->scenario of interface it doesnt works

  • Clearing Model nodes

    Hi there, Sorry If i have asked it before.. But I am not sure again Lets say I want to clear a model node which is bounded to a model, do I use: wdContext.nodeTest().invalidate? (Won't it simply just update the nodes with the result values from the m

  • Quick way to disable seekbar in SMP?

    I'm using the 1.5.1 distribution of SMP, and I've made extensive changes to its classes for captioning capabilities. I'm now looking to disable the seekbar with a JavaScript-passed flashvar property, and I was hoping I could "fake it" by specifying a

  • Screen freezes with LOGIC pro 7 & OSX 3.0.any ideas?

    Hi I have a G5 with dual processors and 1.5 ram/150gb HD. I am running Logic pro 7 on the original OSX 3.0 with a Motu 828mk2 firewire interface. The screen freezes a lot (sometimes with audio still running) and the only way is to turn it off and reb