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

Nov
19
comment Why are Apache 2.0 works excluded from OpenBSD?
The new apache license - Theo de Raadt (Feb 18 2004) seems to be the relevant discussion. Some issues seem to be 1) readability for non lawyers 2) where copyright notices must be placed
Nov
18
comment How to send data between HTTP requests without user modifying it?
You might be able to use a MAC, but that's still potentially vulnerable to replay attacks.
Nov
18
comment Extracting first and last name from a single name field
Writing the code is easy. Deciding on which rules to use is the hard part.
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.