code-comments

PHP: How are comments skipped?

匆匆过客 提交于 2019-12-10 19:11:00
问题 Well if I comment something it's skipped in all languages, but how are they skipped and what is readed? Example: // This is commented out Now does PHP reads the whole comment to go to next lines or just reads the // ? 回答1: Your question doesn't make sense. Having read the '//', it then has to keep reading to the newline to find it. There's no choice about this. There is no other way to find the newline. Conceptually, compiling has several phases that are logically prior to parsing: Scanning.

CSS - smarter code comments

前提是你 提交于 2019-12-09 16:44:55
问题 I read some time ago about a way to comment a css block in a such way that you only need to remove one end of the comment character set in case you want to uncomment the block later. But I can't remember how it was done :( Maybe someone here does know :) 回答1: /* * / .class { color: #ffa; } /* */ The space between the * and / in the first line causes the comment block to be un-closed until the final, paired, */ on the last line. If you close that space then the .class css is un-commented. For

CSS - smarter code comments

点点圈 提交于 2019-12-04 04:30:00
I read some time ago about a way to comment a css block in a such way that you only need to remove one end of the comment character set in case you want to uncomment the block later. But I can't remember how it was done :( Maybe someone here does know :) /* * / .class { color: #ffa; } /* */ The space between the * and / in the first line causes the comment block to be un-closed until the final, paired, */ on the last line. If you close that space then the .class css is un-commented. For languages such as php and JavaScript the opening /* in the last line can be replaced with a // as a single

HTML table to “graphical text” for code comments

青春壹個敷衍的年華 提交于 2019-12-03 15:36:27
Is there a tool (ideally command-line-based) that can help in converting the source to HTML tables into “graphical text” (think perhaps ASCII art for HTML tables) for use in code comments, as show below? For example, given the following HTML table source <TABLE BORDER=1> <CAPTION>A test table with merged cells</CAPTION> <TR><TH ROWSPAN=2><TH COLSPAN=2>Average <TH ROWSPAN=2>other<BR>category<TH>Misc <TR><TH>height<TH>weight <TR><TH ALIGN=LEFT>males<TD>1.9<TD>0.003 <TR><TH ALIGN=LEFT ROWSPAN=2>females<TD>1.7<TD>0.002 </TABLE> the tool would output something like the following to be embedded into

Access attributes/methods comments programmatically in Ruby

£可爱£侵袭症+ 提交于 2019-11-30 15:50:37
问题 Is there a way for programmatically accessing a method comments? or an attribute comments? I would like to use it as a description for the method in a documentation which I don't want to be static or generated with rdoc or equivalent. Here is an example of a Ruby class: Class MyClass ## # This method tries over and over until it is tired def go_go_go(thing_to_try, tries = 10) # :args: thing_to_try puts thing_to_try go_go_go thing_to_try, tries - 1 end end Basically, I'd like to be able to do

Access attributes/methods comments programmatically in Ruby

☆樱花仙子☆ 提交于 2019-11-30 15:39:58
Is there a way for programmatically accessing a method comments? or an attribute comments? I would like to use it as a description for the method in a documentation which I don't want to be static or generated with rdoc or equivalent. Here is an example of a Ruby class: Class MyClass ## # This method tries over and over until it is tired def go_go_go(thing_to_try, tries = 10) # :args: thing_to_try puts thing_to_try go_go_go thing_to_try, tries - 1 end end Basically, I'd like to be able to do the following: get_comment MyClass.gogogo # => This method tries over and over until it is tired No,

What are your “hard rules” about commenting your code?

╄→гoц情女王★ 提交于 2019-11-29 14:07:02
问题 I have seen the other questions but I am still not satisfied with the way this subject is covered . I would like to extract a distiled list of things to check on comments at a code inspection. I am sure people will say things that will just cancel each other. But hey, maybe we can build a list for each camp. For those who don't comment at all the list will just be very short :) 回答1: I have one simple rule about commenting: Your code should tell the story of what you are doing; your comments

Why do /**/ comments work in stylesheets but // comments don't?

扶醉桌前 提交于 2019-11-29 02:57:46
Is there a good reason for this? Lame question, but I just wondered if there was a reason why. The syntax for comments in CSS is: /* comment here */ The // is not a valid syntax. I guess this allows CSS to work correctly when stripped from whitespace and new line characters during minification . Because the specification allows for /**/ but not // :) Seriously, though, CSS treats newlines like all other whitespace, and would not be able to determine the end of the comment without a terminating delimiter. Because /* */ is the style that is defined for comments in CSS. There are a lot of other

How do you comment a Perl regular expression?

柔情痞子 提交于 2019-11-27 21:16:18
问题 How do you put comments inside a Perl regular expression? 回答1: Use the /x modifier: my $foo = "zombies are the bombies"; if ($foo =~ / zombie # sorry pirates /x ) { print "urg. brains.\n"; } Also see the first question in perlfaq6. Also it wouldn't hurt to read all of perlre while you're at it. 回答2: Even without the /x modifier, you can enclose comments in (?# ... ): my $foo = "zombies are the bombies"; if ( $foo =~ /zombie(?# sorry pirates)/ ) { print "urg. brains.\n"; } 来源: https:/