Readit News logoReadit News
arithma commented on What is the index of an empty string in an empty string?   successfulsoftware.net/20... · Posted by u/hermitcrab
arithma · 2 years ago
The most appropriate behavior is implemented by regex.

Find the empty string and replace with say

  `($&)` 
where

  `$&`
refers to the captured variable, and with input

  `xyz`,
the result is

  `()x()y()z()`
With an empty input, the result is

  `()`.
The result of indexOf can consistently return the first index of the first half open subrange in a string. It just so happens that the first subrange of an empty string in an empty string is [0, 0).

The limiting case is also an interesting way to look at it:

  ()a()b()c()
  ()a()b()
  ()a()
  ()

arithma commented on Tricking Monty Hall   ignorethecode.net/blog/20... · Posted by u/zdw
arithma · 2 years ago
I haven't done the analysis, but one major assumption that the whole result is based on is whether the rules of the game are pre-established or just revealed after the first pick. With an adversarial game host who has the option to reveal or not, maybe the result changes, but more importantly, it explains the intuitionistic refusal for some to buy the argument.
arithma commented on Tricking Monty Hall   ignorethecode.net/blog/20... · Posted by u/zdw
evandale · 2 years ago
This is a good way of putting it and I think would resonate with some people!

I've not been able to get my dad to understand why you should switch with 1,000,000 boxes because he refuses to believe the 3 box and 1,000,000 box case is the same. I can't even convince him a 3 and 5 box problem are the same.

I actually think I could convince him switching is correct using this strategy because I suspect if he thinks he's tricking or cheating at the game he'll be more open to the explanation.

arithma · 2 years ago
Are we siblings
arithma commented on Introduction to Spherical Harmonics   puye.blog/posts/SH-Introd... · Posted by u/ibobev
arithma · 2 years ago
Spherical Harmonics became extremely trendy in the graphics literature for dynamic lighting and pre-baked light maps of some sort, and completely dropped off at some point. Still remember some discussions and questions regarding how they're not easy to "orient".
arithma commented on I’m a productive programmer with a memory of a fruit fly   hynek.me/articles/product... · Posted by u/nalgeon
zelphirkalt · 3 years ago
Usually when writing some code, which deals with something new for me, I get many "idiot questions" in my head. I try to write comments in a way, which will answer my future self's "idiot questions". Answering all those questions, I feel more like I truly understand, what I am doing.
arithma · 3 years ago
I often don't comment code, especially in personal stuff, but when I occasionally do, which happens mostly when things get overwhelming, I find bugs or fix things that I was stuck on. Writing forces you to understand better, name better, and almost feels like providing you with another perspective, all without leaving your own self.
arithma commented on I've been abusing HTTP Status Codes in my APIs for years   blog.slimjim.xyz/posts/st... · Posted by u/that_james
arithma · 3 years ago
What I like about this approach is that if you are using any other protocols for transport, everything becomes instantly portable. Imagine having the same logic serving objects per IDs through HTTP and websockets. Rest makes things more clumsy. Though I would concede doing things the REST way, as in the app-server participating in the http headers/status enables caching and all sorts of things that would be hell to do through otherwise.
arithma commented on Fastest-ever logic gates could make computers a million times faster   newatlas.com/electronics/... · Posted by u/DamnInteresting
sharikous · 3 years ago
Scalability, for one. A modern PC CPU has ~10^10 transistors forming ~10^9 logic gates that work because you can chain them easily.
arithma · 3 years ago
Interesting to think how many 10^6 faster gates would be needed to do the work of 10^9 at the same speed. Say take the 8086 and make it a million times faster. At about 30K transistors and 5MHz. A photonic 8086 apparently would run blindingly fast around anything available now.

Serial speed is always a gain up, no questions asked I guess.

Obviously all of that is over simplified, and not considering other components to any system that would be built (but hey, it's not like any of this is happening tomorrow anyway).

arithma commented on “Computer science is not about computers”   quoteinvestigator.com/202... · Posted by u/akakievich
dragontamer · 4 years ago
Computer science is the mathematics behind counting.

You count the number of "swap" operations in insertion sort, quicksort, or merge sort. You count the number of "memory" operations. You count the number of bytes used.

When precise counts are difficult, you learn big-O notation to estimate how counts change as variable grow. Etc. etc. etc.

arithma · 4 years ago
Computer science is much more like Mathematics than Physics. It feels wrong calling "computer science" a science, in the same sense of calling "Mathematics" science.
arithma commented on Backblaze Drive Stats for Q1 2021   backblaze.com/blog/backbl... · Posted by u/caution
jonplackett · 4 years ago
Backblaze is awesome. Anyone not using it should give it a try.

But I have a question - why do they share this info? Is it to show they’re reliable or just for curiosity? Or some other reason?

arithma · 4 years ago
In addition to the other mentioned reasons, I guess it's valuable feedback for their providers, and if that feedback is acted upon, it's beneficial for them.
arithma commented on Bitcoin as a Battery   nickgrossman.xyz/2021/bit... · Posted by u/tomsyouruncle
arithma · 4 years ago
Bitcoin is more of ash rather than a battery in this analogy.

I like bitcoin (the idea, not the burning of the planet, even though it's only a temporary hack to bootstrap the whole thing). And hey, maybe it will encourage building nuclear mining farms, that will give their owners free bitcoin, and then we can use the nuclear plants.

The only defense I can stomach for Bitcoin's unfathomable energy consumption is that it might be only temporary. Is it worth it? So far, not that much, but I think developed-countries under-estimate the value of bitcoin, since they have more stable economies, and thus currencies, and enjoy freedom of moving their money, and data privacy...

u/arithma

KarmaCake day342March 6, 2012View Original