RubberDuck
  • Member for 7 years, 9 months
  • Last seen this week
WebApi Get with paging
Accepted answer
6 votes

Let's start with the BUG. if (entity.Count() == 0 || entity == null) If entity is null, then you'll get a NullReferenceException when Count is called, so there's currently no possible way the ...

View answer
Loop through column cells and compare value with a Collection
6 votes

Scripting.Dictionary may provide a better lookup time depending on how large the data is. source It will, however, provide a nicer experience and make the code more understandable. If Not dict....

View answer
Modified TextBox for forms generating SQL statements
Accepted answer
6 votes

There's not much to review here really. I'd be more interested in reviewing the code that's actually doing the work, but here goes. Lose the Systems Hungarian notation. The IDE/Code tells me what ...

View answer
Scrolly - A (very) simple infinite mouse "scroll"
6 votes

You've implemented an infamous Winforms anti-pattern. You shoved the entire implementation into the code behind. This tightly binds the logic and presentation, making the logic impossible to test in ...

View answer
Running Lights - Embedded "Hello World"
6 votes

It's a small point in comparison to the other answers, but worth noting for a beginner. This is the LED header file. #include <avr/io.h> #define LEDPORT PORTE_OUT #define LEDPORT_DIR ...

View answer
Implementing Dynamic Network Message Handling
6 votes

I really don't like this enum and "type" member. public enum DataMessageType { Login, } public interface IDataMessage { ILogger Logger { get; } DataMessageType Type { get; } void ...

View answer
Product Manager managing product listings and prices
Accepted answer
6 votes

if (myMatch.Success) { return true; } return false; That's an awful lot of code for a simple thing. Why not directly return the value? return myMatch.Success; "myMatch" isn't a very ...

View answer
VBA macro to move data across workbooks
Accepted answer
6 votes

It's a nitpicky thing, but I prefer explicit scoping. Sub MoveData() Should be Public Sub MoveData() There are lots of reasons to avoid Activating and Selecting objects. Performance is just one ...

View answer
A tiny library for textual serialization of lists in Java
6 votes

I'm.... concerned about this code. public static <E> List<E> deserialize(String text, LineDeserializer<E> deserializer) { return ...

View answer
Calculating how long sales reps are idle
6 votes

First, let's give this some proper indentation so we can see what's going on. Sub Latency() ' this sub-routine is used to calculate the no of recent idle months by an agent Application....

View answer
The multilingual duck
6 votes

I would group all of your properties together. Right now you have Code separated from the other properties by the ctors. When overriding Equals, it's important to be sure that it can't throw an ...

View answer
Copying columns and formats on condition
6 votes

This looks nice, but it's a proven waste of time. Dim wsIndex As Worksheet Dim wsImport As Worksheet 'Raw Dim wsFinal As Worksheet Dim indexHeaderCol As ...

View answer
Solving quadratic equation using quadratic formula
6 votes

Maybe it's a personal preference, but I find calls like this hard to understand. public void DrawLineAfterContinue() { View.DrawHorizontalLine(true); } C# supports named parameters. ...

View answer
Socket server class
6 votes

This is not exception handling. catch (Exception ex) { } And neither is this. catch (ObjectDisposedException) { } catch (SocketException se) { } If you're going to catch an exception, you need ...

View answer
Stack with getMin method
6 votes

@Test public void testRandomStack(){ System.out.println("----------------------"); StackMin<Integer> s = new StackMin<Integer>(); s.push(2); s.push(-1); s.push(0); ...

View answer
Calling Stored Procedures with Lots of Parameters
Accepted answer
6 votes

First, your question, then something else I noticed. You have a few options to clean this up. There's the easy way and the robust way. Let's look at the easy way first so you can make your boss happy. ...

View answer
Linq me a FizzBuzz
6 votes

Are you sure about your requirements? In particular this: 'fizzbuzz' for numbers that are multiples of 15 The problem is generally stated as Print "FizzBuzz" if the number is a multiple of 3 ...

View answer
Importing different type of files into Lists
6 votes

I'm going to reiterate ANeves's answer and suggest that you not use Contains() to determine what the file extension is, but I don't recommend using EndsWith() either. It would be much better to use ...

View answer
Search arrays for values
6 votes

I hate to pick on names, but I really dislike single letter variable names. foreach (string[] r in SearchKeys.Keys) How about string[] keys instead? Maybe you can think of something better. And ...

View answer
Checking for Duplicates, Except
6 votes

Let me point out some things that I know can be improved so that other answers can focus on my problem. SELECT * I shouldn't be selecting all like this. Even if there's not really a performance hit ...

View answer
Find smallest prime number greater than given n
6 votes

Simple is nice, but you can easily more than double the performance. for(i=1; i<=n; i++) There's no reason to loop the whole way up to n. If you've not found a multiple of n by time you've ...

View answer
The Bucketizer Script
6 votes

Is the error/exception handling overkill? No. It is definitely not overkill. Particularly because you're throwing an error on certain conditions. This gives you the option of redirecting rows into an ...

View answer
Creating an object oriented model in VBA using COM and ADODB from 2 depended SQL tables
6 votes

Bitwise conditionals make no sense to the "average" VBA dev. I like that you left a comment here, but consider leaving an remark that the check is done bitwise. ' if sucessfully connected then If (cn....

View answer
Triggering editing mode for a form
6 votes

A small note on naming: Being new to your code base, I have no idea what MIF represents and worse, IF looks a lot like if and it confuses my eyes. As a rule of thumb, don't abbreviate names. Spell ...

View answer
Extracting key information from a directory of XML files
6 votes

I'll try not to duplicate advice, but seriously, use an error handler and make sure the application gets set back to a workable state. There's nothing more frustrating for a user than to end up with a ...

View answer
Extensible logging - DatabaseLogger
Accepted answer
6 votes

DatabaseLogMessageFormatter I didn't change the ILogMessageFormatter interface, but the DatabaseLogMessageFormatter implementation ignores the parameters and uses the FormatMessage method to ...

View answer
Array Implementation of Queue
6 votes

Disclaimer: I'm not a Java guy. But.... This If needs some breathing space. public void enQueue(T value) { if ((rear+1)%size==front) { It would be much more readable like this: if ((rear + 1) ...

View answer
Traversing and printing complex Dictionary types (Scripting.Dictionary) - Dictionary inside of a Dictionary
Accepted answer
6 votes

A couple of things, which you've really more or less pointed out already. You've shown us two different implementations of the same routine that outputs two two different places. I think what you ...

View answer
Managing a cruise system
Accepted answer
6 votes

Customer Class It's good practice to explicitly declare the scope of instance variables, if you don't specify it, they will public by default. However, instead of exposing instance variables as ...

View answer
Performance for tags for cars in Java
6 votes

The single most important thing you can do right now is indent your code so that it can be read. It's nearly incomprehensible as it is. You should also be consistent with where you put the braces. ...

View answer
1
3 4
5
6 7
19