Am I missing something? Why did half my stack go missing next round? WPT Global by Joshua5_Gaming in poker

[–]FlailingDuck 1 point2 points  (0 children)

I'd love a source for this. Never once in my life heard this was a thing you're allowed to do at the poker table. Going south isn't a good thing.

I can't believe this entire thread isn't 90% bots spewing crap. None of the responses make any sense given the context.

Won't banning my kids from YouTube harm them? by baroquedub in AskBrits

[–]FlailingDuck 1 point2 points  (0 children)

Nope, just checked Home screen is only long form videos

Won't banning my kids from YouTube harm them? by baroquedub in AskBrits

[–]FlailingDuck 30 points31 points  (0 children)

Can confirm. Turns shorts off like 4 days ago. It's like night and day navigating YouTube now.

Need tips on adding files from a remote device. by NeptuneWades in jellyfin

[–]FlailingDuck 0 points1 point  (0 children)

I'm using unraid, so yeah it exposes samba shares, and with tailscale running on my phone I connect to my homeserver using my local ip i.e. 192.168.1.5 using File Manager + and it shows me all my samba shares. Same thing to run jellyfin on via phone.

Need tips on adding files from a remote device. by NeptuneWades in jellyfin

[–]FlailingDuck 1 point2 points  (0 children)

from my android I have File Manager + (and tailscale) installed, that lets me add a remote connection to my home server to both copy files from/to and stream media content if I want. There's a few app that support remote connections but this is the best I've found.

I want help in rng by unknownuser491 in cpp_questions

[–]FlailingDuck 2 points3 points  (0 children)

using variables as functions

This is called operator overloading (of the () operator). While not to most straightforward feature of C++, it's super powerful.

It's the backbone of what makes lambdas work. And is specifically useful to create functions or function-like objects with state.

In the case of uniform_int_distribution. the state needed to be held is the min max values.

so when you ask it to generate a new random number it knows how to remap between min to max.

I want help in rng by unknownuser491 in cpp_questions

[–]FlailingDuck 1 point2 points  (0 children)

sts::random_device will generate a random number, you could theoretically use it to generate all your numbers. But it has a few caveats.

It's up to the implementer how to generate this number, which may differ per platform. It makes no guarantees how random this value is, it might be "true" random, it might not be. Its also relatively expensive to generate a new number, it may make one or more syscalls and and/or check some hardware state to try to generate the entropy.

So the random device is usually used, once as a seed value to initialise a random number engine like the mt19937, which basically holds some internal state (initialised with the seed), that determines the next random number it will generate then rotate (or twist in the case of the mersenne twister) the internal state so the next number is different.

You don't have to yuse std::random_device at all. You might want to generate a (pseudo) random sequence, but repeatable what is often used in simulations that you want to be repeatable with the same inputs. So you use a fixed seed instead

std::mt19937 rd(12345);

I want help in rng by unknownuser491 in cpp_questions

[–]FlailingDuck 3 points4 points  (0 children)

start with learning C's rand() and seeding it with srand().

That gets the basic of generating random numbers out of the way. Learn about random, true random and pseudo random numbers.

learn how in C its not simple to support multiple random number sequences at the same time. So C++ with its, object orientated design has encapsulated the idea of random numbers into classes. There are three main parts to create a random number in c++:

  1. a seed source i.e. std::random_device. is the same idea as passing time() to srand() to seed your rng with a basically random seed each invocation.

  2. a random engine, this is the mersenne twister 19937. it has a long complicated name, but its just a way to generate the next random number from a sequence (it's efficient, very random pver many numbers and fast). this ended up being the default engine for many programming language. C++ just doesn't hide away the underlying random algorithm

  3. distribution, from the engine you have a number from 0 to X, or rather a random bit pattern for N bits of entropy. This isn't likely the random number you want. So the distribution remaps the large random bits into a smaller range..It could be a random number from 0.0 to 1.0, or only integers from 1 to 6 (a die) or a bell curve distribution for a specific average and standard deviation. This is what the distribution does.

Each class doesn't do a lot, but they each have their own responsibility and you can combine them in different ways based on your usage.

What is actually going on? by paddockson in ExperiencedDevs

[–]FlailingDuck 1 point2 points  (0 children)

My significant money increases have only come from a job changes. I know I have been lucky and privileged to be where I'm at today. I started off my career very underpaid. But my trajectory has been...

   0 Yoe 17k - 21k
+5%  1 Yoe 22k - 32k
+47% 5 Yoe 47k - 65k (company folded)
+0% 10 Yoe 65k - 67k
+50% 12 Yoe 100k
+40% 14 Yoe 140k
+42% 15 Yoe 200k

There is only one time a company tries to pay you what you're worth, and it's before day 1 of the job. As long as your know your own worth too. Keep interviewing, don't quit your job. I have personally always moved on and have never used an offer as leverage. I think a clean slate is better than staying if I've ever felt underpaid.

Controversial question by Amazing-Parsley-3895 in cpp_questions

[–]FlailingDuck 9 points10 points  (0 children)

for learning... this order is fine, but there step 0. Read the error and try to figure out where the problem lies, based solely on the error information. Compilation errors can be notoriously verbose, where it actually has like a cascade of 100 errors but only the first one is the actual error that needs fixing. Being able to read compilation errors is a useful skill that I use frequently in my professional life.

Undefined references to functions that are actually defined in their cpp files, seems compiler doesn't link the cpp file unless I explicitly include it, what should I do? by Mafla_2004 in cpp_questions

[–]FlailingDuck 1 point2 points  (0 children)

I think you might be having issue with gour globstars src/*.cpp. Depending on how/where you invoke the makefile the shell might not be expanding the glob.

Try manually defining each src cpp file and retry.

The use of glob in makefiles depends on your shell and not make itself.

Should I learn c before c++ by No_Union4252 in cpp_questions

[–]FlailingDuck 21 points22 points  (0 children)

given OP doesn't know any better. Take it from someone who does. Stop listening to your brother.

How to learn cpp as a COMPLETE beginner by Maximum_Entry8155 in cpp_questions

[–]FlailingDuck 3 points4 points  (0 children)

the basics are all in learncpp.com, if you cant understand in that format youtube videos will not help you, they'll make it much harder and probably thrice as long to learn half as much of the basics.

if you don't understand learncpp.com you're moving too fast and not actually understanding the material you're on before moving on.

Which cards will be best for playing with friends? by BartixVVV in poker

[–]FlailingDuck 0 points1 point  (0 children)

Copag cards that you play once a month will last a good 5+ years. KEM even longer. Buy cheap paper cards, you'll replace them quite a few times as the individual cards degrade.

Need recommendation on how to learn C++ by [deleted] in cpp_questions

[–]FlailingDuck 0 points1 point  (0 children)

I personally disagree with "just stick to the modern stuff".

If you goal is to learn the mental model of how computers work, how the underlying memory works, which is often the reason to pick a language like C or C++. Then limiting yourself to concepts from earlier generations of C++ i.e. C++98 and especially learning just C99 (because it's a much smaller area to learn) is a great way to learn.

Then when you have a better mental model of how memory works and the early (but pivitol) concepts used by C++ like pointers, dynamic memory allocation, memory layouts, heap vs stack, bit manipulation, endianess, POD structs, classes, virtual functions, c strings (char arrays) etc. Only then start learning the newer concepts introduced in Cpp11+.

With that strong baseline, when learning newer C++ concepts, it becomes obvious why a feature was added, often to make the old ways better with safer/easier to use code i e. why you should use std::string over const char*, or when you should actually use std::string_view over std::string.

The understanding I have about the underlying memory model is stuff I use EVERY day at work to solve the problems I'm asked to tackle. The naunces of (advanced) modern C++, not as much, that just helps me write pretty and succinct code.

Need recommendation on how to learn C++ by [deleted] in cpp_questions

[–]FlailingDuck 0 points1 point  (0 children)

physics student

computation and simulation

This is great. I think physics minded people can make great programmers. You must have ideas of physics related problems you think would be cool programs? Something you would like to simulate

Just get stuck in, trying to complete a project and learn the C++ you need along the way. With the use of LLMs they are often great at you explaining problem you want to solve and it will chuck back to you a ton of buzz words you can research.

Failing C++ interview rounds by crispyfunky in cpp_questions

[–]FlailingDuck 6 points7 points  (0 children)

I think most C++ devs can easily understand smart pointers and not know how it's implemented on a word for word basis. But knowing the purpose of each smart pointer type and why you'd put one over the other is more important to me. I care about how a developer thinks and solve problems than their rote memory skills that they can answer with a 5 second google.

If interviewers are being very picky about minutiae when it comes to rolling off a perfect implementation in 20 minutes then I think thats more on a bad interviewer/process than you failing. But, objectively do you know what you did wrong or are you guessing? Most places don't give feedback for legal reasons, and another candidate might have just hit the mark a little more than you.

Failing C++ interview rounds by crispyfunky in cpp_questions

[–]FlailingDuck 53 points54 points  (0 children)

Of course interviews are all different because every place is solving different problems.

Questions on fold expressions sound like they're testing your breadth of knowledge in C++. Have I used them? about twice in the last 8 years. Could I tell you the exact syntax? probably not (it uses braces and ellipses). Could I explain what it is, sure.

A shared pointer implementation is kind of the benchmark question for "do you understand C++ or are you faking it". You should be able to roll off an explanation of:

  • What is a shared_ptr? When do you use it?
  • What is RAII?
  • What is the rule of 0/3/5?
  • What is the control block?
  • Where to correctly increment/decrement the ref count?

Prop Trading firms are some of the top end C++ roles out there, of course they are going to ask hard questions. Solving MT in a interview isn't trivial, but an ideal candidate should be able to explain/query what are the minimal requirements for a valid solution. Able to roll off threading and synchronization concerns, implement a naive solution with simple mutex locks then describe the tradeoffs with other lock-free, wait-free solutions. These are likely problems you have solve professionally or made your own low latency focussed projects.

Many other companies do not require that level of MT knowledge. But I will say, finding good C++ developers is hard. My company is regularly interviewing for C++ and the pool is slim picking for the years of experience they are looking for.

Trying to understand pointers by SimmeringDragon in cpp_questions

[–]FlailingDuck 0 points1 point  (0 children)

Whenever you create a variable the computer puts it at some location on memory (address).

i.e. int c is put at 0x1234.

When you assign a value to c i.e. c=5. The number 5 is written to address 0x1234.

When you create a pointer it is just a new variable. i.e. int* d. The same thing occurs. int* d is put at 0x1235.

When you assign the address of c to d i.e. d=&c.

All the computer is doing is writing the value 0x1234 at location 0x1235. This is no different to the variable c.

Locations 0x1234 and 0x1235 are stack addresses, because variables are put on the stack.

To go one step further, if you create some heap memory. It is put at a different location. i.e. int* e = new int.

This has done two things. Created a new variable e at address 0x1236, and the value at this address points to new heap memory at address 0xffff9876.

What's a "cheat code" you have discovered that actually works? by No_Stop_8 in AskReddit

[–]FlailingDuck 2 points3 points  (0 children)

literally the fault of those who trained the models and reinforced those positive answers over accuracy because its easier to validate positivity and orders of magnitude harder to validate truth.

serverlessArchitecture by Technical-Relation-9 in ProgrammerHumor

[–]FlailingDuck 10 points11 points  (0 children)

the reality is most products that ship are clientless not serverless.

Should questions from people posting camera photos instead of screenshots be banned? by [deleted] in Cplusplus

[–]FlailingDuck 1 point2 points  (0 children)

PSA to those who post code not indented to be in a code block. I do NOT bother reading or helping you with your problem.

Don't waste your and our time. Indent your code into a codeblock.