Determine Whether Two Date Ranges Overlap
Determine Whether Two Date Ranges Overlap
Determine Whether Two Date Ranges Overlap
What is the best regular expression to check if a string is a valid URL?
In most programming languages, floating point numbers are represented a lot like scientific notation: with an exponent and a mantissa (also called the significand). A very simple number, say 9.2, is actually this fraction: 5179139571476070 * 2 -49 Where the exponent is -49 and the mantissa is 5179139571476070. The reason it is impossible to represent … Read more
First and foremost, the “pass by value vs. pass by reference” distinction as defined in the CS theory is now obsolete because the technique originally defined as “pass by reference” has since fallen out of favor and is seldom used now.1 Newer languages2 tend to use a different (but similar) pair of techniques to achieve … Read more
A debugger is a program that can examine the state of your program while your program is running. The technical means it uses for doing this are not important for understanding the basics of how to use a debugger. You can use a debugger to halt the execution of your program when it reaches a … Read more
What is dependency injection?
Is floating point math broken?
How can I pair socks from a pile efficiently?
PART I: How To Log In We’ll assume you already know how to build a login+password HTML form which POSTs the values to a script on the server side for authentication. The sections below will deal with patterns for sound practical auth, and how to avoid the most common security pitfalls. To HTTPS or not … Read more
Let fabs be a function that returns the absolute value of a float. Then the formula could look like this: function calcRank(float v1, float v2) { float k = fabs(v2-30.0); if (k < 30.0) { // Rule 1 and 2 rank = k/60.0 + (60.0-k) * v1 / 60.0; } else { // Rule 3 … Read more