Order Tray | Contact Us | Home | SIG Lists

[aprssig] Live Telemetry Data Through a Simple Web Page

Steve Dimse steve at dimse.com
Sat Apr 23 21:47:11 UTC 2005


On Apr 23, 2005, at 5:13 PM, Brad McConahay wrote:

> On 23 Apr 2005 11:03:19 -0400, Steve Dimse Wrote:
>>
>> This would be a nice project for someone else to do, let the
>> user specify a url in the page request, the server grabs the
>> user's page from his own web space (everyone can get web space
>> somewhere) and replaces any variables using Brad's XML service.
>
> So if I'm understanding you correctly...
>
> Let's say this is my page with variables, as an end-user: (the things  
> that
> look like "aprs()" functions are the variables)
>
> http://home.n8qq.com/aprs
>
> And I then feed that url and my callsign to this script, as you  
> describe:
>
> http://xml.n8qq.com/replace/index.cgi?call=n8qq&url=http:// 
> home.n8qq.com/apr
> s
>
> ...and the variables are replaced.  Is that the sort of thing you had  
> in
> mind?
>
> These variables look more like functions with arguments than variables  
> -
> maybe they should be something embedded in an html comment, like  
> <!--aprs
> position latitude degrees-->.  Not sure what would be best in that  
> regard.

Well, I guess it depends on the implementation. The way I  visualized  
it, the replace script grabs the data first, then goes through and does  
a global replace on the variable names, so there is really no function  
calling going on. Granted, you could also do it so that you parse the  
file and then call a function each time you find a variable, which is  
easier depends on the language you are using to write the replace  
script. For example, in perl you can do this very easily (say that, for  
example speed is represented in the html source as $speed (a perl-like  
syntax, but it really can be any sort of syntax including the comment  
you mention, see next paragraph for more details on this) and you have  
already called the  database code to get the speed of the callsign  
which is now in the perl variable $speed:

$thepage = `wget http://home.n8qq.com/apr`;

$thepage =~ s/\$speed/$speed/g;
(this is followed by a bunch of other regex that replace all the other  
variables defined that may be in a page)

then just

print $thepage;

As to your syntax, I'd say an HTML comment is not the best choice, as  
it would hide mistakes. Say the variable was speed, but the source page  
mistyped the speed as spped:

my speed is $spped

vs

my speed is <!--$spped-->

My syntax outputs

my speed is $spped

the comment method just outputs

my speed is

Which makes it easier to spot the error? Especially important if you  
want to make users write the full XML hierarchy instead of the simple  
variable names I propose. Not my choice since I'm not writing it, but  
adding XML to this seems like a needless complication to me...that is  
sort of the way I feel about XML in general. You CAN use it in many  
situations, but at this point in time it doesn't make things easier  
than direct access of the data. Maybe when better tools are  
available...

Steve K4HG





More information about the aprssig mailing list