2,672 reputation
2718
bio website github.com/CodesInChaos
location Frankfurt, Germany
age
visits member for 4 years
seen 4 hours ago

4h
comment Is there a keyboard with a specific layout for programmers?
The US layout is already pretty good for programming, compared with the German layout. AltGr+7 for { is great...
8h
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.
2d
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.
Dec
4
comment Securing sensitive data from developers
@Clinton Do you have separate admin and developer teams? The server admin can always read the data and encryption doesn't help since they can easily get the key.
Dec
4
comment Best OOP Practice in C#: Passing the object as parameter VS creating a new instance of the object
Depends a lot on what kind of class TheObject is. If it's something service or policy like, pass it in.
Dec
4
comment How to handle a memory consuming member variable
If it's static, it better be immutable.
Dec
2
comment When is inlining worth it?
I once had a significant performance decrease in a cryptographic hashfunction due to the increased code size when unrolling a loop, probably because it didn't fit into a CPU cache. CPU caches, especially the faster ones, are quite small compared with RAM.
Dec
1
comment Is generating a large random number more unique than generating each digit in that number?
It doesn't make sense to use rand or mt_rand. Use a CSPRNG, or if you just need something unique, a GUID/UUID.
Nov
28
comment if a c# interface contain only getter and setter definition, is it a code smell?
The presence of the setters is a bit weird. This looks like the kind of data which most consumer would only read not modify.
Nov
28
comment Who is responsible for stream positioning?
Yes, in general the caller should do the positioning.
Nov
28
comment Do we still need manual code review if we use sonarqube code review tools
Resharper detects code that can be rewritten as LINQ quite often.
Nov
26
comment Should I accept empty collections in my methods that iterate over them?
I'd throw if the collection is null but not if it's empty.
Nov
24
comment Why are self-hosting compilers considered a rite of passage for new languages?
Unless it's a special purpose language, a language which isn't well-suited to write a compiler in is probably not well suited for what I want to do either.