Reputation
3,264
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
2 9 23
Newest
 Nice Answer
Impact
~99k people reached

Dec
23
comment Should UDP & TCP port numbers represented as a short or integer?
In C# I'd use a ushort/UInt16, but java doesn't support those.
Dec
22
comment Balanced folder increment
Encrypt the integer with a 32 bit block cipher and a fixed key. e.g. skip32 or ipcrypt.
Dec
10
comment Why does the Windows Clipboard require an STA thread?
The joys of COM...
Dec
10
comment Why is checking weird bit errors important in garbage collectors?
@gnat The GC would exhibit undefined behaviour when encountering corrupted references, just like plain C code would when encountering corrupted pointers.
Dec
7
comment Filtering foreach loops with a where condition vs continue guard clauses
Strictly speaking, .Where only gets invoked once. What gets invoked on each iteration is the filter delegate (and MoveNext and Current on the enumerator, when they don't get optimized out)
Dec
6
comment Why is checking weird bit errors important in garbage collectors?
Perhaps so they don't waste time debugging spurious bug reports caused by random memory errors. That's why redis runs a memory test when it crashes
Dec
4
awarded  Cleanup
Nov
29
comment Is it ok to use service locator for ubiquitously used dependencies?
I often use service locators for logging, but wouldn't recommend it for other services.
Nov
27
awarded  Yearling
Nov
27
comment Is there anything that can be done with recursion that can't be done with loops?
@JonHanna Parsers/deserializers (e.g. json) are probably the best example. They often process untrusted data where pathological configurations can easily blow the stack, while a loop would terminate within a reasonable time. Tail recursion doesn't help and rewriting them to a loop+explicit stack is tricky, especially if you value performance.
Nov
27
comment Is there anything that can be done with recursion that can't be done with loops?
Tree walking has multiple recursive calls (one for each child), yet it's trivially transformed into a loop using an explicit stack. Parsers on the other hand are often annoying to transform.
Nov
26
comment Is it better to check `c >= '0'` or `c >= 48`?
@MartinBarker The VK_* constants correspond to keys not characters.
Nov
25
comment Is it better to check `c >= '0'` or `c >= 48`?
Why are you assuming that non rejecting non-ASCII digits is wrong? That depends on context.
Nov
24
comment I have one app on one server - is there a critical reason to use a web server like IIS or NGINX?
Do you count using http.sys as using a web server?
Nov
18
comment What alternatives to a singleton are there for a class which only can have one instance?
@gnat The OP replaces global variables by a quasi-global context device, which is a small step up from the classical singleton pattern (assuming you can create multiple devices, which might contradict the "globally initialized themselves" part, otherwise it's just a singleton).
Nov
16
comment Should UDP data payloads include a CRC?
@AProgrammer Cryptographic hashes (MD5, SHA-1/2/3, ...) aim to be as cheap as possible while ensuring security properties like collision resistance. Typically they can process several hundred MB per second, so they shouldn't be a bottleneck foranything less than Gbit connections. They are still slower than many non cryptographic ones which don't need to be collision resistance. Only password hashes (PBKDF2, bcrypt, scrypt, Argon,...) aim to be expensive to compute.
Nov
16
comment Is using for loop syntax for a “with(variable)” block an anti-pattern?
@LightnessRacesinOrbit I think code smell fits better. It's not a problem per se, but hints at a design problem (you function might be too long). Personally I think that there is a place for this pattern, especially if you have enough shared variables to make a separate function annoying.
Nov
15
comment Is recursion a bad idea for large input sizes due to the limited call stack size?
Tail recursion only works in very specific cases, typically those where a loop would be just as readable (if not more) as recursion.
Nov
15
comment I'm graduating as a CS major from a bad CS program. How can I catch up? How can I get over it?
Do you want to be a compute scientist, or a programmer?
Nov
12
comment Is using for loop syntax for a “with(variable)” block an anti-pattern?
Why not simply a local variable in a nested scope?