Hardware Reference
In-Depth Information
This web site has been used, in part, because enough information is present to make automatic value judgments
when it comes to catching the train. For example, knowing that it takes 35 minutes to travel from work to St. Pancras,
you can exclude any train leaving in that window. Furthermore, by adding a grace period, you can limit the output to
trains that will leave within ten minutes of you arriving at the station:
my $graceMinutes = $minutesAway - $timeToStation;
if ($graceMinutes >= $graceThreshold && $graceMinutes < $maxGracePeriod) {
print "Get the $expectedTime to $destination from platform $platform.";
print "There is $graceMinutes minutes grace.\n";
}
This code can naturally be extended to swap the source and destination locations so that the return journey can
be similarly considered. This could happen by looking at the time of day, for example.
N Output each piece of data on a separate line, making it easier for other tools to extract the information. Or use a
low-level structured format, like JSON, which has processing modules for most languages.
Tip
You now have a way of knowing which are the next trains to leave. This could be incorporated into a daily news
feed, recited by a speech synthesizer while making breakfast, added to a personal aggregator page, or used to control
the alarm clock. (The method for this will be discussed later.)
Road Traffic
With the whole world and his dog being in love with satellite navigation systems, the role of web-based traffic reports
has become less useful in recent years. And with the cost coming down every year, it's unlikely to gain a resurgence
any time soon. However, if you have a choice of just one gadget—a SatNav or a web-capable handheld PC—the latter
can still win out with one of the live traffic web sites.
The United Kingdom has sites such as Frixo ( www.frixo.com ) that report traffic speed on all major roads and
integrate Google Maps so you can see the various hotspots. It also seems like they have thought of the HA market,
because much of the data is easily accessible, with clear labels for the road speeds between each motorway junction,
with the roadwork locations, and with travel news.
Weather
Sourcing weather data can occur from three sources: an online provider, a personal weather station, or by looking out
of the window! I will consider only the first two in the following sections.
Forecasts
Although there appear to be many online weather forecasts available on the Web, most stem from the Weather
Channel's own Weather.com . This site provides a web plug-in ( www.weather.com/services/downloads ), mobile apps,
and a native desktop application (Windows-only, alas) to access its data, but currently there's nothing more open than
that in the way of an API. Fortunately, many of the companies that have bought licenses to this data provide access to
it for the visitors to their web site and with fewer restrictions. Yahoo! Weather, for example, has data in an XML format
that works well but requires a style sheet to convert it into anything usable.
 
Search WWH ::




Custom Search