TrickJarrett.com

Posts Tagged: programming

Scheduled Publishing

I've also begun rethinking the publishing model for this blog. Currently, when I add a post, it immediately rebuilds the site. I've added some improvements to make it avoid publishing everything when not necessary, but largely I just say "rebuild it all" on every publish. Keep in mind, on my busiest blogging days, this is just done 6-8 times. But as I try to make this more central to my online presence again, it's a pain I feel.

As the blog gets older, the time to generate the site's pages gets longer and longer. It's most felt when I'm publishing from my phone, but even when on the desktop I feel the wait. So I'm thinking that I will shift to be a regularly scheduled process which publishes new posts on a regular cadence in the background, disconnected from my interacting with the UI.

Last night, while I was working on the other issues on the blog, I poked around in the code to figure out how to best make this change. It's absolutely doable, it's just not clean and simple. It breaks some functionality that I'll need to either modify, or disable.

Share to: | Tags: glowbug, programming

Podcast Middleman

The NYT are putting their podcasts behind a paywall. You can still get them free for the first few days and then they move behind the paywall. I get it. It's business. But my consumption of podcasts is heavily dependent on the day. And I like being able to go back a little while to recent topics but maybe not immediate.

So I decided to look into using Plex as my podcast server, thinking I could automatically download new podcast files to my server and then listen whenever I wanted. Unfortunately it seems Plex had a podcast function, but it was buggy and they made the call to cut the function rather than integrate it.

Disappointing, but I get it.

Now, I'm going even simpler. A folder on my server, a cron job which fetches and downloads the podcasts daily and keeps them for a month (to avoid devouring server space.) And then I just make my own personal podcast feed for them.

Share to: | Tags: podcast, programming, new york times

I've been a longtime user of FreshRSS, my self-hosted RSS feed reader. However, for the last few years, it hasn't been automatically updating. Today, I finally figured it out myself. And there was much rejoicing.

Share to: | Tags: rss, programming, cron

HTMLforpeople.com

The world has come a long way since days of HTML 1.0. This looks like a fantastic primer to learn HTML from scratch.

Share to: | Tags: html, programming, web development

Did some programming this morning. Nothing too major, mostly fixing small issues which had been bugging me.

First was improving the layout of the site when viewed on mobile. Just some CSS tweaks there.

Second I re-enabled the integration from my blog an my Wallabag article storage system. This was what enabled articles I'd saved to read later to be added to the automated end-of-day entries. I had broken it doing some stuff on the backend a few months ago and just turned it off rather than fix. So, I've fixed that now.

Third, I've been working on the integration of the blog with the discussion board. My idea is that I can make Glowbug automatically create new threads as well as give me the ability to force it when a post wouldn't normally be given its own thread. It's not complicated, the forum has an API system, but I haven't been able to bring my full focus to it.

Share to: | Tags: glowbug, programming

Feeling The Itch

I am getting that itch I get for a new programming project. I think it's no coincidence my Minecraft playing time has gone down significantly, which means it is not providing me the technical projects needed to feed that itch.

Right now the leading contenders:

  1. Collection Management Software - I've started this project a few times now and it always ends up falling off. The latest attempt got the database schema implemented and then lost steam when it came to implementing the surrounding UI. I really want to take this project on again.
  2. Custom RSS Reader - I currently use a selfhosted FreshRSS reader and it serves me well enough. But there are enough quality-of-life improvements that I am thinking about that rolling my own feed reader continues to be something I consider. Things like improved filtering (god I am tired of ads masquerading as product reviews & articles) as well as integrating timelines from Mastodon, etc.
  3. New Glowbug Admin UI - I didn't have this on my radar as a project really until this weekend when I went into the code for the admin side and just found myself rolling my eyes at past-me's implementations of things. This is a dark horse contender for a project I want to take on, but it's worth including.

Or maybe something else. We'll see. I'm just accepting that this is going to be a thing this fall & winter.

Share to: | Tags: programming

Discovered a new bug in Glowbug, my site's custom CMS. First one in a while. Granted, I haven't been avidly blogging lately. Finding the bug though has given me the urge to dive into the code and do some work on it. Guess I know what I'll be doing tonight.

Share to: | Tags: programming, glowbug

The world needs more hobbit software

I just love the concept and agree with it. I think of Glowbug (this blog) as hobbit software.

Share to: | Tags: programming, lord of the rings, glowbug

Threads API is now public

Saving this here so I can come back to it and integrate posting to Threads into this blog.

Share to: | Tags: programming, php, social media, threads

Never Stop Blowing Up's Dice System

So I decided to do some math & coding this morning. I was curious on the distribution of numbers for the exploding dice system used in Dropout's new actual play series: Never Stop Blowing Up

They are using a system built on the Kids on Bikes system, modified to serve the game's theming. The main difference (based on what we've seen) is the dice rolling system.

For Kids on Bikes, you roll the same die when it explodes. For Never Stop, you start with a D4, then on a max roll, you roll again on the next sized dice (D4->D6->D8->D10->D12->D20) adding the combined values of rolls. Roll 1, 2, 3 that's what you get, on a 4, you add 1d6, etc

There's a few more details to what Never Stop is doing, like that it makes it quasi-leveling for the players. Once you explode to a d6, that is now your starting dice roll on that stat, etc. I'm not taking that into consideration for this morning's exploration on the math.

So, looking at every roll beginning with a D4, you have a 25% chance on rolling 1, 2 or 3. Then the remaining 25% chance gets distributed across exploding rolls.

% Range
25% 1-3
4.17% 5-9
0.52% 11-17
0.05% 19-27
0.04% 29-39
0.002% 41-60

You can never roll a 4, 10 (4+6), 18 (4+6+8), 28 (4+6+8+10), 40 (4...12) because those are the threshold numbers an you always add at least 1 to those numbers. This essentially means that everything after these thresholds uses that slot's percentage.

So with 1d4, you have a 25% chance of getting a 4. But since there is no 4, the remaining range of numbers all occupy that 25%. Adding the 1d6 means that you have 25%/6 on each possible roll, except on a 6, that is the percentile chance of the 1d8, etc.

So that's the part I logicked through the math of without any code or simulation. I decided to code a Python script to do large number simulations to see how many times I would roll each number.

from random import randint

dice = [4, 6, 8, 10, 12, 20]

def roll(sides):
    r = randint(1,sides)
    if r == sides and r < 20:
        n = dice.index(sides) + 1
        return r + roll(dice[n])
    return r

def batchroll():
    rolls = []

    for i in range(10000):
        rolls.append(roll(4))

    out = ""
    for i in range(1,61):
        out = out + str(rolls.count(i)) + "\t"

    out = out + "\n"

    with open("rolls.txt", "a") as text_file:
        text_file.write(out)

for x in range(10000):
    batchroll()

(Don't judge the code, I'm sure it could be improved.)

First off, after running it - I was glad to see that I had logicked it all out correctly and the rolls matched expectations. Secondly, seeing actual distribution of numbers was useful for perspective. It's one thing to see them as abstract percentiles, but it's another to see actual numbers of instances.

Out of nearly 100 million simulated rolls, I only rolled on the d20 ~4,300 times. Meaning that with 100,000,000 rolls; I rolled the max of "60" (4+6+...+20) just 203 times. Here's the results of the simulated rolls on a Google Sheet.

Interesting stuff mathematically. A fun morning exercise for the ol' noggin.

Share to: | Tags: dice, python, programming, math

Good morning from SeaTac airport

I got up even earlier than I had planned because I was within an hour of my alarm and at that point my body won't let me go back to sleep. So here I am, mildly caffeinated, and sitting at a power outlet for a few hours before my flight.

On Psychology & a Rewrite

Last night, as I was tweaking Glowbug code, I began thinking I might just need to start new on the backend. The current system is five years old at this point and while it is still quite serviceable, there are also quality of life things I need to work on which I keep putting off because I just don't want to wade into the code.

The irony, of course, being that a complete rewrite would be magnitudes more work.

Brains are funny that way.

Flight Entertainment

As mentioned, I am at the airport with a day of travel ahead of me. I've loaded up on entertainment so expect some reviews once I land:

Movies & TV

Podcast

Books

Too many. I'll list some, but I checked last night and I carry nearly 3 gigs of ebooks on my reader.

Really, the list goes on. I am an eclectic reader and I have an addiction to acquiring ebooks for my virtual library.

And now I must go in search of more caffeine.

Share to: | Tags: books, programming, travel, musing, movies

Quick and easy implementation

Okay, hammered out the progress scroll in thirty minutes. Took some fiddling with the CSS to get right, but it should now be visible to all visitors to the site.

Edit 8:52pm

Also, thanks to Daniel whom I linked earlier, he flagged that the CSS for mobile viewing wasn't working. It'd been so long since I set this layout up, I assume I just hadn't set it up at all. Looking at the code I spotted that it was set, but it was set for a size smaller than most phone screens these days. So it's fixed now.

Share to: | Tags: glowbug, programming

Microfeatures in Blogs

Came across this delightful blog entry which shares some items that Daniel, the author, enjoys seeing implemented on other blogs. For ease of reading, I'll reproduce the list here, but do go read Daniel's post:

I loved the list and have already made some notes for Glowbug (my own blog's engine) implementation. Their inclusion of "Markers for external links" also made me happy given this blog's already implementation of showing linked domains, et al.

I already have an idea for an on-page progress bar. My idea is to add the ability to seen previously seen on the progress bar. Specifically if scroll down a page, and then back up, it should keep the furthest you've scrolled visible and just change that color so signify it isn't currently seen. I don't have time to hack on it this morning, though I might try to get it done tonight before I fly out tomorrow.

Multipost Grouping is something I technically have implemented on the back-end, but haven't really used, and also isn't quite the implementation the author was referring to. My implemention was a thing I called 'chapters' and comes from an old idea I had years ago for a life-blog which let me write entries into chronological "chapters" to capture eras in my life. This concept came about when I was younger in my 20s I think, when my life was somewhat more likely to change. The reality is I also don't tend (at least, currently) to write posts which are grouped in any way other than tags.

I am definitely going to add capabilities for Dialogues to my blog. I don't regularly need them, but agree having them would make the blog better.

My daily automated post potentially includes links to other blogs if they are posts I add to my Wallabag to read later. I like the concept, and the idea I've come up with is a "starred reading" functionality for the blog, where it is posts I've read recently on other blogs and want to recommend in an ongoing fashion. I've added it to my backlog, we'll see if I implement it or not.

Share to: | Tags: blog, glowbug, programming

Database Victory

FINALLY.

I have spent far too long trying to resolve the database issues for Wyrmling, my collection management tool. It now appears to finally be done correctly. I'm using Laravel as the PHP framework and it has a fantastic tool for defining database structure so that it can be stored in git. It took me far too long to sort out the database definitions, but tonight it all ran successfully, including setting up the foreign keys.

Now that the database is setup, I can finally move on to building the remaining 99.5% of the app.

Share to: | Tags: programming, php, mysql, laravel, wyrmling

Working on 'Wyrmling'

Spent several hours so far this weekend getting my custom collection management project. My goal is for it to be an open source self-hosted solution others can use. It's meant to be flexible to use for any set of collections. For example, Katie and I will be able to use it for my Magic cards, her PEZ, my D&D books, our vinyl albums, etc.

You may recall I shared a database diagram a few years ago. The database structure has remained largely the same with some changes since then. The core concept remains the same: there are collections and there are libraries. Collections are what you personally possess. Libraries are the type of collection and its things.

For example, a library would be 'Magic: The Gathering' cards. Pulling that data in from an outside source to include every Magic card. The collection would track which cards I personally own. You don't have to have/use a library for your collection, you can just enter your own title and description, but the library makes things simpler.

A lot of the work has been fleshing out the collection and library database tables. Things like adding fields and foreign key relations, etc. I just added a table for tracking changes to collections, so you can see adding things, removing things, etc.

I'm getting close to being ready to begin building the UI in earnest. That's going to be the brunt of this work.

Share to: | Tags: collecting, programming, project

Sometimes your body wakes you up in the middle of the night, and when you can't fall back asleep you finally pick up a coding project you've been thinking about for way too long.

Share to: | Tags: programming

"Old CSS, new CSS"

Oh this blog entry could have been written by me. I also learned to make webpages in the 90's before CSS. So much nostalgia and memories of our version of "walking up hill in the snow both ways."

Let’s say you wanted all your [h1]s to be red, across your entire site. You had to do this:

<H1><FONT COLOR=red>...</FONT></H1>

…every single goddamn time. Hope you never decide to switch to blue!

Oh, and everyone wrote HTML tags in all caps. I don’t remember why we all thought that was a good idea. Maybe this was before syntax highlighting in text editors was very common (read: I was 12 and using Notepad), and uppercase tags were easier to distinguish from body text.

Keeping your site consistent was thus something of a nightmare. One solution was to simply not style anything, which a lot of folks did. This was nice, in some ways, since browsers let you change those defaults, so you could read the Web how you wanted.

A clever alternate solution, which I remember showing up in a lot of Geocities sites, was to simply give every page a completely different visual style. Fuck it, right? Just do whatever you want on each new page.

That trend was quite possibly the height of web design.

Share to: | Tags: html, web development, programming, css

Hachyderm's server report says there are 36,143 peer instances for it on the Mastodon network. My blog runs a cron job which pings instances.social for the top 1000 instances by active users. I then capture any new ones from that list and add it to my list. As of tonight, my blog knows 2,417 of the instance domains. This represents just 6.7% of the network by instance quantity, but my estimate is that it is 90+% of the userbase.

This code enables my blog to automatically identify when I link to a post on Mastodon (admittedly, not something I'm doing a great deal of these days.) When it knows the link is for a Mastodon post, it can generate the code for embedding the post directly into the blog, rather than simply linking to it.

Share to: | Tags: mastodon, fediverse, glowbug, programming

Testing Threads.net Embeds

The drone dragon is awesome, but also I wanted to see if my code worked for embedding Threads posts on the blog.

Update: Well, that is anticlimactic. It works, but it's pointing you to Threads. What about a post which is not a video?

Yep, that's disappointing.

Share to: | Tags: threads, social media, programming, glowbug

For the first time in literal months, I did some work under the hood on Glowbug.

  1. I turned off the BlueSky embed mechanism, given that bsky.link has become unreliable / gone down.
  2. I also finally fixed the issue with the JSON feed in case someone has been depending on it for the articles.

You're all welcome. Anything to keep the masses happy.

Share to: | Tags: glowbug, programming

Learning Rust has been very interesting. Returning back to desktop coding rather than web coding has been a bigger leap than I expected. It's been 20 years since I programmed in C and C++. Ow my back.

Share to: | Tags: rust, programming

This isn't strictly true. I was consumed by this idea yesterday and I resisted. This morning I gave in and I'm bumbling my way through getting the project stood up. I've never worked with Rust before, so we'll see how this goes.

Share to: | Tags: chess, programming

Chess coding competition

As you'll notice, it appears there's a theme there this morning. In truth, I started watching this video yesterday and just finished it this morning during an early morning of work. Quite enjoyably edited and interesting to see the various concepts of chess programming illustrated in this video.

Share to: | Tags: chess, programming

Chess Programming Wiki

An incredible resource with information for programming your own chess bot.

Share to: | Tags: chess, programming, wiki

Okay, I regret diving into the unfinished search functionality for Glowbug. Such a mess. Thinking about torching it all and starting fresh.

Share to: | Tags: glowbug, programming