Was trying to install a wp plugin- dt world clock and got this error msg.
The actual error msg:
Parse error: syntax error, unexpected '[' in /var/www/html/wp-content/plugins/dt-world-clock/dt-world-clock.php on line 415
And the line 415 is:
function DT_World_Clock_Shortcode($atts = [], $content = null, $tag = '') {
I have no idea where to edit-
Would really appreciate help...
try this
function DT_World_Clock_Shortcode($atts = array(), $content = null, $tag = "") {
Related
It fails here,
message = "{\"response\":{\"billDetails\":\"[{\"name\":\"Account ID\"}]\"}}"
JSON.parse(message)
JSON::ParserError (809: unexpected token at '{"response":{"billDetails":"[{"name":"Account ID"}]"}}')
I'm not sure this will be helpful. But your json string should be written from
"{
"response":{
"billDetails": "[{"name":"Account ID"}]"}
}"
To:
'{
"response":{
"billDetails": [{"name":"Account ID"}]
}
}'
In the array from billDetails, you have two aditional ", that provokes an error when parsing that string.
Trying to go through a list of values where there might be one with a single quote in it. When I try to pass it through a function, it fails.
It gives the error,
Execution error in store procedure REPORT_PRESENTATION_DATA: SQL compilation error: parse error line 1 at position 164 near '<EOF>'. syntax error line 1 at position 158 unexpected 't'. At Statement.execute, line 90 position 41
I then add
myCommonValue = myCommonValue.replace("'","''");
but now get the error,
JavaScript execution error: Uncaught TypeError: Cannot read property 'replace' of null in REPORT_PRESENTATION_DATA at ' myCommonValue = myCommonValue.replace("'","''");' position 36 stackstrace: REPORT_PRESENTATION_DATA line: 85
Here's a code sample:
CREATE OR REPLACE PROCEDURE MY_SNOWFLAKE_PROCEDURE()
RETURNS VARIANT
LANGUAGE JAVASCRIPT
AS
$$
...
sqlText = ` SELECT fields FROM MYTABLE `;
statement = snowflake.createStatement({ sqlText });
const rs = statement.execute();
let results = [];
while (rs.next()) {
let myColumnValue = rs.getColumnValue(1);
myColumnValue = myColumnValue.replace("'","''");
// Using the column value which could contain a single quote in the string,
// get a second result set. IE: "gov't" may be the string value passed into Query_GroupValues
sqlText = ` SELECT * FROM table(Query_GroupValues('${startdate}', '${enddate}', ARRAY_CONSTRUCT('${myColumnValue}'))) `;
statement = snowflake.createStatement({ sqlText });
const rsTableValue = statement.execute();
if (statement.getRowCount() > 0) {
let myValue = rsTableValue.getColumnValue(1);
struct = {
attributes: {
value: myValue
}
}
results.push(struct);
}
}
...
$$;
Looks like myColumnValue was null when it's replace() method was invoked. Adding a guard should fix it. For Example: if (myColumnValue!=null) myColumnValue = myColumnValue.replace("'","''");
I have this concrete syntax:
syntax SomeMore = [...] SyncBlock? sync;
syntax SyncBlock = "sync" "{" SyncStatement* stats "}";
syntax SyncStatement = [...];
[SyncBlock]"sync { <syncStrings> }" seems to work, but when I try to use it as a SyncBlock? and assign it:
SyncBlock? sync = [SyncBlock?]"sync { <syncStrings> }"
it does not work: inline parsing not supported on SyncBlock?, what is the easiest way to build up a value of this X?-type?
Can I convert a SyncBlock to a SyncBlock? somehow?
Something like this also doesn’t work:
syncBlock = (SyncBlock?)`sync { <SyncStatement* syncs>}`;
P.S. SyncBlock? syncBlock = … results in Ambiguous code (internal error), SyncBlock? syncBlock = …. Probably due to a ternary operator ambiguity?
I found a workaround, not ideal, but it works.
It seems that the ? in the types introduces some difficulties, but can be circumvented using an "alias" for this type:
I changed the grammar to:
syntax SomeMore = [...] MaybeSyncBlock sync;
syntax MaybeSyncBlock = SyncBlock?;
syntax SyncBlock = "sync" "{" SyncStatement* stats "}";
syntax SyncStatement = [...];
Now this works:
MaybeSyncBlock syncBlock = [MaybeSyncBlock]"sync { <syncStrings> }";
I'd like to remove this part :
"company.html?#{token_url}&company=#{URI.encode(current_company.trylive_name)}" but an error appears syntax error, unexpected '}', expecting ':'
#iframe_statistics_url = "#{Gaston.amazon.cloudfront.host}/trylive_dashboard/iframe/#{current_user.has_role?(:administrator) ? "companies.html?#{admin_token_url}" : "company.html?#{token_url}&company=#{URI.encode(current_company.trylive_name)}"}"
You can't use double quotes(") inside double quotes. You need to escape those quotes:
"Hello, "are you there?" # doesn't make sense in Ruby
"Hello, \"are you there?" # escaped double quotes inside the string
#VtrKanna
#iframe_statistics_url = "#{Gaston.amazon.cloudfront.host}/trylive_dashboard/iframe/#{current_user.has_role?(:administrator) ? "companies.html?#{admin_token_url}" : "company.html?#{token_url}&company=#{URI.encode(current_company.trylive_name)}"}"
this is work fine
but my problem is just to keep this part
#iframe_statistics_url = "#{Gaston.amazon.cloudfront.host}/trylive_dashboard/iframe/#{current_user.has_role?(:administrator) ? "companies.html?#{admin_token_url}"}"
this is result an error
Try like this
val = current_user.has_role?(:administrator) ? "companies.html?#{admin_token_url}" : "company.html?#{token_url}&company=#{URI.encode(current_company.trylive_name)}"
#iframe_statistics_url = "#{Gaston.amazon.cloudfront.host}/trylive_dashboard/iframe/}#{val}"
Or
g = "https://www.google.co.in/"
q = %[helo #{"world #{g}"}]
=> "helo world https://www.google.co.in/"
Try it
#iframe_statistics_url = %[#{Gaston.amazon.cloudfront.host}/trylive_dashboard/iframe/companies.html?#{current_user.has_role?(:administrator) ? admin_token_url : "#{token_url}&company=#{URI.encode(current_company.trylive_name)}"}]
I am trying to read a text but running into issue. Please note I just got started with JavaCC.
"token1 /path1/*/path /token2"
TOKEN:{
token1: ("token1") :someState
}
someStateTOKEN :
{
token: ("/token")?
}
The error:
Encountered " <token2> " "" at line **, column 8.
Was expecting one of: <RESULT> ... <SPACE> …
Heres the Expression :
tok=<token1>(<SPACE_CHAR>)?val=<RESULT>(<token2>)?(<SPACE>)?