syntax-error

Syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$'

随声附和 提交于 2019-12-10 17:37:15
问题 I'm getting Syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' This is the code i'm using function wpse44503_filter_content( $content ) { $regex = '#src=("|\')'. '(/images/(19|20)(0-9){2}/(0|1)(0-9)/[^.]+\.(jpg|png|gif|bmp|jpeg))'. '("|\')#'; $replace = 'src="'.get_site_url( $2 ).'"'; $output = preg_replace( $regex, $replace, $content ); return $output; } This is the line where i'm getting that error $replace = 'src="'.get_site_url( $2 ).'"'; Can anyone help me to fix it? Thanks

UnicodeDecodeError: 'ascii' codec can't decode byte in 0xc3 in position 304: ordinal not in range(128)

自古美人都是妖i 提交于 2019-12-10 17:12:39
问题 I just left the PC at work (using Python 2.7) and had a script that I was just finishing up (reproduced below). It ran fine at work, I just wanted to add one or two things. But I came home and am using my Mac's version of Python (3.2.2) and I get the following error: Traceback (most recent call last): File "/Users/Downloads/sda/alias.py", line 25, in <module> for row_2 in in_csv: File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/encodings/ascii.py", line 26, in decode

Getting the Notepad++ XML parsing error “Extra content at the end of the document” even though there is none

╄→尐↘猪︶ㄣ 提交于 2019-12-10 17:08:33
问题 I am getting the abovementioned error message when trying to validate my 55 mb XML file in Notepad++. The first enocountered error is here (line 1441520 out of 22258651): Screenshot from Notepad++ I have turned on Show all characters. Nothing suggests that there should be any illegal characters at the end of the line. As you can see on the screenshot there are no other hidden characters than CR+LF. EDIT: Below is a copy of the record that causes the parsing error in Notepad++: <?xml version=

XCTAssertThrowsError strange behavior with custom errorHandler

一笑奈何 提交于 2019-12-10 16:56:17
问题 In my unit test I have the following code that checks whether thrown error is of expected type. It is done with two identical statements one of which doesn't compile: enum Error: ErrorType { case SomeExpectedError case SomeUnexpectedError } func functionThatThrows() throws { throw Error.SomeExpectedError } // 1) this compiles fine XCTAssertThrowsError(try functionThatThrows()) { (error) in switch error { case Error.SomeExpectedError: break //everything is fine case Error.SomeUnexpectedError:

Why does the program give “illegal start of type” error?

若如初见. 提交于 2019-12-10 15:16:29
问题 here is the relevent code snippet: public static Rand searchCount (int[] x) { int a ; int b ; int c ; int d ; int f ; int g ; int h ; int i ; int j ; Rand countA = new Rand () ; for (int l= 0; l<x.length; l++) { if (x[l] = 0) a++ ; else if (x[l] = 1) b++ ; } } return countA ; } (Rand is the name of the class that this method is in) when compiling it get this error message: Rand.java:77: illegal start of type return countA ; ^ what's going wrong here? what does this error message mean? 回答1:

“{} === null” throws syntax error in developer console [duplicate]

﹥>﹥吖頭↗ 提交于 2019-12-10 14:42:23
问题 This question already has answers here : Why {} != ( {} ) in JavaScript? (2 answers) Closed 5 years ago . Why is it that when i type {} === null into the console it throws SyntaxError: Unexpected token === null === {} gives me false as expected. 回答1: Because {} is treated as an empty block. You can wrap it in parentheses to force an expression: ({} === null) 来源: https://stackoverflow.com/questions/20753091/null-throws-syntax-error-in-developer-console

Syntax error “near FROM” when using UPDATE with JOIN in MySQL?

南笙酒味 提交于 2019-12-10 14:11:21
问题 UPDATE bestall SET view = t1.v, rawview = t1.rv FROM bestall INNER JOIN beststat as t1 ON bestall.bestid = t1.bestid this query gives syntax error near 'FROM bestall INNER JOIN beststat as t1 ON bestall.bestid = t1.bestid' at line 3 any reasons? 回答1: That isn't valid MySQL syntax. It is valid in MS SQL Server, however. For MySQL, use: UPDATE bestall JOIN beststat AS t1 ON bestall.bestid = t1.bestid SET view = t1.v, rawview = t1.rv MySQL requires the update tables to come before the SET clause

What are the implications of not closing a directory handle in Perl?

六眼飞鱼酱① 提交于 2019-12-10 13:16:36
问题 I recently inherited some code that someone else had written. I discovered that everywhere in the code that a directory was opened for reading, it was never closed because the original developer had a syntax problem - he was using the close function to try to close a directory handle instead of the closedir function. The code was something like this: opendir( DIR, $dir ) or die "Cannot open $dir: $!\n"; @files = readdir( DIR ); close( DIR ); (Which is another good point that is made in Perl

Threading problems in C# (A field initializer cannot reference the non-static field, ect)

北战南征 提交于 2019-12-10 12:19:24
问题 Im having a quite annoying problem with threading in C#. I get the error "A field initializer cannot reference the non-static field, method, or property 'Scraper.Form1.scrapeStart()'" When using this code: public partial class Form1 : Form { public Thread scrape = new Thread(() => scrapeStart()); //This is where the error happens public About about = new About(); public Form1() { InitializeComponent(); } public void appendOutput(String s) { output.AppendText(s); output.SelectionStart = output

vhdl 4 bit vedic multiplier

泄露秘密 提交于 2019-12-10 11:52:55
问题 entity fourbitmult is Port ( a,b : in STD_LOGIC_VECTOR (3 downto 0); p : out STD_LOGIC_VECTOR (7 downto 0)); end fourbitmult; architecture Behavioral of fourbitmult is component twobitmult port(a,b:in std_logic_vector(1 downto 0); p:out std_logic_vector (3 downto 0)); end component; component rca port(a,b:in std_logic_vector(3 downto 0); s:out std_logic_vector(3 downto 0); carry:out std_logic; cin:in std_logic='0' ); end component; component halfadder port(a,b:in std_logic; s,c:out std_logic)