I am trying to learn blockchain developing(solidity) with the help of tutorial video.and i am very new for this.There is a error while practicing the programming,please help me to avoid this error.and please let me know what is the reason for this error.
the error occurred for this line:
people[] public people;
The error is,
DeclarationError: Identifier already declared.
--> smart.sol:20:5:
|
20 | people[] public people;
| ^^^^^^^^^^^^^^^^^^^^^^
Note: The previous declaration is here:
--> smart.sol:11:5:
|
11 | struct people {
| ^ (Relevant source part starts here and spans across multiple lines).
enter image description here
Related
question : how to invoke http method (GET,POST,CREATE & DELETE) using IBM Datapower dp:url-open function in XSLT language
requirement : code in xslt and step by step process theory in short ?
It's going to be tedious if you don't learn to read the documentation... Your question has the clear answer in the docs, here: https://www.ibm.com/docs/en/datapower-gateways/10.0.1?topic=elements-dpurl-open
However, trying to explain what's going on in a bit more detail as for the command:
<dp:url-open
target="URL"
response="xml | binaryNode | ignore | responsecode | responsecode-binary | responsecode-ignore"
resolve-mode="xml | swa"
base-uri-node="nodeset"
data-type="xml | base64 | filename"
http-headers="nodeset"
content-type="contentType"
ssl-proxy="client:profile"
timeout="seconds"
http-method="get | patch | post | put | delete | head"
options="options">
</dp:url-open>
The first thing you need is obviously the URL. This can be a string or a variable:
target="https://google.com"
target="{$url_variable}"
The default method is GET but for any other you'd need to set the http-method parameter. To post data and fetch the response in a variable you'd use:
<xsl:variable name="jsp-response">
<dp:url-open target="http://www.datapower.com/application.jsp">
<xsl:copy-of select="$some-nodes">
</dp:url-open>
</xsl:variable>
This would make a HTTP POST request sending the data (body) found in the $some-nodes variable.
I'm using WebStorm and I want to remove the newline in empty classes/functions. I couldn't find a related question.
export class AppRoutingModule {
}
=>
export class AppRoutingModule { }
Enabling Keep when reformatting | Simple blocks in one line in Settings | Editor | Code Style | JavaScript (Typescript) | Wrapping and Braces will make the formatter keep the empty classes "as is" (i.e. not insert a new line). But there is no way to remove existing line breaks from such classes on re-formatting
In a complex query, I have a subquery to count/summarize children:
->addSelect('(SELECT CONCAT(COUNT(c.id), \'|\', SUM(c.field1), \'|\', SUM(c.field2), \'|\', SUM(c.field3)) FROM App\Entity\Child c WHERE c.parent = p.id GROUP BY c.parent)')
This query worked perfectly until I upgraded to the new version of Symfony (4.2) and doctrine orm 2.6.1. I got the following error:
[Syntax Error] line 0, col 25: Error: Expected StateFieldPathExpression | string | InputParameter | FunctionsReturningStrings | AggregateExpression, got 'COUNT'
I tried to use CAST ... AS CHAR(25) but it doesn't work (got the same error).
Anyone can help me please?
Best regards,
Jonathan
Looks Like it is regression in doctrine StringPrimary parser function.
After looking at code I have made comment with my observation in issue related to this problem (while not entierly describing it).
Essentially new function missing this part, and defaulting to error when encountering any aggregate functions:
default:
if ($this->isAggregateFunction($lookaheadType)) {
return $this->AggregateExpression();
}
PS. link to the related issue:
https://github.com/doctrine/doctrine2/issues/7205
I found a workaround: I install doctrine extensions and I replace CONCAT by CONCAT_WS (DoctrineExtensions\Query\Mysql\ConcatWs).
Best regards
I recently asked for help to parse out Java error stacks from a group of log files and got a very nice solution at the link below (using awk).
Pull out Java error stacks from log files
I marked the question answered and after some debugging and studying I found a few potential issues and since they are unrelated to my initial question but rather due to my limited understanding of awk and regular expressions, I thought it might be better to ask a new question.
Here is the solution:
BEGIN{ OFS="," }
/[[:space:]]+*<Error / {
split("",n2v)
while ( match($0,/[^[:space:]]+="[^"]+/) ) {
name = value = substr($0,RSTART,RLENGTH)
sub(/=.*/,"",name)
sub(/^[^=]+="/,"",value)
$0 = substr($0,RSTART+RLENGTH)
n2v[name] = value
print name value
}
code = n2v["ErrorCode"]
desc[code] = n2v["ErrorDescription"]
count[code]++
if (!seen[code,FILENAME]++) {
fnames[code] = (code in fnames ? fnames[code] ", " : "") FILENAME
}
}
END {
print "Count", "ErrorCode", "ErrorDescription", "Files"
for (code in desc) {
print count[code], code, desc[code], fnames[code]
}
}
One issue I am having with it is that not all ErrorDescriptions are being captured. For example, this error description appears in the output of this script:
ErrorDescription="Database Error."
But this error description does not appear in the results (description copied from actual log file):
ErrorDescription="Operation not allowed for reason code "7" on table "SCHEMA.TABLE".. SQLCODE=-668, SQLSTATE=57016, DRIVER=4.13.127"
Nor does this one:
ErrorDescription="Cannot Find Person For Given Order."
It seems that most error descriptions are not being returned by this script but do exist in the log file. I don't see why some error descriptions would appear and some not. Does anyone have any ideas?
EDIT 1:
Here is a sample of the XML I am parsing:
<Errors>
<Error ErrorCode="ERR_0139"
ErrorDescription="Cannot Find Person For Given Order." ErrorMoreInfo="">
...
...
</Error>
</Errors>
The pattern in the script will not match your data:
/[[:space:]]+*<Error / {
Details:
The "+" tells it to match at least one space.
The space after "Error" tells it to match another space - but your data has no space before the "=".
The "<" is unnecessary (but not part of the problem).
This would be a better pattern:
/^[[:space:]]*ErrorDescription[[:space:]]*=[[:space:]]*".*"/
This regex would only match the error description.
ErrorDescription="(.+?)"
It uses a capturing group to remember your error description.
Demo here. (Tested against a combination of your edit and your previous question error log.)
I have a document which contains sections such as Assessments, HPI, ROS, Vitals etc.
I want to extract notes in each section. I am using GATE for this purpose. I have made a JAPE file which will extract notes in the Assessment section. Following is the grammar,
Input: Token
Options: control=appelt debug=true
Rule: Assess
({Token.string =~"(?i)diagnose[d]?"}{Token.string=="with"} | {Token.string=~"(?i)suffering"}{Token.string=~"(?i)from"} | {Token.string=~"(?i)suffering"}{Token.string=~"(?i)with"})
(
({Token})*
):assessments
({Token.string =~"(?i)HPI"} | {Token.string =~"(?i)ROS"} | {Token.string =~"(?i)EXAM"} | {Token.string =~"(?i)VITAL[S]"} | {Token.string =~"(?i)TREATMENT[s]"} |{Token.string=~"(?i)use[d]?"}{Token.string=~"(?i)orderset[s]?"} | {Token.string=~"$"})
-->
:assessments.Assessments = {}
Now, when the assessment section is in the end of the document I can retrieve the notes properly. But if it is somewhere between two sections then this will return entire document from assessment section till the end of file.
I have tried using {Token.string=~"$"} in different ways but could not extract ONLY THE ASSESSMENT SECTION IRRESPECTIVE OF ITS PLACE IN THE DOC.
Please explain how can I achieve this using JAPE grammar.
That is correct since Appelt mode always prefers the longest possible overall match. Since any Token can match string =~ "$" the assessments label will grab all but the final token in the document.
I would adopt a two pass approach, using an initial gazetteer or JAPE phase to annotate the "section headings" and then another phase with only these heading annotations in its input line
Imports: { import static gate.Utils.*; }
Phase: AnnotateBetweenHeadings
Input: Heading
Options: control = appelt
Rule: TwoHeadings
({Heading.type ="assessments"}):h1
(({Heading})?):h2
-->
{
Long endOffset = end(doc);
AnnotationSet h2Annots = bindings.get("h2");
if(h2Annots != null && !h2Annots.isEmpty()) {
endOffset = start(h2Annots);
}
outputAS.add(end(bindings.get("h1")), endOffset, "Assessments", featureMap());
}
This will annotate everything between the end of the assessments heading and the start of the following heading, or the end of the document if there is no following heading.
Tyson Hamilton provides this alternative to annotating EOD since $ doesn't work in JAPE:
Rule: DOCMARKERS
// we need to match something even though we don't use it directly
(({Token})):doc
-->
:doc{
FeatureMap features = Factory.newFeatureMap();
features.put("rule", ruleName());
try {
outputAS.add(0L, 0L, "SOD", features);
outputAS.add(docAnnots.getDocument().getContent().size(), docAnnots.getDocument().getContent().size(), "EOD", features);
} catch (InvalidOffsetException ioe) {
throw new GateRuntimeException(ioe);
}
}
I found that EOD was only recognized in later rules by giving it some length. So I have this:
Rule: DOCMARKERS
Priority: 2
(
({Sentence}) // we need to matching something even though we don't use it directly
):doc
-->
:doc{
FeatureMap features = Factory.newFeatureMap();
features.put("rule", "DOCMARKERS");
try {
outputAS.add(0L, 0L, "SOD", features);
long docsize = docAnnots.getDocument().getContent().size();
// The only way I could get EOD to be recognized in later rules was to
// give it some length, hence the -2 and -1
outputAS.add(docsize-2, docsize-1, "EOD", features);
System.err.println("Debug: added EOD");
} catch (InvalidOffsetException ioe) {
throw new GateRuntimeException(ioe);
}
}
And then you should be able to change the end of your rule to
...| {Token.string=~"$"})