2,426 reputation
2617
bio website github.com/CodesInChaos
location Frankfurt, Germany
age
visits member for 3 years, 8 months
seen 8 mins ago

Mar
1
comment Using natural language grammar in fluent API
btw. if you want to use a DSL for querying a database, you could use the already existing DSL called SQL.
Mar
1
comment Using natural language grammar in fluent API
IMO this kind of fluent API is horrible. For example lack of operator precedence is annoying. I'd parse where("name").equals("foo").or("bar") as (name=="foo")or bar. Then it's not clear when a string represents a literal, and when it presents a column name,...
Mar
1
comment Using natural language grammar in fluent API
where is the advantage over Users.Where(u=>(u.Name=="foo")&&(u.Email.StartsWith("foo@"))?
Mar
1
comment How much usage of “likely” and “unlikely” macros is too much?
For application code, I'd add them only if profiling showed that this code is used in a hot path.
Mar
1
comment Is it safe to assume that one controller will only ever use one primary model?
It depends on how you want to design the application. Some people prefer having one controller per resource.
Feb
28
awarded  Nice Answer
Feb
28
revised Dependency Injection and Singleton. Are they two entirely different concepts?
added 195 characters in body
Feb
28
comment Unit-testing of inherently random/non-deterministic algorithms
Even mediocre PRNGs will not show any patters in any statistical tests. For good PRNGs it's practically impossible to distinguish them from real random numbers.
Feb
28
comment When do you use float and when do you use double
Decimal represents numbers of the form m*10^(-e) where e is between 0 and 28. "The binary representation of a Decimal number consists of a 1-bit sign, a 96-bit integer number, and a scaling factor used to divide the integer number and specify what portion of it is a decimal fraction. The scaling factor is implicitly the number 10 raised to an exponent ranging from 0 to 28."
Feb
28
comment Randomness of wrapped RNG
Do you want a formula that transforms uniform random numbers into a specific distribution? Or do you want to know how to verify if an implementation of such a formula is correct?
Feb
28
comment What is the better way to design flexible menus?
Why do you think that the number of permutations matters? It's not like you need to display every permutation at the same time.
Feb
28
comment When do you use float and when do you use double
@BartvanIngenSchenau Floating point for money is usually okay, binary floating point is not. For example .net's Decimal is a floating point type and it's typically a good choice for money calculations.
Feb
28
comment When do you use float and when do you use double
In many cases you want to use neither, but rather a decimal floating or fixedpoint type. Binary floating point types can't represent most decimals exactly.
Feb
28
comment Ethics and best practices when forking code base
CC licenses with SA aren't a good license for code, it's a bit unclear how large the scope of the virality is. I'd talk to the original author and try to agree on a suitable license.
Feb
28
comment Unit-testing of inherently random/non-deterministic algorithms
"some bias even at that level" If you use a good PRNG, then you will not be able to find any test(with realistic computational bounds) that can tell it apart from real randomness. So in practice one can assume that a good PRNG has no bias whatsoever.
Feb
28
comment Random number generation algorithm for human brains?
I recommend using /dev/urandom in almost all situations. /dev/random usually has horrible performance (and the advantage over urand is rather dubious), and rand() typically sucks.
Feb
28
comment Randomness of wrapped RNG
I don't see how "analytical or algebraic" will help you. If you use a standard formula, that formula is probably supported by a mathematical proof. The question is if your code implements the formula correctly.
Feb
28
comment Randomness of wrapped RNG
"If a "good" PRNG (such as an existing RNG from a popular programming language's main library)" -- those often suck
Feb
28
comment Please help me understand the relationship between script file size and memory usage?
Why, oh why would you use a 400MB script? Can't you generate a simple datafile you can read in a streaming fashion? Or database?
Feb
28
comment Best way to unit test methods that call other methods inside same class
Since those derived classes can be in different assemblies, they're exposed to third party code, and thus part of the public surface of your class. To test them, you can either make them internal protected, use a private reflection helper, or create a derived class in your test project.