=========
History
=========

I spent a month without physics studies, focusing on other topics,
particularly history and philosophy. Caught a cold towards the end of
the month, so started skipping physical exercises, and had even more
of spare time then, though not much of energy.


Books
=====

Finished reading the history book I have mentioned earlier, the
Cambridge history book on the 20th century Russia. The book is nicely
structured, I enjoyed even the chapters I expected to find boring: its
first part is chronological, with a chapter per period, and sections
within it focusing on individual topics (economics, politics, culture,
war, etc), while the second part has chapters for those themes, and
goes through periods in sections within those, so the reader goes
through the same arc repeatedly, but viewing it from different angles,
in different contexts. I think it does a pretty good job at fitting a
whole century's events into a single volume, too: much is mentioned
just in passing, but mentioned nevertheless, and with many references.

After that, I have finished reading Plato's "The Republic", which I
started a while ago, and had queued for even longer. Expected to read
it primarily for the context, and as an artifact, with it being
written in such a different culture and time from ours. As it happened
with such works before, I found interesting the considerations
expressed there, and it was surprising to find there some ideas that I
would otherwise view as much more modern, such as providing equal
opportunities for men and women. Found it interesting that mathematics
(such as were available at the time: arithmetic and geometry) were
praised, even viewed as a good mental training, though that was
followed by numerology. Odd--but expected--ideas like gods, immortal
soul, and gods providing good to the just, are present. Along with
plans to lie about an afterlife to citizens of a hypothetical
state. Arguments made throughout the book are far from rigorous,
regularly employing silly analogies. Dialectics were praised, but the
book itself is basically Socrates talking and others agreeing. And I
think any part of it would look like crackpottery if it was written
more recently, as ancient devices found in museums would not be
impressive if they were produced today, but they are still noteworthy
as steps that led us here. Also found it interesting how its
description of democracies degenerating into tyrannies matches the
tendencies observed in modern times.

The next book (or more of a brochure, being so short) is about that:
"On Tyranny" by Timothy Snyder. Seems to be on point, but focuses
primarily on the US and on Trump, not being as general as the title
suggests. And most of it is on resisting the establishment of a
tyranny, which is too late to employ here (in fact modern Russia is
used as one of the primary bad examples there), though some chapters
are relevant to living in one. Its use of terminology seemed lax at
times, such as the use of "communism" to refer to a communism-themed
kind of dictatorship.

Now I started re-reading Aristotle's "Nicomachean Ethics": I skimmed
it before, which is a wrong way to approach it, and barely remember
anything from the first reading now (not even sure in which
translation I have read it back then, and when it was). The teleology,
which is brought up there from the beginning, is odd, but even that is
interesting in being so unusual these days. Well, similarly to Plato,
it would look like crackpottery if it was written recently, but taking
the date into account, it is an interesting sample of ancient views,
and good to know for the context.

Such books help to put the endless stream of bad news into a
perspective. As well as to put the more modern views and works into a
context, in case of those ancient Greek philosophy books.


Work
====

The work goes as usual. As a relatively fun bit, briefly experimented
with optimizing search of nearby objects by their geographical
coordinates, using a k-d tree for space partitioning,
<https://gist.github.com/defanor/db5089cb99b0aa78e4167d60401935d8>,
but found that even a bruteforce performance is not too bad for the
task at hand.

That task at hand, which I imagined as a simple script, is being
solved by a junior developer, building a whole system with
microservices, now with a dedicated container to set them all in, and
storing the state (which I imagined as a single variable in the
script) in dedicated database tables; plenty of practices I would
avoid myself, but which are not exactly unheard of, and which may be
educational even if they will not work well, so I am not interfering
there beyond pointing out that I would approach it differently.

In another project, some time ago I decided to try a more compact sum
type serialization in JSON: not {"tag": "foo", [...]}, but {"foo":
[...]}. Documented that in an OpenAPI/Swagger specification as a sum
type ("oneOf"), but of course that led to a misunderstanding, with the
frontend writing multiple keys there, which was parsed as just one of
the possible structures, turning it into a bug. It can be blamed on
the frontend developers not reading the specification carefully, on me
not validating it sufficiently (to produce an error when multiple keys
are present), or on me not going for the usual "tag" as in the first
example above, but I am once again frustrated at JSON not providing a
sensible sum type encoding, since it contributes to many more issues
like these.

On a different subject, I notice this strange tendency of tech-savvy
people (IT professionals) to send screenshots of text. While
non-tech-savvy ones send even pictures of their screens, taken with a
phone camera. Pretty sure that most of those people can copy texts,
but for some reason they seem to prefer sending pictures of text.

And it looks like the use of "fatherland software" may be actually
required soon (due to yet another law), which is likely to create busy
work, possibly migrating to bastardized proprietary forks of old
(certified) versions of regular FLOSS; that would be quite
unfortunate. Some busy work is already created by regulatory agencies
making inquiries that seem to be for creation of network connection
and user maps. Which is worrying as well, since that may be used for
creation of whitelists, dropping all the connections by default. It
used to be easier to dismiss such worrying worst-case scenarios before
they started happening.

For some projects, both at work and more generally, sometimes I find
it potentially useful to create a single TCP connection, mirroring
incoming packets to multiple clients, turning it into a multicast with
a dynamic list of clients. Thought a SOCKS5 proxy with such connection
merging can be a nice and simple project to implement in Rust (as an
excuse to play with it a little more), and perhaps without
dependencies, to avoid the awkwardness of Cargo described previously,
but found that the Rust's standard library is not quite sufficient for
that: there is nothing for socket polling, while the built-in
async/await features require an external runtime such as Tokio, so one
has to either use multithreading with synchronization between threads,
or perhaps in-place FFI, both of which are quite awkward. Then
considered making it a small and neat C project, but even there, while
I like select(2) and poll(2) normally, they are less suitable for a
project with potentially many connections, such as a proxy
server. epoll(7) is Linux-specific, libevent (or a similar library)
would be an often-unnecessary dependency, and implementing a wrapper
to use different options would be almost like implementing yet another
wrapper library from scratch. Postponed this project at that point,
since I am unsure if I need it, but now I am inclined to use Rust with
Tokio, if I will decide to proceed with it. But it is a shame that
such a seemingly simple and common task as file descriptor polling is
so tricky to achieve in a satisfactory manner in common languages.


----

:Date: 2025-04-06