• Category Archives tech talk
  • Computers and programs, maps and GPS, anything to do with data big or small, as well as my take on the pieces of equipment I use in other hobbies — think bike components, camping gear etc.

  • Re-Re-Re-Litigating

    I saw recently that FreeCAD, the engineering program I played with once or twice in the past (it wasn’t ready for prime time), well it finally just reached its first official release version. I thought I’d give the new version a try, so I installed it (using Flatpak — probably a mistake, but it was the easiest choice in the moment) and got it running pretty quickly. The program looks the same, maybe a bit more polished, but it definitely works much better. That got me thinking…

    There was a work project I automated years ago, then extended the automation; and then (after I retired) I decided to re-do the whole thing using FreeCAD and Python. Looking back, the actual project was a little bit boring, but playing with the programming was fun, and so I found my old programs, re-worked them a bit, and it worked great.

    I won’t bore you with new pictures.

    One difficulty I did run across was that FlatPak builds apps isolated in their own little sandboxes, with their own version of everything they might need in the sandbox with them, and the version of Python shipped with FreeCAD did not have some of the library moduless my original script needed. And I couldn’t for the life of me figure out how to install a library module in the sandboxed version of Python.

    All I needed from the library module was a root-finding function, and in the end it was actually easier to just write my own function than continue messing with the libraries. Strangely enough, my script now runs slightly faster despite my function being less efficient (bisection in Python vs Brent’s Method in C++ or whatever), probably because I got rid of the of the slowdown of having to load that library. Once again, for small problems, small brute-force solutions have their (small) advantages.

    (I don’t remember where I got the idea, all those years ago — I may have pulled it out of my ass made it up myself — but back in school I always thought that the magic number was 3000: when dealing with less than 3000 items, just use the brute-force approach.)

    I also went looking for some of the models I made in my last go-around with FreeCAD. I found a few and moved them from my old laptop to my new one — backing up the old laptop along the way, I don’t think it’s long for this world anymore — but the one I wanted to find, a model of a forged tee I made, was nowhere to be found. Oh well, I guess I can re-litigate that one too, if I really want.


  • Back To That Old New Thing

    I’m slowly digging out, getting back into some of my usual shenanigans: I went for a towpath ride today (and one several days ago), and I’m about to go upstairs to play my cello — first time in a month that I even took it out of the case…

    I also found another computer chew-toy, not so much a new thing as a return to something I was playing with a few years ago: I’m looking at pedestrian crash data using R. This time around, I have my data in a geopackage, and am using a different library to access it, which makes the whole process easier; I’m also limiting myself (mostly) to location data, and keeping the geographic scope limited to Bethlehem, though I am looking at a wider date range: 2013-2023. So far I’m having fun, but who knows when I’ll lose interest?

    We have Iris tomorrow, and Wednesday we’re visiting my Mom — I stop in to help her out with stuff maybe once a week. We’re also doing some backyard cleanup here, in preparation for the kayak storage racks Anne is building. Life goes on.


  • Some Bike Love

    I had a slow leak on the Santa Cruz’s rear tire, which turned out to be a stuck valve and relatively easy to fix (disassembled and cleaned it), but then the next day the front brake felt super soft. I got new brake pads, replaced the front brake — fixed! I did the back brake as well the next day, and I also finally got the shifting dialed back in. It feels like a new bike…

    I took it out on the towpath Tuesday after the front brake fix, then again on Wednesday with the rear brake and shifting done as well. Both times were awesome, but on Wednesday I took the little alternate “fisherman’s trail” in Freemansburg. Big mistake!

    The whole trail was completely overgrown with downed trees, sticker bushes and nettles. I fought my way through — it took forever, I had to shorten my ride I took so long — and when I was back on the towpath I got a good look at my arms, which were completely covered in blood. Yikes! It was from the stickers, and it was really just a bit of blood from the tiny sticker scratches, mixed with sweat and looking worse than it really was — the nettles were far more annoying to be honest. But it sure looked dire; I took pictures but I won’t post them here.

    Post-ride shower, and my arms looked like it never happened. Bike is still great.


  • Fun With Bash

    I got to play with shell scripts a few times over the past few weeks, thought I’d talk about them:

    Wordle Helper

    I have a script I use to help me make my guesses when I play Wordle; it basically generates a list of available words based on my results, analyzes these available words (by checking the overall letter frequency, then scoring the words based on which letters they contain), and returns the word list with their scores, sorted by word score. This is especially helpful as a process of elimination, and most especially in the first rounds — I can confirm or eliminate the most common letters and quickly narrow down my choices (well, usually).

    I decided at a certain point that multi-letter combinations might be even more useful, so I wrote another script to score words based on the frequency of two-letter combinations. This worked well enough that I wrote a three-letter scoring script, and then realized that I should just write something generic that would score based on however many letters I would want in my combinations.

    For some reason I brought my laptop on vacation, and when things got quiet I broke it out and wrote the multiple-letter scoring script — it works like a charm. What I found though, is that there are diminishing returns for the letter combinations: there is no real advantage to use more than two letters. Still, this is a script that I use every day.

    Getting SSL

    Every 90 days I have to get a new SSL certificate for this website, so I can use the more secure “https” rather than plain “http.” This was once a pretty easy process, until my (free) certificate-generating organization got taken over by someone else. I found a much more onerous (but still free) web-based method and have used it for years, but I knew there had to be a better way.

    I eventually found something called getssl, a bash script that automates the process used by that onerous web-based approach. Ufortunately it’s meant to be run on the computer where the website resides, rather than on my local machine which is what I preferred, so I never really messed with it… Then one day I just set it up and ran it, and it basically did 99% of the work, generating the certificates and storing them on my laptop. All I had to do myself was install them manually, which was pretty easy. Awesome! The whole process went from an hour to about a minute, and I’ve been using getssl for almost a year now.

    But it still bothered me that I couldn’t get the whole process automated, and then last week I found an extra feature in getssl that would get me that final one percent; the only problem was that the extra feature would need to be modified to run on my machine rather than remotely. (This modification turned out to be fairly straightforward, which was a bit of a surprise actually.) I managed to make the code change just a few days ago — again, while out of town with my laptop — and my current certificate was installed, fully automatically, using the modified feature.

    Neither of these little projects were hard, but it’s so seldom that I do anything like this anymore that I was pretty proud of my accomplishments.


  • Cancel The Exorcist

    Posted on by Don

    I’ve had a creaking near my mountain bike’s bottom bracket for a few weeks now. I was pretty sure it was either the crank or the bottom bracket itself (rather than, say, the suspension pivots), since it seemed to happen with every pedal stroke, as in an unbalanced load on the BB, rather than with the bike suspension flexing.

    I tightened the cranks — no luck, so i took them off, lubed them and reinstalled them. Still no luck, so I took them off to get to the bottom bracket, cleaned and lubed the threads and reinstalled them, and still had the squeak. Maybe my bike was possessed?

    I thought maybe I didn’t do the job well enough, so I took the cranks and BB off again, and this time I also took the rear wheel off to access the suspension grease port and pumped it full of grease. I put everything back together, and this time the creaking was gone. No idea what actually worked, but the pivots really did need the grease…

    Of course, the bikes never stay perfect for long: the MTB shifting is now a bit funky, and the touring bike had a flat tire when I checked on it. It’s always something.

    Saturday was a ride at Nockamixon with Tim C, someone I know from the Museum, and Sunday was a ride up the D&L to a coffee shop in Weissport. Hot rides, both days!


  • New Toys

    Posted on by Don

    Whelp, I’m now a kayaker…

    Anne and I planned to get kayaks as our Christmas presents to each other, and were doing our research when her brother & sister-in-law gave us two of theirs as a gift. We tried to pay them, but they refused — I think we did our part to help them clean their garage out.

    We got life jackets and paddles from them too, but we still needed some way to transport the kayaks. We did a little online searching, found some used roof racks for pretty cheap, and installed them just the other day.

    Today we put the kayaks on the roof and took them to Mauch Chunk Lake for their “New (To Us) Maiden Voyage.” Driving with them on the roof was a bit unnerving, but they did just fine. We got to the lake, got them in the water, and despite the windiness of the day, we had a great time with our new toys.

    So now we have the boats, and (some of) the infrastructure, and we’ve christened them — we are kayak people now!


  • The Things We Carry

    Posted on by Don

    Anne and I just did a section hike on the Appalachian Trail, walking the New Jersey portion with several friends. More (probably much more) on this later, but one of the things that struck me was how meditative just hiking along can be — songs, other earworms, and various musings would take up a lot of the mental landscape.

    I’d built a QGIS project before our trip, with info about our section of trail, and put it on my phone. It had some distances in miles and others in kilometers, and I was mentally converting back and forth when it struck me: a kilometer is about 0.6 miles, while a mile is about 1.6 kilometers. In other words, their reciprocals differ by one. Is that true, and if not, what number would it be true for? I worked out the quadratic equation:

        \[x^2 - x -1 = 0\]

    (hmmm, seems familiar)… and I found the answer to be:

        \[1 + \sqrt{5}\over2\]

    otherwise known as φ (phi), the golden ratio. Interesting, and a fine bit of mental bubblegum to chew on as I walked along…

    When I got home, I broke my internet fast with some Reddit, and the first thing I see there is a photo of a tee shirt, with the golden ratio written on it — meaning, in this case, the “most irrational” number, as in “I am most irrational.” Anyway, just a coincidence, but a strange and striking one.

    Click To See The Shirt

    (You can see the shirt by clicking the image.)

    The other thing I carried with me in my head? “The Alley Cat,” a perfect earworm for my hiking rhythm, though I noticed that I changed the tempo as the terrain changed.


  • Dry

    The humidity in the house has been really low lately, no surprise with all this cold winter weather. Anne and I have been struggling with dry skin and sinus issues, but for me the big issue has been its effect on my cello: as it dries, the wood shrinks slightly, which makes it play flat, and recently the pegs have come loose so it became really flat and un-tunable. I had to put drops of water on the pegs, then put the cello in its case with a damp-it to recuperate.

    The cello is fine now, and the weather has been moderating — warmer, rainy — but we still broke out the room humidifiers upstairs.


  • Even More Sals GIS Fun

    My map looked so good in the QField app that I thought it might be nice to build a web map, one that could be generally available rather than part of a very specialized app. And rather than doing it from scratch, I decided to try some of the QGIS plugins.

    My first try was with the QGIS Cloud plugin. I’d used this before (verdict: meh), but I still had an account so I decided to give it another try. Verdict is still “meh” but I did get a web map out of it, check it out here. This looks as good as my QField map, which isn’t surprising since it’s basically my original project running on QGIS Cloud’s servers, but this setup came with a lot of latency: the map takes a while to redisplay after every move or resizing. It also had some trouble showing my location when I first launched it on my phone (it worked fine on the laptop) but this problem eventually resolved itself — it might have been a permissions issue, and I might have solved it by pressing random buttons…

    The other plugin I tried is called qgis2web, which builds a local web map using the standard Leaflet or OpenLayers javascript libraries. This sounded like a great approach, but as soon as I ran the plugin, it crashed QGIS — doh!

    It turns out that qgis2web can only work with very simple feature styling: lines (for instance) can be dotted or solid but not a mix, and can only be one color, while my trails were dotted lines in one color, drawn on wider solid lines in another color…

    So, I created yet another Sals sub-project, with a subset of my map’s features (just trails and roads, streams, and trailheads) and a much-simplified symbology. Just for fun I tried building an OpenLayers map, since I’d never used OpenLayers before. It came out great, and though it doesn’t look as fancy as the QGIS Cloud map it loads/runs much faster. I put this one online as well, you can find it here.

    Meanwhile, Ben and Jenny arrived yesterday for their Christmas visit, and today we went for a hike at Sals. I used my QField app to record a bunch of marker posts — I didn’t want to turn the hike into a “Don plays with his maps” debacle, so I didn’t break out either of my new web maps. But capturing the data in QField was a snap, and incorporating it into my main project was mostly seamless, and I’d guess I now have about half of the total number of markers added.

    And that means that my two new web maps are already out of date…


  • More Fun With QGIS

    Anne and I did a hike a few days ago at Sals, very pleasant and a good workout — we got in about 6 miles — but while there I was reminded of a project I’d been meaning to get started: about a year or so ago the VMB put in numbered marker posts at trail junctions, and I had been planning for a while to document them for my Sals map.

    (These numbered posts were something I’d advocated for maybe a decade ago, when I was involved with the trails up there. My advocacy didn’t go anywhere at the time, but it is good to see that the plan eventually got implemented.)

    Logging the post locations could be done using my GPS, and I’d done a few like that some time over the past year, but I am now seeing this as another opportunity to play with QField. And that’s my new project.

    The first thing I did was to clean up my Sals map project in QGIS: I have a big mish-mash of data layers in different formats (mostly geoJSON and shapefiles) and multiple coordinate reference systems, so the first thing I did was to convert them all to the same reference system (the one used by GPS devices), and then put them all in a geopackage, a sort of portable database file. This really cleaned up my project.

    I then created a new project (that also used my new Sals geopackage), and created a second geopackage, one that will be editable in the QField app (as opposed to my official data geopackage, which will be locked down), with a layer to record the new marker posts. This basically means I will capture the data in a scratch file before moving it to the official package. This approach wouldn’t work well for updating existing data, but I think it’ll do well enough here and doesn’t leave my official data as vulnerable to field mistakes.

    So I did all that, and then went through the hoops to get my new Qfield project onto my phone. Opened it up — it looks beautiful, it actually looks better on the phone than on the laptop.