Help needed to write algorithm to find Direction given lat/lon

Hello, i need an algorithm to find out the direction being traveled given the starting and ending lat/lon decimal coordinates. Anybody have any clues how to do it? or where i can find one to just plug into my program? thanks for your help
public String getDirection(double prevLat, double prevLon, double newLat, double newLon) {
    String direction;
    return direction;
}

Perhaps this helps:
http://www.cssd.ab.ca/tech/social/latitude/index.html
It will help you learn the meaning of lat/long-coords. I think you will end up with somthing like this:
if ( prevLat < newLat) {
   //we are travelling north
else {
   // we are travelling south
if (prevLong < newLong) {
   //we are travelling east?
else {
   //we are travelling west
}This could be wrong, since there is a west-long and an east-long..
Anyhow, hope this gets you on your way.
ps: is this a class-assignment??

Similar Messages

  • Help needed in writting Customer exit - ABAP Code

    Hi Friends,
    I have a scenario in one of the query and need to write a customer exit for the same. Here is the scenario:
    I am using one input variable XXX to get input from user which feeds value to one of the charateristic  lets say "CHAR1" in query. I have one more characteristic "CHAR2" which has to get the value from the same variable XXX. This is not allowed in BI7.0 as the variable is Hierarchy Node type. It gives error that "Variable XXX is used for two different characteristics."
    So i need to create one more vaiable YYY which will get the value from XXX and then YYY will feed value to CHAR2.  I would appreciate if some one could tell me step by step how to write customer exit and give me the piece of ABAP code i need to write in my case.
    Your help will be appreciated in terms of points.
    Thanks,
    manmit

    Hi Arun,
    1. What should CHAR2 take - Hierarchy node variable or something else ?
    --> CHAR2 is a simple charateristic
    2. In your scenario - why have CHAR1 and CHAR2 ? why not have the user enter values against CHAR2 ??
    --> We dont want user to enter two input as the input values for both Chars are same.
    3. Did you try using a replacement path variable with the CHAR2 variable taking values from Variable on CHAR1 ?
    --> In BI7.0 replacement path variable only take values from Query results. So not able to do the same.
    Thanks

  • Help needed to write control file.

    Hi Guys,
    i need to write one control file to upload data from .txt file to oracle table.
    .txt file data contains like this
    2006041110:40:22
    2006041111:30:42
    2006041210:40:22
    i need to upload this data into date column in oracle table.
    please help me to write control file for this requirement.
    Thanks for your help and time

        data1        "to_date(:data1, 'YYYYMMDDHH24:MI:SS')"

  • Help needed to write a dialog program

    Hello ABAP Gurus,
    I am very much new to ABAP Programming.
    Can anybody help me to write a simple Dialog Program ??
    I have a database table.
    I have created a screen with screen painter, and kept some input fields & a push button in it.
    I want to fill the database table with the data entered into the fields on the screen.
    When the user enters the data and  presses  the PUSH BUTTON then that data record should be stored into the Database table.
    So what kinda code I have to write in PAI (Process After Input),  to achieve this functionality ??
    The help will be greatly appreciated.
    Thanks in advance
    Best regards
    Ravi
    Edited by: Ravi Kiran on Oct 28, 2009 2:17 PM

    It's easy:
    In PAI you have do an insert into a database table, following the steps:
    1.on PAI  create a module: for exemple Zwrite_table.
    2. inside Zwrite_table code as follow:
    move var1 to wa_table-var1.
    move var2 to wa_table-var2.
    move var3 to wa_table-var3. etc etc
    insert table ztable from wa_table.
    P.s. ztable is a database table.
    wa_table is a structure that have the same structure of ztable.
    var1 var2 var3 etc is a variable inside your dynpro.
    regards,
    Roberto.

  • HELP needed to write a function returning 1 record from join tables

    Hi,
    I would like to have some help to write a function so It can return 1 result.
    I post my question in the APEX Express sextion but I think it's belong here.
    Mount Points and Home Directory
    Also, can I move a thread in another forum?
    thanks
    Roseline
    Edited by: user8772975 on 2009-09-19 21:43

    ok, I think I started to understand the functions. But I still can't figured out
    CONTEXT
    We are scanning pages and images from different newspaper. All the .tif, .jpg are on DVDs.
    I'm trying to build a search page who will allow for all DVDs and All images name related to the search result. Let say I search for:
    FIGARO
    I have this SQL query and I want to make a function that will return the same thing as:
    select     
          "DOSSIER"."ID" as "DOSSIERID",
          "DOSSIER"."TITLE" as "TITLE",
          "DVD"."ID" as "DVDID",
          "DVD"."NAME" as "DVDNAME",
          "DVD"."ID_DOSSIER" as "DVD_ID_DOSSIER",
          "ELEMENTS"."ID" as "ELEMENTSID",
          "ELEMENTS"."NAME" as "ELEMENTSNAME",
          "ELEMENTS"."ID_DVD" as "ELEMENTS_ID_DVD"
    from      "DOSSIER" "DOSSIER",
               "DVD" "DVD",
               "ELEMENTS" "ELEMENTS"
    where   "DVD"."ID_DOSSIER"="DOSSIER"."ID"
    and      "ELEMENTS"."ID_DVD"="DVD"."ID"
      and       "DOSSIER"."TITLE" = :P3_SEARCH
    ORDER BY "DVD".NAMEBasiccly, We are scanning pages and images from different newspaper. All the .tif, .jpg are on DVDs.
    So we have someting like that:
    TITLE: FIGARO
    DVD:        C2008-203
    Elements: 12l10201.tif, 12l10202.tif, 12l11101.tif, 12l11102.tif, 12l11201.tif
                    12l11202.tif, 12l12101.tif, 12l12102.tif
    DVD         C2008-204
    Elements: 12l12202.tif, 12l13101.tif, 12l13102.tif, 12l13201.tif, 12l13202.tif,
                   12l14101.tif, 12l14102.tif, 12l14201.tif, 12l14202.tif, 12l15101.tif,
                   12l15102.tif, 12l15201.tif
    DVD:       C2008-205
    Elements: 12l15202.tif, 12l16101.tif, 12l16102.tif, 12l16201.tif, 12l16202.tif,
                    12m01101.tif, 12m01102.tif, 12m01201.tifBased on what people on the forum told me, I now know that I have to use Pl/SQL so I have to write a function that will return the same thing as the prvious query.
    Is that exact?
    Based on this example,
    [http://plsql-tutorial.com/plsql-functions.htm|http://plsql-tutorial.com/plsql-functions.htm]
    I would write something like:
    CREATE FUNCTION my_super_function
    RETURN VARCHAR(2000);
    IS
    details VARCHAR(2000);
    BEGIN
    select     
          "DOSSIER"."ID" as "DOSSIERID",
          "DOSSIER"."TITLE" as "TITLE",
          "DVD"."ID" as "DVDID",
          "DVD"."NAME" as "DVDNAME",
          "DVD"."ID_DOSSIER" as "DVD_ID_DOSSIER",
          "ELEMENTS"."ID" as "ELEMENTSID",
          "ELEMENTS"."NAME" as "ELEMENTSNAME",
          "ELEMENTS"."ID_DVD" as "ELEMENTS_ID_DVD"
    from      "DOSSIER" "DOSSIER",
               "DVD" "DVD",
               "ELEMENTS" "ELEMENTS"
    where   "DVD"."ID_DOSSIER"="DOSSIER"."ID"
    and      "ELEMENTS"."ID_DVD"="DVD"."ID"
      and       "DOSSIER"."TITLE" = :P3_SEARCH
    RETURN details;
    END;
    / And then, use soemthing like:
    select my_super_function("DOSSIER"."ID") from "DOSSIER" "DOSSIER" where "DOSSIER"."TITLE" = :P3_SEARCHI'm kinda of lost. I spent the last 6 hours but I think that programming is a working progress.
    Any hint would be appreciated,
    thanks
    Roseline

  • Help needed to write in excel sheet

    Hi,
    I currently need to read a table and write it in a file.
    iam able to do it by using UTL package.The utl file also writes in xls format.but if a record has two column.
    both the columns are written in a single column in excel
    sheet.Kindly suggest me how to solve this problem
    Thanks in advance.

    1. spool a file with 'csv' extension using Sql*Plus.
    2. Use a delimiter for columns.
    For example,
    select '"'||column1||'","'||column2||'"'
    from mytable

  • Help Needed to Write Nim Game

    I need help in writing the Nim game. I have the program written already for the user to select if they want to go first or the computer and how many stones the user wants to start with. The problem I am having is writing a loop that recognizes which player is to go first and executes the play of taking stones. Any help would be appreciated.

    Perhaps there could be a boolean firstPlayerMove. Then, when the loop starts, if that is true then the first player enters the stones, otherwise second player. At the end of every time the loop is executed firstPlayerMove should equal "!firstPlayerMove."

  • Help needed to write download file program

    I want to write a servlet which will allow clients to download files from server. Main work is, a fixed no.of downloads(only n users can have download permission) will be allowed at any time. if any more no.of new users came they have to wait for a download connection. if a connection is freed then that connection will be given to a user who had entered first. (First In First Out). Can it possible. Plz help me. Thanks in advance.

    It's easy:
    In PAI you have do an insert into a database table, following the steps:
    1.on PAI  create a module: for exemple Zwrite_table.
    2. inside Zwrite_table code as follow:
    move var1 to wa_table-var1.
    move var2 to wa_table-var2.
    move var3 to wa_table-var3. etc etc
    insert table ztable from wa_table.
    P.s. ztable is a database table.
    wa_table is a structure that have the same structure of ztable.
    var1 var2 var3 etc is a variable inside your dynpro.
    regards,
    Roberto.

  • Help need to write script min and group by

     I want to see min  first print date on last column  for instance Wild Attire INc  there should be 5/30/2014 for all records and for clear vision optical 2013/11/13 for all records belongs to clear vision optical integration name if only
    one record then keep same like Qball 12/1/2014
    select ISNULL(RQPPrintAmountQpYTD,0)+ISNULL(VLQPPrintAmountQpYTD,0) as [Qualified Volume 2014],isnull(PrintamountallYtd,0)+ISNULL(VLQPPrintamountALLYTD,0) as [Total Volume 2014], integration_id as [Integration ID], integration_name as [Integration Name], left([First Print Date],10) as [First Print Date] from #Po
    Qualified Volume 2014
    Total Volume 2014
    Integration Name
    First Print Date
    0
    1.93
    Qball
    12/1/2014
    34446.98
    277285.35
    Wild Attire, Inc.
    5/30/2013
    522236.08
    530125.78
    Wild Attire, Inc.
    8/22/2013
    3861.06
    40820.82
    Wild Attire, Inc.
    10/24/2014
    2087.14
    20783.46
    Wild Attire, Inc.
    10/30/2014
    1296.95
    24272.81
    Wild Attire, Inc.
    11/26/2014
    1457.96
    1512.71
    Jackeez.com LLC
    12/14/2013
    15.27
    37206.62
    PrintingforLess.com
    4/3/2014
    9109.85
    20631.28
    M.A.I.L., Inc
    12/16/2013
    294.59
    2278.32
    B2SIGN, Inc.
    11/17/2014
    37.71
    151.48
    SpiralScout LLC
    11/25/2014
    93960.2
    94110.38
    Clear Vision Optical
    11/13/2013
    140349.03
    140445.65
    Clear Vision Optical
    1/31/2014
    14898.35
    14898.35
    Clear Vision Optical
    3/18/2014
    790.59
    790.59
    Clear Vision Optical
    5/9/2014

    Hi MarkSubedi,
    Your requirement has been extracted and formatted as below, correct me if there's anything wrong.
    I want to see min first print date on last column. For instance Wild Attire INc,there should be 5/30/2014. And 2013/11/13 for all records belongs to clear vision optical integration name.If only one record then keep same like Qball 12/1/2014.
    Based on my understanding, the below code can help to achieve your requirement.
    DECLARE @Table TABLE
    ([Qualified Volume 2014] NUMERIC(18,2),
    [Total Volume 2014] NUMERIC(18,2),
    [Integration Name] VARCHAR(99),
    [First Print Date] DATE
    INSERT INTO @TABLE VALUES (0,1.93,'Qball','12/1/2014');
    INSERT INTO @TABLE VALUES (34446.98,277285.35,'Wild Attire, Inc.','5/30/2013');
    INSERT INTO @TABLE VALUES (522236.08,530125.78,'Wild Attire, Inc.','8/22/2013');
    INSERT INTO @TABLE VALUES (3861.06,40820.82,'Wild Attire, Inc.','10/24/2014');
    INSERT INTO @TABLE VALUES (2087.14,20783.46,'Wild Attire, Inc.','10/30/2014');
    INSERT INTO @TABLE VALUES (1296.95,24272.81,'Wild Attire, Inc.','11/26/2014');
    INSERT INTO @TABLE VALUES (1457.96,1512.71,'Jackeez.com LLC','12/14/2013');
    INSERT INTO @TABLE VALUES (15.27,37206.62,'PrintingforLess.com','4/3/2014');
    INSERT INTO @TABLE VALUES (9109.85,20631.28,'M.A.I.L., Inc','12/16/2013');
    INSERT INTO @TABLE VALUES (294.59,2278.32,'B2SIGN, Inc.','11/17/2014');
    INSERT INTO @TABLE VALUES (37.71,151.48,'SpiralScout LLC','11/25/2014');
    INSERT INTO @TABLE VALUES (93960.2,94110.38,'Clear Vision Optical','11/13/2013');
    INSERT INTO @TABLE VALUES (140349.03,140445.65,'Clear Vision Optical','1/31/2014');
    INSERT INTO @TABLE VALUES (14898.35,14898.35,'Clear Vision Optical','3/18/2014');
    INSERT INTO @TABLE VALUES (790.59,790.59,'Clear Vision Optical','5/9/2014');
    ;WITH CTE AS
    SELECT [Integration Name],MIN([First Print Date]) [Min First Print Date],COUNT(1) cnt FROM @Table GROUP BY [Integration Name]
    SELECT [Integration Name],CASE WHEN CNT=1 THEN T.[Qball Min First Print Date] ELSE [Min First Print Date] END [Min First Print Date] FROM CTE
    CROSS APPLY (SELECT [Min First Print Date] AS [Qball Min First Print Date] FROM CTE WHERE [Integration Name]=N'Qball') AS T
    ORDER BY CNT,[Integration Name]
    In your case, the data seems from the the statement query in your post. If the statement is fine, the below query can be ready to use.
    ;WITH DataSrc AS
    SELECT ISNULL(RQPPrintAmountQpYTD,0)+ISNULL(VLQPPrintAmountQpYTD,0) as [Qualified Volume 2014],isnull(PrintamountallYtd,0)+ISNULL(VLQPPrintamountALLYTD,0) as [Total Volume 2014], integration_id as [Integration ID], integration_name as [Integration Name], left([First Print Date],10) as [First Print Date] from #Po
    CTE AS
    SELECT [Integration Name],MIN([First Print Date]) [Min First Print Date],COUNT(1) cnt FROM DataSrc GROUP BY [Integration Name]
    SELECT [Integration Name],CASE WHEN CNT=1 THEN T.[Qball Min First Print Date] ELSE [Min First Print Date] END [Min First Print Date] FROM CTE
    CROSS APPLY (SELECT [Min First Print Date] AS [Qball Min First Print Date] FROM CTE WHERE [Integration Name]=N'Qball') AS T
    ORDER BY CNT,[Integration Name]
    By the way, there're some columns don't make any sense if what you'd like is just the min(First Print Date), you can remove them.
    If you have any question, feel free to let me know.
    Best regards,
    Eric Zhang
    TechNet Community Support

  • Help Needed to write select statement

    I have a table whose rows like this:
    slno name testno
    1 reni 1
    2 arun 2
    3 jithu 3
    4 rajesh 4
    5 shiju 1
    6 Thomas 1
    7 Thomas 2
    8 Thomas 3
    9 Thomas 4
    many rows like above.I want to select names who have attended all the test that is testno 1,2,3,4
    Looking forward to help from u

    Many ppl have given you solutions and suggestions. Did you try those?
    Anyway, check whether this helps or not?
    SQL> create table t as
      2  select 1 slno,'reni' name, 1 testno from dual union all
      3  select 2,'arun',2  from dual union all
      4  select 3,'jithu',3 from dual union all
      5  select 4,'rajesh',4 from dual union all
      6  select 5,'shiju',1 from dual union all
      7  select 6,'Thomas',1 from dual union all
      8  select 7,'Thomas',2 from dual union all
      9  select 8,'Thomas',3 from dual union all
    10  select 9,'Thomas',4 from dual ;
    Table created.
    SQL> select * from t
      2  where name in
      3          (select name from t
      4          group by name
      5          having sum(decode(testno,1,1,2,1,3,1,4,1,0))=4);
          SLNO NAME       TESTNO
             6 Thomas          1
             7 Thomas          2
             8 Thomas          3
             9 Thomas          4
    SQL> select slno,name,testno
      2  from
      3  (select slno,name,testno,count(1) over(partition by name) cnt from t)
      4  where cnt =4;
          SLNO NAME       TESTNO
             9 Thomas          4
             6 Thomas          1
             7 Thomas          2
             8 Thomas          3
    SQL>

  • Help needed with recursion algorithm..

    I can't seems to figure out which recursion method to use, if anyone can give me some advice, pls do..
    Input: There is a row of n elecments with the initial value of 1.
    Output: Change all the 1s to 0s using the following conditions.
    -The first element can change from 1 to 0, and 0 to 1 at any time (without conditions).
    -While the rest of the elements can only be changed to 0 when the preceeding element is 1 and all other elements are 0.
    For example, when n = 3
    1 1 1 - initial state of all elements
    0 1 1 - change first element to 0 w/o condition
    0 1 0 - change third element to 0 as only second element is 1 and rest are 0
    1 1 0 - change first element to 1 w/0 condition
    1 0 0 - change second element to 0 as only first element is 1 and rest are 0
    0 0 0 - change first element to 0 w/o condition
    I really can't think of a recursive method to work this out, and am desperate to know the answer. Can anyone please help?

    Sorry about it, you can change the rest of the bit back to 1 but provided that the preceeding bit is also 1.
    and that makes the question:
    Input: There is a row of n elecments with the initial value of 1.
    Output: Change all the 1s to 0s using the following conditions.
    -The first element can change from 1 to 0, and 0 to 1 at any time (without conditions).
    -While the rest of the elements can only be changed to 0 or 1 when the preceeding element is 1 and all other elements are 0.
    For example, when n = 3
    1 1 1 - initial state of all elements
    0 1 1 - change first element to 0 w/o condition
    0 1 0 - change third element to 0 as only second element is 1 and rest are 0
    1 1 0 - change first element to 1 w/0 condition
    1 0 0 - change second element to 0 as only first element is 1 and rest are 0
    0 0 0 - change first element to 0 w/o condition
    I'll check my the person who sets the question and get back to you guys as soon as possible. Thanks a lot for helping me out.

  • Help needed with application: "could not find the main class"

    I am pretty new to java and am trying to figure out applications a bit now. The one im working on does run within my editor, but when i "test" it or try to run it from within a .jar file it returns a "could not find the main class" error.
    I have a code similar to this:
    public class user{
    public static void main(String[] args){
    new user();
    public user{
    Does this have to do with it? I've been trying to get this right for a couple of days now, I just wanna be able to run it (on either my pc or another) without starting the Editor.
    Looking forward to receiving an answer..

    It sounds like you are missing the Main-Class attribute in your manifest file. Create a file 'manifest.mf' with the following line 'Main-Class: user'
    Then include that manifest in your jar:
    'jar -cfm user.jar manifest.mf user.class'
    Then run the jar: 'java -jar user.jar'
    http://java.sun.com/docs/books/tutorial/jar/basics/mod.html

  • Need to write object to database but can't find useful examples

    Hi,
    Within one servlet I need to write an Attributes object to a database to be retrieved sometime later by a second servlet. All the examples of serialization code that I can find are for writing to serial or file streams. What I need is to be able to be able to write the Attributes object to a MySQL database. How do I get it into a form that I can write to the database and how do I once again turn in back into an object? I've not been able to answer those question from the examples I've found so far.
    Any help would be greatly appreciated.
    -- Rob

    There are at least two choices.
    1. Serialize to a ByteArrayOutputStream, base-64-encode that data, and save as a string in the database.
    2. Serialize directly to a database blob.

  • Help needed in Finding Download location for Sun One Portal 7

    Hi,
    help needed for finding download location for Sun ONE Portal 7. I tried to find in Oracle Download page ,
    http://www.oracle.com/us/sun/sun-products-map-075562.html, But unable to find.
    Please share the link for download location.
    I am totally new in Sun ONE Portal.
    Thanks,
    Edited by: 945439 on Oct 5, 2012 3:41 AM

    try edelivery.oracle.com under sun products.

  • I have changed my Apple ID name and I want to change it on iCloud, however I am not able to delete the previous account because I need to turn off the Find my iPhone - and for that I need to log in with the old name and that is not working. Help anyone?

    I have changed my Apple ID name and I want to change it on iCloud, however I am not able to delete the previous account because I need to turn off the Find my iPhone - and for that I need to log in with the old name and that is not working. Help anyone?

    Hey tulgan,
    This link will provide information on what to do after you change your Apple ID:
    Apple ID: What to do after you change your Apple ID
    http://support.apple.com/kb/HT5796
    Welcome to Apple Support Communities!
    Take care,
    Delgadoh

Maybe you are looking for

  • Component Video converter?

    Hi, None of my equipment (tv, a/v reciever, etc) has componenet video inputs. I have composite video and s-video on my a/v receiver. Has anyone had any luck finding converters for the component video cable so that they can hook up their AppleTV to su

  • HT5517 How to connect iPad to TV using airplay?

    Just want to watch content streamed from my iPad to my TV using airplay.  I have enabled Airplay in the settings menu and set the password as this website instructs.  However, I then press play on the iPad and begin to watch the program, and I cannot

  • For moderator: where to address a question on music software "finale?"

    i have an older version of finale (2002b) and am having trouble getting the application, which runs in classic mode, recognize the usb ports. i'd like to post the question but there is no forum for this reasonably popular software. where would it be

  • Compressor reduces resolution of image sequence

    Hello, I have an PNG sequence with a resoltion of 1920x1080. When I add a single image to compressor, and doubleclick it, compressor shows the right resolution. When I add the whole folder of the image series, compressor shows me the resolution 1440x

  • Is Lightroom part of the CS Cloud?

    I just subscribed to the Creative Suite Cloud. One of the software programs I was looking forward to using is Lightroom. I'm currently using Apple's Aperture program, but I'm having a few problems with it. Anyway, when I check to see what software's