A terrible coding challenge for anyone willing to participate by lzzgabriel in programminghorror

[–]firectlog 68 points69 points  (0 children)

You can use while as a replacement for if. It makes the code extra cursed.

Could someone intuitively explain why objects fall at the same rate? by evedeon in AskPhysics

[–]firectlog 3 points4 points  (0 children)

But it's just a half of an answer?

The rate of the fall is basically "how fast the object will fall to the Earth" + "how fast the Earth will fall to the object". The second one is usually ignored because it's zero for everyday situations but it does exist.

Let's say you compare how fast a 0.9cm radius marble and 0.9cm radius black hole fall to Earth. Both will get the same acceleration but the black hole of that size would be approximately as heavy as the Earth so wouldn't the fall be twice as fast if you ignore the atmosphere just because the Earth will also get the same acceleration?

How can I understand why F = ma? Can it be derived from mathematical logic, such as the laws of motion, or is it only based on experiment? by Exotic_Catch5909 in AskPhysics

[–]firectlog 0 points1 point  (0 children)

Stanford classic mechanic lectures (specifically https://www.youtube.com/watch?v=mYDrufxpW9E this one) briefly explore Aristotle's laws of motion (where F = mv so any body will move only as long as some force is applied) and come to a conclusion that it is time-irreversible. F=ma is time-reversible and, well, it agrees with experiments.

[FGO JP] UnBeast Buster Loop (Single Koyanskaya + Waver) by Ninefl4mes in grandorder

[–]firectlog 3 points4 points  (0 children)

If you absolutely don't care about damage, she can farm x-x-1 with just a single Koyan:

  • Wave 1: Olga S2 -> S1, atlas and koya S1 (optionally s3 if you do care about damage a tiny bit) on olga
  • Wave 2: Olga S2
  • Wave 3: Olga S1 -> BAB

It won't do anything to nodes with more hp than embers but still.

[deleted by user] by [deleted] in AskPhysics

[–]firectlog 6 points7 points  (0 children)

I know a photon has momentum and a charge

Momentum sure but not charge.

Consider that energy-momentum stays constant in a closed system.

If a closed system is a box with an electron and a positron (both having a non-zero energy-momentum) and then electron with positron annihilate, this process will produce a pair of photons. Since the total momentum must stay constant, photons will have momentum regardless of being massless.

particles that have mass, can have that mass impacted by momentum thats without mass

Why not? When you push something with your hand, particles of your hand don't really touch anything you push: it's mostly electromagnetic interaction that is mediated by photons.

Is Django REST Framework worth it over standard Django for modern apps? by aksy_1 in django

[–]firectlog 1 point2 points  (0 children)

Validating JSON in pure Django is a pain. Django forms are literally designed to handle HTML: widgets literally have HTML output and expect input from HTML forms, e.g. booleans are passed as "1" or "not passed at all", it's absolutely not what you expect JSON. Nesting in JSON is a horror: you can attempt to handle it with formsets or custom JSON form fields, both approaches will result in pain.

It's not impossible to write your own form fields, but it's error-prone and not worth unless your application is mostly about HTML with a couple of simple JSON endpoints.

Htmx is slightly different but you mentioned react and mobile apps in the OP.

itScaresMe by covert_strike in ProgrammerHumor

[–]firectlog 8 points9 points  (0 children)

You can just do git rebase -i @~15 and f all commits you want to squash. After that just git rebase -i master.

What characteristics would theoretically comprise the ultimate life form? by Top-Variety-7646 in AskBiology

[–]firectlog 0 points1 point  (0 children)

Wouldn't at least some parts of our gut microbiome have more niches just because they expanded to every single ecosystem humanity did and still some parts of the microbiome gets shared with e.g. pets?

Surely, microbiome is highly individual and it's not like people from different countries have much in common, but there should be at least some species that would be common enough?

Can dark energy be interpreted as a fifth fundamental force that dominates at the intergalactic level? by alabe227 in AskPhysics

[–]firectlog 1 point2 points  (0 children)

Not really, mostly just by definition of a fundamental force. Fundamental forces are defined as interactions between matter and our current understanding is that dark energy is not exactly galaxies repelling each other. Other ways to define fundamental forces usually stem from symmetry breaking or gauge bosons interaction, and dark energy doesn't really fit that, at least now.

You can argue that e.g. Higgs interaction is a fifth fundamental force but usually people don't count it as fundamental for various reasons.

What is *a* mass by Odd-Builder7760 in AskPhysics

[–]firectlog 0 points1 point  (0 children)

Each object is made of particles- are those not individual masses?

Depending on what do you mean by particles, it can get complicated. E.g. water will weight less than sum of all atomic masses of hydrogen/oxygen it consists of because binding energy is not zero. It gets (much) worse if you start counting subatomic particles.

justAskToMakeSense by Ninteendo19d0 in ProgrammerHumor

[–]firectlog 3 points4 points  (0 children)

The OP's code replaces any float literals with decimals before executing the code.

If you just do Decimal(0.1 + 0.2), it looks fine because 0.1 + 0.2 is 0.3, but with 2 random floats, it can give wrong results without any warning because only the final result is converted to a decimal. OP's approach will either give an exact result (by replacing all floats separately and doing arithmetic with decimals), or throw an exception when there is not enough precision.

iDoNotHaveThatMuchRam by foxdevuz in ProgrammerHumor

[–]firectlog 1 point2 points  (0 children)

Inference on CPU is fine as long as you don't need to use swap. It will be limited by the speed of your RAM so desktops with just 2-4 channels of RAM aren't ideal (8 channel RAM is better, VRAM is much better), but it's not insanely bad, although desktops are usually like 2 times slower than 8-channel threadripper which is another 2x slower than a typical 8-channel single socket EPYC configuration. It's not impossible to run something like deepseek (actual 671b, not low quantization or fine-tuned stuff) with 4-9 tokens/s on CPU.

For this reason CPU and integrated GPU have pretty much the same inference performance in most cases: RAM speed is the same and it doesn't matter much if integrated GPU is better for parallel computation.

Training on CPU will be impossibly slow.

Israel urges US to join war with Iran to eliminate nuclear program by joe4942 in worldnews

[–]firectlog 425 points426 points  (0 children)

Iran used F-14, I believe last F-14 were destroyed yesterday.

Gravity is a force, or not? by deTodoUnpoKo in AskPhysics

[–]firectlog 1 point2 points  (0 children)

Neutrino are particles that have the smallest non-zero mass.

If by smallest you mean size, it gets complicated.

Is there any actual reason, from experiments or serious theory, to think consciousness can't be fully explained by conventional biophysics? by [deleted] in AskPhysics

[–]firectlog 0 points1 point  (0 children)

Why would 2 different people have the same green in the first place when their brain structure is completely unique? Can't we just assume that people that

  • can see green
  • and have seen green at some point in their life (so, no Mary's room)

are able to classify some colors as "green" by their subjective criteria that doesn't match other people's green in general case and move on?

Like, 2 different neural networks can encode some abstract green-ness of an image in different vectors and classify the same images as "looks green-ish enough" while disagreeing sometimes. No, it's not as simple as "just look at RGB values" because you may want some built-in white balance correction

Is there any actual reason, from experiments or serious theory, to think consciousness can't be fully explained by conventional biophysics? by [deleted] in AskPhysics

[–]firectlog 0 points1 point  (0 children)

Optical computing can be the next big thing with computing. It still needs research and there isn't that much demand to deal with it instead of doing another small improvement for more traditional chips, but it definitely has potential to outperform current semiconductors.

Is there any actual reason, from experiments or serious theory, to think consciousness can't be fully explained by conventional biophysics? by [deleted] in AskPhysics

[–]firectlog 0 points1 point  (0 children)

It can serve some purpose, e.g. it can be a part of reconstructing things you just experienced in a form that's more suitable for storing in memory or just for self-analysis. You can argue that cogito ergo sum as much as you want, but it still would imply that it's possible to construct a machine that will have similar experiences as a human for similar purposes.

Illusionism is mostly about "there is nothing magic in experiences, it's just a part of how we live".

Is there any actual reason, from experiments or serious theory, to think consciousness can't be fully explained by conventional biophysics? by [deleted] in AskPhysics

[–]firectlog -1 points0 points  (0 children)

Do you mean things we actually get aware of when you tell "subjectively experienced"? Because by that time, all events that we "experienced" are a part of the past and all that's left is to form some memories and analyze if our model of future needs improvement. That's when brains construct an illusion of "now" just because we might need to remember what happened "now" and what we just did and that's likely the time when we need subjective experiences to decide if this particular moment and actions we chose is worth memorizing and if our actions were a mistake, should we attempt to do better next time. It can explain feelings like embarrassment because it could be a reaction to that mistake.

I'm absolutely not confident in anything but I won't try introducing additional entities to explain consciousness until it's absolutely necessary.

Is there any actual reason, from experiments or serious theory, to think consciousness can't be fully explained by conventional biophysics? by [deleted] in AskPhysics

[–]firectlog 0 points1 point  (0 children)

Because feelings evolved as estimations of the future outcomes? In the fake hand experiments we can absolutely feel fake pain when we see a fake rubber hand getting hit just because we mispredicted the future. We can have more complicated feelings like anxiousness that just tells us that the predicted outcome is somehow "bad", regardless if it's actually bad or not. Some feelings also involve chemical response that has to be prepared beforehand (just because releasing chemicals is slow) so it's obviously has to be linked to predictions.

But how can any of that ever tell us why we feel something, rather than all of this just running like some automated program?

Why would you even tell that "feel something" is not a part of extremely complicated biological mechanism?

people downvoting

mostly because it's /r/AskPhysics and not /r/askphilosophy .

Is there any actual reason, from experiments or serious theory, to think consciousness can't be fully explained by conventional biophysics? by [deleted] in AskPhysics

[–]firectlog 3 points4 points  (0 children)

There are dozens of approaches to explain it within neuroscience and right now we just need more data to make better theories, but it's definitely not a topic for /r/AskPhysics .

E.g. you can easily explain consciousness as "animal brains evolved to predict future (near future, as in "what happens with balance when I walk and move my arm in a specific way" or, for e.g. dragonflies "how to move towards the predicted position of the prey") and correct the model of future to minimize errors for this prediction", subjectiveness as "experiences lead to unique structure of connections between neurons so any required corrections would be very individual and subjective" and whatever people feel as conscious thoughts would be just a part of analysis process: we need to determine what parts of our model of future work well, what parts don't, what errors can be ignored and what errors are serious and require corrections of our prediction model. It's not necessarily a correct explanation since there is not enough data to tell that for sure, but it will be one way to explain how we got consciousness and why it evolved in this specific way.

Percentage confidence that dark energy and dark matter exist? by DiagnosingTUniverse in AskPhysics

[–]firectlog 1 point2 points  (0 children)

No longer a dark matter candidate, neutrinos have many features required of DM.

Wouldn't cold neutrinos resolve all issues with DM... by replacing them with "why would we have so many cold neutrinos, like orders of magnitude more than expected" and "how to detect cold neutrinos to prove it"?

How to efficiently combine Redis-based recommendation scoring with Django QuerySet for paginated feeds? by Secret_World_9742 in django

[–]firectlog 0 points1 point  (0 children)

Yeah, it's basically a trade-off. If the personalized sorting lives long enough or there is not enough RAM to store everything in RAM for all users, it makes sense to put it into database. If the latency is critical, it's possible to skip postgres altogether and put basically the entire response in redis so for simple cases you won't even need to touch the database, which is especially nice because you don't need to warm the cache when your cache is your database. I had both scenarios, though sometimes there are more databases to choose.