1,977 reputation
719
bio website michael.kjorling.se
location
age
visits member for 4 years, 2 months
seen Dec 18 at 12:47

Dec
18
comment Are all magic numbers created the same?
@durron597 Nothing special happens when your timekeeping software is deployed on Mars, because by convention Mars days are 24 hours long, but each hour is 2.7% longer than it is on Earth. Of course, neither an Earth sidereal day nor an Earth solar day is exactly 24 hours (exact numbers are on that same page), so you can't use 24 anyway! Like Izkata mentioned, leap seconds hurt. Maybe you'd have better luck actually using the constant 24 on Mars than on Earth!
Nov
21
revised PHP Source Code Encryption Concept
added 476 characters in body
Nov
21
answered PHP Source Code Encryption Concept
Nov
21
comment PHP Source Code Encryption Concept
Don't forget also that storage can (and does) develop errors. Depending on exactly how the checksum calculation is implemented, this can cause a different checksum to be computed. Now you've permanently blocked that IP address. Some great customer service, there.
Nov
10
comment Is it imaginable to teach a machine how to program itself to a defined specification?
I think it's fair to say though that Jeopardy is a bit of a special case: it boils down to recalling and associating facts. Take even the best specialists, and there will be nuggets of even public knowledge that they are unaware of, or unable to recall under pressure. On the other hand, to a computer which is capable of analyzing an encyclopedia (such as Wikipedia, Encyclopedia Britannica, or any other), no fact stated in that encyclopedia is more (or less) exotic than any other.
Oct
25
awarded  Yearling
Oct
24
revised Code that converts a value into a different representation, then converts it back to where it started is bad, but how?
Convert from double back to double makes no sense
Oct
24
suggested approved edit on Code that converts a value into a different representation, then converts it back to where it started is bad, but how?
Oct
24
comment Code that converts a value into a different representation, then converts it back to where it started is bad, but how?
@gnasher729 At least then you know it's representable as a string before you give it to the JSON parser?
Oct
4
comment Should test data be checked into version control?
@RobertHarvey True, but if the test data is required for the test to work, I feel it should be considered a part of the test. That is also the approach taken by all three answers so far, as I understand them.
Oct
2
comment Should test data be checked into version control?
possible duplicate of Should unit tests be stored in the repository?
Sep
30
awarded  Explainer
Aug
7
awarded  Nice Answer
Jul
15
comment Style bits vs. Separate bool's
@supercat Recall that in many languages, enumeration names can correspond to any value (not necessarily even listed in numerical order in the source code), and the default often is not bitshifted-single-ones. So you'd need some way to detect that usage and act appropriately in each distinct case. A lot of complexity for what I would argue is marginal gain; (int)enumVar & (EnumType.Value1 | EnumType.Value2) != 0 (to be explicit) is only marginally more typing than even enumVar.hasAll(EnumType.{Value1,Value2}) and IMO easier to read if only you know the binary operators.
Jun
10
comment What is the origin of the negative term “legacy code”
While this might be true, it would be better if you were to edit the answer to cite specific references supporting the claims made in this answer. Are there any such references that you can cite?
Jun
10
comment What is the origin of the negative term “legacy code”
@stevebot Of course I'm not -- I'm just suggesting how to phrase the question in order to get the answer to what you yourself say you are looking for the answer to, rather than something else. Clear, specific questions with a minimum of superfluous material helps everyone.
Jun
9
comment What is the origin of the negative term “legacy code”
@stevebot If you want to find the origin of the term, you should ask for that without presupposing a connotation.
May
13
awarded  Nice Answer
May
13
comment Is it correct to call the assignment symbol an “operator” when it is actually a statement?
@rick Anyway, I have edited my answer to try to make it more clear. Does it make more sense now?
May
13
revised Is it correct to call the assignment symbol an “operator” when it is actually a statement?
added 87 characters in body