Sunday 30 September 2007

origami haga

Fionn and my weedding anniversary. We went into Dublin castle and visited gardens and library with kids.
Kids complimented on being very good in library. :)
And then we had food in the Schoolhouse (after throwing sticks into the canal).
Fionn had gotten me some small origami paper.
I had some paper and an origami book on my bed-side locker pile a few months ago but it has been put way again.
Anyway I got out oftc (Origami For the Connoisseur - a lovely origami-fest).
And almost the first thing in it is Haga's theorem which I had passed over everytime before.
I looked at it this time and the diagram in oftc is not great.
It mentiones a third triangle and isn't very clear. Hmf!
So I filled up and A4 sheet with algebra and found by applying pythagoras about 5 times that yes it divides the side
in a third. Yay me.
So tomorrow I look it up and find of course with one application of pythagoras you can prove the same. :D
Still puzzled over the three triangles oftc talks about?

Simple Haga Theorem
Let a be length of side of square.
Crease square in half NOT along diagonal (vertically here) (so that one has a rectangle a x a/2) and unfold.
Fold corner of square (bottom right corner here) so that it touches the midpoint of an opposite side (top side here).
The intersection of the two edges which overlap is a third of the way up (the left side here).

This paper by Robert Lang goes into more detail
Origami and Geometric Constructions
Starting with binary division (i.e. folding in half!) and going on to general case of dividing paper into any integral fraction (look for Haga's construction).
Lang Origami Constructions paper

Geometry origami

Math on the Street, a magic pinwheel, very nice, remind me to try make it sometime:
magic pinwheel

Thursday 20 September 2007

filter gps data and drop bad points

so hdop >= 1.3 isn't great? Or negative values.

#!/usr/bin/perl -w

use strict;
use GPS::Babel;

my $file = shift or die "no file specified";

use Palm::PDB;
use Data::Dumper;

my $pdb = new Palm::PDB;

# register Palm::Raw as handler for all pdb loaded
use Palm::Raw;

#&Palm::PDB::RegisterPDBHandlers("GPSPDB",
#                "cGPS", "coGP"
#                );

$pdb->Load( $file ) or die "Load $file: $!";
# e.g. dumpdatebook.pl pdb processing.
# "No handler defined for creator "cGPS", type "strm""

#print Dumper($pdb);

print "Creator:".$pdb->{'creator'}."\n";

my $fmt;
for ($pdb->{'creator'}) {
    if    (/cGPS/)  { $fmt="cetus"; }
    elsif (/coGP/)  { $fmt = "coto"; }     # do something else
    #elsif (/TZGP/)  { }
    #elsif (/Gps4/)  { }
    else            { print "Not sure what file format\n."; }     # default
}

my $babel = GPS::Babel->new();

#my $babel = GPS::Babel->new({
#        exename => 'gpsbabel'
#    });

# auto detect format (doesn't auto-detect pdb:
# "Multiple formats (cetus, copilot, coto, gcdb, geoniche, gpilots, gpspilot, mag_pdb, magnav, palmdoc, pathaway and quovadis) handle extension .pdb at /home/jamesc/bin/gpspdbtogpx.pl line 20")
#my $gpxdata = $babel->read($file);
my $gpxdata = $babel->read($file, { in_format => 'cetus' } );


print "GPXName:".$gpxdata->name()."\n";
#print Dumper($gpxdata);
#print Dumper($gpxdata->{'tracks'}->[0]);
#print Dumper($gpxdata->{'tracks'}->[0]->{'segments'}->[0]->{'points'});
#print Dumper($gpxdata->{'tracks'}->[0]->{'segments'}->[0]->{'points'}->[0]);
#print Dumper($gpxdata->{'tracks'}->[0]->{'segments'}->[0]->{'points'}->[1]);
#print Dumper($gpxdata->{'tracks'}->[0]->{'segments'}->[0]->{'points'}->[2]);

my $count_rejectL=0;
my $count_rejectH=0;
my $count_ok=0;
my $gpxokay = Geo::Gpx->new();

foreach my $point (@{$gpxdata->{'tracks'}->[0]->{'segments'}->[0]->{'points'}}) {
    #print "point: " . Dumper($point) ;
    #if ($point->{'hdop'} >=4 ) {
    #if ($point->{'hdop'} >=1.4 ) {
    if ($point->{'hdop'} >=1.3 ) {
    $count_rejectH++;
    } elsif ($point->{'hdop'} <0 ) {
    $count_rejectL++;
    #} elsif ($point->{'sat'} <6 ) {
    } else {
    $count_ok++;
    $gpxokay->add_waypoint($point);
    }
}

$gpxokay->name("James-".$file);
$gpxokay->author({ name => "James", link => { text => "dspsrv", href => "http://www.dspsrv.com/~jamesc/map"}});
$gpxokay->link({ text => "dspsrv", href => "http://www.dspsrv.com/~jamesc/map"});
$gpxokay->keywords(['gaoithe','Ireland']);


print "Okay:".$count_ok." RejectH:".$count_rejectH." RejectL:".$count_rejectL."\n";
#'course' => '0.000000',
#'ele' => '-8.800000',
#'lat' => '53.356366700',
#'time' => 1190304846,
#'speed' => '0.720222',
#'fix' => '3d',
#'sat' => '3',
#'lon' => '-6.227361700',
#'hdop' => '3.600000'-18


# use Geo::gpx
# "If you will only be dealing with GPX files use Geo::Gpx directly."
$babel->write($file.'.gpx', $gpxdata, { out_format => 'gpx' });
print "File:".$file.'.gpx'." written.\n";
#my $xml = $gpxokay->xml();
$babel->write($file.'okayok.gpx', $gpxokay, { out_format => 'gpx' });
print "File:".$file.'okayok.gpx'." written.\n";
$babel->write($file.'.text', $gpxdata, { out_format => 'text' });

Saturday 15 September 2007

new GPS toy

Got a lovely blinky (blue) bluetooth GPS from ebay.
First play with it. Talking to palm with Cetus GPS (and coto GPS).
Works very nicely with palm.

blinky Bluetooth GPS -> PalmOS Cetus GPS -> pilot-link -> GPS Visualiser.com

We drove to Dundalk Sat afternoon and visited Fionn's Grandad and her Mum & Dad.
We brought Kate's bike and Daire's ball.
I mostly played outside. We had a football goal game with me carrying Maeve half the time around .75 of the house.
Daire won! 5-4.  Girls and me vs Daire. Kate on bike.
Kate has been doing Gaelic pick-ups (from ground) and then kick in air.
She does drop-kicks.   
Initially was balancing on one leg and taking long slow time drawing other leg back before kicking.
Fionn helps to cook fry for tea. Kids Uncle Hugh visits too.
Kate still playing outside on bike in dark until we leave.

http://www.dspsrv.com/~jamesc/map/to%20Dundalk%20001.html
http://www.dspsrv.com/~jamesc/map/to%20Dundalk%20005.html
http://www.dspsrv.com/~jamesc/map/Dundalk%20to%20Dub%20001.html
http://www.dspsrv.com/~jamesc/map/Dundalk%20to%20Dub%20001elevation.png

Manual is a bit light. And funny windows interface software is weird (& doesn't work easily USB-bluetooth funny connection interface?)
http://www.jrtgps.com/en/pdf/200764122741.pdf
It says GPS technology NemeriX GPS Chipset. Hmmm.  http://www.nemerix.com/
I wonder can it record any points itself. Or ...

http://www.cetusgps.dk/
http://core.de/~coto/projects/cotogps/

http://www.gpsvisualizer.com/


http://www.pilot-link.org/

Friday 14 September 2007

sufferin' back thyres

Since start of school I cycled following bus to school a bit, also collected Kate by bike first two weeks.
Back tyre at end of two weeks had puncture (but also rip in tyre). That repaired but after cycle home from work
yesterday now have puncture again (tyre repair with rubber + duct tape but it wears on tube). Need new tyre and tube (26x1.5).
Weight of Kate on back combined with rough road surface and bumps up/down onto bike lanes and footpaths is
quite wearing. Back tyre is a 1.25 streetrunner (as couldn't get a 1.5 last time).

Jumping off bike (when back tyre soft so jumping off to pump it) I didn't notice but caught left index finger on something (between brake and gear lever?). Noticed it after a little bit. Yeow all swollen and stiff and a little bit ow.  Arnica applied at home.

I've just discovered pirates vs ninjas and I think talk-like-a-pirate day is coming up. Sep 19th. Gahrrr!
(sorry about that, writing subject line in pirate Yosemite-Sam style makes for distraction)
http://www.piratesversusninjas.net/piveni.html
http://www.talklikeapirate.com/
http://en.wikipedia.org/wiki/Yosemite_Sam
How to kiss like a ninja:
 http://everything2.com/index.pl?node_id=1702976
 

Thursday 13 September 2007

commuting to school/work (missing 44 bus this morning)

I'm was back to work this Monday 10th.
Motorbiked to work Mon/Tue. Worked from home Wed.
Cycled today.

We were in plenty of time for the bus this morning (yesterday we were a bit slow and I shouted at kids in house :( sorry guys :( and then ran to get bus. Kate in bike seat. Daire running. Saw it pass by! Gave up, but ran more and it was stuck in traffic. chased after it and nice bus driver opened doors and left kids on. Whew! Back to bring Maeve to creche on my bike.)
Anyway, _this_ morning the usual 44 didn't come! arg!
At 8:30 I took Maeve to creche and kids were still waiting when I came back.
Got the later bus.
Traffic had cleared up our place but I beat the bus down :-P :)
(traffic was bad on Sandyford road).  I said hello to lollipop lady. She said there was no
44 bus that morning, she was there since 8:00 I think.
 Kids got to school just after 9:00.

So:
From - Thu Sep 13 11:15:11 2007
Date: Thu, 13 Sep 2007 11:11:29 +0100
To: info@dublinbus.ie
Subject: 44 bus didn't come? (8:10ish at Kilgobbin Road 13/9/2007 direction
from Enniskerry->City Centre)

Hello,

Your customer service charter on web says this email address may be used to contact your
Customer Comment Desk.

Is there any way to find out what might have happened a particular bus this morning?
The Enniskerry->City Centre 44 bus didn't come at 8:10ish at Kilgobbin Road 13/9/2007.
Everyone that usually gets that bus had to wait for the next one so we're pretty sure it
didn't come early (unless it was much MUCH earlier than usual?)
Is there any provision for replacing a bus if something happens it?

Kids are using the bus to go to school so we are concerned about the reliability of the service.
It is annoying but okay if the weather is fine and if it doesn't happen often.
But it is not a pleasant wait for the next bus in winter-time.

Also that bus is very full in the mornings with schoolkids from before Kilgobbin to Balally
so it would possibly make sense if there was an additional bus during school term?

Okay, well thank-you for reading.
I hope the comment on the possible extra capacity for school runs on that route can be passed on?
I would really appreciate it if you can find out what happened the missing bus and send me a reply
as well.

Sincerely,

James.
No reply yet and it's end of day. So Hmmm. We shall see.