Error while parsing ics for caldav - icloud

iCal .net version -: 2.3.3
I am getting following error while parsing ics using ical .Net -:
expecting "END", found '105'
expecting "END", found '1047'
expecting "END", found '102'
expecting "END", found '1000'
expecting "END", found '1'
expecting "END", found '"'
expecting "COLON", found '.'
expecting "COLON", found ','
expecting "COLON", found ' '
expecting "COLON", found ' '
This is happening only on few accounts/events.

Apple's ical stuff is more broken than most. They fail to serialize at least 2 things properly:
UTC offsets
Locations
Your particular problem is with a location. I think ical.net versions 3+ will handle the location deserialization without dying. The v3 parser is more forgiving in some cases than the v2 (ANTLR-based) parser.
I'm not sure if I'm going to add in Apple-specific ics handling; they really should fix their bugs, but they probably won't.

Related

Google data studio : Error in formula for custom fields with REGEXP_MATCH

I'm currently playing with Google Data Studio and I'm having an error that I can't get rid of.
I'm trying to create a custom field that will store some values depending on the result of my regex, see below the code :
GDS is not accepting this formula as I'm getting the error : Invalid Formula.
The documentation about REGEXP_MATCH is also saying that it returns true or false but when I just get the return of the regex '.' (looking for any character), I do not get any of these values. Instead it shows me {$theCharacterFound} ex : {A}.
Hope someone will be able to tell me what I am doing wrong !
EDIT : I found out in this topic that it is apparently a problem with the postgreSQL connector (that I'm using) so we can only hope that Google will fix it...
I think you are missing an r before the regex literal:
CASE
WHEN REGEXP_MATCH(my_field_text, r'\bWord1\b') THEN 'True'
WHEN REGEXP_MATCH(my_field_text, r'\bWord2\b') THEN 'False'
ELSE NULL
END
Note also that I placed word boundaries around your search term words. This will prevent Word1 from matching a substring in a large string, e.g. AWord1s, which you might not want to count as a match.

Trying to write an SQL query with regexp_matches() look behind positive in postgresql

From a PostgreSQL database, I'm trying to match 6 or more digits that come after a string that looks like "(OCoLC)" and I thought I had a working regular expression that would fit that description:
(?<=\(ocolc\))[0-9]{6,}
Here are some strings that it should return the digits for:
|a(OCoLC)08507541 will return 08507541
|a(OCoLC)174097142 will return 174097142
etc...
This seems to work to match strings when I test it on regex101.com, but when I incorporate it into my query:
SELECT
regexp_matches(v.field_content, '(?<=\(ocolc\))[0-9]{6,}', 'gi')
FROM
varfield as v
LIMIT
1;
I get this message:
ERROR: invalid regular expression: quantifier operand invalid
I'm not sure why it doesn't seem to like that expression.
UPDATE
I ended up just resorting to using a case statement, as that seemed to be the best way to work around this...
SELECT
CASE
WHEN v.field_content ~* '\(ocolc\)[0-9]{6,}'
THEN (regexp_matches(v.field_content, '[0-9]{6,}', 'gi'))[1]
ELSE v.field_content
END
FROM
varfield as v
as electricjelly noted, I'm kind of after just the numeric characters, but they have to be preceded by the "(OCoLC)" string, or they're not exactly what I'm after. This is part of a larger query, so I'm running a second case statement a boolean flag in cases where the start of the string wasn't "(OCoLC)". These seems to be more helpful anyway, as I'm going to probably want to preserve those other values somehow.
After looking over your question it seems your error is caused from a syntax problem, not so much from the function not being available on your version of PostgreSQl, as I tested it on 9.6 and I received the same error.
However, what you seem to want is to pull the numbers from a given field as in
|a(OCoLC)08507541 becomes 08507541
an easy way you could accomplish this would be to use regex_replace
the function would be:
regexp_replace('table.field', '\D', '', 'g')
the \D in the function finds all non-numbers and replaces it with a nothing (hence the '') and returns everything else
It looks like after doing some more searching, this is only a feature of versions of PostgreSQL server >= 9.6
https://www.postgresql.org/docs/9.6/static/functions-matching.html#POSIX-CONSTRAINTS-TABLE
The version I am running is version 9.4.6
https://www.postgresql.org/message-id/E1ZsIsY-0006z6-6T#gemulon.postgresql.org
So, the answer is it's not available for this version of PostgreSQL, but presumably this would work just fine in the latest version of the server.

inserting \" into jsonb value with Qt

I have json encoded data that can have the following format:
{"forumla": "callTo(\"par1\", \"par2\")"}
When I try to insert it into a postgresql table with a jsonb column, I get the following Error:
SQL error QSqlError(-1, "QPSQL: Unable to create query", "ERROR: invalid input syntax for type json
LINE 1: ...15-12-11 15:20:17.350', 21590, '{ "forumla...
^
DETAIL: Token "par1" is invalid.
CONTEXT: JSON data, line 1: ..." : "callTo(\\"par1...
")
It seems like Qt somehow replaced the escaped quotes (\") with an escaped backslash and a quote. Inserting the string via the psql cli works.
Can someone help me with this?
Thanks in advance.
Update:
I removed the binding and replace the double backslash with a single one.
Now I could insert the value successfully.
QSqlField f(name, QVariant::String);
f.setValue(fields.value(name));
const QString value = db.driver()->formatValue(f).replace("\\\\", "\\");
The problem stems probably from Qt (at least pre 5.x) not knowing about json in databases. So it can only treat it as a string and sees the need to escape backslashes.
This is obviously not an ideal solution.
Update 2:
I found an acceptable solution. Qt (at least 4.7) assumes a backslash to be a special character in a string value. This is no longer the case (by default) since 9.1. See http://www.postgresql.org/docs/9.4/static/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE
So I had to set the following so Postgresql again assumes \ to be an escaped backslash:
QSqlQuery query(db);
query.exec("SET standard_conforming_strings TO false");
It would appear that Qt is automatically escaping any backslashes \ you have in your string. Why - I have no idea.
You could try using single quotes ' instead of ". It could be that Qt only cares about escaping double quotes. So by writing:
"callTo('par1', 'par2')")
You can bypass the issue. (UPDATE: confirmed that this works by OP, but is obviously not the ideal solution as it merely bypasses the problem)
Also alternatively it's possible that Qt has an option you can use to disable this functionality, but I'm afraid I'm not familiar enough with it as a tool to be able to tell you if it exists.
Hopefully that helps - it's not the answer I'd like to give you but in the absence of any more knowledgeable Qt experts it might give you some ideas on what to try!
I found an acceptable solution. Qt (at least 4.7) assumes a backslash to be a special character in a string value. This is no longer the case (by default) since 9.1. See http://www.postgresql.org/docs/9.4/static/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE
So I had to set the following so Postgresql again assumes \ to be an escaped backslash:
QSqlQuery query(db);
query.exec("SET standard_conforming_strings TO false");

RGoogleAnalytics replacing unexpectedly escaped characters with gsub

I'm using RGoogleAnalytics, I'm just at the learning stage at the moment.
I'm following the code in the tutorial here https://code.google.com/p/r-google-analytics/
But when I try to run
ga.goals <- conf$GetGoals()
ga.goals
I get an error message telling me there is an unexpected escaped character '\.' at pos 7
I get a similar message for the next two lines of code (GetSegments)
This question deals with a similar problems in the Facebook Graphs API
How to replace "unexpected escaped character" in R
I've tried using a similar bit of code
confGoalsSub <- gsub('\\.', ' ', conf$GetGoals())
to remove the escaped characters, but I get another error :
cannot coerce type 'closure' to vector of type 'character'
Out of desperation I have tried confGoalsSub <- gsub('\\.', ' ', conf) which returns a character vector that is just garbage (it's just the code for conf with the decimal points stripped out).
Can anyone suggest a better expression than gsub that will return a useful object?
EDIT: As per the suggestion below I've now added the brackets at the end of the function call but I still get the same error message about unexpected escape characters. I get the same error when I try to call other, similar function such as $GetSegments().
I saw on one video at the weekend that this package was broken for a long time, although the speaker did not provide details as to why. Perhaps I should give up and try one of the other Google Analytics packages in R.
Seems odd, given that this one is supposed to be Google supported.
I think this error arises when the RJSON library isn't able to parse the Google Analytics Data Feed properly and convert it into a nested list. The updated version of [RGoogleAnalytics] (http://cran.r-project.org/web/packages/RGoogleAnalytics/index.html) fixes this problem. Currently, you won't be able to retrieve Goals and Segments from your Google Analytics account using the library but beyond that it supports the full range of dimensions and metrics.

Log parsing rules in Jenkins

I'm using Jenkins log parser plugin to extract and display the build log.
The rule file looks like,
# Compiler Error
error /(?i) error:/
# Compiler Warning
warning /(?i) warning:/
Everything works fine but for some reasons, at the end of "Parsed Output Console", I see this message,
NOTE: Some bad parsing rules have been found:
Bad parsing rule: , Error:1
Bad parsing rule: , Error:1
This, I'm sure is a trivial issue but not able to figure it out at this moment.
Please help :)
EDIT:
Based on Kobi's answer and having looked into the "Parsing rules files", I fixed it this way (a single space after colon). This worked perfectly as expected.
# Compiler Error
error /(?i)error: /
# Compiler Warning
warning /(?i)warning: /
The Log Parser Plugin does not support spaces in your pattern.
This can be clearly seen in their source code:
final String ruleParts[] = parsingRule.split("\\s");
String regexp = ruleParts[1];
They should probably have used .split("\\s", 2).
As an alternative, you can use \s, \b, or an escape sequence - \u0020.
I had tried no spaces in the pattern, but that did not work.
Turns out that the Parsing Rules files does not support
empty lines in it. Once I removed the empty lines, I did not
get this "Bad parsing rule: , Error:1".
I think since the line is empty - it doesn't echo any rule after
the first colon. Would have been nice it the line number was
reported where the problem is.