Wednesday, May 13, 2009

Trackable Keeper

I have been trying to find some projects that not only are helpful to me but allow me to learn some things about .Net and C#.

I love to go geocaching. Geocaching has these things called travel bugs. These are usually little toys with a special dog tag attached. You can move the travel bug from cache to cache and track that movement with the special number from the dog tag.

To take things a step further. there are also geocoins. Geocoins are, well coins, that are trackable just like a travel bug. The problem with the coins are that people tend to steal them. Now if you send out a travel bug, you are out about $5 for the dog tag and usually less than that for the trackable. Usually people steal their kid's McToys and pick up the dog tags on special. Also dog tags come with a duplicate so you can send out a lost travel bug again. But once a coin is gone, it is gone.

As result of this, many serious (and the not so serious) coin collectors do not send their coins out in the wild. Instead they take them to events for people to "discover" - a way of saying you saw a coin (0r other trackable) without actually moving it from a cache.

The problem with this is the nice people over at do not allow what they call 'virtual discoveries.' This is where someone, hopefully the trackable owner, puts out the special number for people to discover the trackable even if they have not seen it. If they suspect a trackable's item has been compromised, they will lock said trackable so no one can discover it.

Now, I like to share my coins. And I take my coins to events all the time. To not offend the powers that be, I drop the coins at any event I will be at. Dropping them at an event is not a problem. Picking them back up is another matter. Now if you have a handful of them, it is not bad. When you get a couple dozen it starts to become a problem. When you get over 200, you want to take a an ice pick to your eyes. Ok it may not be that bad but it IS annoying.

Being a programmer I figured there is something I could do to help with this. Hence the Geotracking Tracker Keeper was born.

Each trackable has 3 numbers, 2 of which are of concern for this. There is the 'external number' - i.e. the magic number I talk about above that is on the trackable itself. There is also an internal ID, that you can get once you have the external number.

So, the program uses an XML file to keep these 2 numbers and 1 other field - a flag if the trackable is at an event. This allows me to snag some coins here and there as time permits without having to go through ones I have already picked up. How does it work? If I have the internal ID, I can go straight to the log page. If I only have the external ID I go to the trackable's page and then have to add the new log. In either case the external number is pushed into the clipboard so it can be pasted on the log to prove I have the trackable. I then just have to select the log type, date & enter a log (I usually just enter 'Pickup' for my own coins). Once I close the browser the program brings up the next coin.

This program is, really, not that complicated if you look it. Launching a process and waiting for it to finish is not tough. At least once you find the write part of .Net it is not that tough :). I would like to find a way to push keys to the browser, although I am not sure if that would be useful for selecting the log type. XML was used in case I ever decide to rewrite this program in another language (like Ruby or JavaScript). There is no major search or reporting done on the data so SQL seems like overkill. Also lots of APIs work with XML, including RSS, so learning some of the XML tidbits in .Net is worth it.

A side benefit of what I have done is I can create lists of coins from other cachers and of trackables that I find at events and discover them. Same basic process, but I have an XML file that stores the coins that I have discovered in the past. Since I have a couple of coin hounds I can just write down whatever coin codes they have and not worry about if I have discovered it before - the program keeps track for me. By keeping these in my Palm or iPod I can get them in a text file, which of course I setup the discovery part of the program to read.

Future thoughts on the program: I slapped this together so I could use it. I would like to go back and refactor large parts of this. One example - a wrapper around the file selector code. Cut & paste reuse is not good. I also would like to setup an object & collection to wrap the logic. I could have done this all the first time, but this also gives me a chance to stretch my refactoring chops.

No comments: