August 01, 2023

re: "Blaugust"

For the month of August, I'm "participating" in a month of "blogging" per Belghast blogging on aggronaut.com:

Blaugust is a month-long event that takes place in August each year that focused on blogging and other serialized content. The goal is to stoke the fires of creativity and allow bloggers and other content creators to mingle in a shared community while pushing each other to post more regularly.

See other participants here.

re: Coding

This Post is part of the Blog Chain: Write An App (2023) Blog-Chain.

Working through "Chapter 2" of the Rust Programming Language tutorial book today. Its all about building a number guessing game, introducing dependencies in the .TOML file, as well as mutable variables and user input.

Head Fake with rand dependency

The tutorial implies that one should update the TOML file to use rand = "0.9.0" but that library isn't actually available, which caused me to go bug hunting until I saw a stackoverflow response indicating that I performed the same mistaken assumptions as another person using the same tutorial.

Yak Shaving Rodeo with cargo docs --open on Windows WSL

Along the way, I learned about cargo docs --open which seems like a super useful way to browse the libraries in a project, but unfortunately under Windows WSL Ubuntu Linux, the command failed ungracefully. A search showed this Github issue from 2019. It appears that the intended resolution is to install wslu helper commands in my Linux Ubuntu instance. I also wanted to check my Debian version, and learned about the cat /etc/debian_version to check the version of Debian that my Ubuntu install was based on. I was also curious about the Linux tee command that was used in the installation instructions for wslu. Have we finished shaving the Yak yet?

Pasted image 20230801145025.png

Apparently not as I still received an error message when attempting to open the documentation with cargo docs --open. I had noticed however that there were 34 upgradable packages in the warning text output of the wslu installation instructions. So following that hint, I decided to research upgrading those. The command I used was apt upgrade and it appeared to update all the packages, but I still received the above error.

I think I'll have to add a bash script to modify how WSL Ubuntu Linux attempts to open the cargo path to the documentation, but that's more than I want to do today, and a task for another time.

For now, I can find the documentation files in the appropriate subdirectory, open the file in explorer, and then double click to open in my default browser (Brave).

Its a kludgy work-around, but I figure it is the price I pay for trying to do this tutorial in Windows WSL instead of a legit Linux distro install.

For now, this issue moving to my backlog.

Match. Compare. Overkill. (?)

For this part of the exercise, it appears that I should use a library use std::cmp::Ordering; for comparing numbers, which seems a bit cumbersome at this point. Why wouldn't I use inline > and < and = for comparison?

    match guess.cmp(&secret_number) {
        Ordering::Less => println!("Too small!"),
        Ordering::Greater => println!("Too big!"),
        Ordering::Equal => println!("You win!"),

I think the answer for that will have to wait. I finished up the rest of the exercises as they were pretty straight forward, and published my repo to github. Its not really worth looking at, but it is proof I did the work. :)