code-review

Java: Calculating a metric of String simliarity

This method is a bottleneck in my program. (Or, it is at least where most of the time is being spent.) Its purpose is to calculate the similarity between two strings based on the way characters occur in both, or occur in one or not the other. The code is correct, but I would like to optimize it. Do you see any inefficiencies, bad pract...

F# remove imperative code - quick help

I'm new to functional world and appreciate help on this one. I want to SUPERCEDE ugly imperative code from this simple function, but don't know how to do it. What I want is to randomly pick some element from IEnumerable (seq in F#) with a respect to probability value - second item in tuple (so item with "probability" 0.7 will be picked...

Quick way to locate all sub-classes that override a certain function?

I have a base class that declares a virtual function, and a large set of subclasses that inherit from the class, some of which may override the function. Now I need to alter the behavior of the base function (make it non virtual and move the overridable functionality to a different place), and I wonder if there's a quick way to locate al...

Best php qa tools

Hello, I am looking for qa tools for php. I am used to pmd, findbugs and checkstyle in the java world. Do you know some similar tools for php doing code analysis ? So far I have found but not tested yet : phplint pmd's cpd module PHP_CodeSniffer Thanks in advance for your help ...

Test Impact on code change

Are there any tools (for C/C++) available to visualize the modules affected or the test cases to be executed when a block of code in changed. Example, If i modify few lines in a method of a class, I should be able to get metrics on number of calling methods, affected modules. Also If i have a traceability from Code-TestCase, can this...

Java: DRY out these two functions

These two functions have basically the same code. How can I factor it out? public static String[] removeSuffix(String gA, String gB) { String[] results = new String[2]; results[0] = gA; results[1] = gB; if (gA.equals("") || gB.equals("")) { return results; } if (gA.charAt(gA.length() - 1) == gB.cha...

How to find all unused members or objects

I want to try to make code reviews go a bit faster. While in VS, on a particular class or .aspx page or whatever it is, I can right-click a variable, method, property and use the Find Usages, that's still a very manual process and I wouldn't want to do this on every single method, property, etc. on a page...because most probably have no...

Code Review Tool Integrated with Gemini

Has anyone come across a code review tool that integrates with Countersoft's Gemini? I don't need anything too sophisticated. We have a relatively small development team of 10. I'm not looking for yet another web app to log into, I'd like to assign code reviews tasks using Gemini (similar to the FogBugz/Kiln). We are currently using SVN...

Grouping data on year

mydata = [{'date': datetime.datetime(2009, 1, 31, 0, 0), 'value': 14, 'year': u'2009'}, {'date': datetime.datetime(2009, 2, 28, 0, 0), 'value': 84, 'year': u'2009'}, {'date': datetime.datetime(2009, 3, 31, 0, 0), 'value': 77, 'year': u'2009'}, {'date': datetime.datetime(2009, 4, 30, 0, 0), 'value': 80, 'y...

WCF autogenerate FaultContracts

We have many WCF services, we have not been using contract first. So now we have a lot of code that throws exceptions, that are not specified in the FaultContracts. Other than manually inspecting the code. Is there a way to generate FaultContracts or at least get a warning when a FaultContract is missing? Thanks Shiraz ...

What is a good (coding) platform to use for telephone coding interview?

We are going to interview some candidates over the phone and we need the candidate to write code (pseudo code). Obviously, asking the candidate to read the code out loud to us over the phone isn't ideal. I wonder if there is any good platform to do this? I know Facebook uses a simple program they wrote by themselves, and Google uses G...

PHP beginner - looking for veteran criticism of code example (code works btw, that's a start!)

From what I've gathered browsing SO, I'm the worst nightmare of good people like you: someone who never formally learned any programming, decided he'd like to enhance his hobby website, and bought a fast-track PHP book off the shelf and went at it. Browsing SO has taught me a great deal of things, highlights of which include: PHP is t...

Mailing list to review Git commits

We use Git as a revision control system for our code. I need to setup a mailing list to help code reviews. Each new commit to a specified subset of Git branches must be sent to the list as the full patch inside the post body. List must support human replies as well, so all developers would be able to comment on the code. I guess, I n...

How can I improve a Ruby on Rails code that has a lot of SQL as strings?

I have a piece of Ruby on Rails code that has a complex SQL query (well, not that complex, but as far as I know beyond the ORM capabilities) and for my taste it has too many strings and harcoded values. I'd like to improve it as much as possible, so my question is open ended, what else can I do to improve it? Some particular issues I ha...

Alternative to line numbers for identification of code

Line numbers are great in the IDE when you are working with compiler errors - but they degrade overtime. In other words they change when code is added/removed/refactored and the line number that was used in a code review or stack trace may be in the wrong place. Is there an alternative to using line numbers to identify specific lines of...

Code Review: Is this the most efficient/elegant way to recursively walk a tree

This is more of a general question so the answer does not have to be in C#. I have a general code structure below that I use to recursively walk a tree structure. In this particular case I am appending to a string builder object in each iteration. Is there a way to improve this code to be faster or better? public static void Recur...

How to decide which parts of code to review?

Esp. if there is a very large code base and if the team is also doing some level of test-driven development, it is not practical and also does not make sense to do review of entire code-base. In such a case, how do we decide which parts of code to review and whether it is effective at all? This question is also related to 527259. ...

Code Review Tool for Eclipse + Teamprise + TFS

We write Java code, work with Eclipse but use TFS (through Teamprise) as a repository since vast majority of our company is .NET-based. Do you have an idea whether there is a tool supporting code review which works with both TFS as a repository and Eclipse as an IDE and isn't crappy at the same time? Open source preferred, but any idea ...

Challenges of code review with remote team

My entire team works from a different geographical location and I am the only programmer working remotely. I often find it quite difficult to have my code reviewed, as people take very long time to give their comments (usually they are genuinely busy with high priority work and I work mostly only on low priority projects/task ) .The com...

How to add insert-comment feature to any Windows text (code) editor

I want to write a Windows add-on or application that adds the following function to any Windows text (code) editor: I select one or more lines of code in the editor (existing functionality of the editor) I right click and there's an "Insert Comment" choice which I can pick I type my comment and then click outside the comment edit box T...