I was hacking on a PhoneGap app yesterday, and at one point the deviceready event stopped firing. Poked around and discovered that phonegap.js actually redefines document.addEventListener with its own custom version. My problem was that I was attaching the event listener before I loaded phonegap.js … which meant I never called their custom addEventListener and hence never got the event.
I got the idea to use my Google Latitude history to fill in missing GPS data for pictures I take on my DSLR. I use Aperture, and the free Maperture Pro has the ability to import KML files, but the output of the Latitude KML download wouldn’t work. After some digging, I realized that Latitude doesn’t insert proper timestamp elements in the KML output. I hacked up this ruby script to parse the description elements (which contain the full timestamp) and insert the actual timestamp elements.
Caveat: the Latitude data is not great… but it’s usually better than nothing.
#!/bin/bash
# This script should be run from within the directory with the wav files.
# First, create the empty tree under a new "build" directory
# (the name "build" is completely arbitrary here)
mkdir -p build/usr/bin
# Put the sounds in the sounds directory
cp -v degrib/src/degrib/degrib build/usr/bin
# move into the build directory, make a docs directory
cd build
mkdir -p usr/share/doc/degrib
# write the README file
cat > usr/share/doc/degrib/README control
Description: degrib from the NWS.
more info: http://www.nws.noaa.gov/mdl/degrib/
END
# Setting this environment variable fixes Apple's modified GNU tar so that
# it won't make dot-underscore AppleDouble files. Google it for details...
export COPY_EXTENDED_ATTRIBUTES_DISABLE=1
# create the data tarball
# (the tar options "czvf" mean create, zip, verbose, and filename.)
tar czvf data.tar.gz usr/bin/ usr/share/doc/
# create the control tarball
tar czvf control.tar.gz control
# create the debian-binary file
echo 2.0 > debian-binary
# create the ar (deb) archive
ar -r degrib-amd64.deb debian-binary control.tar.gz data.tar.gz
# move the new deb up a directory
mv degrib-amd64.deb ..
# remove the tarballs, and cd back up to where we started
rm data.tar.gz control.tar.gz
cd ..