PageRank by Ciro Santilli 40 Updated 2025-07-16
When Ciro finally understood that this is a play on Larry Page's name (of course it is, typical programmer/academic humor stuff), his mind blew.
SQL TRIGGER by Ciro Santilli 40 Updated 2025-07-16
SQL's implementation of database triggers.
This feature is really cool, as it allows you to keep caches up to date!
In particular, everything that happens in a trigger happens as if it were in a transaction. This way, you can do less explicit transactions when you use triggers. It is a bit like the advantages of SQL CASCADE.
ISO SQL TRIGGER syntax by Ciro Santilli 40 Updated 2025-07-16
TODO what is the standard compliant syntax?
SQLite does not support SQL stored procedures at all, so maybe that's why they can't be standard compliant here: stackoverflow.com/questions/3335162/creating-stored-procedure-in-sqlite
SQL:1999 11.38 covers "Trigger definition". The Abstract syntax tree starts with the CREATE TRIGGER and ends in:
<triggered SQL statement> ::=
  <SQL procedure statement>
This is defined at 13.5 "SQL procedure statement", but that is humongous and I'm not sure what it is at all.
In this example we cache track the number of posts per user on a cache column.
UNION (SQL) by Ciro Santilli 40 Updated 2025-07-16
Basic example tested on SQLite 3.40.1, Ubuntu 23.04:
sqlite3 :memory: 'select 1 union select 2'
output:
1
2
Two columns two rows:
sqlite3 :memory: <<EOF
select * from (values (1, 2), (2, 3))
union
select * from (values (2, 3), (3, 4))
EOF
output:
1|2
2|3
3|4
Note how duplicates are removed, to keep them we UNION ALL instead:
sqlite3 :memory: <<EOF
select * from (values (1, 2), (2, 3))
union all
select * from (values (2, 3), (3, 4))
EOF
output:
1|2
2|3
2|3
3|4
AKA how this GitHub page gets served under the domain: cirosantilli.com
Ciro only touches this very rarely, and always forgets and go into great pain whenever a change needs to done, so it is important to document it.
The last change was of 2019-07-07, when Ciro moved from the www subdomain www.cirosantilli.com to the APEX cirosantilli.com. A redirect is setup from the www subdomain to APEX.
GoDaddy DNS entries:
Type    Name    Value                   TTL
A       @       185.199.108.153         1 Hour
A       @       185.199.109.153         1 Hour
A       @       185.199.110.153         1 Hour
A       @       185.199.111.153         1 Hour
CNAME   www     cirosantilli.github.io  1 Hour
Moved cirosantilli.com to Porkbun 2022-02, unfortunatly records were not automatically updated and domain went down for a bit, upadded to new entries for IPv6 as well which are not documented by GitHub:
TYPE 	HOST	ANSWER	TTL	PRIORITY	OPTIONS
A	cirosantilli.com	185.199.108.153	600
A	cirosantilli.com	185.199.109.153	600
A	cirosantilli.com	185.199.110.153	600
A	cirosantilli.com	185.199.111.153	600
AAAA	cirosantilli.com	2606:50c0:8000::153	600
AAAA	cirosantilli.com	2606:50c0:8001::153	600
AAAA	cirosantilli.com	2606:50c0:8002::153	600
AAAA	cirosantilli.com	2606:50c0:8003::153	600
CNAME	www.cirosantilli.com	cirosantilli.github.io	600
  • Custom domain: cirosantilli.com
  • Enforce HTTPS: checked
And the CNAME file is tracked in this repository: CNAME.
virtualenv by Ciro Santilli 40 Updated 2025-07-16
python3 -m pip install --user virtualenv
virtualenv .venv
. .venv/bin/activate
pip install -r requirements.txt
20% time rule by Ciro Santilli 40 Updated 2025-07-16
The Google Story suggests that this practice existed in academia, where it was brought from. But I can't find external references to it easily:
At Google, the preference is for working in small teams of three, with individual employees expected to allot 20 percent of their time to exploring whatever ideas interest them most. The notion of "20 percent time" is borrowed from the academic world, where professors are given one day a week to pursue private interests.
DELETE with JOIN (SQL) by Ciro Santilli 40 Updated 2025-07-16
NO way in the SQL standard apparently, but you'd hope that implementation status would be similar to UPDATE with JOIN, but not even!

Pinned article: Introduction to the OurBigBook Project

Welcome to the OurBigBook Project! Our goal is to create the perfect publishing platform for STEM subjects, and get university-level students to write the best free STEM tutorials ever.
Everyone is welcome to create an account and play with the site: ourbigbook.com/go/register. We belive that students themselves can write amazing tutorials, but teachers are welcome too. You can write about anything you want, it doesn't have to be STEM or even educational. Silly test content is very welcome and you won't be penalized in any way. Just keep it legal!
We have two killer features:
  1. topics: topics group articles by different users with the same title, e.g. here is the topic for the "Fundamental Theorem of Calculus" ourbigbook.com/go/topic/fundamental-theorem-of-calculus
    Articles of different users are sorted by upvote within each article page. This feature is a bit like:
    • a Wikipedia where each user can have their own version of each article
    • a Q&A website like Stack Overflow, where multiple people can give their views on a given topic, and the best ones are sorted by upvote. Except you don't need to wait for someone to ask first, and any topic goes, no matter how narrow or broad
    This feature makes it possible for readers to find better explanations of any topic created by other writers. And it allows writers to create an explanation in a place that readers might actually find it.
    Figure 1.
    Screenshot of the "Derivative" topic page
    . View it live at: ourbigbook.com/go/topic/derivative
  2. local editing: you can store all your personal knowledge base content locally in a plaintext markup format that can be edited locally and published either:
    This way you can be sure that even if OurBigBook.com were to go down one day (which we have no plans to do as it is quite cheap to host!), your content will still be perfectly readable as a static site.
    Figure 2.
    You can publish local OurBigBook lightweight markup files to either https://OurBigBook.com or as a static website
    .
    Figure 3.
    Visual Studio Code extension installation
    .
    Figure 4.
    Visual Studio Code extension tree navigation
    .
    Figure 5.
    Web editor
    . You can also edit articles on the Web editor without installing anything locally.
    Video 3.
    Edit locally and publish demo
    . Source. This shows editing OurBigBook Markup and publishing it using the Visual Studio Code extension.
    Video 4.
    OurBigBook Visual Studio Code extension editing and navigation demo
    . Source.
  3. https://raw.githubusercontent.com/ourbigbook/ourbigbook-media/master/feature/x/hilbert-space-arrow.png
  4. Infinitely deep tables of contents:
    Figure 6.
    Dynamic article tree with infinitely deep table of contents
    .
    Descendant pages can also show up as toplevel e.g.: ourbigbook.com/cirosantilli/chordate-subclade
All our software is open source and hosted at: github.com/ourbigbook/ourbigbook
Further documentation can be found at: docs.ourbigbook.com
Feel free to reach our to us for any help or suggestions: docs.ourbigbook.com/#contact