MetPhoto
Mark E Taylor IT Consulting Limited

I have updated my CV with details of the skills I have recently been learning. Please take time to read. If you wish to contact me then you can do so here.

Written by: Mark on Saturday 28th April 2012 @ 11:58AM

Recently I have had some time on my hands to learn some new skills and polish some existing ones. Quite some time ago I created a small Perl application that read data from my WaterRower rowing machine. I have recently been practising my MySQL, PHP, HTML and CSS skills by publishing details of my recent rowing sessions. These recent updates have given me plenty of opportunity to improve the quality of the underlying code and learn some new tricks.

However I wanted to include some ‘live’ data on these pages. Currently the tables and charts are automatically created and uploaded when I manually run a PHP script. I only do this when I think I have set a new record. To create the tables and charts all I have to provide to the PHP script is a target distance, for example 7000m. The row in the table that shows the current record for the distance is automatically highlighted using a few lines of JQuery. While the process of creating the tables are charts is automated it is not ‘live’ or fully automatic. I wanted to improve this situation and learn a new skill at the same time.

Recently I have been learning a little about JQuery, JavaScript and HTML CANVAS. This lead me to look at what I could do with JSON. After researching the topic briefly I could see how it would fulfil my need. I have created some PHP scripts on my home server. These scripts run SQL queries, encode the result as JSON and then publish this data. The PHP scripts are only around a dozen lines long. Each script creates a JSON steam for each of the records I want to display. At this I am only display two records; total distance rowed this year and fastest average time over 1km.

To display this JSON data I have added additional PHP code in the rowing records page. This interrogates the JSON streams and extracts the relevant data.

In summary the system currently - as I am sure I will change it soon - works like this:

Data is captured from the WaterRower using a Perl script and stored in a MySQL database on my laptop.

The data is then automatically replicated (from my laptop) to another MySQL database hosted on my home server.

As required charts and tables are created by a PHP script and the resulting HTML and PNG files automatically FTP’d to my web site hosting service.

A few lines of JQuery are then used to hide and show the tables and charts. Some related JQuery code also highlights the record time in each table.

Finally I have created some JSON streams to allow some current data (live) to be displayed on the rowing records page.

Overall I am pretty pleased with the progress so far. The system is reasonably well architected. In particular I have separated the database and the presentation layers. I have plans to take the system further. In particular having the HTML record tables and PNG files created on my hosted web site; it would do this by using the JSON streams from my local home server. This ensures that I can secure the local MySQL server and continue to prevent remote connectivity to it.

(And I also wrote the simple blogging system that created this entry.)

Written by: Mark on Friday 27th April 2012 @ 11:04PM

Hi, everyone. Sorry I have not posted for a while. Other projects have taken me away.

Recently I have been adding to this web site. The 'Rowing records' page (see the menu on the left) has been fully updated. I appreciate it may not be a good 'fit' for this section of the web site - but it does at least show off my recent work. The bulk of the web page is created off-line on the Apple MacbookPro that captures data from my WaterRower rowing machine. (The WaterRower project is documented on the projects page. The data is collected in a MySQL database on the Mac. A PHP script is run on the Mac and reads this data, which then creates the charts and tables. The same script then uploads the images and the HTML files to my hosting server. Where they are embedded into the web page. I use JQuery to show and hide the images and the charts. Overall I am very pleased with the results.

Behind the scenes I have just started to create more sophisticated blog post editing pages. I am hoping to learn more about DOM scripting as a result.

Written by: Mark on Tuesday 17th April 2012 @ 10:16AM