14,221 reputation
13459
bio website
location
age
visits member for 4 years, 5 months
seen 13 mins ago

Feb
26
comment Is this statement correct for floating point numbers?
@Doval With limited memory, the same is true of natural numbers and rational numbers and all other infinite sets. However, these two sets are countable, all naturals and rationals can be represented if you allow unbounded (but finite) memory. The reals, however, are uncountable, so even a bona fide Turing machine cannot represent almost all (i.e., all but a countable subset) real numbers, regardless of the encoding chosen. Which real numbers can be represented is highly dependent on said encoding though: pi and e are rather easy to represent as computable numbers.
Feb
25
comment Feasibility of idea to reduce email spam
Aside from the elephant in the room (you change the protocol but nobody's going to adopt a new protocol), sorting as proof-of-work is far too easy (n log n complexity, actually closer to linear for integer sorting): One has to consume enormous amounts of bandwidth and integer-generating-work to make any sizable dent in the spam-sending capabilities of a reasonably well-equipped adversary. Try looking at other proof-of-work systems for harder problems.
Feb
23
revised Why the practice of writing unit tests in a different language isn't that popular?
added 1 character in body
Feb
23
comment Why the practice of writing unit tests in a different language isn't that popular?
@Doval You can use words in whatever way you wish, but merely being aware of (and primarily interacting with) a very specific class/method/function, the existence and behavior of with is only relevant to the people implementing the software as a whole, makes it a white box test in my book and in every classification I've seen. It doesn't need to poke private variables of the unit under test to be concerned with implementation details.
Feb
23
comment Why the practice of writing unit tests in a different language isn't that popular?
@JeffO How often does someone write unit tests for code they haven't written? Other than that, technically yes, but see the entire rest of my answer for why this is unlikely in practice.
Feb
23
answered Why the practice of writing unit tests in a different language isn't that popular?
Feb
23
comment Caveats of using String.hashCode() on a switch on java < 1.7
@Ordous "".hashCode() is not a constant expression, so you still have to hard-code the number. Moving the magic number behind an appropriately-named constant is better, of course, but only marginally so.
Feb
23
answered Caveats of using String.hashCode() on a switch on java < 1.7
Feb
22
awarded  Nice Answer
Feb
20
comment Why does Jenkins warn you if you tell it to check for changes every minute?
@RaduMurzea I sure hope not! Even ordinary manual user interactions are somewhat concurrent on big projects, and the numerous automated tools that may access the repository compound the problem to a degree that "closing your eyes and hoping nobody does anything concurrently" strikes me as irresponsible. DVCS developers are smart. They should manage to make pulls and pushes and other operations atomic.
Feb
19
comment c++11 random: why different range of int and real?
Half-open intervals are very natural in discrete settings. For example, array indexing and slicing, or range in Python, or any other interval of the form start <= x < end. See also: Dijkstra's take on it.
Feb
16
comment Why are language features more popular than compiler design?
@EECOLOR There trivially are a finite number of programming languages. But no, realistically, there is far too much diversity in languages for a single AST, a single IR, or a single interpreter.
Feb
16
comment Why are language features more popular than compiler design?
Have you actually tried implementing (or even just thought in detail about how to implement) any of that? The longer I think about it, the more problems I find. I've only been at it for two minutes and I already have so much material that beating it into the shape of a good answer takes far more time than I'm willing to invest.
Feb
16
comment Is it possible to avoid SQL injection by not using a Query Language for most tasks?
What value do you think this would add? Why should DBMSs support this, and why should DBMS customers want it?
Feb
14
comment Being among the best to the worst. What to do?
@TomAu For starters, it's not asking for career advice. It's asking how to handle a (programming-specific) workplace situation.
Feb
14
awarded  Good Answer
Feb
11
comment How should I unit test mathematical formulae?
@Evan Testing can never rule out bugs, only find them. Generally this process does not continue ad infinitum though, since you keep the accumulated tests around, and hence (should) never re-introduce any of the bugs already discovered, thus steadily improve reliability. That's what regression tests are all about. There's really no reasonable way to test all inputs. Testing methodology is about getting the most bang for the buck, and a bug which has already occurred in the wild is hard to beat at that: You already know that this problem can occur, and the test case is practically free.
Feb
11
comment How should I unit test mathematical formulae?
I don't see how the first approach (test some reasonable values, add new ones as failures are exposed by other means) defeats the point of having a unit test. Many unit tests are regression tests. Turning real bug reports into test cases is a valid, useful and widespread method of creating regression tests. I don't really see all that much potential for that though, if the implementation is really just straightforward transliteration of a formula that already does what you want. In which case a few manually-picked values (try to choose edge cases) makes a perfectly fine unit test.
Feb
11
awarded  Nice Answer
Feb
11
comment Bridging the gap between abstract machines and computer achitectures?
@Tim I'd guess that course just takes Turing machines as a starting point to introduce the concept of an abstract machine, then quickly moves on to more useful abstract machines.