comments

difference between comments with 2 dashes vs 3 in Coldfusion

人走茶凉 提交于 2019-12-06 04:02:42
问题 What is the difference between comments using 3 instead of 2 dashes? Example <!--comment here--> vs <!---comment here---> Also do people find it more readable if there's a space between the dashes and the text e.g. <!-- comment here --> 回答1: Two dashes signify an html comment. Content within html comments are included in the output of CF pages ie viewable in the html source. Three dashes signify a ColdFusion comment. Anything enclosed within the comments is ignored by the ColdFusion compiler,

Retrieve javascript comments in javascript, or, how do I parse js in js?

无人久伴 提交于 2019-12-06 03:39:49
I am looking for a way to access javascript comments from some (other) javascript code. I plan on using this to display low level help information for elements on the page that call various js function without duplicating that information in multiple places. mypage.html: ... <script src="foo.js"></script> ... <span onclick="foo(bar);">clickme</span> <span onclick="showhelpfor('foo');>?</span> ... foo.js: /** * This function does foo. * Call it with bar. Yadda yadda "groo". */ function foo(x) { ... } I figure I can use getElementsByTagName to grab the script tag, then load the file with an AJAX

What are The Valid & Readable approaches to Commenting in PHP5?

≡放荡痞女 提交于 2019-12-05 23:29:22
问题 In the past 2 months that I have been learning PHP, I have identified more than two styles people use to comment code! I haven't seen much consistency... which I think usually means artists at work . So I wondered: what are the valid ways to comment which are still readable/practical? Seeing all the valid possibilities in 1 place side by side will provide the overview that I am looking for to improve commenting /* | This is what I now use (5chars/3lines) I name it star*wars \* 回答1: Quoting

wordpress - call a function when a comment is posted

亡梦爱人 提交于 2019-12-05 22:03:25
I would like to take some action in php whenever someone posts a comment. How can I set up a hook for that? I assume it would go in functions.php... EDIT - here is my udpated code: add_action('comment_post', 'comment_posted'); function comment_posted() { $MyClass = new MyClass(); //I do this in other functions and don't have any blank screen problems $test = ""; $MyClass->doSomething($test); } See: http://codex.wordpress.org/Function_Reference/wp_new_comment Calls 'comment_post' action with comment ID and whether comment is approved by WordPress. You should be able to then call add_action(

JSDoc Comment Folding In VSCode

Deadly 提交于 2019-12-05 20:38:25
问题 Is there a way to fold JSDoc-style comment blocks in VSCode v1.25 for JavaScript files? I get normal code collapse offered, but comment blocks seem excluded. Is there a keyboard shortcut that would collapse code even without the GUI handlebars showing? 回答1: I had the same issue, and fixed it by doing this: Go to File -> Preferences -> Settings and change the following entry from auto to indentation "editor.foldingStrategy": "indentation" Now JSDoc comments are folding as expected, hope this

Commenting try catch statements

[亡魂溺海] 提交于 2019-12-05 15:02:27
What is the proper place to explain error handling in a try-catch statement? It seems like you could put explanatory comments at either the beginning of the try block or the catch block. // Possible comment location 1 try { // real code } // Possible comment location 2 catch { // Possible comment location 3 // Error handling code } I usually do the following. If there's only one exception being handled, I usually don't bother since it should be self-documenting. try { real code // throws SomeException real code // throws SomeOtherException } catch(SomeException se) { // explain your error

Why does Javascript ignore single line HTML Comments?

别等时光非礼了梦想. 提交于 2019-12-05 13:45:41
I just tried this code on my browser (Chrome 39, Windows 8) :- <html> <body> <script> <!-- document.write("<h1>Hello</h1>"); --> </script> </body> </html> This produces the Header text on the browser. But when I make a slight change- put the HTML comment stuff on a single line, <html> <body> <script> <!-- document.write("<h1>Hello</h1>"); --> </script> </body> </html> This doesn't display anything. Why is it so? I don't think HTML comments are in the Javascript standards. p.s. I know how to put javascript comments. I'm only wondering about this erratic behavior. That's the way to hide

Selecting Comments by their inner xml in xpath/xsl

眉间皱痕 提交于 2019-12-05 13:25:01
Given the following xml document <root> <childnode0/> <childnode2/> <!--Comment1--> <childnode3/> <childnode4/> <!--Comment2--> </root> I know the xpath to select all the comments at a particular level in xsl string xPath = "/root/comment()"; However i'd like to select a comment where the inner xml is "Comment2". Any ideas? Thanks Dave This /root/comment()[.='Comment2'] seems to work. maybe this would work: /root/comment()[2] 来源: https://stackoverflow.com/questions/1759672/selecting-comments-by-their-inner-xml-in-xpath-xsl

doxygen comment multiple variables at once

跟風遠走 提交于 2019-12-05 12:51:36
问题 If I have the following: /** * @brief (x,y,z) points for block */ int x, y, z; It will only generate that documentation for x, is it possible in doxygen to get it to comment all x, y and z with one comment? EDIT Following the suggestions of envu I now have the following (based off http://www.doxygen.nl/manual/grouping.html#memgroup) //@{ /** some documentation here */ int x, y, z; //@} or //@{ /** * @brief some documentation here */ int x, y, z; //@} However both of these still only document

TODOs in Xcode: How to make them stand out?

蹲街弑〆低调 提交于 2019-12-05 12:34:32
问题 I am aware of the method of making them warnings, but I want to keep my legit warnings separate from my todos. I'm also have yet to see xcode 4 highlight the todos like everyone seems to think it does. And xcode's todo support only works on todos outside of functions... The build phase script that is outlined here is wonderful, but it makes the TODOs into warnings, and Objective C creates enough legitimate warnings that I don't want my todo's clogging up the list. Is there a way to make the