|
|
relative time Tuesday, December 3 2024
Today I processed a fairly big fallen white ash not too far from home. It was just east of the Farm Road on a steep slope above the Stick Trail. First I went there with the big chainsaw, bucked it (and some of a much smaller tree) into stove-sized pieces, which I then put up above me on the slope, as close to the Farm Road as I could easily get them and in such a way that they wouldn't immediately roll down again, often just uphill from pieces I'd just placed. Then I came back with the Chevy Bolt to haul the pieces home. I immediately split them up, carried them inside, and placed them on the indoor wood rack (which had been empty) for immediate use. I did this whole series of actions twice, and the indoor wood rack ended up close to full. It was a fair amount of work, but the proximity of the wood and the use of the car made it a good return on human effort.
When Gretchen got back from her pilates class, she made pasta meal using pieces of leftover tofu cutlets from Thanksgiving in a pasta made with tahini and various vegetables.
By that point in the evening, I'd begun adding an important set of features to my ESP8266 Remote Control system. I'd noticed in using it that it had been easy to overlook occasions when the sensors had stopped communicating. Sometimes sensors not communicating is a predictable consequence of how the system works, but other times it is unexpected. So it's essential to always be aware of what sensors are producing data and which of them have fallen silent. To improve the visibility of this information, I decided to show some timestamp data not as an absolute datetime but as a relative time with respect to the present. It's a lot easier to tell at a glance whether a sensor that last communicated "7 hours ago" is still working than one that last communicated at "2024-12-03 12:14:21." I already had a Javascript function to translate absolute time to relative time in my Networked Spelling Bee repository, and my understanding of the importance of relative time dates back to when I was building out a lavish reporting system for Mercy For Animals. To make things easier, though, I had ChatGPT (the original author of timeAgo() function in Networked Spelling Bee) translate it to PHP. I then leveraged existing functionality in the generic data table function that allowed me to simply pass in a configuration option which made it process specified columns through timeAgo() to convert them into relative times.
But my display of tabular data is more complicated than something that simply renders an HTML table using PHP. Some tables also auto-update using a generic system where an encrypted SQL string is passed to the backend on a regular basis. Any manipulation of data in that system would have to be done in Javascript using a Javascript version of timeAgo(). But it proved surprisingly easy to add the code to my auto-update functionality so that the same configuration resulting in data manipulations in PHP would produce them in Javascript. All I had to do was make sure there was a Javascript function with the same name that took the same parameters. I even made it so that the data table would sort correctly on this column when I clicked on its header. (I did this by storing the absolute datetime as a "value" attribute on the span that was acting as a table cell and, when that attribute is present, sorting on that instead of text that might read "2 seconds ago" or "1 day ago.")
I not only displayed such relative times in tablular data; I made sure to prominently display the relative time translation of the time of the latest data point on my weather and inverter graphs, which I consult obsessively for a visual indication of how things are going at the cabin. I even thought about perhaps color-coding the background in cases where the data is various levels of stale.
Most of the results of today's firewood haul, some of which I'd already burned by this point. There was a thin dusting of snow outside at the time.
For linking purposes this article's URL is: http://asecular.com/blog.php?241203 feedback previous | next |