Hairy Larry's Blog - Delta Boogie Network-Gamer+
Home - Table Of Contents - Most Recent - RSS - Permalink - Text
Search:
KISS Stupid
Posted on 2024-06-05

KISS Stupid

Not to repeat myself but KISS Stupid = Keep It Simple Stupid Stupid

I've been working on Plain Text Blog and Not Actually Plain Text Blog trying to deal with this problem.

I use the mtime meta data stored with the file to sort my chronological lists. Which works great. Until it doesn't.

Warning! This is Linux and I am a gearhead. You have been warned.

For instance if you are restoring from a backup CD the chances are that all that time data has been lost. What? you say. Just look at one of your backup CDs. All the dates are the same. The date you burned the CD.

Also there's the problem with making edits. If I am perusing my posts and I see a typo I want to fix it. When I fix it the mtime meta data changes because mtime saves the most recent edit. Which boosts the post to the top of the Most Recent list.

If it's a substantial change I may want the post boosted. But if I'm just fixing some spelling, probably not.

Also not all ftp servers preserve the date of the uploaded file. So even if your backup has good dates when you upload them to a new server their ftp server will cheerfully give all the files the same date. The date of the upload.

I spec'd out several schemes to make this work by backing up the timestamps in a seperate directory. They were all complicated and required extra programs to deal with these problems.

Then yesterday it came to me. The files are uploaded as plain text and the files either have the date created or the date uploaded in the mtime meta data.

When I view the post on it's permalink page the program checks whether the first line starts with

Posted on 2

If it does not it reads the mtime meta data and adds a line at the top of the file that says

Posted on 2024-06-04

or whatever the mtime date happens to be. It saves this file in the text directory (along with all the other text files) and also in a bkp directory (along with all the other backups).

The reason I have to make this backup is because that line is not in my mirror where I write all the text files in the first place. So if I unthinkingly make an edit and upload it without the Posted on line I will lose my original post date.

I also have a tiny little three line routine in my permalink program that will do the unboost by reading the date at the top of the file and updating the mtime meta data to match.

This means I can add Posted on whatever date I want at the top of a file before uploading it and the unboost routine will place it at that date in the chronological order.

See! Simple. If you're a gearhead. Otherwise there's no way you made it here.

Home - Table Of Contents - Most Recent - RSS - Permalink - Text
Hairy Larry On G+DBN Mastodon
Home - Table Of Contents - Most Recent - RSS
Gamer+ Tumblr
Home - Table Of Contents - Most Recent - RSS
Related To Geeks Tumblr
Home - Table Of Contents - Most Recent - RSS
Powered By Plain Text Blog