Diary of a Network Geek

The trials and tribulations of a Certified Novell Engineer who's been stranded in Houston, Texas.

7/24/2020

Programming Widgets

Filed under: Better Living Through Technology,Fun,Fun and Games,GUI Center,On Creativity,The Day Job — Posted by the Network Geek during the Hour of the Hare which is terribly early in the morning or 6:30 am for you boring, normal people.
The moon is Waxing Crescent

I’m anything but a professional programmer, but occasionally, I make stuff.

Sometimes, in my day job, I have to solve a particular problem and the only way I can manage that is via some small bit of programming. Usually, it’s just a little script of some kind; PowerShell or Perl, mostly. I taught myself Perl seventeen or eighteen years ago, in an attempt to stay busy at a job that severely underutilized my talents. Demonstrated, I think, by teaching myself Perl in my downtime. A lot of techs I knew would have just scrolled a news site or played solitaire or some other useless thing. I tried to expand my portfolio of skills. I learned a long time ago, though, that I need a project to guide my learning. It almost doesn’t matter what the project is, as long as it gives me problems to solve and obstacles to overcome. Solving those problems, with the new thing I want to learn, is what teaches me. Granted, I don’t always learn the best way to accomplish my task, or at least not the most commonly accepted way, but I still learn the skills involved in a way that embeds them pretty deeply.

Since I’m mostly self-taught in IT, which is my chosen professional field, I’ve had to find ways to keep learning on my own interesting. Having personal projects is one of them. So, projects are how I teach myself new things. As I work toward a larger goal, whatever that may be, I find problems and solutions to those problems and my knowledge extends into new areas. I did that with Perl a number of years ago. First I tried to teach myself Perl for extending MoveableType, the blogging software that I used to use before their licensing debacle. But, that was a bit too arcane and involved a place for me to start. So, several years later, I found some simpler scripts that did some language processing and were useful for another low-key hobby of mine; conlanging. (That’s constructed language making, for the less geeky.) And, so, I had a project to work with that was within my skill level. In the end, I made those scripts something that could run on a webpage and it drove massive traffic to my site. It was sweet! But, it crashed the server because it was so popular and it drove TOO much traffic to that site. Ultimately, I had to take them down. By then, though, not only had I learned Perl pretty well, but I had moved my blog to WordPress and started looking at this fancy new language for the web called “PHP”. That mostly ran in a way that didn’t put a strain on the servers, so it was better for high-traffic sites. The only problem was, I couldn’t move the functions from the Perl scripts to PHP easily. So, I started looking around for projects to teach myself PHP.

The project I found to let me dig into PHP was a random generator. No, not some random piece of electronic equipment, but a little web toy that randomly generated things. It’s pretty simple, really. You have something, like a title or a sentence that has variables, like nouns and adjectives, like Mad Libs. Those variables become, well, variables in the program. So, I just need to list a bunch of whatever that variable is into the program which randomly chooses those and fills them into the sentence or title and then gives me the result. Sounds simple, right? Okay, it kind of is, which is why I started with that. But, then I went about making it complicated. I added more variables and started reading them in from external sources and getting fancy with the output formatting. But, what it did was let me learn, bit by bit, PHP. You can see a bunch of those at my World Building page at Fantasist.net. When I got good enough at it, I dug back into WordPress and started looking at ways to use my new PHP skills to modify WordPress. What I came up with was the Dale Reckoning Calendar Plugin. For its time, it was pretty good. Now, I look at it and, well, I’m not quite embarrassed by it, but I’m not as proud of it as I was. It does work, but it requires the user to modify their theme and, essentially, become a bit of a coder themselves. That never sat well with me. And, I wanted to have something that would randomly, or semi-randomly, conjure up weather conditions for a particular day. Why? Because, if you’re gaming in a big campaign, things like weather start to matter a little. And, it was fun. It let me use old skills and old code and extend them to something new and stretch my learning even more. So, that’s why I kept coming back and eventually came up with the Forgotten Realms Weather Widget. It works better as a widget in the sidebar than as a daily update on posts. Though, I may still revisit the idea and see if I can’t improve my old plugin to not require the end-user to modify their theme to make it work. Again, for no real reason other than it’s fun to me and it would make my brain work more on something technical, which I’m already good at, but not for my day job. Mostly, though, because it would be fun to me. Oddly, it wouldn’t be fun if I had to do it for a paycheck. By the way, in moving some of the code from the old plugin to the new widget, I did find some ways to tighten the code a bit. I’d still be a little embarrassed to have a professional coder look too closely at it, but at least I’m improving.

And, I’ll keep working on it, though I’ll need to set some better boundaries so that I don’t get so obsessed that I miss much more sleep working on it. In any case, you can see the results for yourself at Forgotten Realms Weather Widget.
It’s free and only for WordPress and there may be bugs that I haven’t seen yet, so let me know if you use and find any. I can’t promise when I’ll fix them, but I promise that I’ll work on them.

This post originally appeared on Use Your Words!  And, that’s where you should leave any comments or bugs you might find.


Powered by WordPress
Any links to sites selling any reviewed item, including but not limited to Amazon, may be affiliate links which will pay me some tiny bit of money if used to purchase the item, but this site does no paid reviews and all opinions are my own.