syntax-error

unable to solve “syntax error near unexpected token `fi'” - hidden control characters (CR) / Unicode whitespace

走远了吗. 提交于 2019-12-10 10:28:20
问题 I am new to bash scripting and i'm just trying out new things and getting to grips with it. Basically I am writing a small script to store the content of a file in a variable and then use that variable in an if statement. Through step by step i have figured out the ways to store variables and then store content of files as variables. I am now working on if statements. My test if statement if very VERY basic. I just wanted to grasp the syntax before moving onto more complicated if statement

Why would whitespace cause a fatal error in PHP?

拜拜、爱过 提交于 2019-12-10 10:25:19
问题 I have an associative array that, for all intents and purposes, appears to have absolutely no reason to throw even a warning. The entirety of the source code is as follows: <?php $entries = array( array('date' => '2012-08-12', 'change' => '-19'), array('date' => '2012-08-13', 'change' => '-21'), array('date' => '2012-08-14', 'change' => '-19'), array('date' => '2012-08-15', 'change' => '-17'), ); foreach ($entries as $entry) { print $entry['date'] . ': ' . $entry['change'] . '<br/>'; } To me

JSON Parse error: Unterminated string

一个人想着一个人 提交于 2019-12-10 09:25:57
问题 I've met an usual problem when escaping a quote within the JSON parse function. If the escaped quote is present, in this case 'test"', it causes the following error 'SyntaxError: JSON Parse error: Unterminated string'. var information = JSON.parse('[{"-1":"24","0":"","1":"","2":"","3":"0.0000","4":"","5":"0.00","6":"0.00","7":"1.00","8":"0","9":"false","10":"false","11":[""],"12":"","13":"","14":"test\""}]'); JSON Lint validates the JSON as valid. 回答1: You'll have to double escape it, as in

Java generics: Illegal forward reference

北慕城南 提交于 2019-12-10 02:58:17
问题 Given a generic interface interface Foo<A, B> { } I want to write an implementation that requires A to be a subclass of B. So I want to do class Bar<A, B super A> implements Foo<A, B> { } // --> Syntax error or class Bar<A extends B, B> implements Foo<A, B> { } // --> illegal forward reference But the only solution that seems to work is this: class Bar<B, A extends B> implements Foo<A, B> { } which is kind of ugly, because it reverses the order of the generic parameters. Are there any

javascript - catch SyntaxError and run alternate function

本秂侑毒 提交于 2019-12-10 01:14:01
问题 I'm trying to build something on javascript that I can have an input that can be everything like string, xml, javascript and (non-javascript string without quotes) as follows: //strings eval("'hello I am a string'"); /* note the following proper quote marks */ //xml eval(<p>Hello I am a XML doc</p>); //javascript eval("var hello = 2+2;"); So this first 3 are working well since they are simple javascript native formats but when I try use this inside javascript //plain-text without quotes eval(

React TypeError this._test is not a function

◇◆丶佛笑我妖孽 提交于 2019-12-09 15:32:41
问题 Since im new to JavaScript and React, i really have problems figuring out the right syntax. Here my problem: _handleDrop(files) should call the function _validateXML(txt) but doesn't. I receive this error Uncaught TypeError: this._validateXML is not a function and can't figure out why. The callBack _handleDrop(files) works fine. When i try this kind of syntax _validateXML:function(txt) i immediately get a error while compiling. Is that because of ecmascript? import React from 'react'; import

String Concatenation Error

老子叫甜甜 提交于 2019-12-09 10:11:49
问题 I ran into a syntax error. I accept that it's a syntax error, but I'm somewhat curious as to why it's a syntax error. This works exactly as you'd expect it to: (0..9).each { |n| puts n.to_s + "^2 = " + (n**2).to_s } This throws an error: (0..9).each { |n| puts n.to_s +"^2 = "+ (n**2).to_s } The error: NoMethodError: undefined method '+@' for "^2 = ":String Oddly, I can move the second plus sign wherever and Ruby seems to have no problem with it, but if that first one happens to touch the

PHP: Parse Error: unexpected T_DOUBLE_ARROW

主宰稳场 提交于 2019-12-08 19:32:24
My code gives me the error Parse error: syntax error, unexpected T_DOUBLE_ARROW, expecting ')' line 208 I keep getting this but it looks correct? Line 208 which is the second down. array( "name" => "Colour Scheme", "desc" => "Select the colour scheme for the theme", "id" => $shortname."_color_scheme", "type" => "select", "options" => array("blue", "red", "green"), "std" => "blue"), please advise! Thanks T_DOUBLE_ARROW is the token for => , so you have one which appears somewhere the parser doesn't expect it. Besides that trailing , , there is no error with the code you posted. Besides that

“Two terms in a row” error

你说的曾经没有我的故事 提交于 2019-12-08 18:53:07
问题 I am trying to write a compact line as below, the code is an extract from a script that reads STDIN by using the dynamically scoped special variable $*IN. Can you please advise how to write this line correctly? This works for $*IN.lines() { last when "" ; say "VERBOSE \"$_ is the string\""; $i=$i+1; } does not work .say "VERBOSE \"$_ is the string\"" for $*IN.lines() last when ""; error output: ===SORRY!=== Error while compiling /usr/share/asterisk/agi-bin/agi-t1.p6 Two terms in a row at /usr

jenkins attachments - what is the syntax?

主宰稳场 提交于 2019-12-08 16:21:57
问题 I'm trying to have Jenkins attach a file or set of files to the email notification that the job has completed. I keep getting an error along the lines of: Sending email for trigger: Success ERROR: Error accessing files to attach: Expecting Ant GLOB pattern, but saw C:\p\p\etc\\\*\*\\\*.html . See Fileset syntax And yes I've looked at that site and tried every variation I could think of: / instead of \ ../\*\* ../\*\*/\*.html removing C: What is the Ant GLOB pattern I'm missing here? thanks,