Taeluf Devlog, Feb 17, 2021

I planned on working on Code Scrawl and maybe Better Regex, but remembered I want to make a devlog. My website is in shambles (won't even show a page on localhost), so I'm starting with that. Later, I hope to work on Code Scrawl.

Taeluf.com

My site uses .md files for articles/blog posts, so I've started by creating this file. I setup my vhost file & selinux to allow the site directory locally. Content doesn't display, so I confirm server is working with a simple echo. Now, I debug. Likely will update to the latest version of Liaison in this process.

Reorganizing my files. It was still using my old release-setup that used a git hook. Converting it to my tlf release script, which uses rsync. I just had too many problems when I tried using git hooks for this. rsync has worked great, plus I <3 bash, ever since building Git Bent.

Little Stuff

  • My tlf release setup script outputs a bad excludes file, so lets fix that.
  • Then I find an old script that could record keys with xdotool. I once wanted to automate some things in Stardew Valley with this. It's simple, so I delete it.
  • Found old notes for my mtg site, with some impressive looking sql functions with recursion & stuff I forgot you could do in sql. Delete.
  • Delete so many old files & notes

Updating the code

Repo is cleaned up. Let's review my code & get it working with the latest Liaison version (which might be a bad idea, because its latest update is incomplete).

Its brekky break time. Peanut Butter Banana Chocolate Oatmeal. <3 And a fresh cup of decaf coffee.

30 mins later. I don't wanna code any more. But I'm gonna!

  • update deliver.php with new folder paths & minor changes
  • Liaison isn't working. A couple wrong-named variables/strings. Fixed!
  • Minor change in my site's code, & everything's displaying! Unless I remove the var_dump($blogDir) that I put in for debugging. What the hell?
    • Ahh, everything is sending 'html' mimetype... which TOTALLY explains why var_dump($blogDir) fixes everything.

Fixing Liaison

if ($route->isCallable()){    
    echo "CALLABLE";    
    echo $target($route);    
}    

This little block is to blame. Why are my css & js files handled by a callable? Because my router for cached+compiled files is yuck & I forgot it was like this.

(break to make more coffee)

The relationship between my Server component, route resolution, theme inclusion, and content-type headers is... worse than my high school relationship. But maybe less angry and yelly and jealous. Maybe a little jealous of more mature frameworks.

  • Rework server component. Make StaticFile utility care less about the file existing & more about the file extension.
  • Rework Resources component that handles delivering compiled css & js files.
  • My fonts WORK, but content-type is html... Back to Server component
    • Remove a debug message & exit. Idk why my fonts and favicons were working, because the response was just exiting & I had use cache disabled in Firefox's dev tools.

Back to Taeluf.com

Blog Posts

My blog posts are at /blogg/ for some reason AND aren't displaying... Let's see.
There was a substr issue when getting the relative path to the .md blog file, so this is the cause of the blogg/ bit & easy enough fix (though the code for all that is a bit convoluted. Past Reed (me) wrote bad code.).
The lack of delivery was because of earlier changes to dynamic routing, so I had to just replace an echo $blogView to a $response->content = $blogView.''. .'' to invoke the __toString().

Errors

I don't have any proper error handling, for not-found pages, random Exceptions, etc. So I at least need something simple. This is not built-in to Liaison yet either, though its much needed.

  • Use a simple catch () { if ($env->is(['host.local']) throw the error else { show a short message & link to home page.} }
    But its $env->is(...)->asBool(). So I tried to figure out how to cast an object to a boolean value. Something like __toString but __toBool... Why doesn't PHP have this?

Grepper !!!

In the searching, I found Grepper & that looks super cool. I had an idea for something like this a few months ago. I have some really slick sketches. & ideas for MUCH more organization. Not knocking grepper. Site looks heckin sweet. I don't know if I'm jealous, inspired, or what? Shows there's a market. But what's the point? What if I tried to contribute to their site instead of making my own? It's a project I'm probably never gonna make anyway...
At the very least, I feel a little validated... That the idea I was SO excited about was actually a good idea. I so often get excited about ideas like this & never know if I'm just being crazy or not. That's the problem with having no programmer friends, I suppose. And not wanting to share my best ideas publicly.

__toBool RFC

Is there an RFC for it? I'm not taking the time to search.
So I did.
From 2020
From 2012
The 2020 one doesn't mention the 2012 one, so I email the 2020 RFC poster with the link.

That was very anxiety producing. Worried about saying the wrong thing / coming off as rude / maybe I'm being too lazy by not researching more about how to edit an RFC on the php wiki site. (There wasn't a link on the page). Plus I REALLY have to pee, so that's making me excitable & I haven't done ANY excercise today. So maybe its time for a walk.

Break time

  • Went for a walk. Accidentally played in the snow, a bunch :D
  • Josh from the RFC responded & will try to add the 2012 link. He mentioned that he's busy with other things. It doesn't seem like he'll be able to contribute to php internals for this rfc
  • Checked my other email accounts & deleted most of the emails

Publishing new Taeluf.com

taeluf.localhost is working.

  • Update a link to point at my gitlab instead of my github
  • Update my BetterRegex "tool" to work with the latest Better Reg & update some of the text & the link to BetterReg.
  • Try to make highlightjs work for regex, but I don't think I have regex in my bundle of it... So I gave up & don't care that much.
  • I tried... but still, problems

Change highlight.js styles

There's caching issues. Somewhere in Liaison. (not HTTP caching, but internal stuff).

if ($env->is(['host.local'])->asBool()){    
    $liaison->api('lia.config', 'set', 'lia.resource.forceRecompile', true);    
    $liaison->api('lia.config', 'set', 'lia.maxage.jsCompile', 0);    
    $liaison->api('lia.config', 'set', 'lia.maxage.cssCompile', 0);    
}    

This fixed it. Yuck, I know. $liaison->set('lia.resource....', ...) is the shorthand, but that's still gross.

So now I'm using the stackoveflow light theme.

But what about a11y?
I don't have a way to switch themes right now. I intend to improve on this in the future, but today is not the time for it.

Other stuff for publishing

  • Move my current site to MY_HOST...old/www.taeluf.com. Upload my local files. Oh WAIT. I didn't update dependencies!!!
  • Update my vendor dir with the latest liaison & better regex. Neither is on packagist, so I can either add them (something I planned on doing LATER) OR I can have static repository urls in my composer.json. So I gotta look that up. Cause that's what I'm doing for now.
  • Updated taeluf.com's composer.json. Update BetterRegex's composer.json to classmap to the actual code dir.
  • Actually push better reg & liaison to gitlab.
  • composer update & tlf release push (after moving a couple things around on the server)
  • IT WORKS. My brain is scattered at this point.

I didn't review Highlightjs's license... It's BSD-3... So I'm probably ok? Not gonna worry about it right now.

Then

  • Tweet about the website update
  • Check twitter notifications
  • Check dev.to & reset my password...

Alright. It's 4:40pm. I code til ~6pm. Short break, then I gotta figure out what the heck I'm gonna do with my time. I'm not in a very good headspace for code... so idk how this'll go.

My mind is very unsettled. I got a snack. Got on twitter. It's 5:18pm. Gonna take a hit (of cannabis) and delete some old code, I think.

Didn't delete old code. I got an itch to work on Git Bent, so I did that.
I continued work on new internals for the help menus. Current version uses core_help(){prompt_choose_function "list" "of" "help" "items"}.
In the new version, I declare core_tip_upload(){echo "message"}, and I call do_fancy_new_help from core(), so if someone runs bent core, it will show a help menu listing core_tip_upload's message, as well as any other core_tip_function(){}s.

It's 6:47 now. Not surprisingly, I got in the zone & got carried away.

First devlog done! I think I liked it. I think I'll write more devlogs. I don't expect them to be super interesting, but I enjoyed logging what I was doing through the day.

Some things I thought of during the day

  • I should setup an automatic sitemap (Liaison needs a feature for this)
  • I need to rethink how Liaison handles dynamic routes & sitemaps
  • Liaison really needs a lot more caching...
  • My Liaison $response object needs an easier way to set headers... Some convenience methods for location & diff error codes (or I guess I could use the Goto component)
  • Liaison desparately needs error handling
  • I REALLY need some simple privacy-conscious analytics. I just want to know which URLs are requested & maybe the referrer host (but not the referrer page? since urls often have all kinds of trackers)
  • I love my <h1>/h2/h3/etc font, but its such a big file
  • Social links, ads (or link to my patreon or something) would be nice.
  • Liaison configs need consistent naming conventions
  • My release script... Need a way to push FEWER things. Like, my tests don't need to go on the prod server, but they do currently.
  • It'd be great to have actual blogging ON the site, rather than through .md files. Comments would be neat, too, maybe? Or option for community edits? That would be nice.