TrickJarrett.com

Posts Tagged: programming

Behemoth has begun

Last night, I finally truly began work on what I've come to call 'Behemoth.' It is the generalized collection management app that I've been thinking about for a few years now. Originally I was going to call it CeMeNT for "Collection ManagemeNt Tracker" but the more I thought about this project and how big it would be, I decided to give it a more impressive sounding name.

The idea centers around a flexible abstract database design which would allow a single centralized system to manage collections of all different types. The two most notable for Katie and me are her PEZ and my Magic: The Gathering cards. (Disclosure: I work for the makers of Magic, Wizards of the Coast.) But we could also track our vinyls, books, boardgames, and metal lunch boxes in a system like this.

Elwood woke me up at 3:30 this morning and I sat down to re-diagram the database schema. I came up with initial schema design back in December of 2021:

And at the time, when I first shared it, I framed it as a concept that I wouldn't write because I knew it would be a very large project. So I sat on it for the past 18 months, occasionally it would come back to mind and I'd think more about it. Over that time I'd refined the concept a bit mentally, but I had never sat back down to redo the schema.

Well, with this morning's wakeup, I found my brain iterating on the Behemoth project and thinking about the database.

So, I sat down and rebuilt the schema which is a bit more robust version 2:

The biggest change from V1 to V2 is that I formalized a design where you have the 'library' which is the "master list" of possible things in a collection. This simplifies a few things in the overall management, though it introduces its own issues.

A lot of the "version" details are tracked in the library rather than the individual collection. This makes sense as you'll have new items which refer to the library. But, collectors love to collect random things. What if your collection has something which isn't part of the larger library, whether by obscurity, or maybe something like an artist signature - how is that tracked? I'm not sure yet. I'm letting my subconscious chew it over right now.

Another thing is that collections come in two varieties. I have come to think of them as the vertical and the horizontal. Verticals are the ones which are "easy." They have a very clear backbone, whether it is "Magic: The Gathering cards" or "PEZ dispensers." Horizontal collections might be for an IP or fandom, where it is much more broad in varieties and details. Think of a "Star Trek" collection which might include DVDs, books, clothes, toys, etc. Currently Behemoth is well suited for vertical collections, and so I'm trying to figure out how best to handle horizontal collections.

To that end, I'm still trying to come up with different collections, and find corner cases which might be out there that this structure can't handle.

Even as I seek more unknowns, there are a few known things I need to add and account for. That said, I am quite happy with the concept V2 currently represents.

Two of the things I know I still need to account for:

  1. Commenting / discussion - Allowing additional conversations on the collection.
  2. Transaction tracking - Tracking when we buy or trade for things in the collection. Tracking the acquisition price, where we got it, etc.

While the database comes into focus and crystallizes, I'm also preparing to actually start coding.

I'm going to build this in PHP using the Laravel framework. I'm still deciding on the CSS, probably Tailwind. The database will be MySQL. I debated if I should use MongoDB to allow it to be more flexible, but the truth is I don't know MongoDB well enough to schema it properly. So I'm sticking with what I know, MySQL.

We'll see how this goes.

My intent is to open source the project and allow others to contribute to it. In theory. If it works and I'm not embarrassed at the quality of my code.

Share to: | Tags: programming, project

A page of HTTP Status errors with Cats

Share to: | Tags: programming, humor, cat

Simple Feed Filter

Since FreshRSS doesn't really offer filtering by feed, I'm wondering if I should do a simple RSS pass through which takes in a RSS feed url and a string of filter terms and then spits out a corresponding RSS feed removing posts which get filtered.

Share to: | Tags: idea, programming, rss

I learned how to use ffmpeg last night to rotate videos from the terminal. Going to be a big help going forward rather than having to wrestle with VLC's convert functionality.

Share to: | Tags: linux, ffmpeg, programming

Adding 'On This Day'

I've added a small feature to my automated end of day posts which is to link to other entries on that day in the past. Now that this blog has been active for two and a half years, as well as posts from my online writing archives, it seemed like a good addition. Right now it's just a bare bones link to past day archives, but I may expand it further in the future.

Share to: | Tags: programming, glowbug

Friday morning code tweak

Sometimes I accidentally save articles from my RSS reader without meaning to. Which means they get captured in the end of day automated post. So, I will go in and remove these errant posts.

And this morning I realized that when I do so, the post gets its HTML stripped out. Which is a bigger issue, but it also made me realize the automated posts inserted HTML rather than markdown text as it should. Old habits die hard I suppose.

So a quick bit of adjusting code and they should now be inserting Markdown properly. I still need to fix the editor stripping HTML, for correctness sake, though it shouldn't be an issue really.

Share to: | Tags: programming, glowbug, markdown

Coding ChatGPT from Scratch

Absolutely loving this step by step walk through explaining the terminology and how exactly it all works.

Share to: | Tags: programming, python, machine learning

Modifications for my end of day posts

As regular readers will notice, what started as just collecting a handful of Mastodon posts each day has evolved and now includes my daily chess results on lichess.org. This is, admittedly, primarily for me and I expect the audience for it to continue to be very small. I am currently thinking about how to continue expanding this post.

The top ideas right now, in a very rough order of likelihood of implementation:

  1. Add the day's weather - Mainly for posterity, so I can look back and see what the weather was on the day of various posts.
  2. Add a daily motivational or inspirational quote - I already have a list to pull from, it is trivial, and would be a nice little add in. It feels odd to do at the end of the day, but if I did this I'd add it to be something I email myself or somehow otherwise put in front of myself earlier each day.
  3. Add posts I snag for reading later - I have this integrated in a rolling manner on the sidebar of the site, this might be an interesting way to archive them. This would be ones I've added to be read later, but might or might not. I snag dozens of articles and only come back to read a handful. It also moves them more central, and inserts those links into the RSS feed, which isn't done in the current manner.
  4. Writing stats - As I mentioned earlier, now that I have a new larger writing project, I'm tracking my progress on it. Currently it's done in a Google sheet, though I could code it into a custom web app. If I did so, it would be trivial to start including the day's progress into the end of day wrap-up post.
  5. Blog traffic - There's an interesting seed of an idea to publicize traffic to the site, newsletter subscribers, etc. Would require a bit more coding and finding the best way to access this data automatically from where it's gatherered.

Who knows. Just musing as I get my day started and think about things ahead.

Share to: | Tags: glowbug, programming, musing

PHP in 2023

I default to PHP for my server side programming. And, while I'm just a hobbyist, it's interesting to see where PHP is going and how. I hadn't really been aware of the PHP foundation, but I'm glad to hear about it and that its first year has been a success.

Share to: | Tags: programming, php

Extending Markdown

I've been running into limitations of Markdown as it comes to this blog, and am finally taking steps to extend it.

First up is a new implementation for links:

[This is a new link{With helpful link titles}](http://www.linkingtosomewherecool.com)

And what that does is create this (hover your mouse over the link):

This is a new link

Share to: | Tags: programming, markdown, glowbug

Coder at Zulily went full 'Office Space' - Where's Michael Bolton when you need him?

He managed to get over $300,000 syphoning off of shipping costs during orders to Zulily, literally inspired by the 1999 Office Space movie.

Castro, 28, is now charged with two counts of felony theft and one count of felony identity theft in King County Superior Court. Prosecutors allege Castro set up three separate computer schemes, ultimately stealing $302,278.52 from Zulily.

Share to: | Tags: programming, criminal

Date Archive Updates

Spent a while this morning with small updates on the blog. What better way to ring in the new year than watching soccer and coding?

Started with a properly implemented footer across the site, but that led to me finally delving in and updating the archive page.

The archive page was growing unwieldy with just a giant unordered list of every day that had an entry in the blog. With hundreds of days with entries, it was unsightly and useless except as a resource for bots to crawl the site, which is not a good reason to have it.

So I did a complete rebuild on it and changed it to be a Year -> Month -> Date list. Still only sort of useful, but still interesting and better to look at. First off, it puts the archive posts into better perspective. I've got posts from over 20 years ago here on the site thanks to the posts I migrated over for archiving.

It was also a prime example of iterative programming as I kept having to rebuild the site with every tweak to check functionality and presentation, etc.

Share to: | Tags: glowbug, programming

Colordoku

My mother-in-law was bemoaning wanting a color version of sudoku, so I am spending a few hours today hammering out a version for her. Building it on this JS library for the puzzle generation. I'm estimating that it's 80% of the way there.

All I've got left to do is finish the puzzle checking and also to allow "noting" possible colors for cells. I'm not sure the best way for me to do the "notes" function yet since this is color based. I'm thinking I'll do a mini grid of the colors put in as a note.

Share to: | Tags: puzzles, programming

MySQL Tracking Changes to Records

I am thinking about adding a versioning history ability to my blog engine, so I Googled to see what I could find about best practices in regards to the database design for it. And I found this fantastic answer on StackOverflow which breaks down the structures, reasoning and methodology beautifully.

Share to: | Tags: programming, mysql, database design, stackoverflow

Newsletter bug fixed

Discovered a bug in my code this morning. Yesterday's and today's newsletters pulled the entries from November rather than December - oops. It's fixed now.

The issue originated because I changed how I called my newsletter generation code, moving the date selection from built-in PHP to Javascript. However, I missed that Javascript numbers months starting with zero. So January = 0 and December = 11.

So it was calling for 2022-11-27 thinking we all agreed that this meant December 27th, rather than November 27th. Whoops.

Share to: | Tags: glowbug, programming, javascript

Adding emoji to the blog

So, up to now, I've had some hardcoded ways of adding emoji-like graphics in specific ways. Tonight I'm spending time adding an extendable solution for adding more emoji graphics. Hardly newsworthy, but this is a nice and light little project to distract myself.

Share to: | Tags: glowbug, programming

Related Links

One feature idea I keep coming back to is something which lets me append related links to a blog post. My RSS reader (purposefully) gives me a number of posts related to big news. For example, the January 6th post I made a bit ago could already have a half-dozen related links if I had a system set up for them.

Sure, I can just dump them in the body of the post, but I'm thinking about something automated such that there could be future development done with the data.

This is definitely a parking lot idea, but it's one which I've come back to time and again. Ultimately I don't think it's needed. This is just my small blog, not a major one. If I ever cross into "major" traffic, then I'll go about adding it.*

Share to: | Tags: glowbug, programming

Share to Mastodon

I started coding this yesterday and continued to today. I wrote a small bit of custom code that adds a Mastodon button in the entry footers when visiting the blog. Clicking one of them lets you click a button to share the entry to your Mastodon account.

The first time you use it, it prompts you for your Mastodon instance. It then saves your response as a cookie. Then when you click it, it confirms you want to share to the saved instance (in case you migrate instances, etc.) And then redirects you to the Mastodon "Share" page with a simple message of "Just finished reading [title] - [url]"

Required some adapting of my templating code as I hadn't prepped tags for URL encoded titles and post URLs. But, overall, nothing crazy.

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

#hachybots

I crawled into bed last night and checked my phone. Surprisingly I got notice of a post of mine on Mastodon being taken down. It turned out the instance has implemented rules for automated posts and I simply hadn't been aware of them. So they had taken down my automated afternoon blog post.

The change was simple enough, they simply wanted to ensure automated posts include the "#hachybots" hashtag so that individuals on their instance can easily choose to block that tag if they want to avoid seeing automated posts.

No sweat. My body ended up waking me up at 5:30 this morning, so after my morning shower I decided to quickly make the change. While in there though, I decided it was time.

I also made the decision to go ahead and disable the automated posting to Twitter. I only barely engage over there anymore, and the meager traffic I do get, Twitter is not a big driver. I'm creeping closer and closer to fully exiting there. We'll see.

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

Going back to school

It's been twenty years since I started at Georgia Tech to study Computer Science, and it's been over ten years since I was a professional programmer. So, I figure, I'm going to check out Harvard's CS50 for refresher and updating on programming thinking & theory.

Share to: | Tags: programming, school, learning

Advent of Code - Day 7

Remember when I was waiting for a day where I felt really challenged? Well, I'm a few days behind and Day 7 did it.

I was able to get, I'd say 80% of the way there for getting an answer to Day 7's first challenge. I am confident I would have eventually figured out what was going on with my code and gotten to the solution, but it was taking a while and I realized that I didn't need to keep banging my head against the wall. Rather than blindly bumble into the correct eventual solution, I decided to stop and see how it was done by others. YouTuber 'thibpat,' a French programmer and casual YouTuber, had a video showing how he approached solving it.

Also, I have realized over the course of these days of coding, that I need to better understand Regular Expressions. They are an example where I have a very base level of understanding and rely heavily on googling up a solution when I need them. I would like to just understand them. So I'm going to work on that.

I asked on Mastodon and @shiftingedges recommended recommended Execute Program's free course on it. So I'm going to check that out in the coming weeks.

Share to: | Tags: programming, advent of code, javascript, regex

Advent of Code - Day 4 complete!

Just wrapped up Day 4 of the AoC event. This one began to stretch my mental muscles more as I figured out what was needed.

I only submitted one wrong answer, and that was due to a quirk of Javascript where I realized it was possibly parsing numbers as strings and thus making faulty comparisons. For the second puzzle, it took me a little bit to figure out what was needed, but my second submission was right the first time.

Today is also the first day I am going to seek out other solutions in Javascript and see if there were more optimized ways of writing the code, not that mine was long, but I feel like it was pretty optimized and am curious where I could do it better.

Share to: | Tags: programming, programming, advent of code

Advent of Code - Day 4 complete!

Just wrapped up Day 4 of the AoC event. This one began to stretch my mental muscles more as I figured out what was needed.

I only submitted one wrong answer, and that was due to a quirk of Javascript where I realized it was possibly parsing numbers as strings and thus making faulty comparisons. For the second puzzle, it took me a little bit to figure out what was needed, but my second submission was right the first time.

Today is also the first day I am going to seek out other solutions in Javascript and see if there were more optimized ways of writing the code, not that mine was long, but I feel like it was pretty optimized and am curious where I could do it better.

Share to: | Tags: programming, programming, advent of code

Advent of Code - Day 1

Hammered out the answers to today's Advent of Code.

I decided to work in Javascript as I felt it would be a bigger challenge and more rewarding exercise than to do it in PHP; and honestly I didn't feel like doing it in Python. I might do it in Python after work if I have time.

Share to: | Tags: programming, advent of code

Advent of Code

Like NaNoWriMo, this is 25 days in December of coding puzzles. I have known of it but haven't ever participated before, so I'm not exactly sure what I'm in for. I intend to participate with Javascript, as an exercise to improve my skills there for working with it as more than just for on-page shenanigans.

Share to: | Tags: programming, programming, christmas