2,463 reputation
1021
bio website
location
age
visits member for 3 years, 5 months
seen 21 hours ago

Jul
3
comment Is it a good idea to return a default value if a field in a query cannot be found?
In the context of data readers, it is especially dangerous to return default values for value-types (e.g., default(int)). Whereas default values for reference types will tend to eventually throw NullReferenceException, default values on value types will often not trigger visibly broken behavior quite so immediately. E.g., int NewId = getProductId(arg);setProductLabel(NewId,NewLabel); might very well silently corrupt (or discard) your data without any sort of warning or error. Database constraints can mitigate this issue, but cannot eliminate it entirely.
Jun
20
comment How should I unit test a bitmap modifying method?
@EugenePodskal: Well, if the images tend to fail binary equality tests due to complex, mostly imperceptible (to humans) differences, a diff that tests for near-equality might work. E.g., PerceptualDiff. If your application supports dependency injection, injecting a randomization service with hard-coded values or seeds should allow your system to maintain binary equality (well, unless randomness is also introduced by parallelization artifacts and the like).
Jun
18
comment Why was C# made with “new” and “virtual+override” keywords unlike Java?
See also this answer to Why all java methods are implicitly overridable.
Jun
18
comment Why was C# made with “new” and “virtual+override” keywords unlike Java?
Eric Lippert discusses this in detail in his post, Virtual Methods and Brittle Base Classes.
Jun
12
comment Is method overriding always a violation of Liskov Substitution Principle?
Non-private members (function signatures, properties, fields) are also part of the contract. Generally, statically typed languages enforce this during compilation.
Jun
4
comment Is ASP.NET MVC too much overhead for smaller projects?
@gnat: Meh, I think that's a bit unfair. While the wording of the title makes it sound like an opinion-based question, I think the core question is answerable without this being a problem. Specifically, whether or not, for small projects, MVC has more overhead than WebForms. There is a little bit of subjectiveness in this question, but it strikes me as Good Subjective. The good thing about this question is that the OP provided a narrow enough X vs Y question for it to actually be answerable.
Jun
2
comment Is this simple XOR encrypted communication absolutely secure?
Or you know some of the plain text because you know what protocol the user is using. There's plenty of room for evil when editting the standard, predictable headers of an http response.
Jun
2
comment Is this simple XOR encrypted communication absolutely secure?
Many encryption algorithms work by somehow converting a key into a stream of data which is indistinguishable from random data, then using that data as a one time pad. From an attacker's perspective, there is no difference between data that is truly random and data which is indistinguishable from random data (by definition; if you found a difference, it wasn't indistinguishable), so in theory this is just as safe as OTP. Of course, when we say data is indistinguishable from true random data, there's usually a bunch of caveats. This explanation is of course a gross over-simplification.
Jun
2
answered Should a Parent with Children have a DefaultChild, or should a Child have a Default property?
Jun
2
comment How to convince management of making our project open source?
@MrSoundless: In that scenario, you tell them to stop violating your license (and possibly sue them).
Jun
2
comment Should a Parent with Children have a DefaultChild, or should a Child have a Default property?
@Stijn: Given that pair of user-visible choices, your question is more a UX question than a technical question.
Jun
2
comment Should a Parent with Children have a DefaultChild, or should a Child have a Default property?
To use Microsoft terminology, DefaultChild is really just an MRU (most-recently-used) default?
Jun
2
comment Can I, as author and copyright holder, relicense my code under a more liberal license after it has been published under a more restrictive license?
Please take careful note of MichaelT's prefix, "As a copyright holder." If you've used any outside code (contributions from other people, code from other sources, etc.), you probably aren't the copyright holder on that code. For example, when contributing to GPL projects, people tend to GPL license their code, rather than assigning copyright to the project owner. In theory you could still fork a non-GPL version of such a project, but doing so would require it to get rid of the GPL code (and since that code is in your head, rewriting those portions of the project w/o GPL is difficult).
May
27
comment Should I use my own public API on my site (via JS)?
I remain unconvinced that this is not a duplicate of Should a website use its own public API?
May
22
revised Why does VBA / VBScript require “Set” prefix
Removed complaints about MS.
May
21
answered How to store the file names, start offset and length while avoiding the issue of self imposed limits (lookup table) or having to scan the entire file?
May
20
comment Program license : Open-Source and commercial?
This discussion is getting a bit excessive. I made my reply in chat.
May
20
comment Program license : Open-Source and commercial?
@IvayloSlavov: They can extend/repackage/resell the product as a closed source application. For example, the product may be used as a component in a larger, proprietary application.
May
20
comment Program license : Open-Source and commercial?
@IvayloSlavov: No. Dual-licensed code has two separate licenses. A company which does not pay for the proprietary license only has the GPL license. You can think of a license as a set of conditional permissions. "I give you permission to do X, Y, and Z, so long as you do Q, R, and S." The company offering a proprietary license does not need to distribute it to everyone.
May
20
revised Program license : Open-Source and commercial?
Fixed outdated information