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

Aug
20
comment Converting static utility class into singleton
How would your automatic tool recognize which methods are fine as static methods and which should be turned into instance methods?
Aug
20
comment Does HTTPS prevents man in the middle sending the same message several times
Do you validate the server's certificate do ensure you're talking to the correct server?
Aug
20
comment Why does Python's math.ceil return a float?
In C you obviously need to return a double, since it has a much larger range than integers. I'd consider turning a 64 bit double into a 1000 bit integer by rounding slightly unintuitive even in a language with arbitrarily sized integers. It's be even more extreme for 80 bit floats (extended precision) or custom floats which aren't limited to measly 11 bit exponents. And how would you handle special values, like infinities and NaNs?
Aug
20
comment Why does Python's math.ceil return a float?
A parameter signifying decimal digits while rounding a binary floating point number might not be the best of ideas. If the rounding is for display purposes I'd do it as part of the conversion to string, if it's required for the correctness of the computation, a binary floating point number probably isn't the correct choice of type.
Aug
20
comment How does HashSet in Java remove the duplicate elements
@minping You should learn about the difference between overloading, hiding and overriding. Using the @override annotation will help you avoid this problem, because it won't compile if there is no method to ovverride.
Aug
19
comment Is using hashes for primary keys a good idea?
Why would you trust a UUID which typically (V4) consists of 122 random bits over a 160 bit has? Accidental collisions will obviously be rarer for the latter.
Aug
18
comment Is it okay to return the “wrong” HTTP status code in order to show a more user-friendly error page?
You could check the link using a javascript triggered HEAD request before redirecting there. Downside is the increased latency, which should be insignificant if the server is fast.
Aug
11
comment Why not just make non-parameterized queries return an error?
As an approximation for "is it a literal" you can check if the string is interned.
Aug
10
comment The best shard key for user authentication
@Ivan 1) With logins the computation of the password hash if by far the most expensive step, and that step happens on the application side and is thus can be distributed trivially among several servers. 2) SHA-256(password + salt) an insecure hash, since it's too cheap to compute. See How to securely hash passwords? for details.
Aug
10
comment The best shard key for user authentication
Are you creating a social network for insects, or why do you have so many users that you need to shard this?
Aug
9
comment Rest APIs - mobile specific challenges
The number of requests shouldn't matter that much if you can do them in parallel, especially if you use spdy/http 2 or similar protocols.
Aug
7
comment How do I bundle library files for use in branches?
@snowman If you check out the root, you get one directory per branch on the client. I think that's where the OP's confusion comes from. But AFAIR you can check out individual branches.
Jul
30
comment What if the “catch” block is empty - “{}”
@Wilman If you rethrow using throw ex; instead of throw; you overwrite the stacktrace.
Jul
29
revised How to promote code review as an employee?
added 24 characters in body
Jul
28
comment Is throwing new RuntimeExceptions in unreachable code a bad style?
@MatthewRead The execution of code intended to be unreachable is a severe bug, return null is quite likely to mask the bug because you can't distinguish the other cases where it returns null from this bug.
Jul
23
reviewed Approve i++ vs i+=1 in cycles, why evaluate?
Jul
22
comment File sharing web application - folder PIN code entry best practice
Why PINs instead of some kind of ACL? Password sharing isn't exactly good practice.
Jul
21
comment Is an interface considered 'empty' if it inherits from other interfaces?
Being unable to specify several interfaces as type of a parameter/field etc. is a design flaw in C# / .NET.
Jul
18
comment What is the time complexity of the algorithm to check if a number is prime?
In practice we use probabilistic algorithms with runtime O((log n)^3) (or slightly lower if you use fancy multiplication algorithms) instead of AKS.
Jul
13
comment How to sort fractions (small numbers)
You forgot to subtract the q from the exponent.