Nextcloud session annoyances

This is a note to my future self about an annoyance with Nextcloud.  If you're not aware of it, Nextcloud is basically a fork of ownCloud, which is a "self-hosted cloud" platform.  Basically, they both provide a bunch of cloud-based services, like file sync and share, calendar, contacts, and various other things.  I switched to Nextcloud last year because ownCloud was lagging way behind in its support for newer PHP versions.

Anyway, I noticed a rather annoying issue where Nextcloud was leaving hundreds of stale auth tokens in the database.  Apparently, I'm not the only person this has happened to.

While Nextcloud has a menu item to revoke and remove stale sessions on their settings page, it's on a per-item basis.  So if you have hundreds of stale sessions, the only way to remove them is to go through, one by one, and click the menu and select the "revoke" option.  Needless to say, this is terrible.

The less annoying solution is to just go straight into the database and delete them there.  You can just run something like:
DELETE FROM oc_authtoken WHERE last_activity < <whatever_timestamp>;
That might be ugly, but at least it doesn't take forever.

It's important to note that, in addition to being annoying, this is evidently also a performance problem.  From what I've read, it's the reason that authenticating to my Nextcloud instance had gotten absurdly slow.  The app responded fine once I was logged in, but the login process itself took forever.  It also seems to be the reason why my hosting provider's control panel has been showing I'm way over my allotted MySQL execution time.  After deleting all those stale sessions, not only is login nice and snappy again, but my MySQL usage dropped off a ledge.  Just look at this graph:

2023-02-21T17-16-56-020Z-med.png

As you can see, January is a sea of red, and then it drops off to be comfortably under the limit after I deleted the old sessions.  The Nextcloud team really needs to fix this issue.

Komodo is being retired

It looks like my old go-to editor, Komodo IDE, is being retired. I find this slightly sad, since I was a Komodo Edit and Komodo IDE user for many years.  Of course, it's been several years since I used Komodo, but it still feels like a loss to see something you were once very invested in being put out to pasture.  Although it is good to see that ActiveState chose to open-source Komodo IDE rather than just letting it die, so bravo!

Of course, when you read the rationale, you can't really disagree.  The number of free, high-quality editors and IDEs makes "generic code editor" not exactly the best business to be in.  Especially when you're tied to an archaic, end-of-life framework like XUL.  And given that they don't exactly have a large team working on Komodo (never more than 4 people, according to the article), rewriting sounds like it would be a pretty huge effort.

Looking at my blog history and tag list, it seems I started using Komodo Edit some time before November of 2008, used that for several years, and then upgraded to Komodo IDE.  I posted about looking for a new IDE in March 2017.  So I was a Komodo user for 8+ years.  Not  bad run.  It was a good IDE for a long time.  Sadly, I was one of those people who didn't like the UI revamp that came out in version 10.

However, I was somewhat lucky in my timing, because by the time I dropped Komodo, Visual Studio Code had come out.  So I was starting to use Vim seriously in the era where language servers were becoming a thing.  The importance of the Language Server Protocol (LSP) for making "Vim as IDE" viable cannot be understated.  This makes things way easier and better.  All you need is a Vim plugin that speaks LSP (I use coc.nvim), and you can get all the same code intelligence that VS Code does.  That means you can get all of the goodness of Vim without having to sacrifice your intellisense.  It's a good time to be coding.

This year's Christmas mission

Once more this year I devised a Christmas mission for my son.  I posted about the one I made up for him last year, and he liked it so much that he requested another one this year.  In fact, he requested it multiple times in the weeks before Christmas, so I pretty much had to come up with one.

This year's mission was based on the Peanuts comics where Snoopy pretends he's a World War I flying ace fighting the Red Baron.  That became my son's latest obsession this year (I'm not even sure how) and he's constantly making up games and stories about it, so that seemed like a good theme.

The mission this year was a bit longer than last year, consisting of a series of seven messages which build on each other and lead to a series of surprises.

  1. The first message was an unsigned, cryptic note placed in an envelope on the Christmas tree.  This one was intended to be found and contained an encoded message at the bottom.  The accompanying plain-text informed him that this was a "substitution cipher" and that the cats had the key with their treats.  
  2. The second message was hidden with the cat food.  It was a note from Captain Snoopy giving him the key to use with the first message.  The "key" was simple chart a mapping each plain-text character to a cipher-text character.
  3. The message from the first note decoded to "your stocking is in the cat tree", which led my son to...the cat tree, where his stocking and the next note were hidden.  This note was a message from General Pershing laying out the mission: to save Christmas by engaging the Red Baron and preventing him from shooting down Santa Claus.  It gave him the hint that he need to be in tip-top condition for this mission, so his next clue was with the training equipment.
  4. The next note was in the basement, between two presents, next to my barbel and squat rack.  The presents were some exercise equipment - some "workout dice", an agility ladder, and a kids punching bag set.  The note, signed "Agent Fifi" (apparently Fifi was Snoopy's girlfriend), told him to use these to get in shape to fight the Red Baron and included an excerpt from the Wikipedia article for the Battle of Verdun.  The clue said that the next message was in a room where the number of seasons matched the result of a simple subtraction problem based on the start and end dates of the battle, which yielded three.
  5. Note number five was in the three-season room (get it?) off the back of the house.  I left that one in plain sight, because it was cold and I didn't want to spend a lot of time out there hunting for it.  In addition to the note, it contained a "poster" my wife got on Etsy - a color print of Snoopy sitting on his dog house in his World War I outfit, printed on an old dictionary page.  The note, signed "Captain Linus van Pelt", contained a "double encrypted" message, with instructions to use the same key as the previous message, but to shift the letters by two.  The message told him to "look in the drier".
  6. The sixth note was in the laundry room,  hidden inside the drier.  With it was a hat in the style of a World War I era aviator, complete with goggles.  The note from "Colonel Charlie Brown" (I'm not sure how I came up with the fake ranks) told him that this was the last piece of equipment he needed to face the Red Baron.  The final clue to the Baron's location was another "double encrypted" message, this time with the clue to shift the key by the number of letters in the Baron's first name, again including an excerpt from the relevant Wikipedia page.  The message told him to look "under your laptop".
  7. The final message (hidden under his laptop) was from the Red Baron himself.  It was a taunt, daring my son to come and face him.  It included instructions on how to start up an old "Snoopy vs the Red Baron" video game that I found.  I thought that seemed like a nice prize at the end, and also gave him something to do until the rest of the family arrived and we could open presents.

It took me about an hour and a half to come up with this and write up all the clues.  Of course, I was far too lazy to do the encoded messages by hand, so I wrote a little program to encode and decode them for me.  I even printed it out and hid it with the last message, on the off chance that my son might be interested (spoiler: he wasn't).

While I feared that I might have gone a little overboard, the mission was a big hit.  My son was a little unsure about the encoded messages at first, but once we showed him how to do it he took right to it.  By the last message, he was completely engrossed and dove right into it.  He seemed to enjoy the rest of the mission and seemed to like having the series of gifts worked into it.

But the aftermath was what really showed me how much my son enjoyed himself.  You see, he saved all the individual notes, and when his grandparents came over to open presents, he insisted on giving them a debriefing of his mission.  He read them all the notes, told them about the presents and the decoding process, and how he figured out the clues.  And the next day, when his other grandparents came to visit, he repeated the whole debriefing again.  

The only question is: How am I going to top that for next year?