Flyover maps in ConnectStats 2.5

Screen Shot 2015-10-31 at 09.36.24I recently saw an article on iOS development, explaining the maps features available to developers. I had never realised it was possible to enable in an app the 3d views you see in the apple Map app. A little bit of fiddling later and you can now see your course in gorgeous 3d views if you have an iPhone that supports it and your city is covered by the feature.

I haven’t really yet figured out how it can help you with training or analysing your data better, but it looks great and is a pretty neat way to relive some of your runs or rides, so here it is available in connectstats 2.5 (under review by apple at the time of this writing)

How to

Screen Shot 2015-10-31 at 09.43.15To enable it, simply go to the detail page, switch to the satellite view and tap anywhere on the map, it will then show you the closest point on your course in 3d. You can then use the normal controls of the map to zoom or move around.

Small Gallery

You can see here a few samples from recent runs. Enjoy!

 

Screen Shot 2015-10-31 at 09.39.02Screen Shot 2015-10-31 at 09.45.29Screen Shot 2015-10-31 at 09.44.27

ConnectStats Cache Management

ConnectStats downloads activity data from the web service of your choice, and then maintains a local cache. This is for speed, to allows for offline drilling of the data and minimise bandwidth usage.

When you do a refresh, ConnectStats will try to download the only summary information it needs to display a summary and when you try to open an activity details, it will then only download and cache these details. This allows for faster initial download and also minimise bandwidth usage as it only downloads what it needs once.

There are quite a few options to help manage the cache in the Settings Tab, under Current Profile. You can find information about creating profile here.

Delete Activities or Profile

Usually when you do a refresh of the activities in the app, it will try to detect if some activity were removed from the remote service and remove them from the local cache. It will also try to check if anything was changed on the remote service. But it only does that for the last 20 or so activities. If you have a lot of activities it would be too slow to check too many each time.

If you feel the cache is very inconsistent you can delete some activities from the local cache, which will force the app to download a fresh version. The 3 options when you select Delete Activities or Profile are:

  • Delete Profile: this will delete the whole profile, including associated settings and all the cached activities
  • Delete Some Activities: this will delete all the activities in the local cache from the most recent until the activity you have currently selected
  • Delete All Activities: this will delete all the activities in the local cache but preserve your profile settings

Note that all these functions only delete activities in the local cache, but never on the remote service

Compute Best for more old Activities

ConnectStats beside maintaining a cache of the activity data from the remote service, also store some of it’s own data. Specifically for now it maintains your best overall speed and heart rate for given distance or time. This is somewhat slow to calculate, so it only calculates it when you look at an activity. Given the data is more interesting when you look at it over longer period of time, this option lets you force a calculation over a set of older activities. This can be useful to get the graph in the summary stats page to account for more activity. It can be a bit slow, but it’s also safe to interrupt and restart. It will always compute about 15 activities worth of analysis. Note it will not force a download of the details of an activity but only analyses activities for which the details cache has been downloaded.

This can be useful if you have a lot of activities already downloaded and want to make sure the summary stats are takes everything into account.

Force Download Details

This option allows you to force the app to download details for 30 activities. As mentioned earlier, initially it only downloads in the cache summary information and the details information on demand (when you look at an activity). This allows you to force the download of many activities without opening them all by one. If you start the app when your history on the remote service is quite long, it lets you download and run the extra analysis.

Force Reload Old Activities

When you refresh, ConnectStats only checks changes and the summary for the 20 most recent activities. This option allows you to force the app to checks every activity in your history. It should then pick up changes on older activities as well as older activities deleted on the service.

View and Manage Cache

This will show you the break down of the files in the local cache and the space it takes on the disk. You can press on a category to clear the files of that type. But I don’t recommend you do that.

What the Summary Stats say about September

Looking at the summary stats September turned out a pretty good month for my running.

Looking at the fitness vs fatigue graph section corresponding to september, the line stayed pretty constant, showing I kept my training level pretty constant. Later in the month I pushed a bit more as the peak in fatigue shows.

Simulator_Screen_Shot_17_Oct_2015__21_12_12In the bottom graph, the thicker black line shows the best speed achieved for given distances in september. I achieved my best speed of the year for all distance between 6km and 13km. You can see that as the thicker black line for september is the minimum for the year, and I did quite significantly better in speed than august.

Simulator_Screen_Shot_17_Oct_2015__21_12_27Meanwhile the best heart rate profile shows that this was achieved without pushing the heart rate more than the other months. Actually, the september line (black thick line) stays quite below the max of the year for any duration. This is pretty satisfying: better speed without pushing  much more…

 

What’s new in ConnectStats 2.3

Universal Links

Now, it will be possible to directly open the app in a specific page from an article. It will make it easier for people to navigate to a corresponding page from a post or help on the web. For example this should open the summary page.

Force Touch

For those lucky iPhone 6s owners, you can have quick access to stats, refresh from the home page and you can have preview of an activity without opening it by pressing hard on the main activity list.

Cache Management

A few more options to manage the local cache, and an option to display an icon to quickly identify what activities were downloaded or not.

Few more months to catch up

Another year of running comes to a close. How did I do this year so far?

Year to Date

1443360891_thumb.pngThe Year to Date graph gives me a good incentive to keep the weekly running distance high. I have so far run 949km  this year, about 80km behind last year at the same date. I had a slow beginning of the year compared to the previous one, but since April, I did pretty well.

So if I keep the momentum of the last few months, I maybe able to catch up my running distance of 2014. The year 2012 is still quite a way ahead, though…

Monthly Totals

1443361239_full.pngTo better evaluate my chances, let’s look at how much I ran last year in the last few months. In the monthly stats over the last year, I can see that november and december in 2014 were on the low side with less than 90km each, so hopefully if I keep at it, I’ll catch up! I finish september close to 150km…

ConnectStats and iOS 9

ConnectStats will take advantage of a few new features of iOS 9 with version 2.2.

Spotlight Search

Activities you looked at will show up in spotlight searches. So if for example you type run london in the spotlight search, it should shows activities you ran in london. Note that it will not search your whole activities history, but only the activities you opened in the last few months. To do search on the whole history you can still do that with the search function in the activity list of ConnectStats

Dynamic Fonts

Ok, technically this was already available in iOS 8, but never got around to implement it. So now, ConnectStats will use the system font, the new San Francisco font on iOS 9 and the size will be adjusted with the Dynamic Type settings of your phone. Very personally I prefer the iOS 8 font, but I feel it’s the right thing to update ConnectStats to follow the system default font. There will still be an option in the settings to revert to the old font if you really prefer that.

Optimized Binary and Asset

ConnectStats asset have been reorganised to potentially benefit from the new app thinning for the app store that should result in smaller size binaries and download.

Website change

So today this website is hosted by a new service. The intention was that it would be transparent, but it took a bit of time to remap the domain name to the new host and it resulted in quite few temporary outage.

After many years as a loyal customer to yahoo for the hosting of this website, I switched away because the iOS 9 release is coming and Apple introduced a change to improve the security of interaction between apps and website. It will now require a site with a secure connection (https). Yahoo unfortunately didn’t support https in a way that enabled me to support some of the new features of iOS 9 I intend to leverage.

It is possible to continue to interact with an insecure website from an app by registering an exception, but two main reason led me to make the change:

  1. It’s just the right thing to do. There are a few informations sent from the app to the website when you send a bug report or use google earth, and it’s just better to secure it going forward.
  2. It will allow some interesting interaction between the web and the iOS9 version of the app, where by I could write an explanation of a screen and link it directly to opening the app on your device with the matching report or graph. Given some of the graphs and analysis are a bit involved and I didn’t figure out a nice way to integrate a help on a small screen like the phone, I am hoping this will be quite helpful for people to have more fun with the app.

Note that the secure uploads and the new features I mentioned above will not likely be included in the first version for iOS9, but hopefully shortly after.

 

How to track the non reproducible bug in version 2.1

So, version 2.1 was crashing for quite a few users on startup. Obviously the app wasn’t crashing for me in any of my tests.

First line of defence when crashes happens is to ask the user what they were doing and try to replicate the same action to see if I can recreate the crash. But here they weren’t doing anything it wasn’t starting.

Second is to look for patterns in the crash. The first few users reporting the issue were all using an iPad. There are a few differences between the iPhone and the iPad, mainly that the iPad displays an activity detail at the same time as the activity list. This can result in some difference in logic and makes the startup on iPad marginally more prone to issues. This can lead to hard to reproduce bugs too as it is a function of the type of activity the user would load on startup (the last one downloaded)

Another help is the crash report from apple. In this case, they were very few and reporting crash in location that are not triggered at start up or inside apple libraries. So not helpful to pinpoint the problem.

Some users affected by the issue kindly sent me their activity data so I could try to see if the problem was linked to their specific activities data. It wasn’t, I could start the app with their data fine.

This leaves one other possibility, a thread concurrency issue. This can be really random, and a function of both the speed of the hardware and the exact activities you have. ConnectStats is quite multi-threaded to try to keep the app responsive as many calculations are performed in parallel. So it is possible that some of this parallel activity result in a collision or some instructions run too early (when required data is not ready).

I try to be very careful on collision conditions and to make the code robust to data not being ready. In version 2.1, in order to optimise the startup, I had done a clean up of all the notifications between events in the app to limit them to the minimum needed. So likely the problem was linked to that: issue affecting random users, not a logic issue (users data didn’t let me reproduce it), but the issue was systematic for some users: so this gives another hint. The one issue that can exhibit these symptoms is if you trigger a User Interface event not from the thread dedicated to the UI (main thread).

I did a review of all the events that happen on start up and found one that, in the clean up of 2.1, wasn’t not forcefully directed to that main thread…

So while I couldn’t reproduce, I feel strongly that this must be the issue:

  • linked to some change I made in version 2.1,
  • random: depends of when precisely event get triggered
  • systematic for a given user: for a set of hardware speed and size of data, always happens or not

I submitted a fix for that event issue to apple, let’s cross fingers until version 2.1.1 is approved by apple and hope the issue is indeed resolved. I requested an expedited review, but it’s not always granted.

Frustrations of a botched release

I try to release ConnectStats regularly. Once in a while, as today, I push an update with an issue. I have been receiving a lot of bug reports today from users who can’t start the app after last night release.

I know it’s quite frustrating for users, and it is for me as well. In this case so far it has been impossible for me to reproduce the issue.

So as I try to sort it out, I decided to write a bit about the testing and debugging of ConnectStats

Before the problem happens

Automatted Testing

First I wrote a bunch of tests that verify the very basic functionality of the app at the lowest level. For example it checks that all the unit conversions continue to be correct, that the statistics computation continue as expected, etc, etc

I have also built a testing sister app to ConnectStats that share most of the code, but run a bunch of test replicating the download process, or statistics on saved samples of activities.

Device Testing

While the automated testing is critical, most of the issues, like the one today I suspect are due to subtle interaction between different aspect of the app, when run with different set of activities or different devices.

Given I develop ConnectStats alone in my free time, this kind of testing is fairly limited for me. I mostly test with my phone and my activities, as well as a secondary device. For example I do not use an iPad, so issues on iPad are more likely to appear as I don’t have as much opportunity to try these.

Once a problem happens

Bug Reports

Typically, the first thing that happens is I’ll start receiving some bug report. The bug report contains workflow information and diagnostic collected as the app executes. It’s only as good as what I anticipated to record. But quite a few bug can be understood this way, especially when people email me and answer a few questions about what they were doing or how to reproduce the problem.

Apple Crash Reports

When as today, a large amount of people email me that the app crash on startup it’s much harder, as the log does not contain any useful information. I can also see some crash report collected by apple, but they take a while to appear. So right now I just need to wait and hope that the information in apple’s report will help me.

Bad Reviews

Of course the next thing that happens, is that ConnectStats will start receiving bad reviews. It’s basically a race, fix it before too many bad reviews accumulate…

 

Year to date or Month to date statistics

Version 2.1 of ConnectStats introduces the ability to see year to date or month to date statistics. The yearly cumulative graph was already giving a good idea of how well you were doing this year versus the last, but now you can see the full stats you reached at the same point of last year.

Below for example you can see that in 2015, so far I ran 758km, while on the full year of 2014 I ran 1356km. If you press on the button All, you get to the YTD screen, that shows that in 2014 at the same point in the year as today (August), I had run 913km.

IMG_1664 IMG_1665

In the monthly view, the graph is slightly different, the full month bar is shown, but the blue shows how much for each month was reached at the same point in the month, here around august 15, or about half way through the month.

 

IMG_1666 IMG_1667