code-review

Can I make this C++ code faster without making it much more complex?

Hi all, here's a problem I've solved from a programming problem website(codechef.com in case anyone doesn't want to see this solution before trying themselves). This solved the problem in about 5.43 seconds with the test data, others have solved this same problem with the same test data in 0.14 seconds but with much more complex code. ...

why licenced code is packed and then is reviewable using Disassembler at the same time ?

Is it legal / ethical to copy code for any reason, or utilize it (like code review) from the .Net framework or any other .Net based API using Reflector or similar tools ? If it is, what advantages do Microsoft and other licence based softwares have for packing there code ? If it is not, Why can we use ILDasm and Reflector ? An...

Does speaking interfere with a code read / review?

I find that I myself cannot keep quiet when I present my code to a peer. However, when someone else presents the "business logic" to me while I am looking at the code, it simply does not register in my head - I am just looking at the code. Now, what can make 1:1 code review more productive? I think this is particularly hard when the cod...

API Design for Task/Parallelization Library

I've just completed a significant revision of my task pool/parallelization library for the D programming language. I'm interested in having the API critiqued, especially by people who are not regular users of D, but know a decent amount about use cases for such a library. I'd like to avoid the groupthink that would be created by asking...

the right code flow in attached code? (ruby)

in the extract of my script code (see the first piece of code below) I use the array @post_csv_order to specify the order and key => value relationship of elements for the hash @post[post_id]. I run the assignment line @post[forum_id] = Hash[*@post_csv_order.flatten] in a loop when I collected all values (like forum_id, post_title etc)....

can I declare an array where one of the array elements is undeclared variable? (ruby)

#input_from_the_net = "" my_array = [ ["Header name" , input_from_the_net] ] input_from_the_net = "a value scraped from the net" puts "#{my_array[0][0]} is #{my_array[0][1]}" EDIT: I use the variable input_from_the_net later on in the loop and assign its value into a hash. That hash is then stored inside another hash. If I use inpu...

how to code a condition: 'can this string be converted into a date type'? (ruby)

can I code this condition in ruby somehow? I need to know if a string can be converted into a date variable. The only way how to do it is Date.parse("my string") and exception. Is there any other way? date_scraped_from_the_net = "20 Dec 2009" or it could be "today" if date_scraped_from_the_net is not a date type needs_to_be_updated ...

Find all code that is not protected by a Try Catch

I am doing a code review of a large SharePoint project. One thing that I need to check is that there are no unhandled exceptions. We allow exceptions to "buble up", so in many cases they will not be caught before the UI layer (web part). Is there a way to get a list of all methods that have code outside a try catch block? ...

Alternative way of implementing a groupBy method in Scala?

I've come up with this implementation of groupBy: object Whatever { def groupBy[T](in:Seq[T],p:T=>Boolean) : Map[Boolean,List[T]] = { var result = Map[Boolean,List[T]]() in.foreach(i => { val res = p(i) var existing = List[T]() // how else could I declare the reference here? If I write var exi...

bug or desired behaviour? couldn't identify form using string 'post' but 'POST'. html contains 'post' though (ruby,mechanize)

the code that didn't work: login_form = page.form_with(:method => 'post') and code that works login_form = page.form_with(:method => 'POST') I inspected the form object via puts page.forms.inspect and got [#<WWW::Mechanize::Form {name nil} {method "POST"} ....] html source: <form class="login" method="post"> <fieldset> <legend>...

Do we have a tool for Cleaning the Code Name Conventions

im looking for the tool which takes the C# source code as input and does the processing based on the rules set like change all the method parameter to camel case or pascal case vice verse and gived output the modified source code. ...

Working thru sample code

Hi, I am trying to work thru some sample code. The code I am having a problem with is: private ListControl GetSelectedList() { return (ListControl)FindControl(ddlControls.SelectedItem.Value); } ddlControls is a DropDownListBoxControl collection What does the ddlControls.SelectedItem.Value return (its a numeric value, but I don't kno...

Dynamic Code Analysis tools for Objective C/Xcode

Hi all, Is there any tools available for Dynamic Code Analysis for Objective C Codes? Thanks in Advance ...

Feedback on TOC Generation Code

Hi All I wrote a small code to generate ToC or Hierachical Bullets like one sees in a word document. Like the following set 1. 2 3 3.1 3.1.1 4 5 and so on so forth, the code is working but I am not happy with the code I have written, I would appreciate if you guys could shed some light on how I can improve my C# code. ...

how to mark code review defects in eclipse?

i'm using eclispe 3.5 + mylyn + trac. i'm looking for a way to mark source locations, that we identify in code reviews, in the IDE. i need at least a way to collect all source locations and associate them with either a review or an assignment. i'd prefer to use mylyn tasks as much as possible, but i can settle for the most basic eclip...

How beneficial is a top down code review?

It seems that most code reviews are bottom to top - being that the lower engineers get their code reviewed by the higher ups and the higher ups by the managers or not at all. It occurred to me when working with some new graduates that a top down code review may be a great thing. The idea being that us older guys have probably adopted so...

C# XNA: How to remove repetition from this simple function?

I have a game consisting of ships that fly around on a 2d grid. I am writing a function that takes a location, and figures out if the (predefined) target can be hit from there. This simply requires checking all the grid square's in the potential aggressor's line of fire. In most cases, this is a cross, formed like so: (currX +/- SHOT_R...

How to quote in HTML (not blockquote)?

I want to some sample code in a html page. How do I do it, for example I want to show a tag and image tag, in stackoverflow I use 4 spaces: A Tag example: <a href="your_url"></a> Image Tag example: <img...> ...

C89: Any beginner mistakes in this code?

I am new to C. (I'm using C89 on Visual Studio 2010.) I wrote a little program that uses a tree to give a histogram of arguments presented to the program. Are there any obvious beginner mistakes I've make? Everything appears to run fine in my extremely limited testing. hist.c #include "tree.h" #include <stdlib.h> #include <stdio.h> in...

Logic on DAL class??

Guys, I have a conceptual question.- I have a Class named ClientDAL that inserts an object on the DataBase (Im using LINQ2SQL).- But before insertinng that class checks that it is not already on the database (check if it exists already on the DB) so I have a try and a if incrementing the ciclomatic complexity.- My question is, ClientDA...