Armatura Borealis & SPOT tracking

August 7th, 2011 by Lars-Georg Paulsen

Blue Water Sailing

One of my good friends has started on a big adventure. Travling around the world with a sailboat. With 3 friends he set sail from Arendal. And where do I come into the picture? Well, I’ve been helping them building a webpage/blog, with some cool features. And that’s what I’m gonna talk about now!

SPOT-Tracker
On board they have a satellite SPOT tracker.Witch gather and send GPS location to a SPOT service. They make the data available through some interfaces, a pre-made widget and raw XML data. The pre build stuff sux! Sorry, but this should be a lot better so that the “man in the street” can actually get something useful out of it. But for the geek, they also provide XML data. Witch you can do a lot of fun with….

Satellite Tracer
First of, I need to build a widget that would display their whereabouts. Since SPOT provides XML data, it shouldn’t be huge issue. Using PHP’s SimpleXML the task was done quite fast. (After learning about PHP and XML….). When I finished I thought, this is quite good, maybe somebody else would like to use this as well. So I sent an email to SPOT, to see if they would like to publish it on their site. Still no answer from them…

Nothing fancy, and can probably be written better, but it’s clean, small and it works:
File: SPOT.phps

Collection historical data
SPOT only save position for a certain time. I think it only save the last 7 days. And that’s no good if you going on a longer trip! So my first though was to just ‘wget‘ the XML file and save it locally. But I quickly found out that this would be a big mess if you wanna use the data on a later stage. Time to write a XML Data Collector!

Using what I’ve learn from when I built the satellite tracker, and googled my way to add children to an existing XML file, I had the idea, and it was time for some coding.

Due to the add_children function in PHP, you can only add to the end, not append to the top. I had to reverse my xml, so that the latest “message” was saved at the bottom.
File: XMLDumper.phps

And when you do all this, you’ve learn PHP and XML handling, I couldn’t just let it be with this. I had to use my newly created XML files for something useful! Using google API, I could created a map that would show their route from the start too their current posision. Check out Blue Water Sailing – Travle Map
If you wanna see how the widget works. Take a look at http://www.bluewatersailing.no/

**Update:
Playing around with xml/php and google MAP API, I’ve now upgraded TravelMap to include “traveled route”, and with a planed route. The planed route is made i Google Maps, and is controlled by the guys how is sailing. It means that they can put what ever they want onto the map, and it’s automatically updated on the website. Long live KML data! :)
Updated map:

Cacti+PHP-PRCE upgrade+2 little time= :(

March 8th, 2009 by Lars-Georg Paulsen

Earlier today I upgraded some ports on my FreeBSD box, and without thinking more about that, I went on living my life. About an hour ago I went in to check how things where going on. Cacti, my dear old friend, are so perfect for doing this. But, HEY!, where did all my stats go?

Time to investigate!
Cruising through cacti logs I came over my first clue.

POLLER: Poller[0] WARNING: Poller Output Table not Empty. Issues Found: 3, Data Sources: (DS[5]), ping(DS[32]), (DS[37])

Now what?
Google is my friend, but this time it was not much help…
Time to do some research. Let’s run the poller manually…

PHP Fatal error: Call to undefined function preg_match() in /usr/local/share/cacti/lib/functions.php on line 855

Hmm.. I could swear I remembered that PHP or some of the PHP components where updated today. Getting closer, it was time to give Google one more chance. I knew I could trust Google in the end! Getting closer and closer, and while reading up on php5-pcre, and how it now it is included in PHP, it was time to do some testing.

cd /usr/ports/devel/php5-pcre && make config

And guess what, you are presented with a dialog box that says:
[ ] BUNDLED_PCRE – Select if you use apache 2.0.x“.

Time to feel stupid..
Due to my lack of attention to the upgrade process, I’ve actually overlooked this. Since I also run Apache 2.0.x it is kind of self explaining? After a reinstall of php5-pcre with the right options, cacti was up and running again…

So today’s moral
Don’t just press enter on every default dialog box you see!!

NVE-Collectors Edition – a gift to all of you!

May 29th, 2008 by Lars-Georg Paulsen

TechNet strikes again, this time with a update of NVE-collector-script.

A while back I build a small script to collect water levels from nve.no. This was then used on NPK’s webpage to show different water levels in the area. But was badly written, and couldn’t not be easy implemented on other sites. So then it was time to rewrite the whole thing….

NVE collectors edition

The basic NVE-collector script can be downloaded from TechNet. But this was not enough for me. I wanted to build a NVE collectors edition page, and so I did.

The basic are build, but now I need help from you guys to finish it. What I need is:

  • NVE-ID (eq 0018.00010.000)
  • River-name
  • Mininum and maximum values
  • Short comment

The comment section hasn’t been implemented yet, but will arrive shortly. This is to give basic info about the river. One station can be a messasure point for 5 stretches, and you then need to be able to tell witch stretch works on what waterlevel… you know what I mean.

If you know other places that provides level information. I can probably extract information from them as well, and included them on the site………

So, enough said.. —> NVE Collectors Edition <—