504 karma · joined February 21, 2019
I still need to spend some time understanding how the math guarantees unique combinations of values, but I did figure out how to generate the series now (in Ruby).
(0..4).map do |b|
(0..4).map do |a|
(0..4).map do |x|
(a * x + b) % 5
end.join(" ")
end.join("\n")
end.join("\n\n").then { puts _1 }
EDIT: To make this line up with the document, I actually had to offset a by the value of b. I'm still not totally sure why this is necessary. (0..4).map do |b|
(0..4).map do |a|
(0..4).map do |x|
((a - b) * x + b) % 5
end.join(" ")
end.join("\n")
end.join("\n\n").then { puts _1 }To be clear, I'm talking about these grids:
0 0 0 0 0
0 1 2 3 4
0 2 4 1 3
0 3 1 4 2
0 4 3 2 1
0 re-throwIs there a standard strategy for optimizing balance queries against a series of transactions? I assumed that we would eventually have to cache some kind of snapshot for each account to avoid the overhead of totaling every transaction on every balance check.
More concretely, performance is on my list of "good problems to have". Businesses die in the time it takes to write raw SQL.
https://github.com/tigerbeetle/tigerbeetle/blob/main/docs/DE...
Much like automation, the question should be phrased in terms of how long it will take and how much time it will save. https://xkcd.com/1205/
If I had learned VIM first, I'm not sure how the switch to Dvorak would have gone. My fear of breaking an unfamiliar editor may have accidentally steered me into success.
In the end, I spent more hours earning my degree than using it. I work in software now.