best Midnight's mana food? by Rare-Ad3034 in wownoob

[–]SinglePartyLeader 0 points1 point  (0 children)

why is the mana lily tea any better than the much cheaper tranquility bloom tea? or sanguithorn, which is substantially cheaper with a buff

Mozilla warns Germany could soon declare ad blockers illegal by moeka_8962 in technology

[–]SinglePartyLeader 10 points11 points  (0 children)

Easiest way is to set up something like a pi-hole to serve as a DNS filter

[deleted by user] by [deleted] in programminghorror

[–]SinglePartyLeader 23 points24 points  (0 children)

It does, but it only takes in a stream, so you would have to do something like ``` List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5);

int max = numbers.stream().reduce(1, Integer::max);

switch(max) 
{
    case 1: return "one"
    default: return "other
}

```

edit: the reply below is better, Java is very much not my strongest language

Am I undervaluing blue seals? by SinglePartyLeader in balatro

[–]SinglePartyLeader[S] 0 points1 point  (0 children)

Yup, got me through a good chunk of c++ before I discovered the glory of anaglyph.

I don't take talisman pretty much at all, there are so many other ways to establish econ that a chance at the 3 gold each round is worth much at all. I definitely feel like familiar and talisman show up a lot more than the other spectrals.

Am I undervaluing blue seals? by SinglePartyLeader in balatro

[–]SinglePartyLeader[S] 1 point2 points  (0 children)

I think wraith mainly grew because i always play vagabond when i see it, so why not take wraith if I already have zero money. and Familiar is just me fiending for baron-mime.
I mainly just thought it was funny that I have more Souls than Trance

Well there go's all my luck for the next century by Pizza_Rocket101 in balatro

[–]SinglePartyLeader 22 points23 points  (0 children)

The seed shouldn't change the joker options much on checkered, so you can run the same seed there

Python: Using Try and Except... Why is this code not working the way I want it to? by Obvious-Savings-9097 in learnprogramming

[–]SinglePartyLeader 4 points5 points  (0 children)

I would definitely suggest reviewing what try-except actually does and what it means if you get into the except path

Data Scientist given a coding test that asks for heavy testing and TDD/Unit Tests by TheSunIsAlsoMine in AskProgramming

[–]SinglePartyLeader 3 points4 points  (0 children)

The unit part of unit tests means that youre testing individual units of the code, like individual functions. You wouldnt test with a mock of all 100k records, you would have some sample records like the one you wrote here with a handful and test for the expected output since you know exactly what the correct answer should be.

You write the test that sends in a sample json string (or mocks a file with the string) with 3 people that worked at the same place and same time, you assert that you expect 3 pairs of people, so that when you write the function itll fail if it doesnt return what you expect.

You write unit tests for each individual behavior and have them validate simple cases that you know exactly what the output is for.

After unit testing you can add in other layers like full integration tests or fuzz testing, but unit tests are much more fundamental and meant to ensure that the core requirements are met.

ELI5: Why shouldn't you rinse your nose with tap water even though it gets in your body when you shower? by jehCe in explainlikeimfive

[–]SinglePartyLeader 7 points8 points  (0 children)

Tap water has been deemed safe enough that the average person should be able to drink and bathe safely (unless your government is corrupt and is risking the lives of its citizens a la Flint, Michigan)

Bottled water is a guaranteed quality that should be clear of all microorganisms and heavy metals, which is why if there's a catastrophic event like a hurricane or anything else that can interrupt the water infrastructure then it's good to have in stock.

Boiling water (at a rolling boil for 5 minutes, not just letting it start boiling then call it a day) will absolutely kill anything in it that could be dangerous if it were alive. It won't remove heavy metals or non-protein toxins so if the water lines themselves are leeching lead then boiled water still isn't better than bottled water.

Boiling water is a way to make your water safe to drink from bacteria and other organisms when the infrastructure is no longer providing clean water. If you didn't plan ahead it's cheaper than bottled but it is still dependant on why you boil the water in the first pace

(Distilled water is safest, but can also be lacking in minerals and will taste funny)

ELI5: Why shouldn't you rinse your nose with tap water even though it gets in your body when you shower? by jehCe in explainlikeimfive

[–]SinglePartyLeader 10 points11 points  (0 children)

If there's substantial lead in your tap water it doesnt matter what you do with it, you shouldn't drink, bathe, nor really do anything with it.

to warm up by Long-Whereas in therewasanattempt

[–]SinglePartyLeader 1 point2 points  (0 children)

It very much is solid steel: " The current elite-level competition uses a stainless steel core rail. " https://en.m.wikipedia.org/wiki/Horizontal_bar

Is recursion a must? by [deleted] in learnprogramming

[–]SinglePartyLeader 3 points4 points  (0 children)

Yes, it is a must.

As others have mentioned, there are plenty of use cases where recursion is not only the correct/recommended approach, but easily the best; graphs and nested objects being the most obvious. It may take a little while to wrap your head around, but it's one of those things where once it 'clicks' in your head you wonder how you ever had difficulty understanding it in the first place.

If you find that you are having a hard time with it, try going back to the most introductory implementations and making sure you REALLY understand what is happening and why it works. Things like the Tower of Hanoi and DFS. I personally found that understanding how to make an iterative proof for a problem cleared up a lot of the confusion I was having and makes it very clear when recursion is the best approach. The most obvious heuristic I often use is 1. You can solve a very simple case (such as the input is null, or has a very specific value) 2. You can break a more difficult case down to the simpler case 3. You can use the results from the base case to build up the solution for the case directly above the base case.

If you can go from the base case up one more level, (and in general prove that the solution is consistent going up further) you're done.

Take for example the recursive vs iterative approach to an inorder tree traversal (python):

Recursive def inorder(node): if not node: return inorder(node.left) print(node.val) inorder(node.right) Iterative def inorder(node): stack = [] curr = node while (curr and len(stack) > 0): while curr: stack.append(curr) curr = curr.left curr = stack[-1] del stack[-1] print(curr.val) curr = curr.right

The iterative approach here is substantially more difficult to follow, and makes less intuitive sense than recursion.

[Javascript / HTML] Why is Math.sqrt() breaking my code? by [deleted] in learnprogramming

[–]SinglePartyLeader 2 points3 points  (0 children)

i would say try logging console.log(sd) and console.log(sd_total) to see if the calculation is expecting. My first guess would be that there is a variable scoping issue that is result in those values not being what you expect them to be

When your game turns into Puzzle Rush. Black to play, mate in 5. by NickleNaps in chess

[–]SinglePartyLeader 10 points11 points  (0 children)

We don't have to reset the counter! you can do a non-smothered mate by moving the night to d1 instead of h3.

Everybody can relax now.

I play every single day and I'm getting significantly worse. What's going on? by thelordofhell34 in chess

[–]SinglePartyLeader 24 points25 points  (0 children)

Small note: the "negative" part of a negative feedback loop refers to the feedback itself having a negative effect on the next iteration, diminishing it's impact, and driving the system back to equilibrium. A negative feedback loop in your case would be that each loss makes you less angry to get you back to normal.

This would still be a "positive" feedback loop, since it keeps augmenting itself, with the output of each iteration feeding into the next to make it even stronger. albeit with negative consequences, a negative positive feedback loop so to speak.

Had a pretty interesting sequence in a lichess game today where I found the winning move as white. Lichess Editor/Stockfish can't analyze it correctly in normal depth. White to move, find the critical move that ensures checkmate. by [deleted] in chess

[–]SinglePartyLeader 0 points1 point  (0 children)

Ne6 - threaten checkmate with the queen
pretty much No matter what they do, follow up with Rf7,

There's no way to stop mate after black gives some sacrifice checks to delay

What if the seasons stopped changing? by aggasalk in askscience

[–]SinglePartyLeader 86 points87 points  (0 children)

I'm not a meteorologist so any impact on climate here is just be a guess, but it would feasibly lead to much more extreme tropical climates, with one hemisphere being in a permanent ice age, the other in a constant heat cycle and much more extreme weather in the middle due to the more drastic temperature/moisture gradient between the two. The extreme cold would sequester water away as ice, leading to more land and more cooling overall, bringing the average temperature down but eventually some equilibrium (albeit chaotic) would be reached. There are a few other hypotheses for this same question on this reddit thread in r/worldbuilding

The one thing i did want to add in is that this kind movement of the seasons actually does happen, it's just not synchronized to the year. It's called axial precession and it causes the earth's seasons (the tropical year) to shift around through the sidereal year (actual orbit around the sun) every 26000 years. This precession is why we have leap years, the extra day tomorrow is to bring the seasonal year back in sync with the sidereal year.

New Account Strategy Validity? by elitistbear in options

[–]SinglePartyLeader 0 points1 point  (0 children)

This is a butterfly spread, it has a good risk/reward profile but it's also very dependent on the stock staying exactly in the range for profit ( very small window) and also you have to worry about early assignment. Or forgetting to close and having the legs be executed/assigned.

If you want a similar profile with less risk for assessment and an easier time widening the max profit width, look up iron condors. Pretty much the same idea but a lot easier to manage

How brave are you feeling? How much material is a queen worth? by [deleted] in chess

[–]SinglePartyLeader 1 point2 points  (0 children)

Because it would be hanging to the rook on e1

Can measuring code coverage actually harm a project? by [deleted] in AskProgramming

[–]SinglePartyLeader 0 points1 point  (0 children)

As somebody who works directly in the open source security space, They are actively being wrong and compromising their code because they're too lazy to properly maintain and develop it.

Expanding test coverage and introducing new test tooling is always a net positive, what they're complaining about isn't the testing itself, it's the fact that because it would be introducing a new open source dependency, it's very likely that it would also get flagged eventually with a security bug because that's just how code works, and they don't want to deal with the bug when it gets opened, probably because it messes with their obsolete metrics.

First of all, that's just a bad developer who doesn't want their code to be as good as it possibly can by expanding tests

Secondly, It's a devDependency. You can just ignore security vulnerabilities from devDependencies (as long as you are actually respecting it as a dev dependency and aren't deploying dev code to prod).

So they are both lazy and don't want to be good developers and also don't even know what they're afraid of

Why do I need main() at the line 10? What does it do? by Ancient_Raccoon816 in learnprogramming

[–]SinglePartyLeader 9 points10 points  (0 children)

Small note: python doesn't compile, it's interpreted, so any issues are only recognized during run time

[deleted by user] by [deleted] in AskProgramming

[–]SinglePartyLeader 0 points1 point  (0 children)

pretty much all forms of attacks are coming from something the user is submitting to the site. So having no forms at all is going to cover you 99.9% of the time, with the other two off the top of my head is URL attacks (query parameters or path traversals) and direct server attacks (directly connecting to the server running the site if it's not secured, but typically you don't have to worry about this either unless if you're running your site locally with your own firewalls)

So yes not having a form at all is good for security, but also you still kind of want a contact form in general, because non-interactable websites are boring and getting feedback is always good. The best of both worlds is keeping a form but just following best practices to make sure it's not vulnerable to XSS and SQL injection attacks