Sometimes you can debug software by staring at the code for long enough Updated 2025-07-16
A senior developer came over, and rather than trying to run and modify the code like an idiot, which is what Ciro Santilli usually does (see also experimentalism remarks at Section "Ciro Santilli's bad old event memory"), he just stared at the code for about 10 minutes.
We knew that the problem was likely in a particular function, but it was really hard to see why things were going wrong.
After the 10 minutes of examining every line in minute detail, he said:and truly, that was the cause.
I think this function call has such or such weird edge case
And so, Ciro was enlightened.
Spacetime diagram Updated 2025-07-16
Answer: it can give some qualitative intuition on what is larger/smaller happens before/after based only on arguably more intuitive geometric considerations, without requiring you to do any calculations, see e.g. Figure "Spacetime diagram illustrating how faster-than-light travel implies time travel".
Spark-gap transmitter Updated 2025-07-16
The first type of device that allowed sending Morse code without wires, as opposed to the wired electrical telegraph that previously existed.
Wireless voice transmission came about with modulation.
Spherical cap model of the real projective plane Updated 2025-07-16
Ciro Santilli's preferred visualization of the real projective plane is a small variant of the standard "lines through origin in ".
For those sphere points in the circle on the x-y plane, you should think of them as magic poins that are identified with the corresponding antipodal point, also on the x-y, but on the other side of the origin. So basically you you can teleport from one of those to the other side, and you are still in the same point.
Ciro likes this model because then all the magic is confined just to the part of the model, and everything else looks exactly like the sphere.
It is useful to contrast this with the sphere itself. In the sphere, all points in the circle are the same point. But this is not the case for the projective plane. You cannot instantly go to any other point on the by just moving a little bit, you have to walk around that circle.
Spherical cap model of the real projective plane
. On the x-y plane, you can magically travel immediately between antipodal points such as A/A', B/B' and C/C'. Or equivalently, those pairs are the same point. Every other point outside the x-y plane is just a regular point like a normal sphere. Spin experiments Updated 2025-07-16
- Stern-Gerlach experiment
- fine structure split in energy levels
- anomalous Zeeman effect
- of a more statistical nature, but therefore also macroscopic and more dramatically observable:
- ferromagnetism
- Bose-Einstein statistics vs Fermi-Dirac statistics. A notable example is the difference in superfluid transition temperature between superfluid helium-3 and superfluid helium-4.
Spin number of a field Updated 2025-07-16
Best mathematical explanation: Section "Spin comes naturally when adding relativity to quantum mechanics".
Physics from Symmetry by Jakob Schwichtenberg (2015) chapter 3.9 "Elementary particles" has an amazing summary of the preceding chapters the spin value has a relation to the representations of the Lorentz group, which encodes the spacetime symmetry that each particle observes. These symmetries can be characterized by small integer numbers:As usual, we don't know why there aren't elementary particles with other spins, as we could construct them.
Spin (physics) Updated 2025-07-16
Spin is one of the defining properties of elementary particles, i.e. number that describes how an elementary particle behaves, much like electric charge and mass.
The approach shown in this section: Section "Spin comes naturally when adding relativity to quantum mechanics" shows what the spin number actually means in general. As shown there, the spin number it is a direct consequence of having the laws of nature be Lorentz invariant. Different spin numbers are just different ways in which this can be achieved as per different Representation of the Lorentz group.
Video 1. "Quantum Mechanics 9a - Photon Spin and Schrodinger's Cat I by ViaScience (2013)" explains nicely how:
- incorporated into the Dirac equation as a natural consequence of special relativity corrections, but not naturally present in the Schrödinger equation, see also: the Dirac equation predicts spin
- photon spin can be either linear or circular
- the linear one can be made from a superposition of circular ones
- straight antennas produce linearly polarized photos, and Helical antennas circularly polarized ones
- a jump between 2s and 2p in an atom changes angular momentum. Therefore, the photon must carry angular momentum as well as energy.
- cannot be classically explained, because even for a very large estimate of the electron size, its surface would have to spin faster than light to achieve that magnetic momentum with the known electron charge
- as shown at Video "Quantum Mechanics 12b - Dirac Equation II by ViaScience (2015)", observers in different frames of reference see different spin states
Quantum Spin - Visualizing the physics and mathematics by Physics Videos by Eugene Khutoryansky (2016)
Source. Ciro's Edict #4 China front Updated 2025-07-16
At github.com/cirosantilli/china-dictatorship/issues/738 a user made a comment about gang raping my mother (more like country-raping).
As mentioned at github.com/cirosantilli/china-dictatorship/issues/739, ally Martin then reported the issue, and GitHub took down the wumao's account for a while using their undocumented shadowban feature, until the wumao edited the issue.
Based on the discussion with Martin, I then recommended at github.com/cirosantilli/china-dictatorship/blob/41b4741a4e6553f44f5f1ef85cf63c55eb7b8277/CONTRIBUTING.md that we do not report such issues, and that GitHub do not delete such accounts, with rationale explained on the CONTRIBUTING.
Ciro's Edict #4 ourbigbook.com Updated 2025-07-16
I had meant to make an update earlier, but I wanted to try and add some more "visible end-user changes" to OurBigBook.com.
Just noticed BTW that signup on the website is broken. Facepalm. Not that it matters much since it is not very useful in the current state, but still. Going to fix that soon. EDIT: nevermind, it wasn't broken, I just had JavaScript disabled on that website with an extension to test if pages are visible without JavaScript, and yes, they are perfectly visible, you can't tell the difference! But you can't login without JavaScript either!
I still haven't the user visible ones I wanted, but I've hit major milestones, and it feels like time for an update.
I have now finished all the OurBigBook CLI features that I wanted for 1.0, all of which will be automatically reused in ourbigbook.com.
The two big things since last email were the following:
A secondary but also important advance was: further improvements to the website's base technology.
E.g.:
README.cironot-readme.cirothe table of contents for
= My website
== h2
\Include[not-readme]= Not readme
== Not readme h2index.html also contains the headers for not-readme.ciro producing:This feature means that you can split large input files if rendering starts to slow you down, and things will still render exactly the same, with the larger table of contents.
This will be especially important for the website because initially I want users to be able to edit one header at a time, and join all headers with
\Include. But I still want the ToC to show those children.This was a bit hard because it required doing RECURSIVE SQL queries, something I hadn't done before: stackoverflow.com/questions/192220/what-is-the-most-efficient-elegant-way-to-parse-a-flat-table-into-a-tree/192462#192462 + of course the usual refactor a bunch of stuff and fix tests until you go mad.
Ciro's Edict #5 Completely rebrand Cirodown to OurBigBook Updated 2025-07-16
The name cirodown should not appear anywhere now, except with very few exceptions, e.g.:
- github.com/cirosantilli/cirodown to github.com/ourbigbook/ourbigbook
- file extension from
.ciroto.bigb - the Node.js NPM package was renamed from
cirodowntoourbibook. - all in-code instances
I have also squatted
OurBigBook on all major social media handles for near future usage, e.g.: twitter.com/ourbigbook and so on.I was going to do this sooner or later, it was inevitable, but the timing was partly triggered due to noticing that English speakers (and likely many other nationalities) are not able to easily read/hear/pronounce "Ciro".
Ciro's Edict #8 List topics on home page Updated 2025-07-16
The new default homepage for a logged out user how shows a list of the topics with the most articles.
This is a reasonable choice for default homepage, and it immediately exposes users to this central feature of the website: the topic system.
Doing this required in particular calculating the best title for a topic, since it is possible to have different titles with the same ID, the most common way being with capitalization changes, e.g.:would both have topic ID
JavaScript
Javascriptjavascript.The algorithm chosen is to pick the top 10 most upvoted topics, and select the most common title from amongst them. This should make topic title vandalism quite hard. This was made in a single SQL query, and became the most complext SQL query Ciro Santilli has ever written so far: twitter.com/cirosantilli2/status/1549721815832043522
Screenshot showing the list of topics
. The page is: ourbigbook.com for the logged out user, ourbigbook.com/go/topics for the logged in user.Screenshot showing a topic page
. The page is: ourbigbook.com/go/topic/vector-space. Before this sprint, we didn't have the "Vector Space" at the top, as it wasn't necessarily trivial to determine what the preferred title would be. Ciro's Edict #8 Next steps Updated 2025-07-16
I guess ended up doing all the "how things should look like" features because they clarify what the website is supposed to do, and I already have my own content to bring it alive via
ourbigbook --web upload.But now I honestly feel that all the major elements of "how things should look like" have fallen into place.
I was really impressed by Trillium Notes. I should have checked it long ago. The UI is amazing, and being all Js-based, could potentially be reused for our purposes. The project itself is a single-person/full trust notetaking only for now however, so not a direct replacement to OurBigBook.
Spontaneous parametric down-conversion Updated 2025-07-16
You can then detect one of the photons, and when you do you know that the other one is there as well and ready to be used. two photon interference experiment comes to mind, which is the basis of photonic quantum computer, where you need two photons to be produced at the exact same time to produce quantum entanglement.
Features Alan Migdall of the National Institute of Standards and Technology. Produced by the Joint Quantum Institute (JQI).
Mentions that this phenomena is useful to determine the efficiency of a single photon detector, as you have the second photon of the pair as a control.
Also briefly describes how the input energy and momentum must balance out the output energy and momentum of the two photons coming out (determined by the output frequency and angle).
Shows the crystal close up of the crystal branded "Cleveland Crystals Inc.". Mentions that only one in a billion photon gets scattered.
Also shows a photomultiplier tube.
Then shows their actual optical table setup, with two tunnels of adjustable angle to get photons with different properties.
Very short whiteboard video by Peter Mosley from the University of Bath, but it's worth it for newbs. Basically describes spontaneous parametric down-conversion.
One interesting thing he mentions is that you could get single photons by making your sunglasses thicker and thicker to reduce how many photons pass, but one big downside problem is that then you don't know when the photon is going to come through, that becomes essentially random, and then you can't use this technique if you need two photons at the same time, which is often the case, see also: two photon interference experiment.
SQL contiguous ranges Updated 2025-07-16
stackoverflow.com/questions/17046204/how-to-find-the-boundaries-of-groups-of-contiguous-sequential-numbers/17046749#17046749 just works, even in SQLite which supports all quoting types known to man including
[] for compatibility with insane RDBMSs!Here's a slightly saner version:
rm -f tmp.sqlite
sqlite3 tmp.sqlite "create table mytable (id integer primary key autoincrement, number integer, status integer)"
sqlite3 tmp.sqlite <<EOF
insert into mytable(number, status) values
(100,0),
(101,0),
(102,0),
(103,0),
(104,1),
(105,1),
(106,0),
(107,0),
(1014,0),
(1015,0),
(1016,1),
(1017,0)
EOF
sqlite3 tmp.sqlite <<EOF
SELECT
MIN(id) AS "id",
MIN(number) AS "from",
MAX(number) AS "to"
FROM (
SELECT ROW_NUMBER() OVER (ORDER BY number) - number AS grp, id, number
FROM mytable
WHERE status = 0
)
GROUP BY grp
ORDER BY MIN(number)
EOFoutput:
1|100|103
7|106|107
9|1014|1015
12|1017|1017To get only groups of length greater than 1:
sqlite3 tmp.sqlite <<EOF
SELECT "id", "from", "to", "to" - "from" + 1 as "len" FROM (
SELECT
MIN("id") AS "id",
MIN(number) AS "from",
MAX(number) AS "to"
FROM (
SELECT ROW_NUMBER() OVER (ORDER BY "number") - "number" AS "grp", "id", "number"
FROM "mytable"
WHERE "status" = 0
)
GROUP BY "grp"
ORDER BY MIN("number")
) WHERE "len" > 1
EOFOutput:
1|100|103|4
7|106|107|2
9|1014|1015|2 SQL histogram Updated 2025-07-16
OK, there's a billion questions:
- SQL Server
- stackoverflow.com/questions/485409/generating-a-histogram-from-column-values-in-a-database OP did not know the difference between count and histogram :-) But it's the number one Google result.
- stackoverflow.com/questions/19103991/create-range-bins-from-sql-server-table-for-histograms has a minor extra group by twist, but otherwise fine
- stackoverflow.com/questions/16268441/generate-histogram-in-sql-server
- SQLite
- stackoverflow.com/questions/67514208/how-to-optimise-creating-histogram-bins-in-sqlite perf only, benchmarking would be needed. SQLite.
- stackoverflow.com/questions/32155449/create-a-histogram-with-a-dynamic-number-of-partitions-in-sqlite variable bin size, same number of entries per bin
- stackoverflow.com/questions/60348109/histogram-for-time-periods-using-sqlite-regular-buckets-1h-wide time
- MySQL: stackoverflow.com/questions/1764881/getting-data-for-histogram-plot MySQL appears to extend
ROUNDto also round by integers:ROUND(numeric_value, -2), but this is not widely portable which is a shame - stackoverflow.com/questions/72367652/populating-empty-bins-in-a-histogram-generated-using-sql specifically asks about empty bins, which is amazing. Amazon Redshift dialect unfortunately, but answer provided works widely, and Redshift was forked from PostgreSQL, so there's hope. Those newb open source server focused projects that don't use AGPL!
Let's try it on SQLite 3.40.1, Ubuntu 23.04. Data setup:
sqlite3 tmp.sqlite 'create table t(x integer)'
sqlite3 tmp.sqlite <<EOF
insert into t values (
0,
2,
2,
3,
5,
6,
6,
8,
9,
17,
)
EOF
sqlite3 tmp.sqlite 'create index tx on t(x)'For a bin size of 5 ignoring empty ranges we can:which produces the desired:
sqlite3 tmp.sqlite <<EOF
select floor(x/5)*5 as x,
count(*) as cnt
from t
group by 1
order by 1
EOF0|4
5|5
15|1And to consider empty ranges we can use SQL which outputs the desired:
genenerate_series + as per stackoverflow.com/questions/72367652/populating-empty-bins-in-a-histogram-generated-using-sql:sqlite3 tmp.sqlite <<EOF
select x, sum(cnt) from (
select floor(x/5)*5 as x,
count(*) as cnt
from t
group by 1
union
select *, 0 as cnt from generate_series(0, 15, 5)
)
group by x
EOF0|4
5|5
10|0
15|1sqlite3 Node.js package Updated 2025-07-16Includes its own copy of sqlite3, you don't use the system one, which is good to ensure compatibility. The version is shown at: github.com/mapbox/node-sqlite3/blob/918052b538b0effe6c4a44c74a16b2749c08a0d2/deps/common-sqlite.gypi#L3 SQLite source is tracked compressed in-tree: github.com/mapbox/node-sqlite3/blob/918052b538b0effe6c4a44c74a16b2749c08a0d2/deps/sqlite-autoconf-3360000.tar.gz horrendous. This explains why it takes forever to clone that repository. People who don't believe in git submodules, there's even an official Git mirror at: github.com/sqlite/sqlite
It appears to spawn its own threads via its C extension (since JavaScript is single threaded and and SQLite is not server-based), which allows for parallel queries using multiple threads: github.com/mapbox/node-sqlite3/blob/v5.0.2/src/threading.h
Hello world example: nodejs/node-sqlite3/index.js.
As of 2021, this had slumped back a bit, as maintainers got tired. Unmerged pull requests started piling more, and
better-sqlite3 Node.js package started pulling ahead a little.- github.com/mapbox/node-sqlite3/issues/1381
FATAL ERROR: Error::ThrowAsJavaScriptException napi_throwwith Node.jsworker_threadsvsbetter-sqlite3Node.js package github.com/JoshuaWise/better-sqlite3/issues/237
SQL RECURSIVE prevent infinite recursion Updated 2025-07-16
Example under: nodejs/sequelize/raw/tree.js
SQL tree traversal Updated 2025-07-16
Example: nodejs/sequelize/raw/tree.js
- Implementation agnostic
- Postgres
- stackoverflow.com/questions/67848017/simple-recursive-sql-query
- stackoverflow.com/questions/28688264/how-to-traverse-a-hierarchical-tree-structure-structure-backwards-using-recursiv
- stackoverflow.com/questions/51822070/how-can-postgres-represent-a-tree-of-row-ids
- depth first
- uspecified depth first variant
- preorder DFS
- breadth-first stackoverflow.com/questions/3709292/select-rows-from-table-using-tree-order
- MySQL
- Microsoft SQL Server
SQL TRIGGER Updated 2025-07-16
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.
DBMS:
There are unlisted articles, also show them or only show them.

