Hot answers tagged

21 votes
Accepted

Don't search for minors, it isn't allowed

This part of the review is focused on the Javascript aspect of the answer I will be really light on this review. I will try to make it short and quick. You have some mixed quotes. Consider the ...
13 votes

C# Am I using proper SOLID principles?

I suppose the simplest thing is to go through the principles: SRP - Cannot see any 'too big' things in your example OCP - The example is small enough and you are not using class inheritance that I ...
10 votes
Accepted

Simple Google ReCaptcha validation

private readonly string _ReCaptchaSecret; private readonly string _ReCaptchaSiteKey; private fields are either ...
8 votes

Validate and Add Service Provider/Location in C#

There are five lines that are repeated three times: ...
  • 10.9k
8 votes
Accepted

C# Convert BLOB to jpg, resize, then back to BLOB

Welcome to CodeReview! I hope you get some good feedback. Absolute paths ...
  • 54.4k
7 votes
Accepted

Displaying a row of buttons

This can be shortened up quite a bit. First, you have presentation logic intertwined in your ASP code, which is the main cause for the code repetition. Shortening this code and DRY-ing it up involves ...
7 votes
Accepted

Educational website using ASP.NET webforms

...
7 votes
Accepted

Audit table queries for various combinations of search criteria

First of all you should remove duplication. It's clearly that every if..else block has same code for filling DataTable and binding it to ListView. Move it to the bottom: ...
7 votes

Combating magic strings in a web application

First point, these extensions are really cool. I don't have much comments to give, your code looks pretty good! The ActionInfo class could be simplified a little :...
  • 12.3k
7 votes
Accepted

ASP controller for tracking equipment

Index It would appear you primarily do three things here. Sort, Filter, and Page. There's not much to say about your paging, but the sorting and filtering logic clutter the action. Try creating an ...
  • 1,970
6 votes
Accepted

Displaying a video player to eligible users

What you call "underscore functions" are actually the result of a few principles including separation of concerns, single responsibility and sure, there is some encapsulation involved as well but that'...
6 votes
Accepted

jQuery dialog for help popup

I would suggest loading the external file and initializing the dialog prior to the event...kind of like: ...
  • 306
6 votes

Simple Google ReCaptcha validation

I'm not a fan of properties in the form of: public List<string> ErrorCodes { get; set; } as someone can do this: ...
6 votes

Simple Google ReCaptcha validation

...
  • 50.1k
6 votes

Parsing pipe delimited lines

In the object initializer syntax you're using here: ...
6 votes

Parsing pipe delimited lines

Will I get into trouble if I post the same solution to both questions in two places - here and there? :-) There is no one proper way of doing this but I have a suggestion for you that uses a custom ...
  • 44k
6 votes
Accepted

External application for the web application deployment

static void Main(string[] args) If you're not going to use args, you can omit them: ...
  • 24.1k
6 votes
Accepted

Which is correct : Open one Connection for inserting List of objects or open connection for every single insertion?

In general, the best is to do all your inserts in one connection. Open/Close a connection implies a penalty. Although it is mitigated by some connection pooling mechanism on the database side (btw ...
  • 266
6 votes

Factory for report handlers

Not sure if that's going to improve the maintainability index, but You're misimplementing Inversion of Control. IoC is when your dependency (namely, IReportHandler)...
6 votes
Accepted

Update SQL database with using statement and SqlParameters

Stacking the using statements I am particularly difficult to please with code that has nesting, and I highly prefer to stack the ...
  • 1,023
6 votes

Find consecutive numbers and turn them into ranges

Letting a single method do everything is not such a good idea. You should rather separate the logic for finding consecutive numbers from creating a string from ranges and let them produce the final ...
  • 44k
6 votes

C# Am I using proper SOLID principles?

IMO returning IEnumerable<T> from an API is a violation of "L", as running GetEnumerator() a second time (or ...
6 votes
Accepted

Is this correct way to setup DB Infrastructure with repository pattern and Dapper

Quick remarks: Why do you convert a string to a string: ...
  • 10.9k
5 votes

Code optimization by constant if-structure iteration removal

Besides the two answers already given, I'd also suggest the following. Rename projLead to projectLeader. Same for ...
  • 10.9k
5 votes
Accepted

Return a list of values from a single column in a DataTable

Two code-style issues are immediately obvious: Use braces for 1-liners only split lines where it overflows Code like: ...
  • 96.9k
5 votes

Educational website using ASP.NET webforms

Comments You have a lot of useless comments in your code which should be deleted because thy don't add any value to the code but reduce the readability. A very good answer about the usage of ...
  • 50.1k
5 votes

Educational website using ASP.NET webforms

Jeroen has already covered some of the problems with Comp_CatID/Comp_CatID_D/Comp_CatName/<...
  • 16.2k
5 votes

EF lookups and enums

Instead of overloading the == and != operator you could simplify the part with the heavy casting by casting only once. Instead ...
  • 50.1k
5 votes
Accepted

Generic getting single value from DB in C#

Something smells hinky having this class inherit from something called Page. Like it's mixing UI and data concerns where it shouldn't. What does ...
5 votes

Checking overlap ranges between two prices

I am adding my comments at first glance. This is not a final review as this code needs lots of refactoring. Delete commented code Never keep commented code; it adds distraction while reading by ...
  • 2,638

Only top scored, non community-wiki answers of a minimum length are eligible