Geocaching Log Feed Added

Since I am limited to Blogger for publishing our “My Finds” PQ, I’ve used a WordPress widget to add a link to the latest posts here.

You can find them on the Geocaching page.

Blog Your Geocaching Found Logs with Blogger

You may or may not be aware that Google have recently released a command line tool called Google CL which allows limited updating of some of it’s primary services from the command line – including Blogger.

I have been working on a script and looking for a utility to parse the “My Finds” pocket query for uploading to a blog for a while now so on hearing this news I set to work to see if I could create an automated script. You can see the results on my old blogger account, which I have now renamed _TeamFitz_ and repurposed for publishing our Geocaching adventures.

It’s a little bit clunky and could be improved, but the script is now complete and ready for ‘beta’. I’m publishing it here and releasing it under GPL for others to download, copy and modify for their own Geocaching blogs.

A few snags:

  • It will only work with one “Find” per cache – if you found twice it may screw up the parser.
  • Google have an arbitrary limit of 30-40 auto-posts per day, which is entirely fair, it will then turn on word verification which will prevent CL updates. I have limited the script to parse only 30 posts at a time.

You will need to download and install Google CL, it goes without saying the script is Linux only but if someone wants to adapt it to Windows they are welcome.

I have commented out the “google” upload line for test runs, remove # to make it active.

Either cut n’ paste the code below, or download the script from YourFileLink. Please comment and post links to your own blogs if you use it, also let me know if there are any bugs I haven’t addressed.

#!/bin/bash
# Script to unzip, parse and publish
# Pocket Queries from Geocaching.com to Blogger
# Created by Wes Fitzpatrick (http://wafitz.net)
# 30-Nov-2009. Please distribute freely under GPL.
#
# Change History
# ==============
# 24-07/2010 - Added integration with Blogger CL
#
# Notes
# =====
# Setup variables before use.
# Blogger has a limit on posts per day, if it
# exceeds this limit then word verification
# will be turned on. This script has been limited
# to parse 30 logs.
# Blogger does not accept date args from Google CL,
# consequently posts will be dated as current time.
#
# Bugs
# ====
# * Will break if more than one found log
# * Will break on undeclared "found" types
#   e.g. "Attended"
# * If the script breaks then all temporary files
#   will need to be deleted before rerunning:
#	.out
#	.tmp
#	new
#	all files in /export/pub
#####     Use entirely at your own risk!      #####
##### Do not run more than twice in 24 hours! #####
set -e
clear
PQDIR="/YOUR/PQ/ZIP/DIR"
PUBLISH="$PQDIR/export/pub"
EXPORT="$PQDIR/export"
EXCLUDES="$EXPORT/excludes.log"
GCLIST="gccodes.tmp"
LOGLIST="logs.tmp"
PQZIP=$1
PQ=`echo $PQZIP | cut -f1 -d.`
PQGPX="$PQ.gpx"
BLOG="YOUR BLOG TITLE"
USER="YOUR USER ID"
TAGS="Geocaching, Pocket Query, Found Logs"
COUNTER=30
if [ ! $PQZIP ];then
echo ""
echo "Please supply a PQ zip file!"
echo ""
exit 0
fi
if [ ! -f "$EXCLUDES" ];then
touch "$EXCLUDES"
fi
# Unzip Pocket Query
echo "Unzipping PQ..."
unzip $PQZIP
# Delete header tag
echo "		...Deleting Header"
sed -i '/My Finds Pocket Query/d' $PQGPX
sed -i 's/'"$(printf '\015')"'$//g' $PQGPX
# Create list of GC Codes for removing duplicates
echo "		...Creating list of GC Codes"
grep "<name>GC.*</name>" $PQGPX | perl -ne 'm/>([^<>]+?)<\// && print$1."\n"' >  $GCLIST
# Make individual gpx files
echo ""
echo "Splitting gpx file..."
echo "	New GC Codes:"
cat  $GCLIST | while read GCCODE; do
#Test if the GC code has already been published
if [ ! `egrep "$GCCODE$" "$EXCLUDES"` ]; then
if [ ! "$COUNTER" = "0" ]; then
echo "      	$GCCODE"
TMPFILE="$EXPORT/$GCCODE.tmp"
GCFILE="$EXPORT/$GCCODE"
sed -n "/<name>${GCCODE}<\/name>/,/<\/wpt>/p" "$PQGPX" >> "$TMPFILE"
grep "<groundspeak:log id=" "$TMPFILE" | cut -f2 -d'"' | sort | uniq > "$LOGLIST"
cat $LOGLIST | while read LOGID; do
sed -n "/<groundspeak:log id=\"$LOGID\">/,/<\/groundspeak:log>/p" "$TMPFILE" >> "$LOGID.out"
done
FOUNDIT=`egrep -H "<groundspeak:type>(Attended|Found it|Webcam Photo Taken)" *.out | cut -f1 -d: | sort | uniq`
mv $FOUNDIT " $GCFILE"
rm -f *.out
URLNAME=`grep "<urlname>.*</urlname>" "$TMPFILE" | perl -ne 'm/>([^<>]+?)<\// && print$1."\n"'`
echo "      	$URLNAME"
# Replace some of the XML tags in the temporary split file
echo "      		...Converting XML labels"
sed -i '/<groundspeak:short_description/,/groundspeak:short_description>/d' "$TMPFILE"
sed -i '/<groundspeak:long_description/,/groundspeak:long_description>/d' "$TMPFILE"
sed -i '/<groundspeak:encoded_hints/,/groundspeak:encoded_hints>/d' "$TMPFILE"
sed -i 's/<url>/<a href="/g' "$TMPFILE"
sed -i "s/<\/url>/\">$GCCODE<\/a>/g" "$TMPFILE"
LINK=`grep "http://www.geocaching.com/seek/" "$TMPFILE"`
OWNER=`grep "groundspeak:placed_by" "$TMPFILE" | cut -f2 -d">" | cut -f1 -d"<"`
TYPE=`grep "groundspeak:type" "$TMPFILE" | cut -f2 -d">" | cut -f1 -d"<"`
SIZE=`grep "groundspeak:container" "$TMPFILE" | cut -f2 -d">" | cut -f1 -d"<"`
DIFF=`grep "groundspeak:difficulty" "$TMPFILE" | cut -f2 -d">" | cut -f1 -d"<"`
TERR=`grep "groundspeak:terrain" "$TMPFILE" | cut -f2 -d">" | cut -f1 -d"<"`
COUNTRY=`grep "groundspeak:country" "$TMPFILE" | cut -f2 -d">" | cut -f1 -d"<"`
STATE=`grep "<groundspeak:state>.*<\/groundspeak:state>" "$TMPFILE" | perl -ne 'm/>([^<>]+?)<\// && print$1."\n"'`
# Now remove XML from the GC file
DATE=`grep "groundspeak:date" " $GCFILE" | cut -f2 -d">" | cut -f1 -d"<" | cut -f1 -dT`
TIME=`grep "groundspeak:date" " $GCFILE" | cut -f2 -d">" | cut -f1 -d"<" | cut -f2 -dT | cut -f1 -dZ`
sed -i '/groundspeak:log/d' " $GCFILE"
sed -i '/groundspeak:date/d' " $GCFILE"
sed -i '/groundspeak:type/d' " $GCFILE"
sed -i '/groundspeak:finder/d' " $GCFILE"
sed -i 's/<groundspeak:text encoded="False">//g' " $GCFILE"
sed -i 's/<groundspeak:text encoded="True">//g' " $GCFILE"
sed -i 's/<\/groundspeak:text>//g' " $GCFILE"
# Insert variables into the new GC file
echo "      		...Converting File"
sed -i "1i\Listing Name: $URLNAME" " $GCFILE"
sed -i "2i\GCCODE: $GCCODE" " $GCFILE"
sed -i "3i\Found on $DATE at $TIME" " $GCFILE"
sed -i "4i\Placed by: $OWNER" " $GCFILE"
sed -i "5i\Size: $SIZE (Difficulty: $DIFF / Terrain: $TERR)" " $GCFILE"
sed -i "6i\Location: $STATE, $COUNTRY" " $GCFILE"
sed -i "7i\Geocaching.com:$LINK" " $GCFILE"
sed -i "8i\ " " $GCFILE"
mv " $GCFILE" "$PUBLISH"
touch new
COUNTER=$((COUNTER-1))
fi
fi
done
echo ""
echo "			Reached 30 post limit!"
echo ""
# Pubish the new GC logs to Blogger
if [ -f new ]; then
echo ""
echo -n "Do you want to publish to Blogger (y/n)? "
read ANSWER
if [ $ANSWER = "y" ]; then
echo ""
echo "	Publishing to Blogger..."
echo ""
egrep -H "Found on [12][0-9][0-9][0-9]-" "$PUBLISH"/* | sort -k 3 | cut -f1 -d: | while read CODE; do
CACHE=`grep "Listing Name: " "$CODE" | cut -f2 -d:`
GC=`grep "GCCODE: " "$CODE" | cut -f2 -d:`
sed -i '/Listing Name: /d' "$CODE"
sed -i '/GCCODE: /d' "$CODE"
#google blogger post --blog "$BLOG" --title "$GC: $CACHE" --user "$USER" --tags "$TAGS" "$CODE"
echo "blogger post --blog $BLOG --title $GC: $CACHE --user $USER --tags $TAGS $CODE"
mv "$CODE" "$EXPORT"
echo "		Published: $CODE"
echo "$GC" >> "$EXCLUDES"
done
echo ""
echo "                  New logs published!"
else
echo ""
echo "                  Not published!"
fi
echo ""
else
echo "			No new logs."
fi
echo ""
rm -f *.out
rm -f *.tmp
rm -f "$EXPORT"/*.tmp
rm -f new

How I Came to Hate the BlackBerry Pearl

In case you weren’t aware my order for a Motorolla Milestone finally came through – bought with my own cash to replace my BlackBerry Pearl 8120 business phone.

But how did I arrive at this level of contempt for BlackBerry, and why Android? It’s partly down to progress in smartphone tech and partly down to discovery of limitations with the Pearl – which led to inevitable smartphone envy.

When I first got my Pearl last summer, it was through our business account. At the time the Android didn’t exist and the only other cutting edge smartphone on the market was the iPhone. I turned down having an iPhone for £50. I’m still glad I made that decision.

I had just returned a HTC Diamond back to O2 because it was a 5 year old Windows Mobile interface with a skin applied to make it look new – but ran and responded 5 times slower than my old SPV C500 – incidentally running the same OS.

I was really pleased with the Pearl at first – the UI was very responsive, the wifi connected seamlessly and didn’t hang up or have trouble reconnecting like some Nokia phones I’d used. I immediately noticed the lack of file system manager, the lack of themes and the dated 2mp camera – but these things didn’t bother me – the GUI was responsive and worked, the wifi connected automatically.

Then there was the email – it took me a while to figure out that email is not configured on the phone but has to go through the BIS server. I had to call O2 get them to push a bunch of services and apps down then log into their website and setup my email accounts. After this it was no trouble – the email service is second to none.

However, the honeymoon was short. The limitations, particularly with the Pearl model, soon started to make themselves apparent…

Lack of GPSr (Pearl models)

I had just started Geocaching after discovering it in Canada and discovered a problem with the Pearl model in particular that wasn’t really a problem before – that is lack of GPSr. Every BlackBerry model seems to have a GPSr but the Pearl is the black sheep of RIM that doesn’t get one. Why is this? I get they were attempting to court the general mobile user crowd with the retooled keyboard but it’s still a smartphone, and not as cheap as a Nokia either.

Consequently a lot of GC apps I couldn’t use because they explicitly require a GPSr enabled in order to seek caches. I managed to discover CacheBerry – which does take PQs and doesn’t need a GPSr, but still.

2.0mp Camera

At the time I got this Pearl, smartphones were already being made with 3+ megapixels. My other mobile, a Nokia N96 was 5mp. So it was a little disheartening to move down to a lower mp camera – particularly one a phone that is more socially network inclined than the Nokia was. I mean being able to load photos up on Facebook is great, but what’s the point when anybody looking at them is going to have trouble working out what the blobs are?

What else, the media library and camera are painfully slow. Sometimes I wanted to get a quick once-in-a-moment snap of, oh say, the nephew doing something cute and funny – too late it’s gone! A full 2 minutes later the camera app loads and is ready to take a picture. Of course better hope in your haste you didn’t accidentally click twice because actions are queued! Yes it will suddenly run everything you clicked all at once, then you have to start it all over again and wait… again.

Email

Everyone applauds BlackBerry BIS email service. It’s fast, efficient and gives companies the option to manage it. But for a small consultancy that uses POP3- unnecessary. Furthermore I found it frustrating when we changed network providers – being without email access for a couple of days until I could get login details to the BIS portal and add email accounts. This is not really useful for consultants who work on client sites where access to their company email is blocked by the customers network.

During times when my BlackBerry was down I switched sim cards to the Nokia as a backup phone – email could be setup easily and I could get on with the job. Now that I’ve moved to Android, the BlackBerry will not be used as a backup phone – it’s useless without having to login to the BIS portal and reconfigure accounts – I’m not prepared to do that every time so the Nokia will stay as my backup.

Facebook

BlackBerry have a Facebook app so I thought I might as well add my account. Sounds like a good idea right? I configure FB to only get alerts when someone sends me a message, but when I did get a message and go to the FB app – it takes forever to load and finally get to the message. Then there’s the pictures, on such a small screen what’s the point? It uses more bandwidth and I can’t see them anyway.

It’s junk, that’s all I’m going to say. I actually tried other apps that gave me FB access but then I encountered the other problem the Pearl has with apps…

Memory

My biggest bugbear about the Pearl. Out of the box the Pearl is quick yes, but install one too many additional apps (that means more than 2 or 3) and the Pearl will start to feel sluggish. Why? Because you just reached the 64mb memory limit, delete some emails and sms or you’re screwed! But don’t worry there’s an app that will help you manage that by flushing all your cache etc… Only trouble is that app will take up 1 slot that another app could have had instead!

Of course, you can expand the memory card up to 8gb, but you can’t install apps or even emails or cache on it. But at least I can store images… taken with… a 2.0mp camera, which means I’ll never fill up the wasted space on that card.

PC Connectivity

OK maybe this is going to be unfair because most phones have some kind of problems like this. As soon as you plug the BB in, you may only want to charge but the SSD card is no longer accessible. What’s worse is my data port has become really loose recently and I have to place the Pearl in an undisturbable position in order to keep the connection active. Why can’t the Pearl be told to behave like charging, not media card access?

Furthermore why no support for the Linux desktop? Sure other phone makers may be guilty of this too, but it does seem easier to find workarounds or partial support for the others, BlackBerry seems to totally ignore Linux.

Small Screen (Pearl Models)

Just one word – email. Ok maybe 2 words: html emails. 3? long html emails. I should have known. This should have been the giveaway I wouldn’t be satisfied long-term. After a 2.8′ N96 screen I should have made the vow never to go back. I’ve learned my lesson. I have a Motorola Milestone now.

Themes

The default themes are trying to be too… Windows XP. The carrier themes are not much better. Furthermore installing new, better themes takes up valuable memory space and you can’t delete the defaults without hacking it. Lame all round.

Security Policy

Sure BlackBerries are secure and they are corporate friendly. So corporate friendly in fact, to the detriment of the user and owner. I would sometimes need to plug my BB into a clients network machine to charge the battery. Trouble is these are XP machines and as customary they will pop up detecting new hardware.* It just so happened that BB Desktop Manager was installed by stealth on the machine I was using when I accidentally clicked for Windows to install the new hardware rather than ignore.

Installing the hardware and drivers allowed my clients corporate BB Security policy to be automatically installed on my Pearl without any warning or permissions given whatsoever. My BB previously didn’t have a security policy in place because our consultancy doesn’t have a centralised system. However my phone was suddenly locked out from allowing me to make all kinds of changes.

I had to find a crack on the tubes, download this and run it to reflash my BB. I lost my data despite backing up with my own Desktop Manager for some reason. Never again.

*Yes, I am now aware you can disable new hardware detection through the device manager on Windows. This shouldn’t have happened without consent though.

Browser

It’s just crap. Oh sure I installed Opera (until I ran out of memory), but BlackBerry refuses OTA installs through Opera which renders it only half as useful.

…And finally

OK, so maybe you would say to someone like me that my experience of BlackBerry got burned by the Pearl – I didn’t get to fully appreciate the large screen, the GPSr, the full qwerty keyboard or the memory(?). But the fact remains is that if RIM want to introduce people to BlackBerry, this is not the phone to try it on. Instead it would be better sticking with the larger models – this way when someone does make the leap they won’t make some half-assed leap like I did and taint the brand.

For all I know the full size models are better, but I’m already put off by the BIS email, the lack of control and the OS itself, I’m no longer intrigued at what RIM have to offer. Besides I’m really loving Android right now – I can’t imagine RIM ever coming near to competing with the open platform.

Curious Problem with Cork City Locale Geocaching Pocket Query

If you’re a premium member with Groundspeak’s geocaching.com then you will be aware of the ability to create pocket queries. These are really useful for throwing up to 1000 waypoints onto your GPSr for a days, or even a holidays caching.

As some of you know we were in Ireland recently (the reason for lack of posts) and I decided to take advantage of Stena Ferries free satellite wifi on the boat. I set a PQ for Cork and waited for it to build. When the query was ready I saved as usual to my shared Dropbox folder and then attached my Garmin 60CSx but despite loading fine onto my CacheBerry – the PQ just wouldn’y upload to the Garmin.

Puzzled, I tried an older PQ and verified that my script was working, as well as the Garmin was not having some kind of software fault. Next most obvious thing that occurred to me was perhaps the file was corrupted during download, after all it was a wireless connection via satellite on a moving ferry. I tested this theory by downloading the PQ again. Then I downloaded one I’d created earlier. The earlier one (Watford) worked, the Cork didn’t.

Then I decided to test the website PQ builder itself – maybe there was a technical problem. I checked the forums but there was nothing reported, so I posted a thread which didn’t go anywhere. I then tried creating an entirely new PQ of Leicester (never run before). I downloaded and Leicester loaded up onto my GPS no problem.

So there was something local to Cork which was borking my PQ which had to be in the file itself. I didn’t have much time left so I tried a splicing the file with my newly created Leicester PQ. I opened up the GPX file and chopped out the header:

<?xml version="1.0" encoding="utf-8"?>
<gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 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>Cork</name>
<desc>Geocache file generated by Groundspeak</desc>
<author>Groundspeak</author>
<email>contact@groundspeak.com</email>
<time>2010-06-16T03:12:46.2642819Z</time>
<keywords>cache, geocache, groundspeak</keywords>
<bounds minlat="51.551967" minlon="-9.37105" maxlat="52.428967" maxlon="-7.593717" />
<?xml version="1.0" encoding="utf-8"?><gpx xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 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>Cork</name>  <desc>Geocache file generated by Groundspeak</desc>  <author>Groundspeak</author>  <email>contact@groundspeak.com</email>  <time>2010-06-16T03:12:46.2642819Z</time>  <keywords>cache, geocache, groundspeak</keywords>  <bounds minlat="51.551967" minlon="-9.37105" maxlat="52.428967" maxlon="-7.593717" />

and footer:

</gpx>

I then copied the remaining xml and pasted it below the header in the Leicester PQ, then saved this and zipped it back up.

I ran my script and and uploaded it to my 60CSx – it worked!

I can’t see anything wrong with the header info above but this is where the error seems to lie. Maybe it’s something to do with the coordinates in the boundary tag, or perhaps some hidden character I missed. Does anyone more technical in both xml and WGS84 Datum than me have an idea?

Oddly enough, subsequent PQs for Cork after we arrived worked too.

The Best Dock Application In The World? Probably…

With apologies to Carlsberg.

I upgraded to Ubuntu Lucid last month and already, again, my desktop is starting to look vastly different from previous incarnations. Up till recently I had been using Cairo Dock, which is a damn find dock, but whilst looking for something completely different I happened upon a blog post by Tech Drive-In which caused me to try out Docky.

Having installed it, I can testify to it’s ease of use and simplicity. What’s more is the simplicity doesn’t kill it. It’s very easy to add icons and widgets – docklets and helpers as well as configure size and theme. Admittedly the list of docklets are looking a little bare right now – hopefully that will change.

One thing it has that I’ve not seen in other docks is the ability to switch to panel mode – this stretches out the dock to the borders and causes it to behave like a rather stylish panel which I like a lot. This is great for people who like the idea of docks but find using them slightly more cumbersome.

It’s also less buggy and intrusive than some of the other dock applications I’ve used. Cairo is pretty good but sometimes it feels a little in the way, and the auto-hide feature can be a little too sensitive. Docky’s autohide in comparison is much more stable and non-intrusive – it can be set to dodge either active or all windows.

One thing that Docky lacks is the ability to customise how your icons react on hover and click. The only option right now is zoom, which also doesn’t work in panel mode. It’s not a bother for me because after a while of using a Mac-like dock you lose interest in how many times the icon flashes.

The other very, very slight niggle is the Docky settings icon which appears permanently and immovable on the left-hand side of the bar – I don’t see a way to remove it. It’s just a slight niggle, but in panel mode it takes the place of where the logical app menu would normally appear. Not a problem for me but maybe for Linux newbies.

Other than that, is it the best dock app in the world? Not sure, but it’s the best I’ve used so far, for it’s simplicity and non-intrusiveness. Download Docky from Launchpad or check your package manager – I installed it from Ubuntu Software Centre.