Reputation
2,739
Top tag
Next privilege 3,000 Rep.
Cast close & reopen votes
Badges
2 8 19
Newest
 Enthusiast
Impact
~83k people reached

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
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
Oct
4
comment GPL - No version mentioned
I recommend contacting the authors/copyright holders and asking them to clarify.
Oct
4
comment Why overriding a static method does not result in polymorphism in java
Why do you claim that you can override a static method? You can hide it, but that's quite a different thing.
Oct
4
comment How do I handle a spam server invalidating my tokens?
I don't think the form should only have that single button, it should ask for the new password. Change the password when pressing the submit button and invalidate the token at the same time.
Oct
4
comment How do I handle a spam server invalidating my tokens?
IMO you should combine invalidation on password change (POST, see Bart's answer) with an expiry time (24h or so). If the user opens the email too late they simply need to request another email.
Sep
29
comment How do I compile my software for all platforms from Ubuntu Linux 64 bit?
1) Can you cross-compile? I believe that should be possible at least for different linux flavours. 2) Compilation is usually the easy part. Debugging platform specific issues is the main problem.