3,896 reputation
634
bio website
location
age
visits member for 2 years
seen 17 hours ago

Apr
17
comment Is there any performance benefit in checking the item count prior to executing a foreach loop?
Checking for null and count are two different things. Doesn't checking SqlParams.count if SqlParams is null throw and access violation?
Apr
16
comment Is there a term for the coding error that resulted in heartbleed, or the code that exploited it?
@Doval no it's not. It's very basically, I send a keep-alive packet which gets assigned a buffer and ask the server to reply to me back that buffer of "length". The attack is to specify a larger length then the keepalive packet you sent so you get more information then is put into the buffer.
Apr
16
comment Is there a term for the coding error that resulted in heartbleed, or the code that exploited it?
CWE is closest I can find as to "official naming". That and the term is widely used and describes the problem at hand.
Apr
15
comment When do you use subquery in SQL?
As a rule of thumb I use a subquery when I forget how to do the same thing with a join.
Apr
11
comment Functions returning either “OK” or “error message” instead of procedures
EInsufficientUserPrivileges, ERecordAlreadyExists look like some pretty common paths to me so you should write code for it to handle the condition, not throw an exception, because expected exceptions should never be exceptions but handled.
Mar
28
comment Should static data be stored in a database or somewhere else?
@gbjbaanb my reaction wasn't to the OP but to you and your comment about weekday names. Just recently I had to fix an application, where the initial programmer thought exactly that: those don't change. So he came up with the nice solution: if the name starts with an "s" it's weekend. Now fastforward and the application got internationalized and suddenly the weekend was only 1 day. And nobody knew why. Must be a European thing.....
Mar
28
comment Should static data be stored in a database or somewhere else?
@gbjbaanb my illustration wasn't nitpicking it was about how easy it is to make a wrong assumption on the: "this will never change."
Mar
27
comment Should static data be stored in a database or somewhere else?
"Static data that never changes (eg days of week names) are good to go in code" And even then you can go wrong: wait till your app goes international. Weekday names are NOT static at all.
Mar
27
comment Should exceptions do things other than tell the user something went wrong?
No, exceptions can leave your program in an unknown state. And one exception is not like the other.
Mar
25
comment Joel Test: Quiet working space as a developer?
Please don't let me hear conversations of others. I have an opinion about pretty much anything and need to process all info that enters my brain.
Mar
6
comment Should I refactor large functions that mostly consist of one regex?
How can a 100 line regexp do only 1 thing?
Mar
5
comment How to get better understanding of the users as a programmer
So basically you want to go sit in the chair of the business analyst? Become one? And then make user stories....you know where I'm going?
Feb
24
comment Why are dark color schemes in editors so popular?
The current trend isn't so much light on dark or dark on light rather then a trend of going towards lower contrast color schemes. Just look at programmers, it also has a low-contrast color scheme with no real white and no real black.
Feb
24
comment Apple eating problem
I didn't say what gets taken last, I specifically said, what gets EATEN last, this sounds like a backtracking problem to me.
Feb
24
comment An alternative to an array of functions?
What's the higher level problem you want to solve here? Why do you need so many functions in an array called by name?
Feb
24
comment Apple eating problem
Ok, a hint: focus on what gets eaten last instead of what gets eaten first.
Feb
19
comment How did separation of code and data become a practice?
I think what the author of the quote meant is that the magic numbers aren't really immutable.
Feb
12
comment Why is BigDecimal the best data type for currency?
I actually ran into the problem that I had 1234.10 in my (game)account and wanted to transfer all funds to another account and it refused because I "didn't have enough funds" in my account to complete the transaction. Minor nuisance ofcourse because you do 1234.09, but it surely looks unprofessional.
Feb
12
comment Why is BigDecimal the best data type for currency?
@user40989 I think it expands on DougMs answer by giving an example where floats are inadequate even when it's not a millionth of a cent.
Feb
12
comment Is it better to use a switch statement or database to look through 5,000 to 10,000 instances?
@user3201185 no, a serarch based on string will be slower then one on id. But still it will be more then fast enough with only 10.000 records. So fast you would probably not even notice the difference.