A Thought of Incomplete Towers

Good Morning from my Robotics Lab! This is Shadow_8472 with a small thought for the week. Let’s get started!

As much as I hate to admit it, scope is important when working on a project. Luke 14:28-32 bids anyone who wants to build a tower first assess its cost and compare against personal treasury. The advice truly applies to non-monetary resources as seen in the following illustration of a king going to war with an army twice the size of his own. Even if you are the only witness to the foundation you laid, incomplete projects are a constant source of annoyance when you lack the resources to complete them.

I am in such a situation in pursuing a Linux phone. Even this post is an example. I was going to observe how I probably should have focused my attention on a tablet. It’s basically just a phone without a dialer, right? Alas, as I began writing this paragraph, I figured I should do some background research on Linux tablets… If phones are wanting, tablets are even farther behind.

I’ve taken a few days to think about it. When given a choice between a phone or a tablet, the typical user will choose the phone. With the bias towards phones, limited development efforts are focused accordingly. From personal experience, I have observed how apps designed without the larger screen in mind sometimes do strange things if they even install. The same thing happening with an entire operating system is not something I’m prepared to deal with.

In other news, I’m now active on Twitter @Shadow_8472. I’m still considering my balance of priorities: digital privacy vs. free speech, so at most I’ll be adding around here is a traditional link on my socials page. However, I believe the new direction Elon Musk is taking the platform is an improvement from what it was doing prior to his buyout.

Final Question

What projects of yours would have benefited from an evaluation beforehand?

I look forward hearing your answers on in the comments below or on my Discord Socials server.

I Choose AnySoftKeyboard as My Android Keyboard.

Good Morning from my Robotics Lab! This is Shadow_8472, and today I’m finalizing my decision on an Android Keyboard. Let’s get started!

AnySoftKeyboard (ASK) is not the perfect keyboard for me. As I stated last week, the default (Googled) keyboard that came with my tablet is my control test for user experience. The only visible features I find it lacking are up/down keys and a dark mode. ASK offers both of these, but offers additional features I need to grow into.

Unlike other keyboards I tried, ASK is especially flexible if you don’t move on before you’ve explored the depths of its settings app. Buried within its confines are a number of prebuilt top and bottom key rows – around a dozen each. The most unintuitive feature for me was a list of swipe gestures I could safely ignore if it wasn’t key for switching keyboards on-the-fly. I even found a “developer mode” with 41 different types of text fields to test how the keyboard behaves.

My biggest standing complaint with ASK is the confusion over exactly what is a “language.” Installable ASK languages appear to be plugins for key mapping/dictionary pairs, while Android’s installed languages menu brings up a set of all installed on-screen keyboard programs. ASK’s definition is the better descriptor, but a multilingual end-user who only cares that things work will accept Google’s definition before something more descriptive like “keyboards.”

Special thanks to muneyotxi for showing patience while educating me about ASK’s less obvious features – namely long-pressing the Return key for a faster access to keyboard app switching.

Final Question

AnySoftKeyboard is an almost trivial tweak to Android I would recommend for anyone thinking about digital privacy. What other raw beginner level tips do you have to share?

I look forward hearing your answers on in the comments below or on my Discord server.

I Replaced My Android Keyboard and You Can Too!

Good Morning from my Robotics Lab! This is Shadow_8472 and today I have a side project of the week while I work on something larger. Let’s get started!

My journey to replace the default Android keyboard on my tablet started with the need for an up arrow. I already had left and right (a massive improvement over tap, check, and revise), but no up or down – which would be extremely helpful when using an SSH program I rarely use.

As a note to the unaware: Google collects as much data on you as it can get away with, and they use it for their own profit. Their word suggestions as you type works by sending them your keystrokes and memorizing you well enough to predict your most likely next words. Symbiotic or parasitic relationship? I don’t need this feature, and it is a privacy concern. For me, the answer is parasitic.

Switching to a new keyboard was as easy as installing any regular app. Note that I am preferring F-Droid over installing through a Play Store client. My first find was Unexpected Keyboard, a keyboard with a dark mode and four-way arrows. If only it wasn’t designed around key swiping, I’d be more than content with the ability to hold Ctrl+Shift+left/right to select text.

Shortly afterwards, I found Open Board, a fork of the AOSP (Android Open Source Project) keyboard. It too has a dark mode, but its visual familiarity despite lacking enhancements such as the left/right keys has kept it relevant to my search. My biggest complaint is that the backspace doesn’t play well with Collabora Office, an open source document editor I used this week to write about a page of fiction.

Much later, I tried out AnySoftKeyboard. Where I’ve had a chance to form a full opinion on the first two, AnySoft appears as though it could be a compromise for a “just chilling” type of keyboard. It has the left/right keys I’m so fond of, but auto-correct is a slight bit too aggressive.

Most importantly, I learned that each keyboard is handled as a separate “language” by Android. All three keyboards have the option to quickly switch to another, and that makes the goal of finding the perfect keyboard less important than defying the monopoly by straying from the gold standard for its deal breaker. My tablet is one of two operable portable devices I own with one being purely experimental. I don’t want to lose the other because I didn’t know enough of what I was doing.

Takeaway

I wish I had a pie chart data the typical smartphone collects on its user. How useful to its masters is each piece? How hard is it to mitigate each slice? The hardest part of replacing a keyboard has been finding a single one that works, and I cannot always tell right away because they often require time to explore any configuration options. For now, any issues I have with each board are not so important when I can easily access a menu to switch boards. This is more of a progress report than anything final. However, I am glad to report that I’m well on the way to a solution without breaking non-redundant functionality.

Final Question

What on-screen keyboards have you tried out?

I look forward hearing your answers on in the comments below or on my Discord server.

My 3D Printer Needed Maintenance!

Good Morning from my Robotics Lab! This is Shadow_8472 with a side project for the week. Let’s get started!

I wanted an easy post this week, as the past two weeks have been downer endings, and 3D printing has been on by background list for a while. For reference, I have a Monoprice Maker Select Plus I got for Christmas several years ago. Since then, I’ve learned that 3D printing is almost more about maintaining your machine than it is about actually printing things.

I wanted to print up a part I need for a planned project, but no matter what I did, the bed wouldn’t level out for me. The back, right corner kept turning up as too close to the extruder, even when at the end of its adjustment screw.

I reached out to relevant help channels, and someone from the Sweetie Bot Project’s Discord server informed me of new ways my model of printer was a low-end tool/high-end toy. My print bed is warping over time, though I cannot test it with a ruler or triangle because of a bad spot in the middle.

My solution was to find an Allen wrench and raise the Z-stop switch a notch. I leveled the bed again, and I was just barely comfortable enough with a flat test print to try a Benchy. I came back to a failed print. When I got around to servicing it properly, the filament was snapped off – my filament is wet from improper storage over a period of humidity.

I don’t have time to fix it and try again before posting, so this short post again turns into a downer ending. At least I learned a thing or two.

Final Question

If you have a 3D printer, how do you manage how it absorbs humidity?

My Sister’s Computer Hates Me!

Good Morning from my Robotics Lab! This is Shadow_8472, and today I am starting a series on installing Linux on my sister’s desktop. Let’s get started!

The Plan

My sister has expressed an interest in digital privacy and switching to Linux. She showed interest in installing Linux on her computer this week, and I just got a pair of new SSD’s on sale while shopping for my Arch installation, so I’m using one of those for this installation.

To the best of my experience, PopOS has been the distro of choice to use in terms of compatibility and privacy – by that I mean it has access to the Ubuntu library while System76, the company that makes it, advertises itself as being more privacy aware. While I’ve had problems with it in the past, they weren’t too difficult to sort out. It has a straightforward installer, and then their website has a selection of commands to install a preferred desktop environment. In short: it’s my favorite distro for beginners.

Hardware Installation 1

My sister left me a note inviting me to start work at my convenience, only for a Windows update to pop up while her system was unattended. I got her message before it was obscured, but I still found the irony funny.

For reference, I am working with a 1TB SATA SSD. About as soon as I had the case open, I was scavenging the technology pile for a SATA cable and a power connector from the supply I replaced a while back. The computer screws I found gave me too much trouble attaching it to her computer’s bracket, so I left it loose, later securing it with electrical tape several hours and “learning moments” later.

PopOS Install 1

Computer motherboards have what’s known as firmware, often referred to as BIOS, though recently replaced by UEFI. For the rest of this post, BIOS refers to the old, limited firmware exclusively. My sister’s computer boots with UEFI, and it was displaying on her WACOM graphical tablet where I missed it for playing around with HDMI connections on the graphics card so I could override boot to a USB drive with the latest PopOS install media.

I forget how, but the tablet-monitor went unnoticed until it was the sole output with the installer. I took special care to make sure I was installing to the blank drive, and not over her Windows installation. This was especially important because the system already had a 1 TB hard drive. After that, I put on the KDE desktop environment.

A minor, still-unresolved nuisance was the main monitors constantly being swapped. You can swap cables, or physical devices. Somehow, they always end up swapped. I also noticed some sort of U/I ghosting and horizontal line flickering I solved by removing the WACOM tablet entirely (it was mirrored to one screen – possibly both directions).

I finished up my first day arguing Minecraft into working (barely). I installed MultiMC and GraalVM, only for her modded world to require Java 8 (not an option at present for GraalVM). I was able to link up OpenJDK 8, which came preinstalled. I had to duck back into Windows to disable fastboot so Linux could mount the Windows drive and she can play the same world in either operating system using a symbolic link (shortcut) there. Despite Minecraft only launching around 1 in every 30-50 attempts, we were able to leave her world running “overnight” – which turned out to be only a few minutes after walking away. We found Linux in a mess in the morning. Very little worked, but it all pointed to hard drive failure. It wouldn’t even boot after requiring a forced shutdown. We ended up trying a SATA cable from an old church office computer in our stock – praise God, it cleared up the issue! It still didn’t solve Minecraft from arguing with video drivers:

java: ../nouveau/pushbuf.c:730: nouveau_pushbuf_data: Assertion `kref' failed.

or throwing SIGSEGV errors I haven’t begun to investigate yet.

All this time, I was thinking about how GRUB (Grand Universal Boot Loader) was never able to see Windows, like in the other systems I’ve dual booted. To my dismay, I found PopOS was running in legacy BIOS mode, where Windows was in UEFI mode. The two will never be able to see each other. A reinstall was in order.

PopOS Install 2

Dual booting is no joke if you don’t know what you’re doing. If it were my system, I’d have just taken the hit and accepted the need to select an operating system at the firmware-level. But no, I want an intuitive menu my sister can use. Unfortunately, this meant reinstalling in UEFI mode. To help with that, the folks at r/TechSupport pointed me to Ventoy and instructions on how to set it up with a GPT (General Partition Table for UEFI) instead of an MBR (Master Boot Record for BIOS).

I used my new Ventoy USB to reinstall PopOS, being sure to select the NVIDIA drivers version of the install disk image and choosing the more KDE-native display manager sddm over GDM3 when prompted.

UEFI is a pain to dual boot.

GRUB did not come installed this time. I tried installing grub-efi, but was never able to get it to work correctly, even after installing something for it to /dev/sdX. After much reading, I concluded that a simpler alternative to GRUB may be more suited to this application as the last of my stamina for the week depleted.

Takeaway

I thought this would be a nice, little side project done in a couple hours with a tough issue here or there. WRONG!

Final Question

Have you ever had a project fight you every. step. of. the. way?

I Don’t Want to Use Manjaro Anymore

Good Morning from my Robotics Lab! This is Shadow_8472, and today, I am scoping out Arch Linux for install on a daily driver. Let’s get started.

Majaro done did it this time. With every bad update I get, I’m more keen to listen to the people calling out its mistakes. Recently, an update broke around three pieces of software I use – including one I need for an upcoming project. Let’s spend a week or few installing Arch!

Arch Linux: Pre-Install Impressions

Arch is a major Linux distribution heading a branch of other distributions, similar to Debian or Fedora (of the Red Hat branch). Its userbase has an elitist reputation like the ability to install Arch makes them smarter or something, but I’m sure it’s just for the memes. My understanding going into this project is that Arch Linux is less a “Here is an operating system to install” and more “Here are the components, install what you need. If you don’t know what you need, check the wiki [1]. It’s one of the best.” Thus: people who use arch [by the way] have only proved they know how to follow instructions.

Arch Linux has two primary resources: archlinux.org [2] and wiki.archlinux.org [1]. Additionally, I’m following a tutorial by Learn Linux TV on Arch installation [3]. One afternoon on the Arch Wiki, and I can tell this is looking like a longer project. I’ll be lucky to have my installation media and basic install.

The Arch community is smaller than other distributions, and therefore places a heavier emphasis on users contributing back. Given the more technically inclined user base Arch caters to, it’s a more reasonable of an expectation than it sounds like at first glance.

Choices Before Install

As noted above, Arch is a distribution that highly values customizability. Browsing the wiki turns up a slew of names I’ve seen while troubleshooting. Every little part that can go into an operating system one never thinks of until it’s not working properly is on display here. While I intend to go for a complete desktop environment at this time, I could totally spend months building something truly unique if I had the patience to learn each piece – perhaps starting with a window manager as different from what you typically find on phones and desktops as they are from each other, maybe something that doesn’t use the mouse outside a program. I’m not ready for that though.

One major choice made before even download is if you want to install for a BIOS vs UEFI (or on an encrypted drive). BIOS almost needs no introduction – almost. Some version of the Basic Input Output System can be found on most desktop computers made since around 1980 and on into the new millennium. BIOS runs directly on a computer’s motherboard the moment power turns on. Its job is to start the boot loader, and manage system I/O until shutdown. It has become so ubiquitous that even having grown up around computers, I only recently realized the word is a proper name like “Linux” as opposed to describing its purpose per the term “operating system.”

It’s taken fifty-some-odd years, but BIOS replacement UEFI is the de-facto successor that addresses these limitations. UEFI boots drives beyond 2.2 terabytes, with its limitations on the 2022 scale of the Internet in exabytes. Unconfined to 16 bit operations, UEFI can afford things like a nicer interface with mouse support. Like it for its additional utilities or hate it for being closed source and Internet capable, it’s what most people are stuck with going forward.

Takeaway

Installing Arch is a much larger task than I originally gave it credit for. From what I have seen, it is the distribution I would recommend for people looking to learn how to assemble a Linux system once they are familiar with the command line. I expect this project to take my Linux problem solving skills to the next level.

Final Question

What is the deepest you have gone into your favorite operating system?

Works Cited

[1] wiki.archlinux.org, [Online]. Available: https://wiki.archlinux.org/. [Accessed Oct. 17, 2022].

[2] J. Vinet, A. Griffin, and L. Polyák. archlinux.org, 2002-2022. [Online]. Available: https://archlinux.org/. [Accessed Oct. 17, 2022].

[3] Learn Linux TV, “Arch Linux: Full Installation Guide – A complete tutorial/walkthrough in one video!,” youtube.com,March 31, 2021. [Online]. Available: https://youtu.be/DPLnBPM4DhI. [Accessed Oct. 17, 2022].

I Went From Command Line to Discord Voice on Raspberry Pi

Good Morning from my Robotics Lab! This is Shadow_8472 with a side project of the week. Let’s get started!

Starting From the Basics

I found myself in need of a separate Discord account connected to a voice server this past week. With one account on my main computer and myself unable to use Discord mobile, I chose to work with my Raspberry Pi 400. I downloaded a build of Debian 12 for the Pi, flashed it with balenaEtcher, and it booted to the command line with no Internet access.

I was challenging myself by trying to maintain a conversation while setting things up. As I lacked a free Ethernet connection, that meant working with Wi-Fi. I only got as far as failing to get wpa_supplicant up while only using far fewer tools than were assumed by the tutorials I was using. In the end, I moved a connection over from my main computer temporarily.

Desktop Environment

The MATE desktop environment has been good to me for my old laptop. Once I got it installed on the Pi, even it felt a bit heavy – a note for next time, I suppose. I was able to easily connect to Wi-Fi and restore my desktop’s Ethernet.

Firefox went on next because Discord doesn’t have a client for ARM processors outside the same Android app I cannot use, but the browser version loaded. It didn’t see my USB microphone, and neither did Firefox even after bumbling around with allowing web pages to see my mic. Only then did I find and enable the PulseAudio daemon so Firefox could see my mic and pass it to Discord.

pulseaudio --start

Since I was working quick and sloppy as root, I had to use the following instead:

pulseaudio --system

Takeaway

I can tell my skills are improving. I believe a full Arch install may be in my future.

Note

An interesting problem I keep running into is the system clock. Extreme low-end computers frequently don’t include the circuitry to measure time while power is otherwise off because of monetary cost and circuit board real estate. This week, it meant I had to reboot after connecting to Ethernet, though I could probably have found a way to manually set it.

Final Question

What is the craziest project you’ve ever done starting with a command line?

I look forward hearing your answers on in the comments below or on my Discord server.

I Want to Power On Without the Power Button

Good Morning from my Robotics Lab! This is Shadow_8472 with a side project of the week. Let’s get started!

Booting Without the Power Button

I retired my laptop as a server primarily over a broken load-bearing clip on the screen’s bezel. As I now have to be more careful than I can be in regular use, I want to minimize how often I open or close the lid. The power button is under the lid. A month or so ago, I told it to reboot over Cockpit, a web admin interface, and the web interface remained down. Only this week did I open the lid to the background of my login screen.

Without considering the actual problem, I marched along research for booting with lid closed. Options for this kind of thing are either limited or use different keywords than I think of. My options consolidated into the following: “Wake on LAN,” “Wake on USB,” “Wake on AC.” Wake on LAN allows other computers to power on a device with a special packet. Wake on USB was an option I found for the look-see in my BIOS under a similar name, but its help description implied it was only for when the computer was asleep and would work for a cold boot or perhaps even with Linux.

Wake on AC is an option I have witnessed before and even used without understanding it for a fair booth I once helped with long ago when it was defaulted on for a system. I reached out to multiple places for help with this one, and am still to hear back. No option appears in my BIOS menu, but rumors exist about hidden options or recovery modes. I have been unsuccessful in accessing any such modes so far.

Open Source BIOS Replacements

While it’s easy to think of BIOS as essentially part of the hardware, it’s actually a category of software called firmware, and it can be swapped out like an operating system. On the other hand, open source BIOS alternatives suffer from the same challenges as replacement operating systems for smartphones: every model of motherboard potentially has a tailored BIOS to run it, meaning it can take a while reverse engineer and get working properly.

My I focused my attention on two projects called Coreboot and Libreboot (Libre-boot, not Lib-reboot). Both are open source projects. Coreboot is willing to grab proprietary, closed-source blobs of binary data to increase their availability to enthusiasts. Libreboot’s mission is 100% open source booting at the cost of more extensive work to communicate with different chipsets. Neither project lists my laptop model as supported. On the other hand, I recognized System76 on Coreboot’s list of vendors.

All I wanted was to boot without my power button. Is that too much to ask?

Takeaway

In the end, I worked on the wrong problem this week. I misdiagnosed my symptoms with a valid concern, but even if I pulled it off this week, Cockpit still does not start until I’m logged in, and that’s kind of important when physical access is less than immediate.

Final Question

Have you ever gone off working on an issue you hadn’t actually run into yet?

I look forward hearing your answers on in the comments below or on my Discord server.

I Upgraded My Python Discord Bot (Week5)

Good Morning from my Robotics Lab! This is Shadow_8472 and today, the month of bot development concludes. Be sure to catch the previous posts before reading this one. Let’s get started!

Measures of Progress

Progress this week towards the bot while substantial, wasn’t anything special. In fact, the last day I had to work on it was mostly a flop of me goofing off on other pursuits instead of focusing. Instead, I’d like to focus on what I’ve accomplished over the month.

This longer push on the bot built upon a dice bot I programmed up several months ago that understood how to roll X dice with N sides. Over the month, I achieved multiple personal firsts and worked on my coding style. It was always satisfying when I came up with a new or clever trick to reduce code complexity for a given job. I learned a thing or two about coding the “right” way and practiced with Git version control software.

Memorable Milestones and Personal Firsts

The first big milestone that sticks out in retrospect was rewriting the dice rolling engine from scratch. I will likely want to make another dice bot geared for another game in the future. By splitting out related functions of a larger project into separate files, I can almost trivially re-use the code in another project or re-implement the whole thing. Shorter source files are also much easier to navigate and maintain.

Code condensation is fun. It hurts to see a piece of code you spent all day hacking together (successfully) to be replaced in five minutes by a stupidly more efficient approach, but simpler is easier to maintain. I found myself going through my code more than a few times as I learned about the likes of fstrings and the enumerate function to make sure they were being used when they made more sense than old standards or contextually strayed code, respectively.

This week in particular, I noticed how my relationship with exceptions has changed over the long term. As a beginning programmer in high school, exceptions and tracebacks always meant the existence of a bug. As I became more experienced (one of my early blog projects), I encountered a programming problem where the only way I could solve it was to try/catch an exception. On this project, I have a few places where I reached for try/except almost as though it were an if/else statement. I’ve even made use of Python’s ability to manage different kinds of exceptions with different code blocks in a new feature I worked on this week (but haven’t finished as of writing).

Saving and Loading Data

I have next to zero practical knowledge of writing programs with save data. I was able to bodge a webcam subtitle program involving a second webcam and writing text to a file, but that’s it from before this week.

Fancy dice bots have the ability to store information about players and characters involved in a game. My group don’t strictly need this feature to play, but it is high up on the nice-to-have list. Plus this is a skill I am after; it was just so intimidatingly long to research! Modules like Pickle and Shelve that dump data directly into a file warn in their documentation that clever users can inject arbitrary code through clever wording if the programmer isn’t careful. I started with a module called “configParser,” before realizing this wasn’t exactly its intended use case. It’s close enough though, but it still took a while to gain a mental model of how it operates internally – with an object in RAM, and not directly on the disk. Write the object to essentially a plaintext file, and it can be read back fairly simply. As an important bonus, the saved files are human readable.

Again, saving data to files is perfectly safe. It’s important though to be careful when loading naively stored user-generated data. While researching, I learned about a 15 year-old, trivially exploited vulnerability in the tarfile module that circulated in the news last week. The moral: know what you’re loading, and sanitize incoming data from users or directly from the Internet before saving it.

Takeaway

Sometimes, you need to look at something ten or more times before things start making more sense than not. Programming takes time to learn. One new technique I tried out this week (but wasn’t able to use) is called Ternary Operators. These look like if/else statements nestled into a single line, but they’re more for when you have multiple variations on a single command. My to-do list on this project is quite lengthy as I still need to diagnose why my newest feature collapsed on me. I wish I could end the month with everything in a working state, but such as it is, I have other things I need to work on too.

Final Question

What is your most ambitious personal project to date?

I Upgraded My Python Discord Bot (Week4)

Good Morning from my Robotics Lab! This is Shadow_8472 and today, the month of bot development continues. Be sure to catch the previous posts before reading this one. Let’s get started!

Iteration vs. Recursion

My first major milestone this week was coding a recursive dice tally function to replace the iterative one. Iteration and recursion are two approaches to solving the same types of problems.

The experience of iteration is the more native one to think in. Your program has a path to walk that loops back in on itself as needed. Its downside is that this path can grow beyond the comprehension of the programmer fairly quickly when using in loops within loops within loops if need be. From experience, I found myself guessing more often than not when I was finishing the iterative tally function, and even then I had to teach myself to indent debug text.

To get the idea of recursion, imagine having an army of clones. Each recursion clone has a tiny job, but half that job is working out what it’s supposed to do, and most of the time, that it’s subdividing the problem and summoning one or more clones to work on each one. Recursion has a higher learning curve, but it’s a lot simpler to maintain. I was able to identify and squash a bug involving my pip tally missing secondary pips within seconds to a minute as opposed to fixing the same bug in minutes to an hour and a lot print() statements.

Code Polishing

The more time I spend on this project, the more I discover or rediscover tidier ways to code. It’s not always a hundred lines crunched down into two or three, but it can still feel validating to get a whole chunk of debug code onto a single line I can easily comment out.

In terms of memorable condensations this week, I had two functions –cleanInput() and tokenizeInput() (the later of which underwent around an eighteen:three line reduction last week)– in my dice engine file used for turning raw input into a format my roller can understand. Upon closer inspection, they combined neatly. Later, I solved a bug introduced when adding support for counting dice sets against the total [subtraction] by re-arranging lines of code from tokenizeInput in before lines from cleanInput.

Another thing that’s been bothering me has been the inability to pass off the context from Discord messages to other functions. As far back as the first stint on this bot, I wanted a function so I wouldn’t have to repeat myself in-code when sending a copy of returned messages to the command line. I achieved this with a function that logs, then returns strings I pass it.

print(“Hello World!”)
await ctx.send(“Hello World!”)

becomes

await ctx.send(broadcast(“Hello World!”))

Furthermore, I also played around with the ‘or’ operator. As I began work on implementing more features, of a trio of lines used for grabbing a user’s server nickname – or baring one, a user’s global account name. The way Python works, I was able to use

(ctx.message.author.nick or ctx.message.author.name)

straight in my broadcast liner function.

My general philosophy for this project has been to come up with a creative approach instead of just patching problems as they pop up. The readability of code will go down sharply as efforts to limit the amount of guesswork patching are neglected. As it stands right now with the next section’s features unfinished, I’d say this should be something I can come back to in a few months and make sense of faster than recoding it from scratch.

The Pythonic Way

Change of plan: implementing a save system can wait. While researching save file systems, I happened across an article on askpython.com about so-called “pythonic coding” [1]. Conventions change over time. I’ve noticed this first hand over this project as my style has noticeably drifted as I’ve consulted resources from over the past decade. Looks like I’ll be going through my code again and bringing my code up to standard where I can.

My first task was converting to using fstrings (f-strings – I cannot find anyone saying for sure what the f stands for, but I will be thinking of it as “format” until someone corrects me) when putting variables into strings. It went pretty smoothly, though I did have to be careful about using single vs double quotes when dealing with string data, such as keys in a dictionary. I’m not going for total conversion. If a print statement contains just one string and one variable, I can separate them with a comma. Anything more, and it’s time for fstrings.

The enumerate() function for getting loop indexes was one I’ve read about before, but didn’t appreciate until now. Similar to fstrings, enumerate has its place – specifically anywhere I used pointer variables. Now that I look at my code, my most annoying use of pointers was in that ugly function I’ve already replaced. Nevertheless, I was able to combine a pointer and its supporting code into for-loop statements. Similarly, I employed range() in a while-loop being used for a similar indexing job.

The AskPython article also brought up naming conventions, but I’m putting a hard pass on that one for this project. Variable names are fragile, and only work if they’re all converted at once. I’m not up to that level of potential breakage right now.

Takeaway

Code takes a lot of work to maintain and ensure readability. Add a seemingly innocent feature or consolidate chunks of code that belonged together all along, and you’re liable for something breaking and going unnoticed. I’ve lost track of all the bugs I’ve squashed, but I try to commit it to Git whenever I have a stable version, documenting my progress since my last commit. I still haven’t looked into using its other features yet, but it’s good practice making improved quality commits, and I know that’s worth something, even if it doesn’t feel like it yet.

Final Question

Have you ever taken up [part of] a set of standards for projects, even mid-project?

I look forward hearing your answers on in the comments below or on my Discord server.

Work Cited

[1] pankaj, “Pythonic Way of Writing Code,” [Online]. Available: https://www.askpython.com/python/examples/pythonic-way-of-coding. [Accessed Sept. 19, 2022].