# C[omp]ute

Welcome to my blog, which was once a mailing list of the same name and is still generated by mail. Please reply via the "comment" links.

Always interested in offers/projects/new ideas. Eclectic experience in fields like: numerical computing; Python web; Java enterprise; functional languages; GPGPU; SQL databases; etc. Based in Santiago, Chile; telecommute worldwide. CV; email.

© 2006-2013 Andrew Cooke (site) / post authors (content).

## Half of Americans Think Climate Change Is a Sign of the Apocalypse

From: andrew cooke <andrew@...>

Date: Sun, 23 Nov 2014 22:08:56 -0300

Seriously.
http://www.theatlantic.com/politics/archive/2014/11/half-of-americans-think-climate-change-is-a-sign-of-the-apocalypse/383029/

Andrew

## Previous Entries

For comments, see relevant pages (permalinks).

### Saturday Surf Sessions With Juvenile Delinquents

From: andrew cooke <andrew@...>

Date: Sun, 23 Nov 2014 14:51:56 -0300

http://www.huffingtonpost.com/claudio-pino-cabrera/saturday-surf-sessions-wi_b_6154254.html

Andrew

### Ssh, tty, stdout and stderr

From: andrew cooke <andrew@...>

Date: Wed, 19 Nov 2014 20:32:11 -0300

The following code runs a calibration on a seismometer (this is the system I
developed at ISTI):

ssi_calconfig -n
ssi_caladdsignal -w random -D 60 -a 5 -s KIV1 -c SHZ
ssi_calrunat -n

It starts a new calibration, adds a random waveform (duration 60s, amplitude
5%) and then runs the calibration immediately.

Under the hood, the first two commands add entries to a database that
describes the calibration; the third command starts a scheduler that executes
the commands necessary to trigger the hardware, collect the data, calculate
the results, etc.

Separately, a co-worker developed a GUI for this system.  The GUI can control
calibrations on a remote machine.  When it does so, it executes the commands
above over ssh.

The following script (I've removed connection details) emulates that:

#!/bin/bash
ssh ... ssi_calconfig -n
ssh ... ssi_caladdsignal -w random -D 60 -a 5 -s KIV1 -c SHZ
ssh ... ssi_calrunat -n

Unfortunately, both the script and the GUI have a problem: one program, which
is forked from the scheduler, which is itself forked from the ssi_calrunat
program, crashes.

As far as I could tell, the only thing unusual about this program was that it
called a library that wrote an error message to stdout (this is just crappy
programming - everything else uses a logging system - but for whatever reason
we had to use this library).

After searching the net, I decided this was somehow related to ttys - that
seemed to be the only "real" difference between executing commands locally
(which worked) and remotely (which failed).

My hypothesis was supported by this script, which worked:

#!/bin/bash
ssh -t ... ssi_calconfig -n
ssh -t ... ssi_caladdsignal -w random -D 60 -a 5 -s KIV1 -c SHZ
ssh -t ... nohup ssi_calrunat -n

However, when we modified the GUI to include the changes above, the program
continued to crash!

I finally fixed the issue by replacing "-t" with "-tt".  The man page says:

Multiple -t options force tty allocation, even if ssh has no local tty.

so I guess there is some difference between a shell script and a Java GUI that
removes the "local tty".

Andrew

PS I was criticized for wasting time "doing computer science" because I
tracked this down rather than "just removing the print statement" from the
library that was crashing.  I can see the concern, but (1) be honest and say
we don't have time, that an ugly hack will have to do, and (2) just because
you don't understand doesn't mean it's "computer science".

### Feathers falling in a vacuum

From: andrew cooke <andrew@...>

Date: Wed, 19 Nov 2014 07:20:09 -0300

You know the answer, but still, seeing them fall makes you grin like an idiot.

https://www.youtube.com/watch?v=E43-CfukEgs&feature=share

Andrew

### Santiago 30m Bike Route

From: andrew cooke <andrew@...>

Date: Mon, 27 Oct 2014 22:58:02 -0300

[Distance may be a little less if you don't get lost!]

A good route for Sundays.  Cuts right across Santiago from E to W then returns
on the South side.  Almost all on ciclovias and pretty flat.

Given the map
https://maps.google.cl/maps/ms?ie=UTF8&oe=UTF8&t=h&source=embed&msa=0&msid=200859449321945444424.0004936368ca70e20d7c0&dg=feature
I won't give a huge amount of details, but the basic idea is:

* From Europa / Lyon (where I live), go N to the Costanera, and then W into
town.  On a Sunday the Costanera itself is closed to traffic, otherwise use
the ciclovia along the riverside.

* Continue past Bellas Artes until the park finishes.  Then turn left (head S)
into Santiago on Diagonal Cervantes, turning right onto Rosas.

* Head W on Rosas, crossing Ruta 5, until Gral Bulnes.  Then S down Bulnes to
Alameda (all this, including Rosas, is ciclovia).

* Ride the cicolvia down the centre of Alameda W until it stops (where Ruta 68
branches right the cyclovia moves to the left side of the road for a time,
but keeps going) (that is where I got lost).

* Eventually, you're on Los Pajaritos, approaching Vespucio.  The ciclovia
stops for a time - use the footpath / dirt on the right, but basically keep
on the same route until it starts again, still on Pajaritos, but now heading
S.

* That ciclovia stops at the town square.  Cross the square and head E on 5 de
Abril (ciclovia soon starts again).  Follow the same ciclovia, curving NE,
crossing Vespucio on a footbridge (cool spiral descent!) along Camino A
Melipilla and Pedro Aguirre Cerda.

* The ciclovia disappears briefly in a few places, but gets you all the way to
Ramon Subercaseaux / Rodizzoni.  Go E there (on the road) until Parque
O'Higgins.

* Enter the park at the SE corner and go N, exiting at the metro station, on
Matta.  You want to go E on Matta, but since there's no ciclovia at first
it's easier to drop S one block and cycle along Santiaguillo until San
Diego.

* At San Diego return to Matta and take the central ciclovia E until the
junction with with Grecia There you jink N and continue in the same
direction as Matta (ie don't turn on Grecia) on Matte Oeste, then Duble
Almeyda.

* The ciclovia on Duble Almeyda is the shittiest I know.  It stops and starts
so often it's almost useless, but the road is busy.  Continue E until the
road passes through a small wooded area then turn left (N) onto Juan Moya
Morales, which soon becomes Montenegro.

* Montenegro eventually reaches Tobalaba, and then it's N to Pucon and back
home.

Andrew

### Mapa de Ciclovias en Santiago

From: andrew cooke <andrew@...>

Date: Sun, 19 Oct 2014 16:44:26 -0300

https://maps.google.cl/maps/ms?ie=UTF8&oe=UTF8&t=h&source=embed&msa=0&msid=200859449321945444424.0004936368ca70e20d7c0&dg=feature

Most complete I've seen.

Andrew

### How Unreliable is UDP?

From: andrew cooke <andrew@...>

Date: Thu, 16 Oct 2014 18:24:47 -0300

http://openmymind.net/How-Unreliable-Is-UDP/

Interesting stuff about ordering towards the end.

Andrew

### SE Santiago 20m Bike Route

From: andrew cooke <andrew@...>

Date: Sat, 4 Oct 2014 18:35:34 -0300

20 miles (30km) - mainly on cyclepaths!

I'll describe this as I ride it, as a loop from Europa / Lyon, but if you
trace it out on a map then obviously you can start wherever you want.  Also,
since it has a "figure of 8" shape, you can break it into shorter rides.  And
I'll include an additional cyclepath that gives smaller (12m) route.

Starting from Europa / Lyon (or Antunez / Lyon), go S on Lyon (new cyclepath)
to Pocuro.  On Pocuro turn E (cyclepath) and continue to the junction with
Tobalaba.  Here you need to take some care - I cross at the pedestrian
crossing and cycle slowly across the bridge on the footpath - to get to the
other side of the river.  Then travel SE along Sanchez Fontecilla (path shared
with pedestrians for first block, til Bilbao, then cyclepath).

Continue on the cyclepath, following the canal, until the large junction at
Principe De Gales.  Here you need care again - I use the pedestrian crossings
- until you can pick up the cyclepath on the left side of Tobalaba, after the
Metro entrance (so you're heading in the same general direction as before, but
have now swapped to the other side of the canal).  La Canada is best crossed
just after the speedbump before continuing SE on the cyclepath along Tobalaba.

Continue to Larrain (which is now called Alcalde blah blah) and turn left.
There's 10 metres or so on the footpath before the cyclepath starts again.  Go
almost all the way up Larrain.  Near the end, when the gradient is steepest,
the cyclepath stops and you need to share a fairly narrow road with a fair
amount of traffic.  You could probably take the pavement at this point (almost
no pedestrians here).  Good excuse to walk...

Climb until you reach Casanova (bus stop on right) (incidentally, at this
point, if you climb a little more, you get to Parque Mahuida, with some
horse/cycle trails).

Turn right (S) along Casanova.  This is a road, but has only light traffic.
When you reach the apparent end, in a T junction with Talinay, turn left and
climb a little before bearing right, and the road becomes Casanova again!
Keep heading S (crossing an over-complicated junction with Arrieta) until
Diagonal Las Torres.  Cross Torres and you arrive at Grecia.

Turn right and go W down Grecia.  There's a cyclepath on the right (with
parked cars!), which switches to the centre (it's not easy to see, but when it
stops on the right, cross to the centre and then continue to descend on the
right hand of the central park).

Eventually Grecia meets Tobalaba.  The cyclepath stops just before, so you
need to cross back to the right of the road.  At this point, for a little
diversion you can make your way on the right of the canal, but it's a longer
route, and includes some overgrown paths and roads, so it's simpler to cross
the canal and return N along the Tobalaba cyclepath.

Heading NE and NW you retrace some of the route earlier (but only a relatively
short distance, and it's a pleasant path) before arriving back at the junction
Tobalaba / Principe De Gales.  Here, leave the earlier route and instead head
N on Ossa.  There's no nice way to do this - for one block I cycle slowly
along the pavement.

But after that one block you reach Bilbao, and Ossa becomes Vespucio, with a
central park suitable for cycles.  So navigate the junction there and head N,
NW along Vespucio.

Vespucio goes on and on [* shortcut - see below].  Currently there are
construction works near Vitacura, but you can cycle round them.  Continue
through the central park until the path stops, on the right, near a fountain
(IIRC), and just before the bridge over the Mapocho.  To your right you will
see, on the other side of the road, some blue bollards.  CAREFULLY cross the
road here (it's not easy to see oncoming traffic, which is fast).  Go through
the bollards and left, along a quiet street, which turns to the right.

Just after the turn there's a pedestrian crossing.  Turn left on that crossing
and enter the park.  Turn left again, and follow the track on the edge of the
park, going SW and then NW, climbing steeply, and going over a bridge.  Cross
the Mapocho.

On leaving the bridge, descend, bear right and climb again, turning left onto
another bridge, that takes you towards the Parque Metropolitano.  Continue NW
until you reach the road entering the park, turn left, enter, and climb to the
SW.

This is a fairly steep climb, but not as bad as Larrain, so don't worry.
Fairly soon you meet a roundabout.  Bear right (heading roughly W) and
continue to climb (less steeply).  You will reach another roundabout where you
can turn right (heading SW) and descend.  Yay!

Follow the road down to a T.  If you go right here you can go up to the
Virgen, but for now turn left and head E, following a winding road (including
a couple of hairpins) down to the exit of the park, at the top of Pedro de
Valdivia N.

Go S down Valdivia.  This is back on a road, but fairly quiet until the river.
Crossing the river and continuing S on Valdivia is then cycling in busy
traffic - you may want to use the pavement or walk.  But I cycle in the
traffic, and continue S until I get to Europa (just before Antunez).  Turning
left (E) down Europa brings me back to where I live, and the start of the
route.

[*] I said I'd include an additional route that makes things shorter.  From
Vespucio, turn left (W) down Isabel La Catolica.  This is a cyclepath that
takes you back to Pocuro / Tobalaba.

Enjoy!

Andrew

### Cameron's Rap

From: andrew cooke <andrew@...>

Date: Wed, 1 Oct 2014 19:55:23 -0300

https://www.youtube.com/watch?v=0YBumQHPAeU

Andrew

### Configuring libxml with Eclipse

From: andrew cooke <andrew@...>

Date: Wed, 1 Oct 2014 10:44:06 -0300

In the project settings, under C/C++ General, Paths and Symbols, add
/usr/include/libxml2 to the "includes" tab (or wherever the include file is -
run pkg-config --cflags libxml-2.0)

Goodbye red squiggly underlines!

Also, for my future reference, the station.xml schema web page thing is at
http://www.data.scec.org/xml/station/20110427/stationxml_schema_doc.html

Andrew

### Reducing Combinatorial Complexity With Occam - AI

From: andrew cooke <andrew@...>

Date: Sat, 27 Sep 2014 08:50:32 -0300

http://gup.ub.gu.se/records/fulltext/199296/199296.pdf

Having a hard time working out if this is useful or not.  I don't really know
enough context, but it seems obvious.  Is it new?

Andrew

### Sentidos Comunes (Chilean Online Magazine)

From: andrew cooke <andrew@...>

Date: Sun, 21 Sep 2014 11:03:16 -0300

http://www.sentidoscomunes.cl/

Looks like some good, serious reporting on local and international issues in
spanish.

Andrew