Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Extra libraries, Code snippets, applications etc. » Applications created with U++ » Distance - geodesic - Vincenty - very accurate
Re: Distance - geodesic - Vincenty - very accurate [message #25981 is a reply to message #25979] Tue, 23 March 2010 02:49 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Strange error.

I download the Linux Distance from the above link (1499004 bytes) and try and run it:
Could not display "/home/neil/Downloads/Distance".
There is no application installed for executable files


It runs fine from /upp.out/GCC.Force_size.Gui.Shared/
I copied it (1499004 bytes) from upp.out/... to another dir and it works fine.

I replaced the file in upp.out/... with the downloaded file, same error.

I deleted it from the website and uploaded it 3 times, same error.

This is with Ubuntu 10.04b on the same computer used with theIDE to compile it.

[Updated on: Tue, 23 March 2010 03:04]

Report message to a moderator

Re: Distance - geodesic - Vincenty - very accurate [message #25983 is a reply to message #25981] Tue, 23 March 2010 03:37 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
I copied the file that works to a flash drive, booted into Win, made a .tar with 7z and uploaded it with FileZilla.
That worked!

edit: It ran but still has a glitch, will work on it in a few days when I get back.

[Updated on: Tue, 23 March 2010 04:08]

Report message to a moderator

Re: Distance - geodesic - Vincenty - very accurate [message #25986 is a reply to message #25983] Tue, 23 March 2010 11:57 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3030
Registered: August 2008
Ultimate Member
Hello nlneilson

What is the situation now?. Does Linux version work?


Best regards
Iñaki
Re: Distance - geodesic - Vincenty - very accurate [message #26007 is a reply to message #25986] Thu, 25 March 2010 10:35 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Just got back tonight. Had problems with that computer, Vista?, Ubuntu 10.04?, ??.
Re: Distance - geodesic - Vincenty - very accurate [message #26020 is a reply to message #26007] Fri, 26 March 2010 11:09 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
I found where the glitch was. It had nothing to do with Ubuntu 10.04b (although I will drop that until the 10.04 release for other problems).

I ran some tests with the Linux version and found a problem.
The copy and paste from a web site for a location in deg,min,sec was not parsed correctly.

In another Java app, Location.jar, I spent a considerable amount of time parsing the different ways the location in lat,lon format is specified on the web.
http://www.nlneilson.com/nww.html

For the Distance app, Java or C++, unless the latlon is in decimal degrees, the lat and lon should be comma delimited, this eliminated many problems with odd ball formats.

The format that was a problem in the C++ Linux version is also a problem in the Win .exe version, I just did not catch that. I will go back into the parsing code and correct that.

The Java version worked but there were two function there:
.replaceAll("\\s+", " "); // This replaces several spaces with a single space
.trim(); // this removes leading and trailing spaces

I did not know the corresponding functions in C++, my error as usual.

[Updated on: Fri, 26 March 2010 11:27]

Report message to a moderator

Re: Distance - geodesic - Vincenty - very accurate [message #26021 is a reply to message #25894] Fri, 26 March 2010 12:30 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3030
Registered: August 2008
Ultimate Member
Quote:

.trim(); // this removes leading and trailing spaces


TrimBoth();


Best regards
Iñaki
Re: Distance - geodesic - Vincenty - very accurate [message #26022 is a reply to message #26021] Fri, 26 March 2010 13:08 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
TrimBoth(); I will try that.

One thing I noticed that seemed odd in upp:
The character for the degree symbol as int = -80
I thought that should be 176

I am handling it in upp with:
//            if (ic>122 || ch=='' || ch==''' || ch=='"') ic = 32;
            if (ic>122 || ic==-80 || ic==39 || ic==34) ic = 32;

That could have something to do with the problem.
Sometimes for ic = -62 AND ch = -62 rather than ch = ''

With my code the should be replaced with a space.
To take care of some strange stuff I have:
if (ic < 0) continue;
I could change that to:
if (ic < 0) ic = 32;
and then a few lines of code in C++ to check/remove the consecutive space/s similar to .replaceAll("\\s+", " "); in Java.

[Updated on: Fri, 26 March 2010 14:09]

Report message to a moderator

Re: Distance - geodesic - Vincenty - very accurate [message #26045 is a reply to message #26022] Fri, 26 March 2010 20:07 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3030
Registered: August 2008
Ultimate Member
Hello Nlneilson

nlneilson wrote on Fri, 26 March 2010 13:08

TrimBoth(); I will try that.

One thing I noticed that seemed odd in upp:
The character for the degree symbol as int = -80
I thought that should be 176

I am handling it in upp with:
//            if (ic>122 || ch=='' || ch==''' || ch=='"') ic = 32;
            if (ic>122 || ic==-80 || ic==39 || ic==34) ic = 32;

That could have something to do with the problem.
Sometimes for ic = -62 AND ch = -62 rather than ch = ''

With my code the should be replaced with a space.
To take care of some strange stuff I have:
if (ic < 0) continue;
I could change that to:
if (ic < 0) ic = 32;
and then a few lines of code in C++ to check/remove the consecutive space/s similar to .replaceAll("\\s+", " "); in Java.




I think the problem does not come from Upp, but for the characters code used. Probably there is not only one option for .



Best regards
Iñaki
Re: Distance - geodesic - Vincenty - very accurate [message #26055 is a reply to message #26045] Sat, 27 March 2010 01:56 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
koldo wrote on Fri, 26 March 2010 20:07

I think the problem does not come from Upp, but for the characters code used. Probably there is not only one option for .


Now I know where the problems could be I can easily correct them.
I didn't have problems with this in Java or C++ in Eclipse CDT.

I think Upp/theIDE is great, will stay with it.
Re: Distance - geodesic - Vincenty - very accurate [message #26056 is a reply to message #26055] Sat, 27 March 2010 05:31 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
That glitch is fixed, not yet for all instances.

if (ic < 0) ic = 32;

And for the multiple spaces:
changed if (j==1) to if (j==1 && Dms!="")

I tried this and several others:
1234'56"N,1234'56"W
12 34'  56"  N ,  12  34'  56" W


http://nlneilson.com/apps/Distance.exe

It still seems strange the integer representation of
any character would be less than 0.

edit: Still have a glitch, works fine in theIDE and then
when it is copied to a directory with other apps.
When I upload and then download the .exe has problems with the extra spaces.
With Build->clean, Build->Clean UPPOUT I could get the error re extra spaces
using Debug->Execute but Debug->Run(in debugger) only the break points in the main would work.
Downloaded 2272 and the break points work OK.
This is with Vista, I think I will try with XP, Vista has been a real pain.

I found the problem with the break points (it had nothing to do with theIDE)
and only some times with extra spaces.
It checks the latlon for decimal degrees first and I have a comment:
// with ',' ' ' '~' but only one
I will add a count for spaces and if >1 get out of that loop.

The code will also work with the input of a GGA GPS sentence so it gets a bit complicated.

[Updated on: Sat, 27 March 2010 07:42]

Report message to a moderator

Re: Distance - geodesic - Vincenty - very accurate [message #26057 is a reply to message #26056] Sat, 27 March 2010 08:05 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Dumb mistake, I really mess up sometimes.
When I port from one language to another I copy and paste and if
several lines are nearly the same I paste that in more than once
and then change what is necessary.

In Java I used dLat for a double and sLat for a String.
In Upp I used lat for a double and Lat for a String.

In the parse decimal degrees loop:
if (lon<=180 && lat>=-180)
should be lon
if (lon<=180 && lon>=-180)

This catches most error that would be caused by more than one space.

If I ever get an error caused by multiple spaces, or a report of one
I will count the spaces in the code and kick it out.
In Java this took care of it: .replaceAll("\\s+", " ");

I uploaded the file with FileZilla, downloaded and tried it, works OK.

[Updated on: Sat, 27 March 2010 08:22]

Report message to a moderator

Re: Distance - geodesic - Vincenty - very accurate [message #26058 is a reply to message #26056] Sat, 27 March 2010 10:23 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1758
Registered: August 2008
Location: Czech Republic
Senior Contributor

Hi nlneilson
Quote:

The character for the degree symbol as int = -80
I thought that should be 176

Quote:

It still seems strange the integer representation of
any character would be less than 0.

It is not that strange as it looks. Internally, only last byte of int is considered, that is like if you performed modulo 256 operation. In your case, -80+255=176, so it is the same char, '' Wink But I agree, it is kind of obfuscating, maybe it should be changed.

Regards,
Honza
Re: Distance - geodesic - Vincenty - very accurate [message #26065 is a reply to message #26058] Sun, 28 March 2010 14:25 Go to previous message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
dolik.rce wrote on Sat, 27 March 2010 10:23

In your case, -80+255=176, so it is the same char, '' Wink But I agree, it is kind of obfuscating, maybe it should be changed.


Thanks for the explanation, usually anything strange is from my code. A change for this in upp would be good.

Koldo: "Probably there is not only one option for "
Usually it is -80, only with Vista, and then rarely but enough to cause errors has it been -62, maybe the format of the character.
if (ic < 0) ic = 32; takes care of it.

[Updated on: Sun, 28 March 2010 14:27]

Report message to a moderator

Previous Topic: Google Translator
Next Topic: How to load dll
Goto Forum:
  


Current Time: Thu Nov 14 20:06:16 CET 2019

Total time taken to generate the page: 0.02532 seconds