Wanderings uses iCloud’s private databases as a backing store for data. I wanted to delete some data from them and it is terribly, terribly slow. Roughly 40ms / record.
If the data is 100 records it takes 4000-5000ms to complete. 10 records takes about 400-500ms. So much for batch deletion.
Exacerbating this we had a bug where I was trying to delete 60,000 records at once. This hangs for a very long time and then returns with an error that the operation is too big. Also there was a second bug where we were executing several requests in parallel. This does seem to work but isn’t a good idea. Chrome crashes outright (Oh, Snap) if 26 requests are running in parallel. Firefox didn’t crash but other bad things happened.
So now I’m deleting 60,000 records, 100 at a time every 5 seconds. That’ll be most of an hour.
Working on adding data import to my Wanderings project so I can bring in data from other trackers. I have 6 years of data from OpenPaths. And when I imported it the first time I got so much joy out of seeing it again. Particularly trips to India and France.
Our Wanderings project uploads location fixes with the iOS significant location changes APIs. It includes an accuracy number, distance in meters, and occasionally we get points with accuracies > 1000m. We’re about to stop displaying those, but before I do here’s what the data looks like:
That shows most points have an accuracy of 10m, a significant number have an accuracy of 65m, and a few have 1414m. This histogram tool is misleading, there are also 15 points with an accuracy > 1414m. (Shout out to 7094 meters; you did your best, little iPhone).
If I had to guess, I’d say 1414m means “location from a single cell tower” and 65m means “location from a single wifi access point”. But who knows. It’s possible to ask the iPhone to give you more accurate fixes, we’re deliberately only using the most low power location monitoring to conserve battery life.
I wanted to do some simple unit testing in a Browser context; no NodeJS. I decided to use Mocha and Chai, then found it remarkably difficult to figure out how to just get it working without a bunch of complicated setup.
I finally figured it out: demo here. It’s pretty simple really, grab the CSS and JS from a CDN, then write the tests.
Boy there’s a lot of stuff in these frameworks. Mocha + Chai is literally 26k lines of code, 820k bytes. Minified it’s more like 300k but that’s still huge. I see why folks like tape instead. I wasn’t sure tape really supports running in a browser though.
My friend Brad and I launched Wanderings, a simple location tracker app for iPhone and Web. Put it on your phone and forget about it, come back a few weeks later to have a nice heatmap of where you’ve been. It was inspired by the late lamented OpenPaths. See also Google Timeline, which is much fancier but doesn’t have a heatmap.
I was inspired to start working on this while traveling in Berlin. I just want to know where I’ve been, you know? I don’t know anything about building iPhone apps but fortunately Brad does.
Some of the interesting stuff we use:
We have lots of ideas for future features. Some particular ideas I’m excited to do:
- Import of data from other sources
- Some sort of time-based visualization
- Android app (not me!)
It’s a modest project but I’m proud of it.
Garrett Dash Nelson has a lovely visualization of snowfall for 2017-2018; take a look! His code is very simple. A Python script to download data from NOAA, then some bits of shell scripts using GDAL to reproject, hill shade, and convert to an animated GIF.
I wanted to see what this treatment would look like over years so I did my own little thing based on his. Here’s the image processing script I used
for y in 2014 2015 2016 2017 2018; do
gdalwarp -t_srs "EPSG:5069" -srcnodata "-99999" sfav2*to_$y*.tif $d-warped.tif
gdaldem hillshade -z 1500 $d-warped.tif $d-hillshade.tif
gdal_translate -of JPEG $d-hillshade.tif $d-hillshade.jpg
And the images below. Starting at 2013-2014, and the final image is just a partial year of 2017-today. It’s not a great result TBH; the years end up looking pretty much the same and not that different from an altitude graph. In California you can’t see the low snowfall years of 2014-2015 and 2015-2016 vs the high snowfall 2016-2017, for instance.
Some notes on a survey of what all I find in IndexedDB storage in Firefox. That’s something like cookies, a way for a website to store data on your computer, only in this case it’s a fancy NoSQL database. I’m using it myself and have found Firefox’s Storage Inspector unreliable and limited, so I built my own tool to look through my profile directory and tell me what it finds.
Example report from the tool:
https://twitter.com dm_typeahead 20160920 98304
users name_lowercase, screen_name
https://www.smithsonianmag.com ONE_SIGNAL_SDK_DB 1 49152
https://www.theguardian.com test 1 49152
That tells me
- Twitter has a database called “dm_typeahead” with three tables; conversations, metadata, and users. Users has two columns, name_lowercase and screen_name. It has a version string of “20160920” and was 98304 bytes big when last vacuumed.
- Smithsonian is using some SDK to create some tables about notifications, but they contain no columns at all.
- The Guardian created a database named “test” with no tables at all.
So what’d I find?
- A bunch of empty “test” databases, presumably testing the browser can do IndexedDB at all. This may be for detecting if the browser is in private mode.
- A bunch of sites use One Signal, which I guess manages those horrible HTML5 website notifications that spam pop ups. I’m religious about never allowing that, which is probably why I have no data.
- Several sites using Augur, a web tracking system.
- Things called LPSecureStorage and fibet; trackers?
- archive.org seems to be storing PC emulator state
- Amazon is caching a lot of data about books, maybe for Kindle Cloud?
- Twitter has extensive app-specific usage
- WordPress’ Calypso
- broadwayworld.com, a pretty spammy site, has a database named J7bhwj9e with some user tracking stats.
- ft.com has a bunch of databases named next:ads-v1 and next:image-v1 and the like
- wired.com has something called workbox.
The tool I built is in this gist.