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.
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
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
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| 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 |
- New Products
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- Reply to comment | Linux Journal
1 min 34 sec ago - Nice article, thanks for the
10 hours 42 min ago - I once had a better way I
16 hours 28 min ago - Not only you I too assumed
16 hours 45 min ago - another very interesting
18 hours 38 min ago - Reply to comment | Linux Journal
20 hours 31 min ago - Reply to comment | Linux Journal
1 day 3 hours ago - Reply to comment | Linux Journal
1 day 3 hours ago - Favorite (and easily brute-forced) pw's
1 day 5 hours ago - Have you tried Boxen? It's a
1 day 11 hours ago
Enter to Win an Adafruit Pi Cobbler Breakout 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 Pi Cobbler Breakout 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
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




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.