Category Archives: computers

for the dedicated small audience

Discovered YouTube Channels and have subscribed to some niche programming like: DRIVE, a worthwhile video source if you happen to lust for cars like the GT3 cup car. These are all short works because there is only so much time in the day that one can spend consuming media. Here’s a representative piece on Lowriders from Motortrend .  They are cinematic and skillfully done in the artistic vein of Top Gear — which has its own channel as well.  There are numerous categories from which to choose should automobilia not be your thing. You can immerse in Kinetic Art or Surfing or… whatever your interest.
Unfortunately you can not replicate the YouTube channel subscription experience in your living room on your HDTV.  Not yet.  A few 3rd parties using YouTube APIs are trying and some have tried but Google has locked down this functionality. It is probable that Google is seeking a monetization model.
TiVo has “Web Videos“, some of them in HD, that showcase the Internet connected TV. Example:  The excellent production of CNET video podcasts  offerings can be viewed via YouTube Channel but on your high definition TV via TiVo Season Pass the experience is complete. One can see what Google needs to achieve.

runmeter export display

Runmeter is an iPhone app useful for GPS tracking outdoor exercise and as such does a fine job eclipsing some of the other variants. Runmeter features the ability to export and share your (KML,GPX,CSV) data via email or link. Although Runmeter has excellent data analysis menu choices on the iPhone itself and can recall and layout event history; the Runmeter does not have a co-branded display and summary website. However, it is possible to mirror your events and statistics on a personal remote web page. Using the Runmeter export feature you might try uploading a GPX file to Everytrail or Trailguru. I prefer to roll my own and follows is a tutorial on how it can be done.

Add a table, which mimics Runmeters CVS file column headings, to your mysql database.

CREATE TABLE raw_runmeter_data (
  Route varchar(35) NOT NULL,
  Activity varchar(10) NOT NULL,
  Start_Time datetime NOT NULL,
  Time_normal time NOT NULL,
  Time_normal_seconds smallint(6) NOT NULL,
  Time_stopped time NOT NULL,
  Time_stopped_seconds int(11) NOT NULL,
  Distance decimal(5,2) NOT NULL,
  Average_speed decimal(5,2) NOT NULL,
  Average_pace time NOT NULL,
  Average_pace_seconds int(11) NOT NULL,
  Climb int(11) NOT NULL,
  Calories int(11) NOT NULL,
  Fastest_speed decimal(5,2) NOT NULL,
  Fastest_pace time NOT NULL,
  Fastest_pace_seconds int(11) NOT NULL,
  Notes text
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

With this table constructed use PHP to retrieve your event data from the Runmeter server and store it in the mysql table. This code downloads your Runmeter CSV file and after some housekeeping, imports the data events to your mysql.

import_cvs.php
[php]
<?php

/**********************************/
/* This file is named import_cvs.php
/* As the file name implies, this code will import your data from Runmeter. You may run this file manually or better still, by setting up a cron job.
/* Edit the entry below to reflect the appropriate value i.e. your unique Runmeter export URL which should look something like this: “http://share.abvio.com/438h2 53u978cd/Runmeter-Route-All.csv”
/*********************************/
$inp = file(‘http://share.abvio.com/***********/Runmeter-Route-All.csv’);
/*********************************/
/* If you use this code, find a flaw, enhance or otherwise improve it then please let me know
/* via comment or link.
/* End Edit (nothing to do below this line)
/*********************************/

include ‘dbinfo.inc.php’; // your variable constants for database access

if (!$inp) {
echo “<p>Unable to open remote file.\n”;
exit;
}
$out = fopen(‘runmeter_clean.csv’,’w’); // a flat file which will temporaily hold your imported data
for ($i=1;$i<count($inp)-1;$i++) // step through the cvs file to leave out the first line ($i=1) and the last line of the file (count($inp)-1) because the first line is a header row and the last line has extraneous data
{
fwrite($out,$inp[$i]);
}
fclose($out);

echo “<font color=red>{$i} Runmeter events</font><br>”;

$file_handle = fopen(‘runmeter_clean.csv’,”r”);

$con = @mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error());
@mysql_select_db($databasename) or die(mysql_error());

// first task: let’s empty the mysql table (remove all existing recors)
mysql_query(“TRUNCATE $databasetable”);

// now insert the new recent data. Process Each Line
while (!feof($file_handle) ) {

$data = fgetcsv($file_handle);

$Route = mysql_real_escape_string($data[0]); // this function escapes out the pesky apostrophe character (and double quuotes etc.

$sql_insert = “insert into $databasetable ( Route, Activity, Start_Time, Time_normal, Time_normal_seconds, Time_stopped, Time_stopped_seconds, Distance, Average_speed, Average_pace, Average_pace_seconds, Climb, Calories, Fastest_speed, Fastest_pace, Fastest_pace_seconds, Notes)
values ( ‘$Route’, ‘$data[1]’, ‘$data[2]’, ‘$data[3]’, ‘$data[4]’, ‘$data[5]’ ,’$data[6]’ ,’$data[7]’, ‘$data[8]’, ‘$data[9]’, ‘$data[10]’ , ‘$data[11]’, ‘$data[12]’ , ‘$data[13]’, ‘$data[14]’, ‘$data[15]’, ‘$data[16]’ )”;

echo $data[0].”<br>”;

mysql_query($sql_insert);
}
fclose($file_handle);
@mysql_close($con);
?>
[/php]

Runmeter furnishes a unique and user specific download URL. Replace the URL (line #8) in import_csv.php file code above with yours. If not already familiar with the Runmeter app, review the screenshots from the app below. Start with the Routes Tab then touch Email/Export All. Next screen choose CSV File URL. (Runmeter sends your event data from your device to update your file CSV File on their server) In the third screen you are provided the discreet link which you will need for access. This URL does not normally change so you will not necessarily need to alter your php configuration above but note that current Runmeter app behavior does require you to refresh their data by doing this little procedure each time.

You can run import_csv.php as needed manually from a web browser. I created a cron job that will do this automatically. (once daily so as not to hammer the Runmeter server)

* * * * * wget -q http://www.strombotne.com/import_cvs.php > /dev/null 2>&1

With the event data in place. It is a simple task of writing some queries that will display the information in meaningful way. For example, this snippet will count the number of days run within the last 30.
[php]
<?php
include (“../dbinfo.inc.php”);
/********************************/
/* Code from http://strombotne.com/
/* The query in this file is for PHP5 only
/* If you use this code, find a flaw, enhance or otherwise improve it then please let me know
/* via comment or link.
/********************************/
$con = @mysql_connect($databasehost,$databaseusername,$databasepassword) or die(mysql_error());
@mysql_select_db($databasename) or die(‘Could not connect: ‘ . mysql_error());

$dataArray=array();

//get data from database
$sql=”SELECT COUNT(*) AS Last30Days FROM $databasetable WHERE Activity = ‘run’ AND DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= Start_Time”;
$result = mysql_query($sql) or die(‘Query failed: ‘ . mysql_error());
$event_count=mysql_fetch_object($result);
$event_count=$event_count->Last30Days;

// days run will be $count_events_data from 30 == days off
$days_off = 30 – $event_count;

@mysql_close($con);
?>
[/php]

Google has an API for charting that neatly displays the query output.
[php]

<img src=”http://chart.apis.google.com/chart?cht=p3&chs=375×125&chd=t:<?php echo $event_count.’,’.$days_off.’&chl=’.$event_count.’+Days+Run|Days+Off&chtt=Last+30+Days’;?>”>
<!– uses query_count_events_last_30.php –>

[/php]

And the output looks like this:




There are additional queries and charts in the zip file, along with the complete code for this project for download here. Please share a link to YOUR Runmeter Statistics display in the comments section.

laptop vs. tablet

Conclusion: iPad wins. As an experiment the MacBook was left behind; lid closed and shutdown for an entire week. The objective was to lighten and reduce the shear number of devices and peripherals loading my computer bag. The test was to determine whether there would be withdrawal symptoms. There were none. As far as media usage is concerned the iPad holds its own. The iPad can be my new go-with device.

List of pleasant surprises: No more range anxiety. The battery in the MacBook was good for 3 hours tops. At times I would have to carry a spare battery to hot swap. The iPad can go all day on a charge. No more searching for an unused wall plug-in socket which can be scarce in older hotel rooms and many airport terminals. Easier, faster scan in the TSA line. Laptops have to come out of the bag to ride the conveyor belt. The iPad is exempt. Once on the airline, the iPad is less obtrusive. Try using a laptop within the cramped confines of a coach class seat especially after the passenger in the row forward reclines his/her seat-back. The iPad is quiet. No whirring fans and does not get hot. Boot time is instantaneous. No waiting. Nice form factor, very portable, less geeky.

Disclaimer: This post was typed on a full size keyboard and a Mac. Correct; the iPad keyboard is not useful for anything beyond a short email burst. It is a two finger hunt and peck. Don’t plan on using the device for creating Spreadsheets or anything. The iPad is designed for consumption and at that it excels.

The iPad may seem like a “tweener” but in many respects it shares the characteristics and functionality of the iPhone and the MacBook and is therefore not a necessary addition. However, after using it for extended duration I can report that the laptop has been eclipsed.

Lost in the Translation

The Google Voice service transcribes voice mail messages ( by machine ) which can be somewhat off:

This is James a catholic area calling let you know that your car needs 8 number is that it is not opening and closing properly parts and labor to your place with them. That is about 481. Give me a call back. 555-2036. Thank you.

I get the gist. Thankfully Google has a Play Message Back link with the real deal.

Dont try this at home

The only way in is with the cutting wheel or chisel pry tool or hacksaw. The Apple power adapter (brick) wasn’t intended to be disassembled. The case is glue bonded. However with the power supply inop due to a separated output wire, what was there to lose by attempting a repair. A simple splice and solder could make it serviceable once the dead section was cut out. So S’man with the Dremel Tool split the sealed case and from there the job was easy to complete. Of course the re-assembled package looks a bit ghetto.

this is a test

now reading If you’d have asked me if people would actually read (and enjoy) books on a 2 X 3 inch screen, I would have ____________.?! Well, it is not as horrible as one might think. Of course, if I have deep and permanent squint marks afterward then you’ll know better. (Font Aa size adjustable) The jurors are still out.Media delivery to the device is nearly instantaneous. Convenience: A+ as it’s in my shirt pocket, I can whip it out, wherever. A page here a chapter there, this may be the new way to save trees. Like Apple’s excellent iTunes Store however, it’s way to easy to charge the (typical) $9.99 per to the CC.

Trails & Tracks

jog track aggregatorWordPress is a great CMS apparatus which can be further enhanced with Plugins. A Routes extension, just installed, solved a need for a way to display a collection of jog tracks that I’ve built upon over the years. This plugin features an aggregate function which displays them all on a central map index. Routes has several methods for entering geographical information on a Google Map post but it is the ability to import GPS tracks from a GPX XML file that beats all. 5 Stars!