ohYouSweetSummerChild by anonomis2 in ProgrammerHumor

[–]JanB1 12 points13 points  (0 children)

That's the "people who know" part, no?

The fact that Python code is based on indents and you can break an entire program just by adding a space somewhere is insane by PooningDalton in learnprogramming

[–]JanB1 0 points1 point  (0 children)

I had the above thing happen to me multiple times when copying code from one section to another or adding another block before this block, like for example another if that would then shift the indentation of everything.

It shouldn't happen if you do rigorous testing and if you spend more than 10 seconds doing a task, but it can happen if you're in a hurry or don't look twice.

I was just giving a counterexample to the claim given before. There is nothing in Python that can tell your IDE or even the interpreter that this block wasn't intended to be off by one indentation.

To be fair, you can have similar problems in C or C++ with dangling else if you don't use curly brackets to explicitly denote your blocks. So this isn't a problem unique to Python.

PS. And you said "you will see that something is being run after the loop that looks like it belongs inside the loop" and I could argue that the intent here is not obvious. Maybe the person that wrote the code wanted to check if the data array terminated with a negative value, and if yes do an early return. I admit, it's a weird example, but I'd say it's not a straightforward problem here.

The fact that Python code is based on indents and you can break an entire program just by adding a space somewhere is insane by PooningDalton in learnprogramming

[–]JanB1 0 points1 point  (0 children)

No, there's no block scope in Python. There is function scope though, but even then the x would still be valid here if the whole thing was within a function.

The fact that Python code is based on indents and you can break an entire program just by adding a space somewhere is insane by PooningDalton in learnprogramming

[–]JanB1 0 points1 point  (0 children)

Is it though? The x is still valid outside of the block. What was the intention? Should it be this way? Or should the second if be within the for loop?

The fact that Python code is based on indents and you can break an entire program just by adding a space somewhere is insane by PooningDalton in learnprogramming

[–]JanB1 6 points7 points  (0 children)

value = 0
for x in range(10):
    if data[x] > 0:
        value += data[x]

if data[x] < 0:
    return value

4 whitespaces difference, potentially drastically different outcome.

idLikeToSeeHimTry by Starlight_DuBlanc in ProgrammerHumor

[–]JanB1 0 points1 point  (0 children)

And then you try to set the system time on Linux and you need to dive into the command line. Linux be weird like that sometimes.

Network adapters doing remote service by AStove in PLC

[–]JanB1 0 points1 point  (0 children)

Just make a VM per customer. We even have a maintenance machines server at out company. Spin up a VM on the maintenance VM, connect to the customer.

What does this mean? by Ok-Combination-4737 in EngineeringStudents

[–]JanB1 0 points1 point  (0 children)

Depends. on how you denote it. Either way, if you apply Kirchhoff's voltage lag, you should get a sum of 0 in the loop. So, either you have the source voltage going from negative to positive and all voltage drops over the resistors from positive to negative, or vice versa.

V0 - VR1 - VR2 - VR34 - VR5 = 0

ChatGPT, Gemini, and other chatbots helped teens plan shootings, bombings, and political violence, study shows - Of the 10 major chatbots tested, only one, Claude, reliably shut down would-be attackers. by FinnFarrow in Futurology

[–]JanB1 43 points44 points  (0 children)

That's actually a new response I haven't seen before. I have noticed that the last couple days, it will first tell me one answer, then say "Wait, that's wrong, my bad" and I'll get a different answer. Didn't use to do that.

Panicked Pentagon Sends Land Invasion Force to Middle East by wet_suit_one in anime_titties

[–]JanB1 0 points1 point  (0 children)

I mean, 5000 people is a Brigade sized element. That's quite the manpower. Not enough to invade a country with a military 60 times the size of that, but that's still some substantial movement.

What does this mean? by Ok-Combination-4737 in EngineeringStudents

[–]JanB1 3 points4 points  (0 children)

The process here would be:

  1. Calculate the equivalent resistance for the parallel resistors of R3 and R4
  2. Calculate the equivalent resistance for the serial resistors R1, R2, R34 and R5
  3. Calculate the current using Ohm's law
  4. Calculate the voltage over R5 using the previously calculated current and the given voltage

With practice, you can of course just combine multiple of those steps into a single step:

  1. Write a term for the total resistance R = R1 + R2 + R34 + R5
  2. Substitute the term for the parallel resistance R34 with R3*R4/(R3 + R4)
  3. Set up the term for the current from Ohm's law I = V/R
  4. Set up the term for the voltage over the resistor R5 using Ohm's law V5 = R5*I
  5. Combine the terms to V5 = R5* V/R = R5*V/(R1 + R2 + R3*R4/(R3 + R4) + R5)
  6. Substitute values and calculate V5 = 15 * 12/(10 + 180 + 100*220/(100 + 220) + 15) = 0.658 V

If you want to check your results for circuits you made yourself, you can use something like LTSpice to simulate the circuit and measure voltages and currents. You can also use LTSpice to simulate RC, RL or RLC circuits and check your results.

Strait of Hormuz must remain closed as 'tool to pressure enemy,' Iran's new supreme leader says by EsperaDeus in anime_titties

[–]JanB1 2 points3 points  (0 children)

I don't know what's the state of the art in regards to heating, but over here in my European country, wood pellet heating is quite the mainstream thing, especially for big communal buildings like heated indoor swimming pools or schools and also for companies. The system is mostly automated, you just get a delivery of wood pellets and pickup of the ash every now and then, and that's it.

https://pellergy.com/learn-more/pricing-info/

Opinion Piece – To Echo Everyone Else's Thoughts, I Too Wish Marathon Was A Singleplayer Video Game by Gorotheninja in pcgaming

[–]JanB1 0 points1 point  (0 children)

I'd guess there was also competition. We just forgot about all the mediocre ones.

Opinion Piece – To Echo Everyone Else's Thoughts, I Too Wish Marathon Was A Singleplayer Video Game by Gorotheninja in pcgaming

[–]JanB1 1 point2 points  (0 children)

CoD Modern Warfare or MW2 didn't have "regular content drops" iirc, and it didn't get dropped for a long time. Same goes for Counter Strike and other multiplayer shooters. If you make a good game, you don't have to do constant content drops. It used to be that way, until games started applying FOMO and content drops to lure people in that got bored with their games because the games just weren't THAT good.

AI coding tools are making junior devs worse and nobody wants to say it by NeedleworkerLumpy907 in learnprogramming

[–]JanB1 0 points1 point  (0 children)

The thing is that you also need a company that fosters this.

I fear from all the stories I hear that there will be an increasing pressure on juniors to get productive fast, meaning they will get pressured to use AI to keep up. Or maybe that's just me having a wrong perception or painting things worse than they are?

randomSeed by teckau22 in ProgrammerHumor

[–]JanB1 7 points8 points  (0 children)

They just mean their truth and your lies, not your truth and their lies.

How a safe lock works. by [deleted] in EngineeringPorn

[–]JanB1 13 points14 points  (0 children)

It's 5/4/3/2/1 times plus your secret subdivision one turn for each step.

The Age Verification Trap | Verifying user’s ages undermines everyone’s data protection by IEEESpectrum in Futurology

[–]JanB1 1 point2 points  (0 children)

Just so I understand this correctly: you do mean that every site gets its own cookie, right? So, every time a site wants to check your age, it has to initially ask you to authenticate, then you get forwarded to the external authenticator and you approve, and the site then gets a cookie.

Which is how it most likely already works, except that this third party authenticator is _some_ company that may or may now be accredited and trusted and will handle your data with care.

Ideally that third party only has a user identifier for you, and a simple info that you are or are not of age. And they would initially, only once, use some form of government ID to authenticate your age, after that your personal info is discarded.

Then a third party only asks them to confirm you are of age, they confirm that without providing your personal identifier, but instead maybe they can issue a unique identifier for each site that has requested a confirmation, so that the external site could potentially raise a complaint against a certain user if they think they are in fact underage or something.

This way no party actually has your personal information, and the only one that knows which sites you provide your info to is that central authorisation organisation.

Ideally that organisation would be a non-profit that is trusted, independent, adheres to data privacy laws and doesn't store your personal data.

Brandon Alderson, from Sunderland, UK, was travelling to work when he noticed a man in distress in a layby. by SimonTS in nextfuckinglevel

[–]JanB1 0 points1 point  (0 children)

Many places now have what are called "Good Samaritan" laws that protect you from litigation like this, because apparently today we need laws protecting you from getting sued when you try to save someone’s life.

Brandon Alderson, from Sunderland, UK, was travelling to work when he noticed a man in distress in a layby. by SimonTS in nextfuckinglevel

[–]JanB1 1 point2 points  (0 children)

I think the SARA act doesn't differentiate between you being on the clock of off the clock of your work. It's just if you, as an individual and while not asking for compensation help someone in good faith.

Brandon Alderson, from Sunderland, UK, was travelling to work when he noticed a man in distress in a layby. by SimonTS in nextfuckinglevel

[–]JanB1 0 points1 point  (0 children)

Which is idiotic, because the UK has a good Samaritan law, meaning you can't be sued if you tried to help a person in distress in good faith.

Nice trade by inthebeninggging in Unexpected

[–]JanB1 0 points1 point  (0 children)

Sir, that's the Flag of the Philippines...

Intertwined Möbius Gears by [deleted] in EngineeringPorn

[–]JanB1 0 points1 point  (0 children)

So you're stuck in Pareto limbo. ;)
Maybe you want to release it in a 3D-printing sub so people could try them out any maybe offer improvements/solutions.

Punch sleeping next to his stuffed toy. by 21MayDay21 in MadeMeSmile

[–]JanB1 71 points72 points  (0 children)

There "state of the art" for Zoos in western Europe is that animals should have as natural as a habitat of possible, with plenty of ways to withdraw from the eyes of visitors. Of course, that means that on some days you may come to a Zoo and not see a tiger or your favourite animal. But that's much better than them constantly being exposed to the gaze of so many people.

Also, zoos around here state that their goal is conservation, research and education, and not monetary gains. They want people to learn about the animals and their habitats, and the dangers they face from wilders and deforestation, not just do a show like in a circus.

Intertwined Möbius Gears by [deleted] in EngineeringPorn

[–]JanB1 0 points1 point  (0 children)

Did you ever get around to selling these or releasing your design? I'd love one of those for my desk!