Picture Day?

My arthritis is a nice safe 2/10 today! The meds I was prescribed helped deal with yesterday, and today Tylenol should do the trick.

In the aftermath of my BBCF post yesterday, I stumbled upon this image, which I felt was extremely accurate to my experience as an ADHD person to the point I had to include it in today's post.

a tiny kitten on a thumb with angry eyebrows, labelled "very briefly experiencing the white-hot anger of a dying star".
Pictured: Systematical violently shaking with rage at themselves for natural human feelings.

I'm looking forward to TRO tonight, and I'll see if I can't fit some time to ping the matchmaking discord for games so I stop worrying about pinging specific people. Or I'll just put another lobby up.

Tech Talk

Code Review

I attended a US-RSE community call today about code review. It was fun to hear the discussion around code review as part of a community that comes from varied backgrounds. I personally think that code review can be extremely critical -- if done right. Hell, I even asked a friend to review my sprite code, since at this point I'm writing all of that just for the sake of practicing writing good code.

Interestingly, a lot of people brought up CI and linting as part of code review. At first I didn't get it, but it makes sense -- we have all of these tools for automated testing and automated linting, so unlike the early days, there's less reason to spend time nitpicking about code style.

Another attendee brought up how code review allows silo'd developers to communicate and feel like they're part of a team, and as a Ph.D candidate, I really agree with that. I wish that my research team had some code review, because not only would that give me an excuse to talk to my fellow classmates, I could learn a little bit about how they're doing the things they do.

Pelican

Images

I've figured out how to add images to my website, which is neat! The one frustrating thing is that it doesn't show the embed in the markdown preview, but I'll either deal with that or make a little script that automatically pelican-ifies image links. It's also mildly annoying to center the images on the page, so I need to figure out a better way to do that other than using <span> tags.

TOC

I've also figured out how to make a table of contents for markdown files in pelican, so I'm going to see if I can't add it as part of my theme customizations cus I think it'd be neat.

Sub-Headers

I've also just noticed that sub-headers are highlighted green on the index page but not in article pages and that bugs the everliving shit out of me, so I'm going to fix that soon.

Skipped Categories

Sure enough my little hack to make BBCF posts not show up outside of their containment zone broke the "Other Articles" doo-dad, so I had to figure out what actually went wrong: turns out that variables in jinja templates are very restricted in their scope. Since I was potentially skipping the first article, I had to set a variable first_done which told the logic whether or not I've actually printed the first article. However, since I was using {% set first_done=True %} inside of a for loop, it was never actually persisting past the first loop!

It looks like newer versions of jinja allow you to use something called a namespace. At the top of the template, I wrote:

{% set ns = namespace(first_done=False) %}

When I check the status, I would refer to it by the name ns.first_done, and I would assign to it using:

{% set ns.first_done = True %}

As you can see by the fact that below this article are correctly-abbreviated articles, it now works! I also had to fix a small off-by-one error. Previously, the theme just checked if loop.length > 1 to see if it needed to print an "Other Articles" section, but since I'm skipping entries, I had to check if the loop goes beyond my current iteration. Stupidly, I did loop.length - loop.index > 1, which breaks on the edge case that there is 1 additional article. It wasn't a problem before because I had the other bug making it look intentional.

Theoretically, if I was trying to be slick and make this a production-ready theme, I'd have to update the logic to check if there is at least 1 article beyond this article that is not a skipped article. I don't think I care about that case for now because there will always be at least 1 article that is not a skipped article on my index.html (which is the only place this rule is applied), although I'll need to see if it breaks once pagination kicks in.

I also gotta say, this whole jinja template thing is pretty neat. I can more or less guess how to write something by writing it how it'd be written in python.

Random Things of Interest

This podcast was linked in the community call, and I want to take a listen at some point: Planning your research software - A workshop in Paris

Kiki struck a cute pose this morning, so enjoy my cat tax payment:

A domestic shorthair cat, laying in the sun. She looks like she was just awoken from a nap and is looking grouchily at the cameraperson.

links

social