2,671 reputation
2718
bio website github.com/CodesInChaos
location Frankfurt, Germany
age
visits member for 4 years, 1 month
seen 1 hour ago

Nov
18
comment What is the simplest human readable configuration file format?
I see two potential problems with your format: 1) Representing lists. You could use array link indexes [0], but that has its share of issues. 2) Representing something that does exist but is empty. If neither of these matter to you, the format is pretty nice.
Nov
15
comment docker-izing a classical db-based webapp - single or multiple containers?
From the article you linked: "for most systems, you'll want role-based containers (app, db, redis, etc)"
Nov
15
comment local communications between two apps
I'd consider ZeroMQ. It's message based, so you don't need to implement that part yourself. It has different backends from in memory over pipes to full blown TCP.
Nov
15
comment Pre-processor usage to separate logic to different versions of product
Note that an if statement doesn't necessarily imply a runtime condition. If the condition is a compile time constant compilers will usually omit the unreachable code (but depending on the language they might produce a warning).
Nov
14
comment Is it better to use preprocessor directive or if(constant) statement?
If you want to be able to set it via the compiler command line, I'd still use a constant in the code itself and only #define the value assigned to that constant.
Nov
14
answered Pre-processor usage to separate logic to different versions of product
Nov
14
comment Why are pointers not recommended when coding with C++
Don't use backticks for highlighting, they're for inline code. Either use bold or italique.
Nov
6
comment Why do new programmers seem to ignore compiler error messages/runtime exception messages?
In my experience just looking at the code works well for syntax errors, since there the compiler message is often about a failure that's indirectly caused by the original error. For semantic errors, as in your example, the error message is usually essential.
Nov
5
comment Where should I store and verify files manipulated by an app
As many tests as possible should not touch actual files at all.
Nov
4
comment What programming languages are most suitable for implementing design patterns?
@Doval For example in many scenarios C# delegates/events can simplify the observer pattern compared to the verbose form that's usually presented. Similarly using a delegate can often simplify factories.
Nov
3
revised Should one write a custom IndexOutOfRange exception?
added 334 characters in body
Nov
3
answered Should one write a custom IndexOutOfRange exception?
Oct
30
comment Better to keep JScript.NET dll or try converting JScript.NET code to C#?
Implementing textbook RSA encryption in C# is trivial: BigInteger.ModPow(plaintext, e, n). But I don't know what kind of padding the java implementation applies.
Oct
29
comment How would you go about compressing a list of integers that are non unique and retain the original order?
I'd serialize it to a byte array and then throw a standard algorithm like deflate at it.
Oct
27
comment How to get a one-way hash function that is collision safe for about 1 million unique inputs?
@ratchetfreak If you can precompute a perfect hash function, you can precompute a hashtable. For some parameters/inputs perfect hashfunctions offer better performance, but I think it's rarely worth the bother.
Oct
27
comment How to get a one-way hash function that is collision safe for about 1 million unique inputs?
One alternative is using a specialized library to compute a perfect hash function. But I have my doubts that the result will be superior to a simple hash plus collision handling in most practical applications.
Oct
27
comment How to get a one-way hash function that is collision safe for about 1 million unique inputs?
@ratchetfreak at 40 bits there is about 1 colliding pair among those 1 million inputs. Since 20 bits are easily enumerable you can easily reject those hash functions that include a collision.
Oct
23
comment Code that converts a value into a different representation, then converts it back to where it started is bad, but how?
@PieterB There is a big German accounting software that doesn't work on computers with a non German locale because it does this. It first converts the date to string using the system locale and then tries to parse it with a fixed locale and complains about the illegal format. It does the same with numbers and varying decimal separators, except that it doesn't complain there, it corrupts the data and exhibits weird behaviour. Took me days to figure that one out.
Oct
23
comment Code that converts a value into a different representation, then converts it back to where it started is bad, but how?
Converting to double is a lossy operation.
Oct
23
answered Software license without modify