Monday, October 16, 2017

Paradise ponders: C programming and compressed air edition...

Paradise ponders: C programming and compressed air edition...  Debbie and I took a beautiful drive yesterday morning up Blacksmith Fork Canyon.  We saw a dozen or so deer – all fat and healthy looking, ready for the privations of winter – and the tail end of the fall color.  It's elk season, and there were hunters all over the place.  Some of them (a minority, thankfully) park along the side of the road and set up what is basically an ambush at the side of a field where an elk might come to forage.  On one stretch of such an ambush, about 50' wide, I counted eleven hunters.  Each had their binoculars up, searching for some elk to poke its head out.  There were four other such ambushes along the edges of the same field, though the others weren't quite so large.  Still, if an elk was dumb enough to stride out onto that field, probably over a dozen rifles would be shooting at it.  I wonder how they decide whose “kill” it is in a situation like that?  We also saw some beautiful effects of the cold weather (it was 15°F where the photos below were taken), around waterfalls and rapids.  The combination of low temperatures and high humidity meant that the fine spray thrown up by the tumbling water stayed in the air as a liquid (or ice crystal) for much longer than usual.  This produced wonderful “steam” effects, and also ice-coated twigs and grasses.  A few photos of some of the better ones:


We also ran a few chores, but for much of the remaining day, and also today, I've been programming in C again.  I greatly expanded the simple little program I wrote about in my previous post, to give me all the functions I could imagine needing for my NTP server.  I've also modularized it in a way that will make it relatively easy to add new features, should I need to.  I'm finding that I quite enjoy the process of programming in C.  It's a far simpler, smaller language that the Java and JavaScript world I've spent the last twenty years in; in that sense it's easier and cleaner.  On the other hand, some things that are easy to do in Java/JavaScript (mainly because of the ubiquitous high quality, well documented libraries) are much harder to do in C.  Then there's the fact that C is fairly close to the hardware and the operating system – not quite as close as assembly, but not too darned far from it.  I like that; it plays to my hardware background and my desire to tinker with little embedded systems (like the NTP server and my irrigation supervisor).  One thing I've come to realize: it's pretty easy to meld the two languages for everything (or nearly so) that I might want to do: I can handle the low-level, close-to-the-hardware stuff in C (where Java either couldn't do it, or would have trouble doing so), and I can run those C “helpers” as a child process under Java.  That's both easy and clean.  I'm doing a test project of that general architecture right now: to let a Java program interpret the NMEA protocol output of the GPS on my NTP server.  A little C program will echo that NMEA data to stdout, and my Java program will run that as a child process and consume its output.  Simple!  But Java couldn't do it on its own...

Our sprinkler contractor showed up this morning, towing a huge air compressor behind his pickup.  He used this compressor to blow all the water out of our underground sprinkler lines, so that when they freeze this winter (as they surely shall), it won't damage any of the system.  The photo at right shows what it looked like as he blew out one zone in our back yard.  The noise as he did this was quite impressive, and full of bass notes that I wouldn't have expected from rapidly moving air...