2,712 reputation
2819
bio website github.com/CodesInChaos
location Frankfurt, Germany
age
visits member for 4 years, 6 months
seen 13 hours ago

NSA running around with their hair on fire because they realise if everyone starts using OTPs and not their weak AES algorithm then their PRISM programme is worthless. --- zuallauz - Would this simple encrypted chat program be feasible using One Time Pads?


Jan
15
comment Creative Commons ShareAlike
Reading older versions of CC might help you understand their intent. With each revision CC got less clear. You should also read the FAQ
Jan
14
comment How to solve this problem of duplicate code with a design pattern
Asking which pattern to use is the wrong approach. What matters is how to solve the problem. That solution may or may not make use of some standard design pattern.
Jan
13
comment Why are return values from compare functions in many languages defined loosely?
@user949300 1) Why would you write specific comparison code for the age of humans? You write that code once, so it's correct for every integer, and then reuse it. For example for the Child type, you'd write something like return child1.Age.CompareTo(child2.Age) where int.CompareTo needs to handle every integer. 2) -int.MinValue == int.MinValue, so negating doesn't change the sign for this case.
Jan
13
comment Why are return values from compare functions in many languages defined loosely?
Which won't work in most languages due to integer overflows. Similarly negating the value to reverse the ordering doesn't work for two's complement integers.
Jan
13
revised How to prove that this while loop calculates n^2
added 8 characters in body
Jan
9
revised Does using == in JavaScript ever make sense?
added 42 characters in body
Jan
6
revised Are there real-life usage and applications for “do while” loops?
edited body
Jan
6
comment Are there real-life usage and applications for “do while” loops?
But you're not doing anything with the data you're reading. Once you add this, do...while isn't a good match anymore.
Dec
21
comment readability vs shorter code in returning from function
The nops in your assembly code are a clear indication that JIT optimizations are disabled. Using the default settings VS disables JIT optimizations if you run in the debugger.
Dec
19
comment What is the hierarchical DB schema for this xml?
The big downside of MongoDB is that it doesn't support transactions (yet).
Dec
19
comment Is using multiple static classes with maximum one public method is a good idea
Most of those disadvantages are only an issue if you have global state or don't use higher order functions where appropriate.
Dec
18
comment Algorithm to test file equivalence
I would not use multiple hashes. One collision resistant hash (e.g. SHA2) should be enough. The probability of accidental collisions is negligible with good hashes of at least 256 bits and beyond ridiculous at 512 bits (e.g. SHA-512). Against deliberate collisions using multiple hashes is only about as strong as the strongest hash, not stronger. In general it's typically better to spend the CPU budget on using a stronger hash instead of multiple weak hashes. Personally I wouldn't even bother with byte-by-byte comparison of files if the have the same SHA-2 hash.
Dec
16
comment Is it better to use strings or int to reference enums outside the java part of the system?
In the javascript API I'd certainly use strings. In the DB both have their advantages. Some databases have built in enum support.
Dec
8
comment Adding non distinct elements to a dictionary
Perhaps a HashSet<T> is a better fit than a dictionary.
Dec
8
comment Is automatic conversion to collection types from non-collection variable a good idea?
It's pretty common, taking the form of (params T[] bla).
Dec
5
comment Rationale behind CSS height with percentage value
Perhaps because it is or at least looks like a circular dependency.
Dec
4
comment Why doesn't Android use shared libraries?
@WyattBarnett I'm generally a fan of putting everything my application needs in the application directory, the security/bug fix issue is the only significant downside I know of.
Dec
4
comment Why doesn't Android use shared libraries?
The main advantage of centralized storage isn't disk space, it's that there is only one place where you need to apply a bug or even security fix.
Dec
4
comment Why do UTC Dates have different days of the week for some months?
2014-12-04 01:00 in UTC+02:00 is 2014-12-03 23:00 in UTC. If you use a library which represents dates by timestamps at midnight, then applying timezone conversion to dates changes the date since midnight can become before-midnight in another timezone.
Dec
4
comment Securing sensitive data from developers
@JanHudec Especially since adding code the the application leaves traces in version control.