2,416 reputation
2617
bio website github.com/CodesInChaos
location Frankfurt, Germany
age
visits member for 3 years, 7 months
seen Jul 9 at 9:01

Feb
3
comment Why is it hard to make a Java program 'appear native'?
There are many many details to take care of. For example the way auto-completition works in a file open dialog is one point where a native looking java application broke down.
Feb
3
comment Is it bad practice to follow up a call to a terminating function with exit()?
IMO it's already bad practice that do_logon calls exit. It implies that your code has bad structure.
Jan
31
comment Why should passwords be encrypted if they are being stored in a secure database?
In the context of password hashing MD5 has no known vulnerabilities beyond being fast, and that applies to SHA-2 as well. Using a slow, iterated construction is far more important than choosing SHA-2 over MD5.
Jan
31
comment What rationale is used when programming language designers decide what sign the result of modulo operation takes?
@BleedingFingers Programming often uses integer division that goes towards zero, e.g. (-3)/2 == -1. This definition can be useful. When you want % to be consistent with this division fulfilling x == (x/y)*y + x % y you end up with the definition of % used in C#.
Jan
30
comment What rationale is used when programming language designers decide what sign the result of modulo operation takes?
One related question is which of these operations directly map to CPU instructions. In c it's implementation defined, which fits with the c philosophy of directly mapping to the hardware on as many platforms as possible. So it doesn't specify stuff that might differ between CPUs.
Jan
30
comment What rationale is used when programming language designers decide what sign the result of modulo operation takes?
Related What's the difference? Remainder vs Modulus - Eric Lippert’s Blog (by one of the C# designers, but I believe he joined team after this decision was made)
Jan
30
comment What rationale is used when programming language designers decide what sign the result of modulo operation takes?
In my code I almost always need modulo not the remainder. No idea why remainder is so popular.
Jan
30
comment How to convey your approach is faster than the built-in, alternative approaches?
@JeffO If you claim that, it better be true. Else I'd mark the product down due to lying marketing. Exponential speedups are rare, since it implies that the original algorithm had exponential cost in the first place.
Jan
30
comment Why should passwords be encrypted if they are being stored in a secure database?
In general it's preferred to use a random salt instead of the username.
Jan
29
comment Unit testing methods with logical dependencies on other classes
That you're using QueryBuilder is an implementation detail. You can produce equally valid implementations that don't use it. So I wouldn't mock it, even if it increases the size of the system under test.
Jan
29
comment How to unit test a missing case in a switch statement where all cases are true
Duplicate on stackoverflow: How to test or exclude private unreachable code from code coverage
Jan
29
comment How to unit test a missing case in a switch statement where all cases are true
IMO the best solution is telling the code coverage tool that the branch is designed to be unreachable.
Jan
29
comment How to unit test a missing case in a switch statement where all cases are true
At least in C# you can trigger it: Error((eERROR)-1). .net enums are just fancy integers, any value is valid, even those without name. Your code looks more like java, but you didn't specify a language.
Jan
29
comment Preventing some downsides of a static class
I'd use abstract instance methods or an interface together with dependency injection. Accessing global state through static members is generally a bad idea.
Jan
29
comment Are there programming languages that allow you to do set arithmetic on types?
@RobertHarvey At least intersection & would be extremely useful IMO. It simplifies interface hierarchies since you can simply have one interface for each feature, without needing inheritance. For example collection interfaces with & instead of just inheritance would be more flexible and cleaner.
Jan
29
comment Are there programming languages that allow you to do set arithmetic on types?
Support for & and | seems useful, but ^ and ! not so much.
Jan
26
comment When must arbitrary precision arithmetic functions be used in PHP?
Chord might interpret a SHA-1 hash as a large number. Not because of SHA-1 is related to big integers, but because the protocol built on top of it might find it convenient to do so. DHTs use a distance metric between hashes, theirs might be expressed using big integers.
Jan
26
comment What is the most effective grammar to use for issue titles?
One problem with the imperative variants is that they assume that you know the solution when creating the issue.
Jan
26
comment C++ Performance vs. Java/C#
My own experience is that for standard C the typical factor between C and C# is between 1.25 and 2.5. When you compare C# with intrinsic heavy C, a factor of 6 is possible. With mono instead of MS's .net the gap seems to be even bigger.
Jan
26
revised If we close browser window without getting logout, what will happen when we provide same URL in the browser?
Format quote as quote, not text. Better tags. Grammar and formatting fixes.