#dev 2025-03-29

2025-03-29 UTC
gRegorLove__ and sebbu joined the channel
#
carrvo
tantek, I disagree that filesystems are so different from databases. The storage of directories is not so different than B-tree nodes that some databases are based off of.
#
carrvo
That being said traditional "databases" are actually "relational databases" (SQL is based off relational algebra).
#
carrvo
LDAP is an example of contemporary NoSQL databases before they had that name. Amazon's A3 storage thing is more recent.
#
[tantek]
carrvo, you're missing the point as prior arguments have made re plumbing / implementation details vs user impacts, usability, portability, reliability etc
#
carrvo
Filesystems, on the other hand, have very different design features to them (they tend to lack the ACID properties of relational databases).
#
[tantek]
No one cares about the underlying structure "on disk" as they say whether b-trees or git or something else. It's the "files and directories" abstraction which is what makes file systems superior to any "database" from a user perspective
#
carrvo
That is kind of my point: all the storage mechanisms (whether classified as "databases" or not) should really be chosen by their differences in features.
#
[tantek]
Databases tend to lack the "easily copy and run and browse and inspect from one system to another system running completely different software" properties
#
[tantek]
Which is why they are dead ends and fragile for long term storage
#
carrvo
I wouldn't call filesystems "superior". They are more friendly to non-technical users (one of their features and a main reason I use SVN).
#
[tantek]
And hence databases are an antipattern for longevity, long term storage, and especially for any personal data that you have to admin yourself
#
[tantek]
File systems are more friendly to anyone who doesn't want to be a DBA. It has nothing to do with technical skills or lack thereof
#
[tantek]
Even DBAs have to do MORE work to move data across heterogeneous systems that's stuck in a database as compared to things like scp, rsync, or drag and drop to a usb stick
#
carrvo
And I would disagree. At least as an absolute for everyone in all situations to be better. That is anti-pluralistic and the equivalent to saying we should only have one OS just because one solved the problem first.
#
sebbu
[tantek], that's why you usually export databases do .sql
#
sebbu
which you can (more or less easily) convert and import to different softwares
#
sebbu
you could even make schema in UML
#
[tantek]
No that's called "more work"
#
sebbu
not if you use the right tool
#
carrvo
sebbu, bit more complex than that...which is why DBs are likely to be "easier" in 90% of cases.
#
sebbu
and then you end up with people inventing redis or mongodb
#
sebbu
and nosql
#
sebbu
and trying to get all the features of DBs
#
[tantek]
lol "the right tool" right you're proving. My point. Cognitive load of what is "the right tool" (this year)
#
sebbu
and making it even harder
#
carrvo
But DBs have other considerations like concurrency and fast read vs fast write that make them worth the extra effort for copy/longevity.
#
[tantek]
As opposed to built in UI in every system
#
sebbu
the main advantage of db is joins and contraints
#
sebbu
and lookups
#
[tantek]
No those other considerations are useful for caches. Not longevity
#
[tantek]
That's my point. Db is wrong tool for longevity and persistence
#
carrvo
Mind you lower technical personal websites are likely not looking for this (which is a narrow use case).
#
[tantek]
No it's the use case for this community
#
sebbu
persistence is usually fine, like everything else, you have backups
#
[tantek]
That's what the database antipattern article is focused on. Personal websites longevity and storage.
#
[tantek]
sebbu no it's not. Plenty of citations in the article
#
carrvo
I would argue that DBs are bad for this community (which is not an absolute statement about everyone). I am also surprised at how many in the community use MySQL or something.
#
[tantek]
Sure we all have different admintax and infra tradeoffs
#
carrvo
"personal website longevity" is not the same as "longevity".
gRegorLove_ joined the channel
#
gRegor
"It has been __0__ days since databases have been debated in #indieweb-dev" :D
#
[artlung]
I can't tell what the goal of these distinctions, disagreements, and definitions are about but there are reasons to use "database" in a "RDBMS" (relational database management system) specific to software. But it's true, the word "database" has a rough meaning of "entity that can have data stored in it" which I feel like is creating ambiguities and worsening the mild, not particularly constructive disagreement here in dev.
#
[artlung]
I will say that when I read "database antipattern" I interpret that as "don't use a database if you don't need to" ... and like the Serenity Prayer that requires "the wisdom to know the difference" as to whether an RDBMS is needed for a use case.
#
[artlung]
Hey that's a fine page that recapitulates a lot of what's been said. Thanks [gRegorLove]++
#
Loqi
[gRegorLove] has 2 karma in this channel over the last year (18 in all channels)
gRegorLove_, gRegorLove__, nemonical, jjuran, gRegor, [jamietanna] and [KevinMarks] joined the channel
#
[KevinMarks]
A .sql file is a program. Using that for transfer is giving remote execution privilege directly to something you download without it having to do code injection. Most SQL exports start by deleting the target table before recreating it which is going to break production for you. (what you normally want to do is to import to an alternative table, and swap the names over atomically afterwards). TSV or CSV is how you normally share larger
nemonical and gRegorLove_ joined the channel
#
immibis
I literally wrote a sqlite to fuse adapter
#
immibis
Filesystems as user-friendly is such a 2010 thing. These days we have photosystems and imessagesystems.
#
immibis
related: a website is a service, not a set of data.
shoesNsocks, skeuos[d], gRegorLove__ and ttybitnik joined the channel
#
Zegnat
I am not sure what service my website is, I would call it a document rather than a service. But I think all these definitions are super unintuitive anyway. Is SQLite or DuckDB a database or are they just introspection tools when I run them against a multiple gigabyte CSV file? Is a multi-GB CSV file any more or less easy for portability than if it had been in a SQLite binary format, considering I probably cannot open it with whatever
#
Zegnat
my OS text editor is anyway? I find it is often much more productive to talk about “tools for the job” and why you chose them. (Note that this is not the “right” tool, it is just tool. Chances are you are not using the most correct tool, and you do not have to. But it is always worth thinking about why you ended up with the tool that you have :) )
nemonical and CRISPR joined the channel
#
Zegnat
Not sure where this goes, but thought it was an interesting case and something we have seen before with microformats class names being used to other things as well. A browser extension that overwrites a CSS variable, breaking styling on a website: https://dbushell.com/2025/03/29/et-tu-grammarly/
#
immibis
a website is a machine that converts HTTP requests into HTTP responses
#
immibis
def website(req : Request) -> Response:
#
immibis
the responses should be something that's useful for displaying in a browser
#
immibis
of course *one possible* implementaion is def website(req : Request) -> Response: assert ".." not in path; return readfile("/var/www/html/"+req.path)
#
[schmarty]
Regression to formalisms? Wow we have got really far away from the initial discussion of how storage choice affects admintax https://indieweb.org/admin_tax
#
[snarfed]
agreed, I love most tech talk here but the semantics debates are getting a bit tiring
#
Zegnat
Felt like I had some thoughts on tools, sorry for necro’ing
#
[snarfed]
no worries!
#
immibis
imagine a channel where people are afraid to civilly discuss on-topic things
#
[artlung]
the word is bored.
#
Zegnat
Oposite of afraid, I am happy to defer to [schmarty] and [snarfed] as to what is still on-topic and when we have moved on :) Known them long enough. I would much rather keep the Grammarly thing in recent chat and hear about what people think about addons breaking their personal websites
#
immibis
[artlung]: i wasn't aware - is it a requirement that everyone in a channel should be interested in every conversation in the channel?
#
[artlung]
On topic, and not boring (to me) was yesterday I replaced my handwritten prints and printfs in php for my mixtape code and replaced it with Twig code that's going to be far nicer to adapt as I inevitably change things. https://gist.github.com/artlung/b79f928b45b85c177656e6bdc9ce64e0
#
Zegnat
[artlung]: nice! You do not need a twig filter when writing out variables into HTML attribute values to make sure things are escaped?
#
[artlung]
so I don't have any values that are dodgy (have quotes or whatever) but that's my understanding.
#
[schmarty]
I think twig escapes by default, hence some of the values being piped thru the "raw" filter
#
[artlung]
I have one bit in there where it goes in raw and that is not escaped. but it kind of amazed me that quotes got turned into smart quotes by default.
#
Zegnat
That might be fine then
geoffo joined the channel
#
[artlung]
I did a phpunit test that ran over the existing outputs and I checked against that when I was doing the work and it went pretty well.
#
Zegnat
I just get flashbacks to mangled RSS feeds where people used to put them together using template engines instead of using an XML serialiser. (And, having not learned anything from it, I then started seeing people put JSON files together with template engines.)
#
[schmarty]
artlung: was twig already in use on your site? I'm interested to hear what led you to choose it!
#
[artlung]
It was not on my site, no. I was basically getting tired of a lot of manual printfs and conditionals to account for whetther there was data in a section or not and started considering Twig. Funny enough I was thinking of Smarty first because I am old but Twig seemed nice.
#
[artlung]
And the templates compile to be faster, it seems to work reasonably well.
#
[schmarty]
artlung: thanks! That makes sense! I have considered Twig (and sometimes Blade) for projects but usually the "PHP is a template language" voice in my head wins out and I just reach for PHPLeague's Plates 😅
#
[artlung]
I have been writing a LOT of code and reworking things in the last year and mostly I haven't wanted to use templating. But all the cases there were things I knew what the output was.
#
[artlung]
The mixtapes project is weirdly more complicated. I have tapes that are a single tape with 2 sides. I have tape series with multiple tapes. I have ones with artwork, ones without. I have CDs which don't have "sides". The data might have track timings or not. They may have additional notes or not. I have some with text in other languages. So doing that all in PHP gets to be really complicated.
#
Zegnat
[schmarty]: I have used Plates too, I seemed to always prefer it over the other ones. But it might also just be we are sharing the same voice ;)
#
[artlung]
My dip-the-toes moment was for server-side search.
#
[artlung]
```<ul>
#
[artlung]
{% for result in results %}
#
[artlung]
{% set title = result[1] %}
#
[artlung]
{% set slug = result[0] %}
#
[artlung]
{% set artist = result[2] %}
#
[artlung]
<li><b>{{ title }}</b> <span>{{ artist }}</span> <a href='https://artlung.com/mixtapes/{{ slug }}'>{{ slug }}</a> </li>
#
[artlung]
{% endfor %}
#
[artlung]
</ul>```
#
[artlung]
```<nav><form method="get" action="search.php"><input type="text" placeholder="Search" name="q" value="{{ search_term }}"></form><div id="search-results">
#
[artlung]
</div></nav>```
#
[artlung]
{% include 'search-results.html.twig' with { results: results} %}
#
[schmarty]
artlung: haha, yeah that sounds like a great case to let a template engine do its thing! I recently experienced the reverse in a work project, turning client-side handlebars templates into PHP templates and having to resolve all the ambiguity that handlebars syntax happily hides was a pain 😅
#
[schmarty]
Those look nice and clean!
#
[artlung]
I was kind of afraid to do it. I thought I would surely screw up some part of the logic. So I set up a unit test that would create the current output snapshots. Then I changed to the templating and really did test driven development. Or test driven refactoring anyway.
#
[artlung]
[marksuth] shares all the code of his Laravel site. I always think his templates look pretty good. Blade.
#
[schmarty]
artlung++ testing++
#
Loqi
testing has 2 karma in this channel over the last year (4 in all channels)
#
Loqi
artlung has 7 karma in this channel over the last year (30 in all channels)
#
[schmarty]
I am attracted to the custom component system in Blade but my understanding is that it's hard to use outside Laravel.
#
Loqi
[preview] [enhance-dev] enhance-ssr-php: Enhance SSR for PHP
#
[schmarty]
(HTML custom element syntax in your templates, processed by your own PHP custom components)
#
[artlung]
Intriguing. Bookmarking that to try
#
[KevinMarks]
That twig syntax looks very like nunjucks/jinja2 - is that the design centre for twig?
#
[KevinMarks]
[Zegnat] I use nunjucks to generate svg and js code as well, so clearly I am a reprobate.
#
Zegnat
[KevinMarks]: it is just like everything else, it works until it does not :D
#
Zegnat
And with feeds often being side files, people do not always notice when their content has broken their XML serialisation
#
[artlung]
It’s funny you say that Kevin, I actually first first started looking at templating options working on my dad‘s poetry chapbook. Potentially TeX. And twig can do that.
#
[KevinMarks]
I miss nunjucks chill handling of null elements when I go back to node or python
#
[artlung]
I have not leapt into that but there’s nothing precluding it
#
Loqi
misses nunjucks chill handling of null elements when I go back to node or python too
#
Zegnat
[KevinMarks]: also, yes, Twig syntax I believe came straight from Jinja (at least to start)
#
[tantek]
What is template
#
Loqi
A template is a file used to generate a page https://indieweb.org/template
#
[tantek]
The wiki says twig is like Liquid. Perhaps that needs updating? https://indieweb.org/template#Twig
#
Zegnat
Probably is a very fuzzy timeline there between django, jinja, liquid, ... I would describe all of them to be like eachother
#
[tantek]
Maybe they're worth clustering together then?
#
[KevinMarks]
There is some commonality there with {% %} for flow control and {{ }} for evaluation, and | for applying functions.
#
[tantek]
That kind of analysis would also be good to add
gRegorLove_, luca, NaomiAmethyst and nemonical joined the channel
#
gRegor
I've enjoyed using Twig in some work projects. The escaping is a nice-to-have. I've been wanting to try out Plates, too.
#
gRegor
It may not look as pretty, [artlung], but in your code snippet I think you could use `{{ result[1] }}` directly without the `set` statements
#
[artlung]
You’re not wrong! That leftover code smell I keep in there because I think an array with named keys is where I’m headed. `result.slug` etc!
#
gRegor
Gotcha, nice. Yeah I like that dot syntax too
#
[schmarty]
fwiw i like the way you're explicitly unpacking the numerically-indexed array into human-meaningful variable names. ✨
#
gRegor
true, magicnumbers--
#
Loqi
magicnumbers has -1 karma over the last year
#
[artlung]
I consider that “being nice to future Joe, who has to maintain this code“
#
gRegor
What is Twig?
#
Loqi
twig may refer to TWiG (This Week in Google), or the Twig (template engine) https://indieweb.org/twig
#
[tantek]
Nice disambig page. I'd say feel free to prioritize the meaning that has more direct (recent?) indieweb relevance
#
gRegor
oh yeah, forgot I moved indiebookclub to Twig too
#
[tantek]
Definitely counts as an indieweb example
#
gRegor
Added
rrix, ttybitnik and SylvatiCodes joined the channel