Dash Express
Earlier in the year, the Dash opened up its API to the community, so anyone could register on its site as a developer and write custom Dash apps. Since then, the API has been updated and expanded with some new features, and it still appears to be in active development. Even so, there already seems to be a pretty active developer community springing up in the Dash forums, and quite a few community-developed Dash apps are already available on the site.
I wanted to see how easy it was to develop my own Dash app, so I downloaded the latest edition of the API documentation, registered as a developer on the site, and started with a sample PHP program I found on the forum. Essentially, when you conduct a search with a Dash app, the Dash Express then sends an HTTP GET to a Web service you specify that contains a few variables including the Dash's GPS location and potentially a custom value from a text entry window on the Dash itself. Your Web service replies back with its results formatted in some basic XML (the structure is defined in the API documentation) that the Dash then displays. Here's a sample of the XML output that Dash accepts:
<?xml version="1.0" encoding="UTF-8"?> <resultSet><serviceId>10114</serviceId><count>1</count> <sort>di</sort> <result><title>Title</title> <point>38.2440154167-122.6531425</point> <description>requestType->search serviceId->10114 point->38.24401541666667 -122.6531425 count->20 offset->0 sort->null signature->ed002f9a2f86013c9affd8d9e1b9f90e </description><address>12000 San Jose Blvd</address><city>Jacksonville</city> <regionCode>FL</regionCode><countryCode>US</countryCode> <postalCode>32223</postalCode></result></resultSet>
After all these years, I still tend to favor Perl for this sort of thing, so the first thing I did was port the sample PHP script to Perl. Once I got that working, I decided to try to write something actually useful. I wasn't ready to dig heavily into sourcing sites like Google Maps for location data, so instead, I decided to write something more basic. I planned to write an application that would take the current mileage as input and then read from a basic CSV file and report back any maintenance due within plus or minus 10,000 miles. The first column in the CSV file has the mileage when the maintenance was due, the second column has a description of the maintenance, and the third column is optional but had a 1 or 0 depending on whether the task was completed. Here's some sample lines from the file:
151000,Change Oil,1 156000,Change Oil and Filter,1 161000,Change Oil 160000,Replace Tires 180000,Replace Coolant 160000,Replace Air Filter
Listing 1 shows the script that reads from the file and outputs the XML for the Dash.
Listing 1. The Script
#!/usr/bin/perl
use CGI qw(:standard);
my $infile = 'maintenance.txt';
my $mileage_range = "10000"; # Only show entries within this range
if(param())
{
$requestType = param("requestType");
$serviceId = param("serviceId");
$point = param("point");
$count = param("count");
$offset = param("offset");
$sort = param("sort");
$signature = param("signature");
$mileage = param("q");
my %hash;
my $items = 0;
parse_infile($infile, \%hash);
foreach (sort keys %hash){
if(abs($_ - $mileage) < $mileage_range){
next if($hash{$_}{'c'} == 1);
$delta = $_ - $mileage;
if($delta >= 0){
$title = "$_ - $hash{$_}{'desc'}";
$desc = "<![CDATA[<html>In <b>$delta</b>
↪miles:<br>$hash{$_}{'desc'}</html>]]>";
}
else {
$title = "PAST DUE: $hash{$_}{'desc'}";
$desc = "<![CDATA[<html><font color=#FF0000>
↪<b>" . abs($delta) . "</b> miles <i>PAST DUE</i>
↪</font>:<br>$hash{$_}{'desc'}</html>]]>";
}
$output .= output_result($title, $desc);
$items++;
}
}
print header('text/xml');
print '<?xml version="1.0" encoding="UTF-8"?>'
. "\n<resultSet>"
. "<serviceId>$serviceId</serviceId>"
. "<count>$items</count>";
print $output;
print '</resultSet>';
exit;
}
sub output_result {
my $title = shift;
my $desc = shift;
my $output;
$output = "\n<result>"
. "<title>$title</title>"
. "<description>$desc</description>"
. '</result>';
return $output;
}
sub parse_infile {
my $infile = shift;
my $href = shift;
my ($mileage, $desc, $completed);
open INFILE, $infile or die "Can't open $infile: $!\n";
while(<INFILE>){
chomp;
$mileage = $desc = $completed = "";
($mileage, $desc, $completed) = split ',', $_;
$$href{$mileage}{'desc'} = $desc;
$$href{$mileage}{'c'} = $completed;
}
close INFILE;
}
It's pretty basic, but it works. The whole process from testing the PHP script to writing the final application took only about two hours. Once you write the program, you can create a new Dash app instance via an interface on the my.dash.net site and add it to your saved searches. You also can choose to keep the program to yourself, or you can make it public so any Dash user can use it.
The ease of developing applications for the Dash is a definite plus for me. There are still some limitations in its API (for instance, there is only one text box available for user entry at the time of this writing), but the API still appears to be under heavy development and already has had feature updates. Even as it is, if you have some imagination and some programming ability, you can write some pretty useful applications.
Kyle Rankin is a systems architect; and the author of DevOps Troubleshooting, The Official Ubuntu Server Book, Knoppix Hacks, Knoppix Pocket Reference, Linux Multimedia Hacks, and Ubuntu Hacks.
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
| Dart: a New Web Programming Experience | May 07, 2013 |
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- A Topic for Discussion - Open Source Feature-Richness?
- Drupal Is a Framework: Why Everyone Needs to Understand This
- Home, My Backup Data Center
- What's the tweeting protocol?
- Readers' Choice Awards
- New Products
- RSS Feeds
- Dart: a New Web Programming Experience
- Reply to comment | Linux Journal
8 hours 24 min ago - Reply to comment | Linux Journal
10 hours 57 min ago - Reply to comment | Linux Journal
12 hours 14 min ago - great post
12 hours 49 min ago - Google Docs
13 hours 12 min ago - Reply to comment | Linux Journal
18 hours 38 sec ago - Reply to comment | Linux Journal
18 hours 47 min ago - Web Hosting IQ
20 hours 21 min ago - Thanks for taking the time to
21 hours 57 min ago - Linux is good
23 hours 55 min ago
Enter to Win an Adafruit Prototyping Pi Plate Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Prototyping Pi Plate Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- Next winner announced on 5-21-13!
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.




Comments
Unfortunately...
Unfortunately, Dash just got out of the hardware biz.
http://www.bizjournals.com/sanjose/stories/2008/11/03/daily29.html
There are still other Linux-based GPS devices out there although none that are quite as hackable.