miniBill
  • Member for 9 years, 6 months
  • Last seen more than 2 years ago
Are my forms a danger towards code injection?
6 votes

It's not a security risk for your server, but it may be for your users. Beside the fact that if the input contains < the output might not be what you expected, the real dangers you face are XSS ...

View answer
Am I coding Java in C#?
4 votes

Have you considered subclassing TermExpression for the various operations? This way you don't have to worry, in Evaluate, if the state of the object is incorrect (which can't be, but code changes...). ...

View answer
Extract common code to enable/disable, show/hide controls on some condition
4 votes

First possible refactoring: define an enumeration for the three possible states enum InputState{ Hidden, Disabled, Enabled } and use it with an extension method (or by extending the ...

View answer
Interpreting Brainfuck code to C#, then compiling to a .exe
3 votes

You should use a for loop in the indent code instead of creating a string on the fly every time. There are the methods ReadAllText and WriteAllText in System.IO.File that could help shorten some of ...

View answer
How is my BlackJack game design?
3 votes

Some remarks: Your main method is HUGE, consider splitting it This code: deck = drawFromDeck(deck, player); deck = drawFromDeck(deck, dealer); deck = drawFromDeck(deck, player); deck = drawFromDeck(...

View answer
Quicksort using pointers
2 votes

I'd make right an exclusive instead of inclusive upper bound, that is write i < right instead of i <= right and last - v instead of last - v - 1. This has the advantage of making the base call ...

View answer
k-nearest neighbors using MATLAB with MEX
1 votes

Your algorithm is O(n^2), and as much as you can optimize, you can't do better with this. I don't see any particularly slow path.

View answer
Optimize list comparison method?
Accepted answer
1 votes

Some comments: && modelList.size() > 1 this check is redundant, in fact if (prevList.size() > 1 && modelList.size() > 1 && prevList.size() == modelList.size()) { ...

View answer
I'm not sure if I still love Fibonacci, but my code is getting better. How much better?
0 votes

I think you are overcomplicating things. If the number is not in the dictionary, there is no need to check whether \$n-1\$ is in there. Just calculate \$F(n-1) + F(n-2)\$ and let the memoization do ...

View answer
Is Concurrent Collection Needed Here?
0 votes

If you only need to return an IEnumerable<Item> you could simply enumerate to Lists and then Concat the results. Otherwise you could consider using a linked list, enumerating in parallel and ...

View answer
Code review: infix to postfix converter
0 votes

Instead of those cascade ifs, use switches Replace all the if(foo == true) with if(foo)

View answer
"P1 attacks P2" and "P2 attacks P1"
-1 votes

If the 5 in the while loop is fixed you can simply unroll it as: [C code, but I hope you get the idea] void turn(int player); void foo(){ int p1speed = 3; int p2speed = 5; int ...

View answer