Saturday, March 03, 2018

An exciting (for me anyway) discovery

Well who’dathunkit!  A few days ago I tumbled across a spiffing App that has helped me to create what I think is my best yet CanalOmeter, which I will demonstrate for you further down the page..  For the non cognoscenti my canalOmeters are devices of my own invention that calculate distances and times from any points A to B along a canal.  The original low tech cardboard ones like this being held by my lovely assistant Simon Tortoise

are still handy , but they are fiddly to make and I’ve had a number of attempts to make a digital one – particularly ones which would work on a phone or a tablet.  First was  a spreadsheet version – a bit cumbersome, then one written in Python which worked very well but was unexciting in appearance and needed the Python language installed on the phone or tablet.  Now I’ve found out a way to create a user friendly Android app that does the job just the way I wanted.  Let me demonstrate with one I’ve done for the Grand Union stretching between Brentford and Braunston.  I call it GUSouth or GUS for short. Let’s imagine I am planning a trip from Fenny Stratford to Cassio Wharf

To the user it’s just an Android App like any other, it sits under an icon on your home screen or wherever and runs on native Android code.  Click the icon to launch it and and up pops this. (This is on my A5ish size Android tablet).  To save space I’ve cropped the screen shots just to show the essentials, just imagine the rest of he tablet /phone screen as blank.

Screenshot_20180303-100225

Here I’ve just started typing in Fenny Stratford and got as far as ‘fen’.  That’s enough - I press OK.

Up pops this list of matching places

Screenshot_20180303-100233

I choose Fenny Stratford Visitor Moorings by tapping it with my finger.  The next screen then appears

Screenshot_20180303-100438

Here I’ve again started typing in the place and after three letters (could be more or less) I hit OK and get another list

Screenshot_20180303-100455

I tap Cassio Wharf and up pops my result:

Screenshot_20180303-100520

Job’s a goodun.  I can then choose to go round again with other places or just stop.  I timed this whole exercise from clicking the App Icon to getting my result and it took 17 seconds.  There are a couple of other advantages.  For instance if you are passing under a bridge, just tap in it’s number eg. B167 or at a lock,say L75, as your from point.  Or how about this if I just type in Pub

Screenshot_20180303-101329

or I could bring up a list of water points or winding holes.

So what are the downsides?

1. It only works on one canal at a time.  It can’t plan routes through junctions like CanalPlan can

2. Accuracy of route timing is necessarily approximate.  I’ve used an average of 3.5 mph and 15 minutes per lock on this canal.  These times are always a rough guide, but experience shows that they’re near enough for journey planning.

3.  It’s still work in progress.  It seems pretty robust but I’m certain a new user could make it fall over easily enough. 

4. I can’t let you have one right now.  I’d have to put it on the Google Play Store first and I haven’t even  looked up how that is done..  Also the source of the base canal data isn’t mine. It’s extracted from CanalPlan whose creator Nick Atty has been very generous in letting me use it in the past but it’s his in essence.  I’ve just added a couple of words here and there such as “Pub” so I can produce lists like the one above.

5. It won’t run on iphone / ipad.  It’s Android only.

5. I could/ would give you my source code and let you install and compile your own, but you’d need a tiny bit of tech savvy. e.g. installing files on your phone or tablet. If you fancy a go, please ask.

So how have I done it?  Well, for me this is the exciting bit because it was remarkably easy, given a bit of coding skill.  I know virtually nothing of Android code development, but I stumbled across two apps that enabled me to put my first App together in a couple of hours. I had to write about 100 lines of   code, which as any programmer knows is not much at all.

The code is written in BASIC!.  Yes, BASIC! That exclamation mark is not for emphasis although it might as well be, as normal Basic is hardly flavour of the month among programmers these days, being thought of as pretty Mickey Mouse.  BASIC! is a version that comes as an Android App available on the Play Store and is more correctly called RFO Basic! developed by the Richard Feynman Observatory and is freely available.  I hadn’t used BASIC for years but this version is pretty damn good and as well as all the usual  number and string stuff it can use all the clever tricks of your Android device such as speech recognition, speech synthesis, camera operation, sensor reading and all that how’s yer father.  BASIC! is free on the Play Store.

Now comes the really clever bit.  There is a companion app called BASIC! Compiler, costing the princely sum of £2.99 if memory serves me right.  This just takes the BASIC! code wot you have writ and compiles it into  Java and on to an APK which is your finished Android App.  Just like that, you just press the button and off it goes.  It takes less than a minute.  Astonishingly for this type of App it seems to work first time every time.  I’m truly amazed at the wonderfulness of it.  My mind is buzzing with possibilities. Watch this space.

PS Just tried installing the finished app on my phone and it works fine. = and eagle eyed spotters will have noticed the typo in the Dolphin Pub – That’s been put right in the App now.  These things happen.

7 comments:

Carol said...

Sounds good Neil but there are pictures showing!

Unknown said...

Oooh thanks Carol, I've just republished with the pictures loaded a different way. Is it working now?

Herbie Neil said...

That last comment was from me, not Grace. Her google sign on seems to have grabbed my browser. Flippin' kids!

Giles said...

Hmm.

I'd wan to rework it using Python and javascript or php to serve a web page rather than code a platform specific app. You've seen what I did with a back-end to CanalPlanAC here: http://yourhelmsman.aegidian.org/trip.html

Carol said...

Got the pictures now Neil!

Herbie Neil said...

Aah Giles, no good having a web based app when you're out in the sticks down the Oxford canal without a signal and just passing under bridge xxx and wanting to know if you'll get to the pub in time. This is aimed at being as quick and simple as poss and purposely standalone. I do however marvel at how clever your thing is. Well done on that.
Neil

Llosgi said...

You clever thing you! Looks great.
Not quite as attractive as the earlier modelled version ;-)