Thursday, November 03, 2011

Uploading Old Polar HRM Data to the Polar Personal Trainer Website

(Update 30th April 2012: Newer version of the HRMUploader jar that fixes, hopefully, altitude data.)

I'm a keen cyclist and have used a Heart Rate Monitor of various descriptions for a number of years. I've religiously downloaded this data onto the PC and stored it in the various applications that come with the monitor. Not that I do anything with it, though I did get part way through writing an application to store the data in a relational database and then display multiple rides overlaid on one another for visual comparison. Anyway, I digress.

More recently I've bought Polar HRMs, they are great products with useful features for cycling. Years ago I wrote a Java application that converted the 'other' HRM files to the Polar format, so that all rides and associated HRM data could be shown in the latest Polar application on the PC.

Polar have caught onto the web, and have launched a site that allows you to transfer your data from the HRM to the web. Great for current stuff, but what about all those old files I have? In their wisdom, Polar have not released a tool that allows me to upload the data I've got on my PC.

There are a few people around who would, like me, prefer to have all their data on the web, and want to upload their old data. Being a professional Java developer, I thought it would be a doddle to create a Java Application that interfaced with the Polar web site and allowed me to transfer my data. And, in general, it was. So here is a Java application that does this. It's a little crude, but does the job.

Just run it with:

java -jar HRMUploader.jar


Enter your Polar Personal Trainer userid and password. If you log in successfully, then you will see your name in the lower status pane.

Browse to your polar .hrm files and select one or more (try it with one first :) ) The application will check the site to see if it's already uploaded a file for this date. If it has, it will put a check mark against the file, if it hasn't then use the upload button to upload the file. It won't upload a file that is already on the site, you will have to delete it from the site if you want to resend it.

There are no guarantees that this will work for you. Might be worth opening another 'test' account on the Polar site and trying it out there first. Whilst you can select many files to upload at once, it might be worth limiting it to 10 or so at a time - the Polar site might choke on too many. I just tried it with about 70 and it took a while, but seemed to work.

Regarding calories expended.

This value is read from the associated PDD file and needs to be in the same directory as your HRM file.  There's one PDD file for each day, so you could have many HRM files that reference the same PDD if you do multiple exercises per day.  In these cases, you are unlikely to be able to read the PDD as it will not have the same name as the HRM file.  Unfortunately, when I originally wrote the HRMUploader, I didn't realise I needed to read the PDD too.  Ideally I need to change the application to read the PDD first,  since this contains all the HRM file names.  However, I'm not planning to do this any time soon, sorry.

Altitude data

Altitude data is sent to the Polar site in 'feet'.  This means that if you are using meters in your HRM file, then the conversion to and from feet could result in a rounding error.

Furthermore, I seem to recall a bug in the HRM files that stores altitude as feet, even though the file is supposed to be metric.  Send me a HRM file example if you suspect the altitude is being uploaded incorrectly.


At some point I'd like to host this on the Google Java App Server, but they've done some funny stuff with Java and restricted various classes in the default 'JRE'. It means that some stuff which should work under Java's WORA mantra doesn't.

The application uses various libraries from Apache, Google and Castor. All their respective rights are recognised. The software is supplied 'as-is' and you use it at your own risk. You did back that data up, right?

Saturday, February 12, 2011

Tune Announcer - Scrobble Links

Noticed with the latest Songbird release for Android they support multiple Scrobble clients but broadcast them ALL!

Whilst it's probably a bug, as no other player does this, I've modified Tune Announcer to let the user select which ones to receive.  Mainly because I want to use Songbird.

However, it took me a while to find which scrobble broadcasts did what (note to self: Code comments are useful), so here is a list of the scrobble sites:

There's also the default clients (Android and HTC),no info on these other than they broadcast the following:

<action android:name="com.android.music.playstatechanged" />
<action android:name="com.android.music.metachanged" />
<action android:name="com.htc.music.metachanged" />
<action android:name="com.htc.music.playbackcomplete" />
<action android:name="com.htc.music.playstatechanged" />

They are very similar to the others in content.




Sunday, January 30, 2011

Gestures Download File

Users of Contact Lookup can create their own gestures file.  See this blog post for more details.

To get the pre-built file, then click this link.


(Apologies for bouncing you from one blog to another, but this blog has analytics so I can track how much interest there is in gestures).

Tuesday, December 28, 2010

Customising Google Search

Spam Sites in Search

How many times have you clicked on a Google search result only to be presented with a spam site that just wraps other site content with ads?  I find technical searches on Google are littered with this dross.  It's pissed me off enough to look at using Bing and Bing is far better at hiding this crap from the search list.

I tried this chrome extension, and whilst the idea is sound, it doesn't work particularly well with instant search.

However, there is another option.  Use a customised Google Search Site.  You can read more here on how to set this up.  Whilst the screen looks very basic, it does work at removing dross sites, although you do need to manually blacklist each one 'as you find it'.

You can even link this into chrome to be the default search engine.  You'll need to tweak a few things in the URL to get it to work, specifically adding %s to indicate where the search terms need to go.  Want dated searches?  Add &tbs=qdr:y to get results in the last year and add the date select to your searches.

So finally, I have a Google search that can filter out those spastic sites.

Wednesday, December 15, 2010

Moving to WordPress

The Android posts have moved over to WordPress, mainly to keep the development off the personal blog, but also because WordPress is so much better at editing complicated pages with images.  Blogger seems to have been dumbed down :-(

I might see how the Google Sites stuff works, as I need some better control over the CSS - oh, wait, they don't allow that either :-(

Contact Search Updated

Works with OS 1.6 devices

The latest changes to Contact Search have been around the Database access classes to allow 1.6 devices to work.

For OS2.0, Google improved the framework around data access for Contacts and these are not compatible with 1.6.  It was a large piece of work to write the 1.6 data access code and refactor the contact searching to be able to run both.

Coming to the Market near you soon ;-)

Tuesday, December 14, 2010

Contact Search Updated

Contact Search has been updated to v1.1.0

This version

  • has options to select a simple search, or a multi-word search.
  • can configure the categories you want to search, such as name and address only. 
  • now prompts you the first time you install to set the search settings.

Tuesday, November 30, 2010

Contact Search v1.1.0


THIS POST IS NO LONGER BEING UPDATED

CLICK HERE TO SEE THE REPLACEMENT BLOG

Contact Search

Contact search works with the standard Google search facility on your Android handset to do a complete search of your contacts.

Whilst the Android OS includes a native contacts search it is, surprisingly for a search company, very limited. If you try search for part of a phone number or address it will not find it.

Contact search, however, will find it. It will search through all the contact fields to find a match for the entry you input.

Be sure to read the following, as there is useful information on getting the best out of the search process.


Installation

Install Contact Search as you would any other application from the Android market.

As of v1.1.0 it will prompt you to configure the global search settings, and direct you straight to step 3), below.  If you decide not to set the settings at installation, then you can still follow these instructions to add contact search as a global search provider.


To use contact search, you need to enable it from the search menu. Follow these steps:


1. From the home screen, press the 'search' button.



2. From the search screen, press the 'menu' button and select the 'Search Settings' menu.


3. From the search settings, select the 'Searchable Items' option.




4. From the searchable items, ensure that 'Contact Search' is selected.

5. You can now enter contact search information, and find it!


Search modes

There are two search modes:

Simple search

The phrase entered is searched for in each of the contacts field exactly as written.  For example, if you search for 'Curly Wurly' then it will only find contacts that have 'Curly Wurly' in them.  (Probably not many, unless you work at Cadburys.)

Multi-word search (OR)

This search mode will look for contacts that have any of the phrases in them.  For eample, if you search for 'Curly Wurly' if will find all contacts that have 'Curly' OR 'Wurly'  in them.  (Now you'll find Cadburys and hairdressers.)


Search tips

The search ranking that Google uses on the Android handset means that Contact Searches may not show up in a basic search. See the end of this page for details on the ranking process .

To ensure that contact details are searched for follow the tips below:

  • Search only on contact details by clicking the search icon and selecting the Contact Search icon.
  • Reduce the number of contacts found by searching on full names or numbers
  • (v1.1.0) Simple search is slightly quicker than the multi-word search.
  • (v1.1.0) Reduce the number of search categories.  If you have not notes, then exclude this from the search.  you can always add it back again later.


Improvements

Here are some things I intend to implement to improve the search process:
  • Ability to have multiple search items, such as name and postcode.  Sort of done in v1.1.0 in that you can enter multiple search terms (currently OR based, but will be AND based too, later).
  • Use the pictures from contacts as icons in the search list, where applicable
  • Regular expression searching
  • Multi-word AND search, so it will find contacts with all phrases in a particular contact field
  • Multi-word searches that work across contact fields.  For example, a contact name and part of a number.  These are in different fields and could help narrow the search even more.
  • Searching for specific words across fields.  Might be implemented as an advanced search form.
  • Search within results to narrow down a search.

Search Performance

On an HTC Desire with Android OS2.2 I can search 250+ contacts in around 1.5 0.6 seconds.  The application now writes a small log file to the system log, so you can see and report this if you think it takes too long.

There is a free application called 'aLogCat' by Jefrey Blattman that can read the log files.  To check the log file, run a search, open aLogCat, press Menu->More->Bottom and look for a FullSearch log message like:

Found 34 records out of 2799 raw entries in 665ms

(Yikes, my 250 contacts are stored as 3K records!)

Changelog

  • 20101214 v1.1.0 New menu options to control the search more.  Can be used as a stand alone application.
  • 20101206 v1.0.3 Performance improvements to reduce number of records searched.
  • 20101205 v1.0.2 Added stats to logging.
  • 20101130 v1.0.1 Case insensitive search, thanks to Gint for the suggestion
  • 20101130 v1.0 Initial version