Friday Hodgepodge

Friday, July 16, 2021

Four Neat Things I Can Thank Stack Overflow For

Software developer Joel Spolsky's Stack Overflow site recently sold for quite a tidy sum. The site, which Wikipedia aptly describes as "a question and answer website for professional and enthusiast programmers," has helped me -- definitely one of the enthusiasts -- do all kinds of things with computers that save me time or make my life easier.

Here are just four instances out of many that I've been able to hack something together without having to spend too much time figuring something out, bothering others with newbie questions, or shelling out money for software that will become obsolete after five years of annoying me.

Image by Gus Van Horn. Copying permitted.
1. A few years ago, I wanted a way to see changes to a web page quickly while editing it. From slinging HTML, I knew how to get a web page to auto-update, but I didn't want to have to explicitly add/remember to take the code out every time I edited an HTML or markup file.

But Gus, just have your browser reload, you might say. I didn't want to do that, either. I basically wanted an editing environment where I could edit in one pane and see changes in the way the web page would look in another in close to real time. I realized I could have a script add the auto-refresh code to a dummy file based on what I was editing. Great, but then the browser is just auto-refreshing the dummy file ... unless I can have that re-generate every time I save my edits to the file I'm actually concerned about. Stack Overflow helped me find how to monitor my saves so I could make a new dummy file, which the browser would load on auto-refresh.

With that piece of the puzzle, I got the HTML/markup editing environment pictured at right. I use this almost every time I blog.

2. Yeah, it's cool to ask Alexa what the weather is like, but I'm really more of a written word guy, and I can't get away with this during writing/planning time at zero-dark thirty, anyway. Not with kids asleep in the next room.

So, as much as I liked her pithy description of the day's weather, I needed another source. The National Weather Service site fits the bill. (Take a look.) Nice, but I have a bad memory for things like this. So I wanted a description of the weather in my planner for reference, and hate to cut and paste.

Stack Overflow helped me figure out how to fetch the web page and extract the short description of the weather for that day. Now, I just hit a couple of keys in Emacs and I have something like this in my planner:
- Today: Partly cloudy. Highs in the upper 80s. Southeast winds 5 to 10 mph increasing to 10 to 15 mph in the afternoon.
- Tonight: Mostly clear in the evening then becoming partly cloudy. Lows in the mid 70s. Southeast winds 10 to 15 mph becoming south 5 mph after midnight.
I do have to change a configuration setting when I travel. I once started to try to automate that, but realized that that was going to be too much of a rabbit hole to be worth it. (Some of you are doubtless saying, Too late!)

3. Yeah, there's probably a way to click on two points and get a distance in Google Maps, but I found out quickly enough from Stack Overflow how to collect the screen coordinates of my mouse.

With that knowledge, I wrote a script that computes distance after I click on Points A and B and each end of the scale, and enter the units.

Better yet, I can use this on any map or image of a map, and I don't have to hunt around and guess if the powers that be at Google decide to hide their method of getting distances under some new, faddish redesign in the future.

4. I save lots of time by having my computer automatically download news from a handful of sites several times a day, remove redundant links, and produce a news and commentary digest I can quickly look at on any of my devices. (I sometimes get ideas for blog posts while looking at this in line at the grocery store.)

Some time along the way, I realized I could also archive these. Now, in addition to having a time-saving list of current news, I have an archive that I can search, including by date.

I consulted Stack Overflow and many other sites quite often as I gradually developed the tools that allow me to do these things. I still use other sources (for news and scripting hints), of course, but overall, Stack Overflow keeps me from having to spend too much time looking at news.

-- CAV

No comments: