Jump to content

Dumb Question Alert


Thot

Recommended Posts

Doesn't the subject line match the name you gave it?

The attachments directory doesn't have subject lines in it.

 

I've been requesting that the name of the PQ be put into the PQ for some time now. I am still unable to understand why it is so difficult that TPTB won't do it. I continue to insist that it is about a 5-minute programming job.

 

But, in the meantime, I run a simple Perl script from my email client (Eudora) that extracts the gpx files from their zip containers and renames them to the query name, which it extracts from the body of the email message.

 

There are several other possible ways to do this: if you re-run the same PQs all the time, you can keep a little DB of the file names that each one returns and rename it. Or you can keep a database of the coordinates of the centers of your various PQs, and determine which PQ it is from the first few caches that appear, or from the bounding box (which is sent in the PQ).

 

For now, anyway, the bad news is that you are going to have to do it yourself.

Edited by fizzymagic
Link to comment
It would seem like the query name could just be added to the filename?

That's actually slightly more difficult. The PQ server needs each PQ to have a unique filename, so you'd still have to have the numbers as part of the filename. And they would have to be careful to limit the allowed characters in the filename to make legal names across many operating systems.

 

But here is the most important fact:

 

The GPX standard already includes an entry for the query name!

 

Go take a look at the GPX schema. Notice the section that says:

<xsd:element name="name" type="xsd:string" minOccurs="0">
- <xsd:annotation>
 <xsd:documentation>
     The name of the GPX file.
 </xsd:documentation>
</xsd:annotation>
</xsd:element>

I am hopeful that if we keep asking (others more politely than me, certainly!) TPTB will eventually take pity on us and use the element.

Link to comment
I am hopeful that if we keep asking (others more politely than me, certainly!) TPTB will eventually take pity on us and use the element.

What are you new here or something? ;)

 

But yes, it does sound like a good thing to have. I don't run that many PQs so I pretty much know what I've got. But I'm begining to think that I'm the only one that does things the way I do things.

Edited by mini cacher
Link to comment
The PQ server needs each PQ to have a unique filename,

Not really. Knowing your background, I'm suprised you fell for that trick. :-) Why would it need a unique filename? Surely you're not suspecting that it writes the PQs back to filestore, are you?

 

If I were building a system where scalability mattered, I don't think I'd pitstop the generated PQ on the filesystem. It's not like the data is perishable - slurp it straight off the spindle, whip it into the shape of a PQ, then hand it to the mail server via a pipe. If the virtual memory system decides to put that to disk, so be it. (And if VM decides to do it, it can generate way nicer I/O patterns to the filesystem layer than your application is liikely to do...) It doesn't seem like a good plan to pick it up from disk, put it down on disk, hand it to the mail system to get it back off the disk (which, in full likelyhood, is going to put it back on disk again if it has to write an mqueue entry for queueing or retries) before shooting it down the SMTP socket.

 

Contrast:

echo "<gpx><name... " | mail fizzymagic

echo "<gpx><name..." > foo && mail fizzymagic < foo

 

The former will generate a much less abusive I/O footprint than the latter when there are large amounts of data flying around.

 

It's even more dramatic if you replace the 'echo' with a database/sql operation that's very likely to disturb head placement and wipe the read cache. (Not that kind of cache...)

 

I also suspect that it'd do more people more good to have the attachment name reflect the PQ name than it would to stuff the PQ name in an internal field to the GPX file. But that's a slightly different subject...

Link to comment
I also suspect that it'd do more people more good to have the attachment name reflect the PQ name than it would to stuff the PQ name in an internal field to the GPX file. But that's a slightly different subject...

I agree there; I just don't expect that it will happen that way, for a number of reasons.

 

If the PQ name does get included into the PQ itself, I hereby volunteer to write a free app that will automagically rename PQ files for people.

Link to comment
The Groundspeak GPX is v1, not v 1.1. There is no such tag in the original GPX format.

Ah! I Did Not Know That!

 

But we still have the <desc> tag, right?

Actually, <name> inside <gpx> (not waypt) would be the way to spell this in GPX 1.0, as I recall the original intent. See: http://www.topografix.com/gpx_manual.asp#name

 

Placing the PQ name (thus leaving it to the user to handle collisions, etc.) inside <gpx> (right before the invariant "<desc>Geocache file generated by Groundspeak</desc>") would be consistent with the GPX spec. This should not torment any reasonable XML reader.

 

But the problem putting it there is that you have to unzip it before you can get to this. If you used that name to control the attachement filename instead, you could more easily to get to it from a procmail-like substance.

 

Edit: Cite GPX 1.0 spec referencing "<name> In <gpx>: the name of the file."

Edited by robertlipe
Link to comment

Lovely. Thanx. Did we sell you on just the embedded tag or the name of the attachment as it appears in the mime header?

 

I'd be happy with <name>MyMiddleTN</name> right before <desc>

 

It probably does need to be CDATA'ed since you could name a PQ with greater-than/lesser-than.

 

It probably needs to be a "cleansed" version. Most filesystem are UTF-8 aware (I think I recall ISO-9660 being is a notable exception) but there's another form of naughtiness.

 

To get your creative juices flowing, I'm going to create four PQs and

name them "c:\config.sys", "..\..\windows\someimportant.dll", "/etc/passwd" and "/home/fizzymagic/.profile" and have them all delivered to Fizzymagic. :-) For security and the intended use, I'd probably recommend passing the name through a "is alpha-numeric" filter.

 

(Of course, once you've done that, it doesn't need to be in a CDATA...)

Link to comment
Serializing the GPX file will htmlencode the string so > and < will show instead of > or <

 

I need to recheck the xsd but isn't a name a name - or a required filename?*

 

* I do get the joke part of that. Just clarifying.

XML and HTML encodings are subtly different. Check 'em carefully.

 

No simpleType/restriction was placed on name. (I seem to remember objecting to that.) So I could create a perfectly legal GPX file with a 64MB filename or other combinations that would choke most OSes. That's why I was suggesting suppressing dots, slashes, backslashes, and colons as those are key components of "naughty names" on DOS/Windows and both UNIX-y systems.

Link to comment
I'll be in Austria next week, but once I get back I will write a fast and simple little program for people to use to rename their query files.

Including a que to the query name in the filename would have been more convenient, but if the query name is a tag inside the file that'll work for me.

Edited by Thot
Link to comment

Now, if I understand the preceding, PQs will now come with the query name on the file instead of the random set of six numbers. Unfortunately that is not the case. My Wednesday PQ came in this morning and neither the zip file, nor the eclosed gpx file had the query name. Both used the six number name. Am I wrong on what this was supposed to do or did it just not work as intended?

Link to comment

Jeremy said " It should be up by the end of the week (cross fingers)." so I wouldn't expect it to be implemented today. It's also not clear yet if the pending implementation covers the name tag or the name tag and the name in the MIME header.

 

(Looking closer at that post, he also used my real name instead of my Geocaching name, thus blowing my cover. Drats! Now the witness protection program is going to have to relocate me again!)

Link to comment

On our computer at home, I wrote a little bat file to deal with this. A given PQ 012345 will always (so far, I guess it could change eventually) be the result set for PocketQueryName.

 

I installed a little command-line unzipper in my Windows command prompt path.

 

For each PQ zip, I have to add a set of lines to:

 

1) Unzip .ZIP file, leaving 012345.gpx

2) Delete Zip file and existing PockeyQueryName.gpx

3) Rename 012345.gpx to PockeyQueryName.gpx

4) Copy PocketQueryName.gpx to the correct path under my Mobile Device to sync the GPX files to my handheld.

 

Then I use GSAK to import the GPX files en masse, export a merged GPX file, and blow the merged file out to the Garmin and the handheld sync directory.

 

Next step is to find a command-line XML utility that will run the merge for me, without needing to use GSAK for that step. Oh, and a utility to just dump a file to my Garmin from the command line. I'm sure the first is out there already (XML utility), I just haven't had time to look. The second would be nice to find.

 

Oh, and I need a million bucks :ph34r:

 

If there's a lot of interest, I'll post the code snippets for the .BAT file, it's really not too hard to figure out on your own though.

Link to comment

My recent pocket queries have had the <name></name> tag inside the GPX file (open it in notepad), and it's populated with the name that I gave the Pocket Query on the Geocaching.com site.

 

Now if someone wrote a quick little GUI application that would run THESE steps, that'd be cool...

  • User double clicks the Converter Exe file
  • User interface browses to GPX file, and clicks "Convert"
  • System reaches in and finds the <name> tag (is that the correct term?)
  • System takes the stuff in the <name> tag and strips off the non-filename characters (?&*/) so that What's Near Me & Unfound? becomes What's Near Me Unfound and truncates to 255 characters if necessary.
  • System renames the target GPX file with the newly created text (leaving the GPX extension).

Daydreaming...

Link to comment
My recent pocket queries have had the <name></name> tag inside the GPX file (open it in notepad), and it's populated with the name that I gave the Pocket Query on the Geocaching.com site.

 

Now if someone wrote a quick little GUI application that would run THESE steps, that'd be cool...

  • User double clicks the Converter Exe file
  • User interface browses to GPX file, and clicks "Convert"
  • System reaches in and finds the <name> tag (is that the correct term?)
  • System takes the stuff in the <name> tag and strips off the non-filename characters (?&*/) so that What's Near Me & Unfound? becomes What's Near Me Unfound and truncates to 255 characters if necessary.
  • System renames the target GPX file with the newly created text (leaving the GPX extension).

Daydreaming...

Give him some time...

Link to comment
My recent pocket queries have had the <name></name> tag inside the GPX file (open it in notepad), and it's populated with the name that I gave the Pocket Query on the Geocaching.com site.

 

Now if someone wrote a quick little GUI application that would run THESE steps, that'd be cool...


  •  
     
     
  • User double clicks the Converter Exe file
     
     
     
  • User interface browses to GPX file, and clicks "Convert"
     
     
     
  • System reaches in and finds the <name> tag (is that the correct term?)
     
     
     
  • System takes the stuff in the <name> tag and strips off the non-filename characters (?&*/) so that What's Near Me & Unfound? becomes What's Near Me Unfound and truncates to 255 characters if necessary.
     
     
     
  • System renames the target GPX file with the newly created text (leaving the GPX extension).
     
     
     

Daydreaming...

Give him some time...

Oh no. Now we will have to refer to this as a Stunod instead of a Markwell :ph34r:

Edited by tozainamboku
Link to comment
Name it is. I think I sorted out all the Microsoft bad text formatting issues (with the help of Robert Lipe) so I don't think the CDATA will be required. I'll go ahead and implement locally. It should be up by the end of the week (cross fingers).

I hope the current practice of putting the name in the subject line won't change. My mail client can use the subject name to decide what to do with the attachment.

Link to comment
My recent pocket queries have had the <name></name> tag inside the GPX file (open it in notepad), and it's populated with the name that I gave the Pocket Query on the Geocaching.com site.

 

All I know is that the zip file and the underlying gpx file have the six digit file name they have had forever. I may be wrong, but I thought those file names were going to change. I just checked on the one I received today.

Link to comment

Nope - they're not changing. Inside the GPX file is where it's added...

 

<?xml version="1.0" encoding="utf-8"?>
<gpx xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" creator="Groundspeak Pocket Query" xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd http://www.Groundspeak.com/cache/1/0 http://www.Groundspeak.com/cache/1/0/cache.xsd" xmlns="http://www.topografix.com/GPX/1/0">
 <name>Unfound Near Home</name>
 <desc>Geocache file generated by Groundspeak</desc>
 <author>Groundspeak</author>

 

Take a look at the data from the top couple of lines inside one of my GPX files. The line that has <name>Unfound Near Home</name> is what I named the query.

 

According to Fizzymagic's post (linked above), there will soon be a tool that will change the numeric name to the name of the query.

Edited by Markwell
Link to comment
On our computer at home, I wrote a little bat file to deal with this. A given PQ 012345 will always (so far, I guess it could change eventually) be the result set for PocketQueryName.

 

I installed a little command-line unzipper in my Windows command prompt path.

 

For each PQ zip, I have to add a set of lines to:

 

1) Unzip .ZIP file, leaving 012345.gpx

2) Delete Zip file and existing PockeyQueryName.gpx

3) Rename 012345.gpx to PockeyQueryName.gpx

4) Copy PocketQueryName.gpx to the correct path under my Mobile Device to sync the GPX files to my handheld.

 

Then I use GSAK to import the GPX files en masse, export a merged GPX file, and blow the merged file out to the Garmin and the handheld sync directory.

 

Next step is to find a command-line XML utility that will run the merge for me, without needing to use GSAK for that step. Oh, and a utility to just dump a file to my Garmin from the command line. I'm sure the first is out there already (XML utility), I just haven't had time to look. The second would be nice to find.

 

Oh, and I need a million bucks :(

 

If there's a lot of interest, I'll post the code snippets for the .BAT file, it's really not too hard to figure out on your own though.

You can do this with GPXSpinner and GPSBabel.

 

Spinner will do all the magic inside the GPX file to change the icon and modify the cache names if you wish. GPSBabel can then be run by the Runafter.bat file in GPXSpinner to send the resulting file to your GPS.

 

Both applications can be found on the Geocaching.com programs page.

 

Let me know if you need some help configuring the two programs.

Link to comment

maybe I am missing something here -

 

for a given PQ, isn't the number the same every time you get it?

doesn't matter what the file name is does it?

 

the title you gave it is in the subject line of the e-mail

the number GC gave it is in the e-mail s well as the file itself -

 

for instance my e-mail for the PQ I got today says in part -

 

"Here are the Pocket Query search results in the formats you requested.

 

285611.gpx: ..."

 

I don't see what the problem is. I keep a couple of weeks worth of PQ e-mail messages "just in case". I used to save each one but that got to be a pain and an unnecessary waste of disk space. All I have to do is pick one with subject name as needed (the 123456.gpx doesn't seem relevent) and take it out of the e-mail if I need it.

 

So what am I missing here?

 

cc\

Link to comment
My recent pocket queries have had the <name></name> tag inside the GPX file (open it in notepad), and it's populated with the name that I gave the Pocket Query on the Geocaching.com site.

 

Now if someone wrote a quick little GUI application that would run THESE steps, that'd be cool...

  • User double clicks the Converter Exe file
  • User interface browses to GPX file, and clicks "Convert"
  • System reaches in and finds the <name> tag (is that the correct term?)
  • System takes the stuff in the <name> tag and strips off the non-filename characters (?&*/) so that What's Near Me & Unfound? becomes What's Near Me Unfound and truncates to 255 characters if necessary.
  • System renames the target GPX file with the newly created text (leaving the GPX extension).

Daydreaming...

For those interested, the next version of GSAK effectively does this.

 

The GetMail fucntion now has a feature to automatically rename your attachment using the email subject (or any part of the subject line), and then removing any invalid file name characters.

 

I am using the subject line rather than the new <name> tag inside the GPX file, because GetMail can download any attachment but only the GPX files from Groundspeak will have the <name> tag inside (just about all emails have a subject line)

Link to comment
Guest
This topic is now closed to further replies.
×
×
  • Create New...