semantics

Which is more correct: <h1><a>…</a></h1> OR <a><h1>…</h1></a>

寵の児 提交于 2019-11-26 08:06:40
问题 Are both <h1><a ...> ... </a></h1> and <a ...><h1> ... </h1></a> valid HTML, or is only one correct? If they are both correct, do they differ in meaning? 回答1: Both versions are correct. The biggest difference between them is that in the case of <h1><a>..</a></h1> only the text in the title will be clickable. If you put the <a> around the <h1> and the css display property is block (which it is by default) the entire block (the height of the <h1> and 100% of the width of the container the <h1>

Are parentheses around the result significant in a return statement?

久未见 提交于 2019-11-26 06:28:08
问题 Is there a difference between these two statements inside a function? bool returnValue = true; //Code that does something return(returnValue); and this? bool returnValue = true; //Code return returnValue; The former has parentheses around returnValue . 回答1: As of C++14, they often are. C++14 adds a fringe case where parentheses around a return value may alter the semantics. This code snippet shows two functions being declared. The only difference is parentheses around the return value. int

boost spirit semantic action parameters

空扰寡人 提交于 2019-11-26 05:18:46
问题 in this article about boost spirit semantic actions it is mentioned that There are actually 2 more arguments being passed: the parser context and a reference to a boolean ‘hit’ parameter. The parser context is meaningful only if the semantic action is attached somewhere to the right hand side of a rule. We will see more information about this shortly. The boolean value can be set to false inside the semantic action invalidates the match in retrospective, making the parser fail. All fine, but

HTML5 nested sections and heading tags

独自空忆成欢 提交于 2019-11-26 04:55:49
问题 I have section tags nested underneath another section tag. Is it okay to have start the headings from 1 again? For example: <section> <h1>Page Title</h1> <section> <h1>Section Title</h1> <h2>Section Sub Title</h2> <p>Sub section text</p> </section> <section> <h1>Section Title</h1> <h2>Section Sub Title</h2> <p>Sub section text</p> </section> </section> Thanks, Mark 回答1: Yes, it’s valid. However, HTML5 encourages to use […] headings of the appropriate rank for the section's nesting level. But

GET vs POST in Ajax

萝らか妹 提交于 2019-11-26 03:06:21
问题 What is the difference between GET and POST for Ajax requests? I don\'t see any difference between those two, except that when I use GET , the parameters are send in URL, which for me don\'t really make any difference, since all requests are made on background and user doesn\'t find any difference. edit: What are PUT and DELETE methods used for? 回答1: GET is designed for getting data from the server. POST (and lesser-known friends PUT and DELETE) are designed for modifying data on the server.

count vs length vs size in a collection

亡梦爱人 提交于 2019-11-26 00:36:02
问题 From using a number of programming languages and libraries I have noticed various terms used for the total number of elements in a collection. The most common seem to be length , count , and size . eg. array.length vector.size() collection.count Is there any preferred term to be used? Does it depend on what type of collection it is? ie. mutable/immutable Is there a preference for it being a property instead of a method? 回答1: Length() tends to refer to contiguous elements - a string has a

Should I put input elements inside a label element?

百般思念 提交于 2019-11-25 23:15:24
问题 Is there a best practice concerning the nesting of label and input HTML elements? classic way: <label for=\"myinput\">My Text</label> <input type=\"text\" id=\"myinput\" /> or <label for=\"myinput\">My Text <input type=\"text\" id=\"myinput\" /> </label> 回答1: From w3: The label itself may be positioned before, after or around the associated control. <label for="lastname">Last Name</label> <input type="text" id="lastname" /> or <input type="text" id="lastname" /> <label for="lastname">Last

Is there a difference between “==” and “is”?

[亡魂溺海] 提交于 2019-11-25 22:13:35
问题 My Google-fu has failed me. In Python, are the following two tests for equality equivalent? n = 5 # Test one. if n == 5: print \'Yay!\' # Test two. if n is 5: print \'Yay!\' Does this hold true for objects where you would be comparing instances (a list say)? Okay, so this kind of answers my question: L = [] L.append(1) if L == [1]: print \'Yay!\' # Holds true, but... if L is [1]: print \'Yay!\' # Doesn\'t. So == tests value where is tests to see if they are the same object? 回答1: is will