colon

What would 'std:;' do in c++?

a 夏天 提交于 2019-11-30 04:08:33
I was recently modifying some code, and found a pre-existing bug on one line within a function: std:;string x = y; This code still compiles and has been working as expected. The string definition works because this file is using namespace std; , so the std:: was unnecessary in the first place. The question is, why is std:; compiling and what, if anything, is it doing? std: its a label, usable as a target for goto . As pointed by @Adam Rosenfield in a comment, it is a legal label name. C++03 §6.1/1: Labels have their own name space and do not interfere with other identifiers. It's a label,

PHP: DOMDocument - attributes with a colon in it?

∥☆過路亽.° 提交于 2019-11-29 16:34:31
I'm using DOMDocument to parse an XML (SVG). Some nodes have attributes with a colon in it, like : <svg id="svg2" width="1000" height="1000" sodipodi:version="0.32" inkscape:version="0.48.1 " ... > But when I do : $node= DOMDocument->documentElement; foreach($node->childNodes as $key=>$childnode) { foreach($childnode->attributes as $attribute) { echo $attribute->name."\n"; } } the attributes with a : are printed without the first part (namespace) How do I get the namespace for that attribute when iterating through the attributes like this? Answer from OP's comment, nodeName from DOMNode .

Bash colon operator in variable substitution? [duplicate]

痴心易碎 提交于 2019-11-29 01:44:42
问题 This question already has an answer here: Usage of :- (colon dash) in bash 2 answers I inherited some bash code and these two lines are bewildering me: branch_name=`git describe --contains --all HEAD` branch_name=${branch_name:-HEAD} My understanding of the : colon operator is that is creates a substring based on an index so using a string, -HEAD in this case, does not make any sense. 回答1: This takes the variable branch_name , if it is defined. If it is not defined, use HEAD instead. See

Are colons allowed in URLs?

左心房为你撑大大i 提交于 2019-11-29 01:24:12
I thought using colons in URIs was "illegal". Then I saw that vimeo.com is using URIs like http://www.vimeo.com/tag:sample. What do you feel about the usage of colons in URIs? How do I make my Apache server work with the "colon" syntax because now it's throwing the "Access forbidden!" error when there is a colon in the first segment of the URI? Colons are allowed in the URI path. But you need to be careful when writing relative URI paths with a colon since it is not allowed when used like this: <a href="tag:sample"> In this case tag would be interpreted as the URI’s scheme. Instead you need to

Is a colon a legal first character in an XML tag name?

放肆的年华 提交于 2019-11-28 14:07:14
According to the W3C XML Recommendation , start tag-names have the definition: STag ::= '<' Name (S Attribute)* S? '>' ..where Name is: Name ::= NameStartChar (NameChar)* NameStartChar ::= ":" | [A-Z] | ... ..(n.b., states that a colon can appear as the first character) suggesting the following is a valid XML document: <?xml version="1.0" ?><:doc></:doc> ..but any parser I try this in shows the colon as a formatting error. Also, under Appendices B (though now a depreciated part of the document) it explicitly states: Characters ':' and '_' are allowed as name-start characters. ..and: <?xml

PHP: DOMDocument - attributes with a colon in it?

为君一笑 提交于 2019-11-28 11:18:56
问题 I'm using DOMDocument to parse an XML (SVG). Some nodes have attributes with a colon in it, like : <svg id="svg2" width="1000" height="1000" sodipodi:version="0.32" inkscape:version="0.48.1 " ... > But when I do : $node= DOMDocument->documentElement; foreach($node->childNodes as $key=>$childnode) { foreach($childnode->attributes as $attribute) { echo $attribute->name."\n"; } } the attributes with a : are printed without the first part (namespace) How do I get the namespace for that attribute

python float got a colon after the decimal point after addition [closed]

元气小坏坏 提交于 2019-11-28 04:46:32
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . In my python program, I got two floating numbers -2901.0, -200.0 during some process. When I tried to add them directly I got -3100.: (If I converted it to str , it would be "-3100.:" ) Python didn't say any

Javascript 'colon' for labeling anonymous functions?

大兔子大兔子 提交于 2019-11-28 03:27:04
What does this code refer too? queryString: function() { //some code } I tested it in the WebConsole (Firefox) but it wouldn't execute, so I'm thinking that it isn't equivalent to function queryString() {} . So what is it exactly? You are missing some code there, but I assume its part of an object declaration like this: var obj = { queryString: function() { //some code } }; obj.queryString(); It assigns a function as a property of an object literal. It would be equivalent to this: var obj = {}; obj.queryString = function() { ... }; obj.queryString(); In general, the object literal syntax looks

How does MATLAB's colon operator work?

廉价感情. 提交于 2019-11-28 00:58:13
As noted in this answer by Sam Roberts and this other answer by gnovice , MATLAB's colon operator ( start:step:stop ) creates a vector of values in a different way that linspace does. In particular, Sam Roberts states: The colon operator adds increments to the starting point, and subtracts decrements from the end point to reach a middle point. In this way, it ensures that the output vector is as symmetric as possible. However, offical documentation about this from The MathWorks has been deleted from their site. If Sam's description is correct, wouldn't the errors in the step sizes be symmetric

Is a colon a legal first character in an XML tag name?

雨燕双飞 提交于 2019-11-27 08:10:14
问题 According to the W3C XML Recommendation, start tag-names have the definition: STag ::= '<' Name (S Attribute)* S? '>' ..where Name is: Name ::= NameStartChar (NameChar)* NameStartChar ::= ":" | [A-Z] | ... ..(n.b., states that a colon can appear as the first character) suggesting the following is a valid XML document: <?xml version="1.0" ?><:doc></:doc> ..but any parser I try this in shows the colon as a formatting error. Also, under Appendices B (though now a depreciated part of the document