tagged [language-agnostic]

How can I pair socks from a pile efficiently?

How can I pair socks from a pile efficiently? Yesterday I was pairing the socks from the clean laundry and figured out the way I was doing it is not very efficient. I was doing a naive search — pickin...

Calculating a 2D Vector's Cross Product

Calculating a 2D Vector's Cross Product From wikipedia: > the cross product is a binary operation on two vectors in a Euclidean space that results in another vector which is perpendicular to the plane...

12 Dec at 00:25

What is non-thread-safety for?

What is non-thread-safety for? There are a lot of articles and discussions explaining why it is good to build thread-safe classes. It is said that if multiple threads access e.g. a field at the same t...

What's the difference between faking, mocking, and stubbing?

What's the difference between faking, mocking, and stubbing? I know how I use these terms, but I'm wondering if there are accepted definitions for , , and for unit tests? How do you define these for y...

Why are many developers opposed to using the "protected" modifier in OOP?

Why are many developers opposed to using the "protected" modifier in OOP? A co-worker of mine is taking an class and was asked a discussion question by his professor: > When the question was brought u...

2 Sep at 21:2

Automatic generation of immutable class and matching builder class

Automatic generation of immutable class and matching builder class What tools/libraries exist that will take a struct and automatically generate an immutable wrapper and also a "builder" class for inc...

The definitive guide to form-based website authentication

The definitive guide to form-based website authentication > #### Moderator note: This question is not a good fit for our question and answer format with the [topicality rules](/help/on-topic) which cu...

When designing a data structure, should helper methods be accessible to other users?

When designing a data structure, should helper methods be accessible to other users? I had a talk with my professor today about the layout of the Chunklist data structure that we've been working on. B...

19 Oct at 01:14

Peak signal detection in realtime timeseries data

Peak signal detection in realtime timeseries data --- The best performing algorithm [is this one](https://stackoverflow.com/questions/22583391/peak-recognition-in-realtime-timeseries-data/22640362#226...

Are unescaped user names incompatible with BNF?

Are unescaped user names incompatible with BNF? I've got a (proprietary) output from a software that I need to parse. Sadly, there are unescaped user names and I'm scratching my hairs trying to know i...

Secret santa algorithm

Secret santa algorithm Every Christmas we draw names for gift exchanges in my family. This usually involves mulitple redraws until no one has pulled their spouse. So this year I coded up my own name d...

Why is processing a sorted array slower than an unsorted array?

Why is processing a sorted array slower than an unsorted array? I have a list of 500000 randomly generated `Tuple` objects on which I am performing a simple "between" search: When I generate my random...

Ball to Ball Collision - Detection and Handling

Ball to Ball Collision - Detection and Handling With the help of the Stack Overflow community I've written a pretty basic-but fun physics simulator. ![alt text](https://i.stack.imgur.com/EeqSP.png) Yo...