nodejs/sequelize/raw/parallel_select_and_update_deterministic.js Updated 2025-07-16
This example contains a deterministic demo of when postgreSQL serialization failures may happen.
Tested on PostgreSQL 13.5.
nodejs/sequelize/raw/parallel_select_and_update.js Updated 2025-07-16
This example is similar to nodejs/sequelize/raw/parallel_update_async.js, but now we are doing a separate SELECT, later followed by an update:
Although this specific example is useless in itself, as we could just use
UPDATE "MyInt" SET i = i + 1 as in nodejs/sequelize/raw/parallel_update_async.js, which automatically solves any concurrency issue, this kind of code could be required for example if the update was a complex function not suitably implemented in SQL, or if the update depends on some external data source.Sample execution:which does:
node --unhandled-rejections=strict ./parallel_select_and_update.js p 2 10 'READ COMMITTED'- PostgreSQL, see other databases options at SQL example
- 2 threads
- 10 increments on each thread
Another one:this will run SELECT FOR UPDATE rather than just SELECT
node --unhandled-rejections=strict ./parallel_select_and_update.js p 2 10 'READ COMMITTED' 'FOR UPDATE'Observed behaviour under different SQL transaction isolation levels:
READ COMMITTED: fails. Nothing in this case prevents:REPEATABLE READ: works. the manual mentions that if multiple concurrent updates would happen, only the first commit succeeds, and the following ones fail and rollback and retry, therefore preventing the loss of an update.READ COMMITTED+SELECT FOR UPDATE: works. And does not do rollbacks, which probably makes it faster. Withp 10 100,REPEATABLE READwas about 4.2s andREAD COMMITTED+SELECT FOR UPDATE3.2s on Lenovo ThinkPad P51 (2017).SELECT FOR UPDATEshould be enough as mentioned at: www.postgresql.org/docs/13/explicit-locking.html#LOCKING-ROWSFOR UPDATE causes the rows retrieved by the SELECT statement to be locked as though for update. This prevents them from being locked, modified or deleted by other transactions until the current transaction ends. That is, other transactions that attempt UPDATE, DELETE, SELECT FOR UPDATE, SELECT FOR NO KEY UPDATE, SELECT FOR SHARE or SELECT FOR KEY SHARE of these rows will be blocked until the current transaction ends; conversely, SELECT FOR UPDATE will wait for a concurrent transaction that has run any of those commands on the same row, and will then lock and return the updated row (or no row, if the row was deleted). Within a REPEATABLE READ or SERIALIZABLE transaction, however, an error will be thrown if a row to be locked has changed since the transaction started. For further discussion see Section 13.4.
A non-raw version of this example can be seen at: nodejs/sequelize/parallel_select_and_update.js.
nodejs/sequelize/raw/parallel_select_and_update.js Updated 2025-07-16
Gibbs free energy Updated 2025-07-16
At least from the formula we see that:
- the more exothermic, the more likely it is to occur
- if the entropy increases, the higher the temperature, the more likely it is to occur
- otherwise, the lower the temperature the more likely it is to occur
A prototypical example of reaction that is exothermic but does not happen at any temperature is combustion.
Lab 7 - Gibbs Free Energy by MJ Billman (2020)
Source. Shows the shift of equilibrium due to temperature change with a color change in a HCl CoCl reaction. Unfortunately there are no conclusions because its student's homework. nodejs/sequelize/raw/trigger_count.js Updated 2025-07-16
numpy/fft.py Updated 2025-07-16
Output:With our understanding of the discrete Fourier transform we see clearly that:
sin(t)
fft
real 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
imag 0 -10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10
rfft
real 0 0 0 0 0 0 0 0 0 0 0
imag 0 -10 0 0 0 0 0 0 0 0 0
sin(t) + sin(4t)
fft
real 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
imag 0 -10 0 0 -10 0 0 0 0 0 0 0 0 0 0 0 10 0 0 10
rfft
real 0 0 0 0 0 0 0 0 0 0 0
imag 0 -10 0 0 -10 0 0 0 0 0 0- the signal is being decomposed into sinusoidal components
- because we are doing the Discrete Fourier transform of a real signal, for the
fft, so there is redundancy in the. We also understand thatrfftsimply cuts off and only keeps half of the coefficients
python/getitem_complex.py Updated 2025-07-16
python/pytorch/matmul.py Updated 2025-07-16
Matrix multiplication example.
Fundamental since deep learning is mostly matrix multiplication.
python/sphinx Updated 2025-07-16
To run each example and see the output run:
./build.sh
xdg-open out/index.html python/sphinx/class Updated 2025-07-16
Basic class example.
python/sphinx/union Updated 2025-07-16
Open source software Updated 2025-07-16
What happens when the underdogs get together and try to factor out their efforts to beat some evil dominant power, sometimes victoriously.
Or when startups use the cheapest stuff available and randomly become the next big thing, and decide to keep maintaining the open stuff to get features for free from other companies, or because they are forced by the Holy GPL.
Open source frees employees. When you change jobs, a large part of the specific knowledge you acquired about closed source a project with your blood and tears goes to the trash. When companies get bought, projects get shut down, and closed source code goes to the trash. What sane non desperate person would sell their life energy into such closed source projects that could die at any moment? Working on open source is the single most important non money perk a company can have to attract the best employees.
Open source is worth more than the mere pragmatic financial value of not having to pay for software or the ability to freely add new features.
Its greatest value is perhaps the fact that it allows people study it, to appreciate the beauty of the code, and feel empowered by being able to add the features that they want.
And "can reverse engineer the undocumented GPU hardware APIs", Ciro would add.
While software is the most developed open source technology available in the 2010's, due to the "zero cost" of copying it over the Internet, Ciro also believes that the world would benefit enormously from open source knowledge in all areas on science and engineering, for the same reasons as open source.
test_executables.js Updated 2025-07-16
Ciro Santilli has been writing scripts of that type for a long time in order to test his programming self-learning setups with asserts.
The most advanced of those being the test system of Linux Kernel Module Cheat.
webpack/template Updated 2025-07-16
Optical fiber Updated 2025-07-16
The Story of Light by Bell Labs (2015)
Source. Gives some ideas of the history of fiber optics. Features: Herwig Kogelnik.Fiber optics fundamentals by Shaoul Ezekiel
. Source. 2008 at MIT. Theory and demonstration.- youtu.be/0DCrIAxEv_Y?t=560:Terefore, the 1.5 micrometer window truly is the minimum.
- on smaller wavelengths, loss is due to Rayleigh scattering
- on longer wavelengths, loss is due to material absorption
Optical tweezers Updated 2025-07-16
Sample usages:
- quantum computing startup Atom Computing uses them to hold dozens of individual atoms midair separately, to later entangle their nuclei
Optical Tweezers Experiment by Alexis Bishop
. Source. Setup on a optical table. He drags a 1 micron ball of polystyrene immersed in water around with the laser. You look through the microscope and move the stage. Brownian motion is also clearly visible when the laster is not holding the ball. Optics Updated 2025-07-16
Oracle Corporation Updated 2025-07-16
Evil company that desecrated the beauty created by Sun Microsystems, and was trying to bury Java once and or all in the 2010's.
Their database is already matched by open source e.g. PostgreSQL, and ERP and CRM specific systems are boring.
Oracle basically grew out of selling one of the first SQL implementations in the late 70's, and notably to the United States Government and particularly the CIA. They did deliver a lot of value in those early pre-internet days, but now open source is and will supplant them entirely.
Ordered pair Updated 2025-07-16
Sets are unordered, but we can use them to create ordered objects, which are of fundamental importance. Notably, they are used in the definition of functions.
Order of an element of a group Updated 2025-07-16
Unlisted articles are being shown, click here to show only listed articles.