Please help, finding all zip codes within a given radius.

I have a table which contains zip, city, state, latdec, longdec, latrad, longrad.
From search screen, user want's to find all zip code's, within
10 mile radius of his zip code.
I came up with following sql but it is not correct:
First, find his latdec, longdec from his zipcode.
Then add radius to those values and do select as follows:
select zip,
latdec, longdec,
city, state, latrad, longrad
from zip_coord
where latdec >= (latdec - 10)
and latdec <= (latdec + 10)
and longdec >= (longdec - 10)and longdec <= (longdec + 10).
I think i need to include radians too, but i'm not able to come up with logical formula.
I would appreciate any help with this topic.
Thanks in advance

I am not sure I understand the gerography concept, but I think the query should be like this:
select zip, latdec, longdec,city, state, latrad, longrad
from zip_coord
where latdec between( select latdec from zip_record where zip='userinput', select latdec+10 from zip_record where zip='userinput')
and longdec between( select longdec from zip_record where zip='userinput', select longdec+10 from zip_record where zip='userinput')
and latrad between( select latrad from zip_record where zip='userinput', select latrad+10 from zip_record where zip='userinput')
and longrad between( select longrad from zip_record where zip='userinput', select longrad+10 from zip_record where zip='userinput')
Hope, it can help.
Aiping

Similar Messages

  • Sql help please with, finding all zip codes within a given radius.

    I have a table which contains zip, city, state, latdec, longdec, latrad, longrad.
    From search screen, if user want, zip code's within 10 mile radius of his zip code, what is the sql. I came up with following sql but it is not correct:
    first, find his latdec long dec from his zipcode. Then add radius to those values and do select as follows:
    select zip,
    latdec, longdec,
    city, state, latrad, longrad
    from zip_coord
    where latdec >= (latdec - 10)
    and latdec <= (latdec + 10)
    and longdec >= (longdec - 10)and longdec <= (longdec + 10).
    I think i need to include radians too, but i'm not able to come up with logical formula.
    I would appreciate any help with this topic.
    Thanks in advance

    gautam ,
    u probably need to use oracle spatial option and store geoCodes for each address as a column in the address table . then doing this will be easy

  • Having problem buying online.need your help since it's my first time here.apple is asking for my billing address but when i enter my address here in qatar,it's saying i should enter a valid zip code within the u.s.does it mean i can't buy online

    having problem buying online.need your help since it's my first time here.apple is asking for my billing address but when i enter my address here in qatar,it's saying i should enter a valid zip code within the u.s.does it mean i can't buy online even if it wil be shipped within u.s. only?

    To buy in for delivery in Qatar, you should be starting from the Apple Qatar site:
    http://www.apple.com/qa/
    Do you have an Apple-ID? if you do, then you should not have to enter your Address again, and may be able to sidestep the US Zip Code issue.

  • When iPhone is connected to PC, it shows in itunes but Autoplay does not open for me to copy photos. I tried the Control Panel, changing Autoplay settings but no use. I use a Windows Vista. Please help! All my little ones' pictures are on my iPhone 3GS

    When iPhone is connected to PC, it shows in itunes but Autoplay does not open for me to copy photos. I tried the Control Panel, changing Autoplay settings but no use. I use a Windows Vista. Please help! All my little ones' pictures are on my iPhone 3GS.
    I tried hard reset on my iPhone. I tried restarting laptop and iPhone. I tried a different laptop. I tried removing driver and reinstalling from Device Manager but did not find a driver other than "Apple Mobile Device USB Driver" under "Universal Serial Bus controllers" which I heard shouldn't be uninstalled.
    Anything I haven't tried?
    HELP!

    A bit confused by your statement
    bcboarder wrote:
    . I do not understand why the music is clearly on the Ipod but wont reconize it anywhere.
    Are you seeing your music listed in the iPod screen, or in Win explorer as in your earlier post?
    I can see all the songs in my Edrive>al's Ipod> Ipod Control> Music folder.
    A corrupted iPod database, will report zero music used, and have your music size reported as others, so you wont see the music in the iPod screen. Sorry, I thought there was some hope for you with iPodAccess, in recovery of the corrupted iPod database with your ratings.
    You can try to borrow and  use the Mac Disk Utility ->First Aid ->Repair.
    Of course, if your iPod Hardisk is in a bad state, from the Disk Diagnostic report, then all my suggestion are futile.

  • Please help finding pre-exsisting methods

    please help find pre-existing methods
    JavaFirstTime Jan 2, 2005 3:21 PM
    please help clever people :)
    how to output decimals in 2 decimal places only?
    how to output large integers using format: 12,376,452
    I've been told there are pre-existing methods for that, but i just can't find it... ideally i need to know the source code...

    Well, there's many ways to do it ... Here's one:
    class NumberFormatDemo {
    public static void main(String[] args) {
    new NumberFormatDemo().go();
    public void go() {
    double decimal = 123.456;
    System.out.println((int) decimal + "." + (int)
    + (int) (decimal * 100 + 0.5) % 100);
    int largeInteger = 12376452;
    System.out.println(recursive(largeInteger));
    public String recursive(int largeInteger) {
    if (largeInteger > 999) {
    return recursive(largeInteger/1000) + ","
    1000) + "," + largeInteger%1000;
    } else {
    return "" + largeInteger;
    yes, that's exactly wot i need...
    how didn't i think of that myself, using mathematics, i was thinking it would be more complicated like converting decimals to string then count letters and so on.
    Thank you for putting me on the right track :)

  • Please help me with ABAP code

    Hi Gurus,
    Please help me with the code.
    Algorithm: This is for master data extraction. I need to append some records to I_T_DATA before the loop on I_T_DATA begins.
    ZTAB is a custom defined table with key KEY. STAB is standard table with key KEY.
    1. Create an internal table I_T_STAB similar to STAB.
    2. Loop at I_T_DATA
        Read record from ZTAB where KEY = I_T_DATA-KEY and { field1 <> I_T_DATA-field1 or field2 <> I_T_DATA-field2 <> field3 <> I_T_DATA-field3}
    If success
         Delete record from I_T_DATA.
    Else
         Continue loop.
    Copy all records of STAB to I_T_STAB.
    3. Delete records in I_T_STAB where I_T_STAB-KEY = ZTAB-KEY.
    Now
    4. Delete all records in I_T_DATA where I_T_DATA-KEY = I_T_STAB-KEY.
    Now,
    5. Append all the remaining records from step 3 in I_T_STAB to I_T_DATA.
    Please help me with the code upto this part.
    Now the actual code in exit starts.
    Loop at I_T_DATA
    Thanks,
    Regards,
    aarthi
    [email protected]

    You might get a quick answer if you were to post in the ABAP forum. 
    Moderator, please move to ABAP forum.  Thanks.
    Regards,
    Rich Heilman

  • Please help find the program

    Please help find the program to block unwanted number, call and SMS, that not all block number ,but  the number on which you want to.

    Which part of "The 5310 is just a java phone that cannot support applications like this." did you not understand?
    If you want to achieve any form of blocking at all, it won't be with that phone. Your operator may be able to help by putting a block in place on their end, though, but I doubt it.
    Was this post helpful? If so, please click on the white "Kudos!" star below. Thank you!

  • HT1338 I have updated my Imac to Mavericks and now my parallells won't work and I have reinstalled as per the instructions. Please help as all my data is on a hardrive that is formatted for PC

    I have updated my Imac to Mavericks and now my parallells won't work and I have reinstalled as per the instructions. Please help as all my data is on a hardrive that is formatted for PC.

    Yes I just discovered that this morning but I have purchased another external harddrive and formatted it for both and am in the process of transferring the files across it and then I will erase the old harddrive and reformat it so I can use it.
    I have learnt to format harddrives from this experience but am happy to see the back of parallells.
    Thank you for your help though it is much appreciated.

  • HT3209 Purchased DVD in US for Cdn viewing. Digital download will not work in Cda or US? please help with new Digital code that will work

    Purchased DVD in US for Cdn viewing. Digital download will not work in Cda or US? please help with new Digital code that will work

    You will need to contact the movie studio that produced the DVD and ask if they can issue you a new code valid for Canada. Apple cannot help you, and everyone here in these forums is just a fellow user.
    Regards.

  • Hello to you all, my Macbook Air won's boot up and upon diagnosis, i realized my startup disk is full to 99% even with 2GB Hard Disk space. It wont also enable me boot into safe mode too. Please help as all my work documents and project files are on HD

    Hello to you all,
    My Macbook Air won's boot up and upon diagnosis, i realized my startup disk is full to 99% even with 2GB Hard Disk space. It wont also enable me boot into safe mode too.
    when i power up, i get this prolong gray screen which wont change screen but remain so. Infact i am handicapped.
    Please help as all my work documents and project files are on this machine and i can't afford to loose them all...
    Please, should you have any solution please send me the details to [email protected]
    Thanks you a millionh times.
    Al.

    The MBA seems to cause several problems to several users on boot ups
    On start up my MBA would not boot up the apple logo came on but only a blank screen appeared no fan i followed several start up recommendations but to no avail so I  took the MBA to the nearest Apple repair centre again the same symptoms on start up ......very sorry sir you need a new mother board that will be $500 not feeling confidant in the product declined and was going to put it on ebay for spares.
    On return home I pressed the start up button and it started normally everything was working fine i decided to reinstall all the software what has caused the problem I have no idea but it is after several attempted reboots it finally started on its own so don't give up if you have this problem it may come to life

  • HT5624 Please help find the IMEI number Please?  My Iphone was stolen  AIS network  (Thailand)

    Please help find the IMEI number
    By email:
    Please?
    My Iphone was stolen
    Call
    AIS network
    (Thailand)
    thank you very much
    <Personal Information Edited by Host>

    http://support.apple.com/kb/HT1267
    Regards.

  • Installed itunes, checked in, I try to download free applications out the window: this Apple ID has not yet been used with the iTunes Store. But the mail I receive, that I'm registered, and I have an Apple ID, please help find out!

    installed itunes, checked in, I try to download free applications out the window: this Apple ID has not yet been used with the iTunes Store. But the mail I receive, that I'm registered, and I have an Apple ID, please help find out!

    Diana,
    This could be a delay while internal service records were updated. Check it out again - is it okay for now?

  • PLEASE HELP ME WITH MY CODE

    i need alittle help i have this GUI that i created and i am trying to hook it up to a database in MS ACCESS and i am have so many problems trying to get my second table called billings to pull and show up in my GUI please take a look at my code and tell me what is wrong with it.
    now on my GUI its supposed to allow you to choose a company in the list box and after choosing a company, this allows you to get all the company's information like address and state and zip code and another list box is populated called consultants and you can choose a consultant and gethis or her billing information , like their hours billed from that company and their total hours billed
    please look at my code and tell me what is wrong, especially with the part about pulling information from the database.
    import java.sql.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Project extends Frame implements ItemListener, ActionListener
    //Declare database variables
    Connection conconsultants;
    Statement cmdconsultants;
    ResultSet rsconsultants;
    boolean blnSuccessfulOpen = false;
    //Declare components
    Choice lstNames = new Choice();
    TextField txtConsultant_Lname = new TextField(10);
    TextField txtConsultant_Fname = new TextField(10);
    TextField txtTitle = new TextField(9);
    TextField txtHours_Billed = new TextField(14);
    Button btnAdd = new Button("Add");
    Button btnEdit = new Button("Save");
    Button btnCancel = new Button("Cancel");
    Button btnDelete = new Button("Delete");
    Label lblMessage = new Label(" ");
    public static void main(String args[])
    //Declare an instance of this application
    Project thisApp = new Project();
    thisApp.createInterface();
    public void createInterface()
    //Load the database and set up the frame
    loadDatabase();
    if (blnSuccessfulOpen)
    //Set up frame
    setTitle("Update Test Database");
    addWindowListener(new WindowAdapter()
    public void windowClosing(WindowEvent event)
    stop();
    System.exit(0);
    setLayout(new BorderLayout());
    //Set up top panel
    Panel pnlTop = new Panel(new GridLayout(2, 2, 10, 10));
    pnlTop.add(new Label("Last Name"));
    lstNames.insert("Select a Name to Display", 0);
    lstNames.addItemListener(this);
    pnlTop.add(lstNames);
    pnlTop.add(new Label(" "));
    add(pnlTop, "North");
    //Set up center panel
    Panel pnlMiddle = new Panel(new GridLayout(5, 2, 10, 10));
    pnlMiddle.getInsets();
    pnlMiddle.add(new Label("Consultant_Lname"));
    pnlMiddle.add(txtConsultant_Lname);
    pnlMiddle.add(new Label("Consultant_Fname"));
    pnlMiddle.add(txtConsultant_Fname);
    pnlMiddle.add(new Label("Title"));
    pnlMiddle.add(txtTitle);
    pnlMiddle.add(new Label("Hours_Billed"));
    pnlMiddle.add(txtHours_Billed);
    setTextToNotEditable();
    Panel pnlLeftButtons = new Panel(new GridLayout(0, 2, 10, 10));
    Panel pnlRightButtons = new Panel(new GridLayout(0, 2, 10, 10));
    pnlLeftButtons.add(btnAdd);
    btnAdd.addActionListener(this);
    pnlLeftButtons.add(btnEdit);
    btnEdit.addActionListener(this);
    pnlRightButtons.add(btnDelete);
    btnDelete.addActionListener(this);
    pnlRightButtons.add(btnCancel);
    btnCancel.addActionListener(this);
    btnCancel.setEnabled(false);
    pnlMiddle.add(pnlLeftButtons);
    pnlMiddle.add(pnlRightButtons);
    add(pnlMiddle, "Center");
    //Set up bottom panel
    add(lblMessage, "South");
    lblMessage.setForeground(Color.red);
    //Display the frame
    setSize(400, 300);
    setVisible(true);
    else
    stop(); //Close any open connection
    System.exit(-1); //Exit with error status
    public Insets insets()
    //Set frame insets
    return new Insets(40, 15, 15, 15);
    public void loadDatabase()
    try
    //Load the Sun drivers
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    catch (ClassNotFoundException err)
    try
    //Load the Microsoft drivers
    Class.forName("com.ms.jdbc.odbc.JdbcOdbcDriver");
    catch (ClassNotFoundException error)
    System.err.println("Drivers did not load properly");
    try
    //Connect to the database
    conconsultants = DriverManager.getConnection("jdbc:odbc:Test");
    //Create a ResultSet
    cmdconsultants = conconsultants.createStatement();
    rsconsultants = cmdconsultants.executeQuery(
    "Select * from consultants; ");
    loadNames(rsconsultants);
    blnSuccessfulOpen = true;
    catch(SQLException error)
    System.err.println("Error: " + error.toString());
    public void loadNames(ResultSet rsconsultants)
    //Fill last name list box
    try
    while(rsconsultants.next())
    lstNames.add(rsconsultants.getString("Consultant_Lname"));
    catch (SQLException error)
    System.err.println("Error in Display Record." + "Error: " + error.toString());
    public void itemStateChanged(ItemEvent event)
    //Retrieve and display the selected record
    String strConsultant_Lname = lstNames.getSelectedItem();
    lblMessage.setText(""); //Delete instructions
    try
    rsconsultants = cmdconsultants.executeQuery(
    "SELECT c.Consultant_ID"+
    "c.Consultant_Lname"+
    "c.Consultant_Fname"+
    "c.Title"+
    "l.Client_ID"+
    "l.Client_Name"+
    "l.Address"+
    "l.City"+
    "l.State"+
    "l.Zip"+
    "b.Hours_Billed"+
    "b.Billing_Rate"+
    "b.Client_ID"+
    "b.Consultant_ID"+
    "FROM Consultants c, Clients l, Billing b"+
    "WHERE c.Consultant_ID = b.Consultant_ID"+
    "l.Client_ID = b.Client_ID"+
    "GROUP BY c.Consultant_ID");
    //"SELECT * FROM Consultants INNER JOIN Billing ON Consultants.Consultant_ID = Billing.Consultant_ID");
    //FROM Consultants INNER JOIN Billing ON Consultants.Consultant_ID = Billing.Consultant_ID;");
    //"Select * from consultants where [Consultant_Lname] = '" + strConsultant_Lname + "';");
    txtConsultant_Lname.setText(strConsultant_Lname);
    displayRecord(rsconsultants);
    setTextToEditable();
    catch(SQLException error)
    lblMessage.setText("Error in result set. " + "Error: " + error.toString());
    public void displayRecord(ResultSet rsconsultants)
    //Display the current record
    try
    if(rsconsultants.next())
    txtConsultant_Fname.setText(rsconsultants.getString("Consultant_Fname"));
    txtTitle.setText(rsconsultants.getString("Title"));
    txtHours_Billed.setText(rsconsultants.getString("Hours_Billed"));
    lblMessage.setText("");
    else
    lblMessage.setText("Record not found");
    clearTextFields();
    catch (SQLException error)
    lblMessage.setText("Error: " + error.toString());
    public void actionPerformed(ActionEvent event)
    //Test the command buttons
    Object objSource = event.getSource();
    if(objSource == btnAdd && event.getActionCommand () == "Add")
    Add();
    else if (objSource == btnAdd)
    Save();
    else if(objSource == btnEdit)
    Edit();
    else if(objSource == btnDelete)
    Delete();
    else if(objSource == btnCancel)
    Cancel();
    public void setTextToNotEditable()
    //Lock the text fields
    txtConsultant_Lname.setEditable(false);
    txtConsultant_Fname.setEditable(false);
    txtTitle.setEditable(false);
    txtHours_Billed.setEditable(false);
    public void setTextToEditable()
    //Unlock the text fields
    txtConsultant_Lname.setEditable(true);
    txtConsultant_Fname.setEditable(true);
    txtTitle.setEditable(true);
    txtHours_Billed.setEditable(true);
    public void clearTextFields()
    //Clear the text fields
    txtConsultant_Lname.setText("");
    txtConsultant_Fname.setText("");
    txtTitle.setText("");
    txtHours_Billed.setText("");
    public void Add()
    //Add a new record
    lblMessage.setText(" "); //Clear previous message
    setTextToEditable(); //Unlock the text fields
    clearTextFields(); //Clear text field contents
    txtConsultant_Lname.requestFocus ();
    //Set up the OK and Cancel buttons
    btnAdd.setLabel("OK");
    btnCancel.setEnabled(true);
    //Disable the Delete and Edit buttons
    btnDelete.setEnabled(false);
    btnEdit.setEnabled(false);
    public void Save()
    //Save the new record
    // Activated when the Add button has an "OK" label
    if (txtConsultant_Lname.getText().length ()== 0 || txtTitle.getText().length() == 0)
    lblMessage.setText("The Consultant's Last Name or Title is blank");
    else
    try
    cmdconsultants.executeUpdate("Insert Into consultants "
    + "([Consultant_Lname], [Consultant_Fname], Title, [Hours_Billed]) "
    + "Values('"
    + txtConsultant_Lname.getText() + "', '"
    + txtConsultant_Fname.getText() + "', '"
    + txtTitle.getText() + "', '"
    + txtHours_Billed.getText() + "')");
    //Add to name list
    lstNames.add(txtConsultant_Lname.getText());
    //Reset buttons
    Cancel();
    catch(SQLException error)
    lblMessage.setText("Error: " + error.toString());
    public void Delete()
    //Delete the current record
    int intIndex = lstNames.getSelectedIndex();
    String strConsultant_Lname = lstNames.getSelectedItem();
    if(intIndex == 0) //Make sure a record is selected
    //Position 0 holds a text message
    lblMessage.setText("Please select the record to be deleted");
    else
    //Delete the record from the database
    try
    cmdconsultants.executeUpdate(
    "Delete from consultants where [Consultant_Lname] = '" + strConsultant_Lname + "';");
    clearTextFields(); //Delete from screen
    lstNames.remove(intIndex); //Delete from list
    lblMessage.setText("Record deleted"); //Display message
    catch(SQLException error)
    lblMessage.setText("Error during Delete."
    + "Error: " + error.toString());
    public void Cancel()
    //Enable the Delete and Edit buttons
    btnDelete.setEnabled(true);
    btnEdit.setEnabled(true);
    //Disable the Cancel button
    btnCancel.setEnabled(false);
    //Change caption of button
    btnAdd.setLabel("Add");
    //Clear the text fields and status bar
    clearTextFields();
    lblMessage.setText("");
    public void Edit()
    //Save the modified record
    int intIndex = lstNames.getSelectedIndex();
    if(intIndex == 0) //Make sure a record is selected
    //Position 0 holds a text message
    lblMessage.setText("Please select the record to change");
    else
    String strConsultant_Lname = lstNames.getSelectedItem();
    try
    cmdconsultants.executeUpdate("Update consultants "
    + "Set [Consultant_Lname] = '" + txtConsultant_Lname.getText() + "', "
    + "[Consultant_Fname] = '" + txtConsultant_Fname.getText() + "', "
    + "Title = '" + txtTitle.getText() + "', "
    + "[Hours_Billed] = '" + txtHours_Billed.getText() + "' "
    + "Where [Consultant_Lname] = '" + strConsultant_Lname + "';");
    if (!strConsultant_Lname.equals(txtConsultant_Lname.getText()))
    //Last name changed; change the list
    lstNames.remove(intIndex); //Remove the old entry
    lstNames.add(txtConsultant_Lname.getText()); //Add the new entry
    catch(SQLException error)
    lblMessage.setText("Error during Edit. " + "Error: " + error.toString());
    public void stop()
    //Terminate the connection
    try
    if (conconsultants != null)
    conconsultants.close();
    catch(SQLException error)
    lblMessage.setText("Unable to disconnect");

    I don't think that your DB URL is correct

  • Please help me with my code (has conversion from string to int)

    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    public class Test3 extends MIDlet implements CommandListener
    {   Form mForm;
        Command mCommandQuit;
        Command mCommandItem;
        TextField input,prime1,prime2,prime3,output;
        Display mDisplay;
        int i,j=0,k1,k2,p,q,b;
        //int [] current=new int [1000];
        String mstring,a="";
        String [] temp=new String [1000];
        public void startApp()
        {System.out.println("startApp");
         mForm=new Form("RSA Encryption");
         mCommandQuit=new Command("QUIT",Command.EXIT,0);
         mCommandItem=new Command("ENCRYPT",Command.ITEM,0);
         mForm.append("Enter text:\n");
         input=new TextField(null,"",100, TextField.ANY);
         mForm.append(input);
         mForm.append("Enter first prime number(p):\n");
         prime1=new TextField(null,"",100, TextField.ANY);
         mForm.append(prime1);
         mForm.append("Enter second prime number(q):\n");
         prime2=new TextField(null,"",100, TextField.ANY);
         mForm.append(prime2);
         mForm.append("Enter d:\n");
         prime3=new TextField(null,"",100, TextField.ANY);
         mForm.append(prime3);
         mForm.addCommand(mCommandQuit);
         mForm.addCommand(mCommandItem);
         mDisplay=Display.getDisplay(this);
         mDisplay.setCurrent(mForm);
         mForm.setCommandListener(this);
        public void pauseApp()
        {System.out.println("pauseApp");
        public void destroyApp(boolean unconditional)
        {System.out.println("destroyApp");
        public void commandAction(Command c, Displayable d)
        {System.out.println("commandAction");
         if(c==mCommandQuit)
            notifyDestroyed();
         else if(c==mCommandItem)
         {p = Integer.parseInt(prime1.getString());
             q = Integer.parseInt(prime2.getString());
             b = Integer.parseInt(prime3.getString());
             //breaking up of big string into ints
             mstring=input.getString();
             temp[0]="";
             for(i=1;i<mstring.length();i++)
                {if (mstring.charAt(i) == ' ')
                    {j++;
                     temp[j]="";
                 else
                    {temp[j]=temp[j]+mstring.charAt(i);
             mForm.append("\n\nThe array is:\n");
             for(i=0;i<temp.length && temp!=null;i++)
    {k1=Integer.parseInt(temp[i]); ***********************
    k2=k1;
    for(j=1;j<b;j++)
    {k1=k1*k2;
    k1=k1 %(p*q);
    k2=k1 %(p*q);
    a=a+new Character((char)k2).toString();
    output=new TextField(null,a,100, TextField.ANY);
    mForm.append(output);
    }hi
    this code basically takes an input of string like " 179 84 48 48 155 " (with spaces)
    then it creates smaller strings in an array like "179","84","48","48","155" without the spaces
    then it creates int values 179,84,48,48,155 and finally after some math functions it prints the corresponding letters.
    the problem is that it is not printing the letter because of some exceptions-->java.lang.NumberFormatException .it comes in the line where i have put stars
    could anybody please help me print the letters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    thanks for all ur help guys, but me and my team member solved it on our own. here is the new code:
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    public class Test3 extends MIDlet implements CommandListener
    {   Form mForm;
        Command mCommandQuit;
        Command mCommandItem;
        TextField input,prime1,prime2,prime3,output;
        Display mDisplay;
        int i,j=0,l,k1,k2,p,q,n,b;
        String mstring,a = "";
        String [] temp=new String [1000];
        public void startApp()
        {System.out.println("startApp");
         mForm=new Form("RSA Encryption");
         mCommandQuit=new Command("QUIT",Command.EXIT,0);
         mCommandItem=new Command("DECRYPT",Command.ITEM,0);
         mForm.append("Enter text:\n");
         input=new TextField(null,"",100, TextField.ANY);
         mForm.append(input);
         mForm.append("Enter first prime number(p):\n");
         prime1=new TextField(null,"",100, TextField.NUMERIC);
         mForm.append(prime1);
         mForm.append("Enter second prime number(q):\n");
         prime2=new TextField(null,"",100, TextField.NUMERIC);
         mForm.append(prime2);
         mForm.append("Enter d:\n");
         prime3=new TextField(null,"",100, TextField.NUMERIC);
         mForm.append(prime3);
         mForm.addCommand(mCommandQuit);
         mForm.addCommand(mCommandItem);
         mDisplay=Display.getDisplay(this);
         mDisplay.setCurrent(mForm);
         mForm.setCommandListener(this);
        public void pauseApp()
        {System.out.println("pauseApp");
        public void destroyApp(boolean unconditional)
        {System.out.println("destroyApp");
        public void commandAction(Command c, Displayable d)
        {System.out.println("commandAction");
         if(c==mCommandQuit)
            notifyDestroyed();
         else if(c==mCommandItem)
         {p = Integer.parseInt(prime1.getString());
             q = Integer.parseInt(prime2.getString());
             b = Integer.parseInt(prime3.getString());
             n=p*q;
             //breaking up of big string into ints
             mstring=input.getString();
             temp[0]="";
             for(i=1;i<mstring.length();i++)
                {if (mstring.charAt(i) == ' ')
                    {j++;
                     temp[j]="";
                 else
                    {temp[j]=temp[j]+mstring.charAt(i);
             l=j;
             mForm.append("\n\nThe result is:\n");
             for(i=0;i<l;i++)
                {k1=Integer.valueOf(temp).intValue();
    k2=k1;
    for(j=1;j<b;j++)
    {k2=k2*k1;
    k2=k2 %n;
    k1=k2 %n;
    a=a+new Character((char)k1).toString();
    output=new TextField(null,a,100, TextField.ANY);
    mForm.append(output);

  • Forum Moderator Please help find my message

    Dear Forum Moderator:
    Yesterday (09.20.08) I placed in the FLASH General Discussion
    forum a message about problems in using Flash in my User's account.
    I do not remember the exact title but there were words: user,
    account, counterproductive.
    The message was authored by my screeen name Fonarik
    I DID see this morning this my message, but after I signed
    off and then back again I can NOT find it.
    Please help to find it, as I hope to get help on my problems.
    Thank you

    Fonarik wrote:
    > Urami:
    >
    > You are not correct in: "I only see one post by you,
    this very post
    > and nothing else ever posted from this nick name".
    > Please look at my message above and to the LEFT. You
    will see that I posted
    > TWO messages: the one that disappeared (or was
    deliberately taken away as NOT
    > PLEASANT to Adobe) and this my asking for finding it.
    >
    > By the way please clarify what you mean by applying to
    other spots - I do not
    > understand.
    >
    > Thanks for attention
    Not going to try to prove my point, just look at the obvious:
    This is the NEWS READER screen, loading messages directly
    from the Adobe News Server.
    View forum by user name, only two posts, the first one "Forum
    Moderator..." and
    the reply to my post just now:
    http://flashfugitive.com/stuff/sc_01.gif
    My news reader has copies of posts for past 3 years.
    Then by browsing Web Based Forum, searching for all the
    threads by your user name:
    http://flashfugitive.com/stuff/sc_02.gif
    Just one... in past 90 days...
    Don't believe in "shoosh" conspiracy theories. Adobe (and
    previously Macromedia) never
    suppress any posts. In fact they encourage posts dealing with
    all kind of issues because
    it helps the tech guys to learn about problems they could
    over look during very compressed
    and short testing period.
    You simply post it incorrectly and it never made to the
    forum. Just post once again
    because no matter where you believe in, there simply isn't
    any other, beside this one, posts
    from you on the forum.
    Best Regards
    Urami
    "Never play Leap-Frog with a Unicorn."
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

Maybe you are looking for

  • Why wont apple let me download apps without a credit card?

    Why wont apple let me get an apple ID without a "no credit card" suggestion in the payment method? I dont buy my apps and I dont understand why my sister (and other people) were able to make an apple ID without putting a credit card. Though I can ent

  • Copy from

    Hello Experts, We would like to edit the landed cost (LC) created in the past (in B1 2005A SP01 PL52). After upgrade to B1 2007A SP01 PL10, we want to edit the created lc. However, the document is not available to edit. The LC document is created in

  • Question regarding remapping of fields in Crystal reports 2008

    I have a report that uses 2 BW queries as data source. I created a query that may replace the 2 queries What specific steps should I follow so that the window for mapping of fields will appear once I changed the data source? thanks, Donna

  • WF-Workflows in permanent warning state (SCOM Management Pack)

    Hi, We're starting to monitor a small Service Manager 2012 R2 installation with SCOM 2012 R2. After all discoveries have ran we have a permanent Warning on the Management Server, this warnign relates to the WF Workflows The Repeats above are from my

  • Sun Directory Server: Disabling and Locking Accounts

    Folks, Have some questions about disabling and locked accounts on Directory Server v5.2. Seems like a password policy would be the way to go, but these are my requirements: 1. Automatically disable accounts for that weren’t used (password expired) in