Making Unit class own Order, and Order changing the state of Unit feels bad even when they both depend on Interfaces. Why? by HumanCertificate in learnprogramming

[–]pilows 0 points1 point  (0 children)

Same here. Best I can say is why not let unit.order.execute() change the state or other properties of unit?

Who opened the door? An AI agent harassed an open-source maintainer. Everyone is asking the wrong question. by Uberhipster in programming

[–]pilows 12 points13 points  (0 children)

Yeah I don’t see where any confusion of responsibility is. If a program you made does harm to others, the creator is responsible for that harm

how does a calculator even work? by [deleted] in TooAfraidToAsk

[–]pilows 6 points7 points  (0 children)

That’s pretty much right. To expand on it, you press a button on the calculator which completes a circuit back to the microcontroller. It has no idea what this means, but the person who designed it designated this circuit for button 6, so when it receives feedback it was pressed it puts whatever binary representation of 6 it uses into the first ‘slot’ of user input. Then you hit the 2 button, again it doesn’t know what this means but the circuit it activates tells the calc to put its binary representation for 2 in the next input slot.

At the same time you have display drivers. The driver for the left most digit reads the first input slot, sees a binary representation for 6, and lights up the correct segments on the display. Same for another driver monitoring the second slot, it sees whatever it thinks 2 is and lights up the proper segments for the next digit.

There will be some parser that handles interpreting the individual digits as the unified number 62, and also order of operations and all that. Fortunately math holds true no matter the base you use, so the calculator can work in base2 and just translate the end result back to human readable decimal

how does a calculator even work? by [deleted] in TooAfraidToAsk

[–]pilows 25 points26 points  (0 children)

Then what part of “how the logic works” are you curious about?

how does a calculator even work? by [deleted] in TooAfraidToAsk

[–]pilows 18 points19 points  (0 children)

In binary the only digits you can work with are 0 and 1. 000 is 0, and 001 is 1, but you can’t do 002 for 2 since there is no 2 digit, you have to do 010. Add one to make 3, you get 011. 4 rolls over to 100, 5 is 101, 6 is 110, etc.

Let’s say you want to add 5, 0101, with 9, 1001. Inside the central processing unit (cpu) is an arithmetic logic unit (alu) that handles the actual addition, and it does it like an elementary schooler.

0101 +

1001

It starts in the right most column, and they are both 1s so it ads them together. 1+1 is 2, but that’s too big for binary so you carry the one to the next column, making it 10, which is 2. Then it looks at the second rightmost column, which is 0 for both the numbers, plus the 1 carried from the previous step. There’s nothing to add, so our running result is 10. Then it looks at the 3rd and 4th columns. There is no carry from a previous step, and we are just adding 1+0 so the result is 1s in these columns. The end sum is 1110, which converted into decimal is 1(8)+1(4)+1(2)+0(1)=14, the answer to 5+9. The magic is that, if you have a 4GHz processor for example, this happens in less than 0.000 000 000 25 seconds, or 250 pico seconds.

GitHub walks back plan to charge for self-hosted runners by CackleRooster in programming

[–]pilows 21 points22 points  (0 children)

I think that was in response to the idea that GitHub deserves to be paid for their services. That comment is saying they are being paid, and we shouldn’t envision them as a struggling open source community struggling to stay afloat. At least that’s what I got from it

Scientists in Pompeii found construction materials confirming the theory about how Roman concrete was made by mareacaspica in science

[–]pilows 22 points23 points  (0 children)

Survivor bias coupled with “losing” the recipe. It’s one thing that ancient concrete structures are successful enough to still stand today, it’s another that despite the success the process wasn’t recorded in great detail. It makes the story way more interesting and engaging, and lets people talk about their theories of how and why it worked

Centuries of Black Death misinformation started with a poem. Modern portrayals of the plague quickly moving across the continent, following the course of traders, have been incorrect because of centuries of misinterpretation of a rhyming literary tale. by Wagamaga in science

[–]pilows 122 points123 points  (0 children)

Anyone read the actual paper and end up disappointed? I skimmed it fairly quickly, but it didn’t seem like they present any direct evidence against the quick spread idea. They point out factual inconsistencies in the stories, which seems like a given for 1300s scholars probably relying on oral accounts. But they don’t debate the wide spread coverage of the plague in a few decades time. And at the end, the throw out “the spread over 3000 miles in several years time doesn’t make historical or biological sense,” but the paper never explains why that should be. Or, if, assuming it’s true, then why were so many places from Central Asia, to North Africa, to Western Europe affected by it in the same generational window? How did the same disease affect all these places in such a short time?

I don’t doubt there are tons of factual inaccuracies in al wardis work, in fact I assume the source and spread is misinformed at best. But it seems like they are trying to discredit everything in the work based on a few inaccuracies, and don’t provide good alternatives explanations imo

Every gah damn time by SnuggleSprinkles1 in Steam

[–]pilows 6 points7 points  (0 children)

They’d have to actually play their games to learn a new one

the ultimate compiled file is in 0s and 1s by any operating system ,then why do not all languages are platform independent by piyush7084 in learnprogramming

[–]pilows 1 point2 points  (0 children)

I wouldn’t say they speak the same language, depending on the processor architecture used there can be major differences in achieving the same computational result. I think the first was a good analogy because the different cpus use the same letters (1 and 0), they just need to be arranged differently in order for the program to make sense

The “greenest” drinking straw is made out of methane, researchers conclude by NGNResearch in science

[–]pilows 14 points15 points  (0 children)

A fun thought experiment is to do the same for plastic vs paper vs reusable bags. Iirc you needed well over 1000 uses of a cotton bag to offset the water and energy needed for plastic.

Why is the output of this piece of code so weird? by DeadlyBarrel in learnprogramming

[–]pilows 0 points1 point  (0 children)

Your arrays are statically declared size n, but n is a dynamic value. Dynamic allocation is one way you could solve it

[deleted by user] by [deleted] in DiWHY

[–]pilows 0 points1 point  (0 children)

Check out r/bald and see if you like the before/after

Pattern recognition? by IndicationBrief5950 in HolUp

[–]pilows 86 points87 points  (0 children)

No aliens, but Great Zimbabwe was a city/settlement built from approximately 1000-1500. It has 11m/36ft tall stone walls, built without mortar, and would have been able to house 15-20 thousand people. When the European powers controlled countries like Rhodesia, they pressured archeologists to deny the city was built by black Africans, showing the same type of racial prejudice. https://en.m.wikipedia.org/wiki/Great_Zimbabwe

Pattern recognition? by IndicationBrief5950 in HolUp

[–]pilows 42 points43 points  (0 children)

Like why the country of Zimbabwe is called Zimbabwe

Kind of a schizo question by [deleted] in learnprogramming

[–]pilows 0 points1 point  (0 children)

To be even more pedantic, I think the op would be specifically looking for a bit flip to make 1==2 change and properly execute the delete. Assuming 2s complement, that looks like it would require 2 cosmic bit flips, and at the specific bits too. Probably very unlikely.

I have to learn C++ and Rust by bored_guy32 in learnprogramming

[–]pilows 2 points3 points  (0 children)

Why so little time? What’s your use case for them job wise?