|
|
return of the crazy bear Saturday, September 21 2013
At around 10:00am this morning, Ray and Nancy arrived with their lively mostly-grown puppy Jack. At this point Jack is about the same size as Ramona and, with his light blue collar, looks superficially like her. Those two have lots of puppy energy to expend on one another, which gives Eleanor a bit of a break but all the charging around and yarfing can get on one's nerves.
Sarah the Vegan arrived a little later. The idea was for us to celebrate Wilma's life with a walk in the forest and maybe some leftover barley-kale-and-tomato stew left over from last night (Gretchen had made an enormous pot).
Our walk took us the length of the main line of the Stick Trail. Somewhere along the final stretch that goes northwestward to the trail's end (near the farm at the end of the Farm Road), I was telling Ray bear stories, since their unexpected appearance is one of the more exciting things that can happen on this section of trail. And then suddenly the ladies, who were further ahead on the trail (41.921407N, 74.107075W), started yelling about a bear. The one they were referring to was not a memory from the past but was a real live bear. It had just climbed a tree, narrowly escaping all three of the dogs. But then it climbed down the tree, went to another one, and climbed it instead. Evidently this was that crazy bear who will not stay treed. Since the dogs were relentless in their pursuit, it just seemed like a matter of time before the bear would get fed up and swat the life out of one of them. So I ran down to the latest tree the bear had climbed (as did Gretchen). There was the bear, bigger than me but moving more quickly than physics should allow anything that size to move. It would attempt to come down one side of the tree, but there would be Ramona with her paws up on the tree barking. Eventually I managed to grab Ramona by the collar and haul her away. But Eleanor wasn't wearing a collar and there was no way to contain her. When the bear made it down from the tree (maybe only six feet away from me), she charged after it, making contact with the bear multiple times as it bounded down the hill. She may have even bitten it once. But the bear was completely non-aggressive; all it wanted to do was get away. I felt terrible that it was being subjected to such unnecessary stress.
I managed to drag Ramona up to the Stick Trail, but she didn't want to go. She was puffing and wheezing at the constricting effects of the collar around her neck and she most certainly didn't want to go in any direction that the bear hadn't just charged off towards. For some reason Gretchen asked me why I was still holding her collar and I explained that it was all I could do to keep from being towed bearward. She insisted that there wasn't problem and that I could let Ramona go. So I shrugged my shoulders and let her go. She immediately ran down the hill towards the bear. At this point the only dog we had with us was Jack, and that was because Nancy had improvised a leash to attach to his collar.
Further down the trail, though, Eleanor rejoined us. She was exhausted but happy, and didn't appear to have been mauled.
Eventually we came out of the woods at the farm. Georges, the guy who owns it, was there, and we chatted with him about the bear, his swimming pool, and his homebrewed attempt at heating it via solar thermosiphoning (it was sort of working, but not anywhere near enough to heat his pool). Meanwhile, we could hear Ramona's barking faintly in the extreme distance. Either she'd found the bear or she was warning us about an alien invasion.
Ramona finally rejoined us on our walk back home on the Farm Road. She was exhausted and uninjured, aside from a broken claw on one of her toes that pointed in some unhelpful direction. That injury has happened to Eleanor several times and, though it can be painful to walk on, the claw eventually drops off and a new one grows in its place.
After two encounters with the untreeable bear, I started to wonder if perhaps that sort of behavior might be an adaptive response to heavy human hunting over the years. After all, a bear that will come down a tree despite barking dogs at the base of it will not stay in any one tree for long and will not be as easy for a hunter to come along and shoot. Sure, there is a certain amount of risk that a dog might bite such a bear and cause an injury, but it's nothing compared to the near-certainty of being shot if the bear remains in a tree and a cold-hearted hillbilly with a gun is standing at the base of it.
I had arranged a meeting on Monday with the guy who is paying me to develop a Lightroom plugin, and though I'd done a lot of research, I had yet to make much progress on developing the actual plugin itself. So this afternoon I forced myself to power through all the roadblocks that the Lightroom SDK and (to a lesser extent) the Lua programming language had placed in my way.
As for Lua itself, it's not a terrible language. It reminds me of Pascal and Visual Basic. Having used C-like languages for so long, I now find the absence of curly-bracket-demarcated code blocks and semicolon-delimited lines somewhat disorienting. And it's very easy to accidentally type in a C-style conditional line of the form if(conditional){ instead of if conditional then. Also, Homesite (my preferred text editor) has no syntax coloring engine for Lua, so I've been working without color-coded text. The thing I like least about Lua is that arrays and strings are one-based instead of zero-based, which throws an enormous monkeywrench into my hard-won mastery of how to correctly iterate through an array or parse a string.
Far more vexing than Lua were the many limitations I quickly encountered in the Adobe Lightroom SDK. The first of these that I'd encountered was a lack of support for any databases outside its proprietary SQLite tables. The plugin I was developing was heavily dependent on its database, and if there had been no way to read from and write to a database, the plugin would have been impossible. But, as I mentioned the other day, it turned out that there is a way to connect to a custom SQLite database. It involved using the SDK's executeCommand capability to run what could be any shell script and then using file system operations to read whatever output that script produced. It's not an ideal way to get things done, but it does work.
But it introduces unexpected problems as well. I assumed, for example, that I could make my database calls, read the files produced, parse the data, and then use it. That's how things work when PHP runs SQL queries on a MySQL database server. But in the SDK things don't work that way. The database calls have to be made asynchronously; the script cannot wait for the result after making the call. It has to move on to the next thing. This seems like an unnecessary complication; everything is happening inside one computer and nothing needs to travel over an unreliable network. Initially I tried to implement a pause to see if perhaps the file would be waiting for me after the pause was over, but there was no place in the code to make the pause happen. By putting a series of trace commands in the code, I was able to see that any place I put such pauses (or do-nothing loops) was always fired before the database query. I started to fear that there was no way to issue a query and then doing anything useful with the resulting data. I did, however, realize that what I was seeing was similar to the problem of dealing with data obtained via AJAX (that is, queries made by Javascript using HTTP using the glacial medium of the internet). The solution to my problem in the Lightroom SDK was to pass a function in with the my SQL query to my runSQL function, and put a line in the runSQL function to call the passed-in function once the data was obtained. When I first tried this, I wasn't even sure Lua supported doing such things (and I've never had the need to do it in PHP). But damn if it didn't work, and again I experienced that little thrill that makes computer programming such a rewarding thing to do.
I should mention, by the way, that none of this arcania was mentioned in any documentation available on the web. The documentation for the Lightroom SDK isn't very good, and the range of things being done in the world of Lightroom plugins is not very wide. There is, however, one person who seems to know his shit. His name is Rob Cole and he has posted a lot of his code on the web for people like me to pick through. It was his implementation of the SQLite executeCommand code that I used as a model for mine, though I never figured out how he dealt with the asynchronously-received data, and he only provides general documentation for his open-source plugins. I suppose I could have asked him; he seems to be one of the few people answering questions on the Lightroom SDK messageboard. [Indeed, when I finally did get around to asking a question about how to implement an onchange-style event for a popup menu, he was the one who responded.]
For linking purposes this article's URL is: http://asecular.com/blog.php?130921 feedback previous | next |