code-review

Code Review - Clearcase - How to get a list of files a user modified since another label?

Hi all, I'd like to create a dynamic view that only shows the files a user created/modified for a particular label. Right now, I am listing all of the files in the label and comparing that with the previous label. If I have to use cleartool to find the files, that is fine with me. I'd like the process to be more automated than it cur...

Is Rietveld inextricably tied to App Engine?

I've been looking at Rietveld as a solution for the lack of code reviews at my company. Can it be set up on a server in-house without using App Engine? It seems to have a bit of App Engine specific code, and I'm not sure it could be set up on a plain old Django/Apache install. I've looked around, but haven't found any information abou...

Code Review (first attempt at multithreading)

Ive been working on setting up a throttle to limit the number of messages sent. Although this works, Im curious if there is a better way? Any advice is appreciated. public Class MyApp { private long _messagesSent; private long _totalMessagesSent; public int NumberOfMessages { get; set; } public int MessagesPerSecond { get;...

Ruby on Rails coding efficiency - map CSV data to model

I have a question relating to minimizing some code I'm working with. I am using the map-fields plugin/gem to allow my user to select what fields in a CSV file will map to attributes in a model. map-fields with upload The map-fields plugin uses the name of a select object in the plugin to determine where the CSV columns match up too....

Simplify PHP DOM XML parsing - how?

Hi coders! I've spent whole days with PHP's DOM functions but i can't understand how it works yet. :( I have a simple XML file that looks okay but i cannot use it how i think when i've created it's structure. Sample XML fragment: -pages //root element -page id="1" //we can have any number of pages -product id="364826" //we...

Code review: Cross site scripting DOM load event, could this be cleaner?

Source on Github: http://github.com/tschellenbach/Fashiolista-Button/blob/master/buttons.js Blog post explaining the code http://www.mellowmorning.com/2010/08/03/creating-your-own-diggfacebook-liketweetmeme-button/ The current dom load version is rather verbose. I need the domload event because the code detects all a[href] elements i...

Reasons for doing Code Reviews when we only have Senior Developers

I'm currently trying to pitch code reviews ( to improve code quality) to my manager. I am getting some push back, due to the belief that code reviews aren't required when you only have senior developers (and no juniors). What are some good arguments that I can make for Code Reviews, even though our team is composed only of Senior Devel...

this code is supposed to fail but it works, why?

Folks I think I will throw all my modest C lore away. Look at this code please: int main( int argc, char ** argv, char ** envp ) { int aa; srand(time(NULL)); int Num=rand()%20; int Vetor[Num]; for (aa=0; aa<Num; aa++) { Vetor[aa]=rand()%40; printf("Vetor [%d] = %d\n",aa,Vetor[aa]); } } I would think that this should th...

Question about a Dependency Property example

In the book Visual C# 2010 Recipes: A Problem-Solution Approach, there is an example demonstrating the power of Dependency Properties. The example describes a UserControl that has two properties TextFontWeight and TextContent that have the dependency properties TextFontWeightProperty and TextContentProperty attached to them respectively....

Code beautifiers with reorganisation ?

Hello, As a code formatter in my git repository as a post commit hook, I use astyle in Java mode which is very cool. But does anyone knows a code formatter that can reoganize the code (ctors, accessors, mutators, etc ...), and reassemble them together ? Regards ...

How to check if a radiobutton is checked in a group

I have group of radio buttons, each group ranges from 5 - 27 radiobuttons. And if any radio button in a group is checked I store 1 in db else I store 0. Now I'm checking each radiobutton using if loop to see if they are checked and set database value. I'm also trying to use the code below. Is there a good/better approach to check if they...

Refactoring - which pattern to use in this example?

Hi, I have a function which is processing rows from an excel file.In this function,I have a for loop.Now,once a row is extracted,we check for various conditions.If any condition is false,we continue with next row.Can this code be made more structured using a pattern? foreach (System.Data.DataRow dr in ds.Tables[0].Rows) ...

Performing set operations on diffs?

Are there any tools which can perform set operations (union, intersection, difference, etc) on diffs? For example, if I've got two diffs that overlap (ie, contain hunks with identical changes), I'd like to be able to do things like "get all hunks which are only in one diff" or "get all hunks which are common to both diffs". For example...

Git hooks - propagating from remote repository?

I'm currently looking to convert an existing SVN repository to git, and then to use Reviewboard for reviews before allowing pushes. I've only recently started using git and am far from an expert on it, however what I would like to do is have a pre-push hook which runs "post-review" to submit the changes to ReviewBoard. I have a hook wo...

How do you promote a culture of peer code review with your team?

We have tried many methods such as Code review required before check-in (hard to enforce) Monthly code review sessions (tend to side-track, time consuming, too high level) One or two devs with free cycles review changesets as they are added (low participation) We use TFS and could write a tool to leverage the API or build a workflow ...

Do JavaScript compilers have its preference over how indentation, spaces, and curly braces are placed in the source code?

Hi all. I'm currently having my peer code review with my colleague and have had this question on the subject. Is there any preferable syntax for coding, say, if clause statement for JavaScript compilers(JavaScript Engines)? I personally prefer the pattern A when I review the code myself, but do the compilers have their preference too? ...

How could I tighten up this simple code?

I'm a very early-stage python programmer, and I wrote this simple script to convert miles to kilometers or kilometers to miles: metrics_dict = {("miles", "kilometers"):1.609344, ("kilometers","miles"):0.62137119} number = float(raw_input("Enter the number of units you would like to convert: ")) from_metric = raw_input("I would like to...

A function that returns only true

During a code review I performed today for my colleague, I noticed a function that was defined as returning a boolean value, but in practice it returned only true. In a case of failure, this function threw an exception. I pointed it out and advised to change the return value to void (the code is written in C++). I had no doubt that this ...

using reviewboard with a project hosted on GoogleCode

I can't seem to get reviewboard to work with my SVN project hosted on GoogleCode. When I try to use post-review, the automatic diff posting script, it says that my repository is not in the list of known repositories. It seems to be trying to connect to the SVN server as the reviewboard server instead of the actual server. When looking at...

A little help F-Sharping up this path-finding code, please

EDIT The bounty is regarding my follow up question re: the generic version of the code. As per my last post in this thread, Thanks, JD Hi all, I've just tried porting some of my C# 2D path-finding code into F#. But I'm currently in the 'limbo' of being a C# OO developer and also, probably, trying too hard to be purely functional with m...