comments

Regex to match specific comments in code

Are there any regex experts who can help me clean up the following source code? I'm going through some existing code and I see several instances similar to the following: public enum Numbers { /// <summary> /// One = 1, /// </summary> One = 1, /// <summary> /// Two = 2, /// </summary> Two = 2, //...

2nd or 3rd person comments?

Do you write comments in 2nd or 3rd person? // go somewhere and do something (2nd person comment) or // goes somewhere and does something (3rd person comment) ...

Java - regular expression finding comments in code

A little fun with Java this time. I want to write a program that reads a code from standard input (line by line, for example), like: // some comment class Main { /* blah */ // /* foo foo(); // foo */ foo2(); /* // foo2 */ } finds all comments in it and removes them. I'm trying to use regular expressions, and fo...

How are C++-style comments handled in GCC 4.3.3 by default?

I'm using GCC 4.3.3 on Ubuntu 9.04 64-bit and was getting errors using C++-style comments in C code. When I say "by default" in the title, I mean simply invoking gcc test.c According to the GCC 4.3.3 docs (here), this is supported...yet I got the errors anyway. These errors went away with a simple -std=c99 addition to my compile string...

special comments and pre-processing.

Is a comment of the form /*:[url=users/%id]:*/ going to be a problem with any documentation toolkits out there (especially for PHP)? Or any other comment pre-preprocessors? (Related to http://code.google.com/p/caret/ ) ...

Are comments to show what version code was added/modified for useful?

Some of the developers on the project I work on have a habit of commenting their code to show which version of the product it was added for, e.g. // added for superEnterpriseyWonder v2.5 string superMappingTag = MakeTag(extras); if (superMappingTag.empty()) { autoMapping = false; } // end added for superEnterpriseyWonder v2.5 Whe...

Conditional comment for 'Except IE8' ?

I'm using <!--[if IE 8]><![endif]--> for targeting IE8, but there's some JS that I want to load for all browsers EXCEPT IE8, what conditional comment should I use? Edit: I wonder if this would work: <!--[if lte IE 8]><![endif]--> Thanks ...

Python: How to ignore #comment lines when reading in a file.

In Python, I have just read a line form a text file and I'd like to know how to code to ignore comments with a hash # at the beginning of the line. I think it should be something like this: for if line !contain # then ...process line else end for loop But I'm new to Python and I don't know the syntax ...

Is it possible to override the auto-indentation of comments in VB.NET/VS2008?

Is it possible to override the auto-indentation of comments in VB.NET (Using visual studio 2008)? Please see the comment above the second Case Statement in the code below for context. The IDE auto-indents the comment beyond the following Case Statement. I would like to override this behavior and bring it in line with the C in Case that...

pair programming with comments

Over the years, I've discovered that green-programmers tend to read the comments rather than the code to debug issues. Does having one person document the other person's code (and vice-versa) with the code writer's approval increase code quality in the long term? Is this a good idea? aside: I'm looking for middle-ground between solo p...

Mapping a polymorphic relationship onto 2 models simultaneously

I need to relate a Comments model with two ids at the same time but can't figure out how. Here' my situation. I am building an on-line school grading system and need to be able let the teacher make a comment on a particular student in a particular course for a particular term (grading period). class Course has_many :course_terms h...

Custom comment form in CCK template

Pre-abmle: I am using MakeMeeting module to create/display meeting polls. This module has its own Content Type and I can't get comments to show on the screen (whether I choose to show comments or on same page or not in Comment Settings for this node type). The MakeMeeting module has it's own theme functions, but perhaps they're not guilt...

Why is the usage of "#" comments frequently discouraged in PHP?

As far as I know, there are 3 types of comments recognized by PHP: /* A block comment */ // A single-line comment # Also a single-line comment However, many coding standards, for example, those of PEAR or Kohana, discourage the last type of comments with no explanation. The question is, why is it so? Is this syntax planned for deprec...

WordPress 'comment is awaiting moderation.' message not appearing when a comment is submitted?

Everything is pretty standard from WP samples, with minor modifications. But when a comment is submitted, it does not show the "your comment is awaiting moderation" message. The comments.php: <div id="comment-block"> <h4><?php comments_number('No Responses', 'One Response', '% Responses' );?> to &#8220;<?php the_title(); ?>&#822...

Adding my comments to the index view...Ruby on Rails

Ok...I am new to rails so this may be a stupid question but need help. I just watched and implemented Ryan Bates screencaset about setting up a blog. You can see it here http://media.rubyonrails.org/video/rails%5Fblog%5F2.mov. Here is the skinny: Two tables: Posts and Comments. Everything works great including the addition of comments v...

Including commented Class declaration in implementation file

Hi All, Everyone knows the advantages of a more readable code. So in order to make my code more readable what i do normally is include the commented class declaration in the implementation file of that class. This way i need not have to browse through various include directories to go to the definition. So, Is this a good practice or ju...

To comment out matches in Vim - independent on comment leader?

Hi! I want to comment out lines in some code I have. I have different kinds of codes, and they use different comment leaders. E.g. in latex: '%', in Fortran 90: '!' and in python: '#'. I want to do a substitute command that looks something like this: :g/<search-string>/s/^/<add-comment-leader-here>/ If this is possible, I could al...

Comments & OpenSource software.

This may sound like a foolish question or an observation, but i have seen that most of the times when one tries to look at the opensource code, there are no comments or just one or two lines at the start of the function telling what the function is used for e.g. register a user or data in table etc. There is no code which actually explai...

Is it ok for different implementing classes to throw different exception types?

If i have an interface, which i add comments to to identify that a specific exception will be thrown, is it ok for implementing classes to throw different exceptions? A (bad) example is: public interface IWidgetWorker { /// <summary> /// Do the work required for the specified work id. /// </summary> /// <param name="wor...

VS 10 mangles html comments?

Using the latest VS 10 we created html markup, then commented it with html comments. The file on disk is not mangled, but when it renders, it renders the html comment tags, then removes some of the html markup within the commented tags: Two questions (1) why would it not like the html comment tags and (2) why would it change the html c...