apache jena tdbloader2 illegal escape sequence value - jena

I am trying to insert several ttl files with the tdbload2 v1.3.6 command. During installation i get the following error; what can I do to fix it?
org.apache.jena.riot.RiotException: [line: 1306503, col: 56] illegal escape sequence value: n (0x6E)
at org.apache.jena.riot.system.ErrorHandlerFactory$ErrorHandlerStd.fatal(ErrorHandlerFactory.java:132)
at org.apache.jena.riot.lang.LangEngine.raiseException(LangEngine.java:169)
at org.apache.jena.riot.lang.LangEngine.nextToken(LangEngine.java:116)
at org.apache.jena.riot.lang.LangTurtleBase.predicateObjectItem(LangTurtleBase.java:299)
at org.apache.jena.riot.lang.LangTurtleBase.predicateObjectList(LangTurtleBase.java:280)
at org.apache.jena.riot.lang.LangTurtleBase.triples(LangTurtleBase.java:271)
at org.apache.jena.riot.lang.LangTurtleBase.triplesSameSubject(LangTurtleBase.java:210)
at org.apache.jena.riot.lang.LangTurtle.oneTopLevelElement(LangTurtle.java:47)
at org.apache.jena.riot.lang.LangTurtleBase.runParser(LangTurtleBase.java:110)
at org.apache.jena.riot.lang.LangBase.parse(LangBase.java:42)
at org.apache.jena.riot.RiotReader.parse(RiotReader.java:116)
at org.apache.jena.riot.RiotReader.parse(RiotReader.java:93)
at org.apache.jena.riot.RiotReader.parse(RiotReader.java:66)
at com.hp.hpl.jena.tdb.store.bulkloader2.CmdNodeTableBuilder.exec(CmdNodeTableBuilder.java:163)
at arq.cmdline.CmdMain.mainMethod(CmdMain.java:101)
at arq.cmdline.CmdMain.mainRun(CmdMain.java:63)
at arq.cmdline.CmdMain.mainRun(CmdMain.java:50)
at com.hp.hpl.jena.tdb.store.bulkloader2.CmdNodeTableBuilder.main(CmdNodeTableBuilder.java:81)

Which version? It helps align the line numbers.
Check line 1306503 and see what it says. I guess there is a \n in a URI.

Related

Pipe character ignored in SPSS syntax

I am trying to use the pipe character "|" in SPSS syntax with strange results:
In the syntax it appears like this:
But when I copy this line from the syntax window to here, this is what I get:
SELECT IF(SEX = 1 SEX = 2).
The pipe just disappears!
If I run this line, this is the output:
SELECT IF(SEX = 1 SEX = 2).
Error # 4007 in column 20. Text: SEX
The expression is incomplete. Check for missing operands, invalid operators,
unmatched parentheses or excessive string length.
Execution of this command stops.
So the pipe is invisible to the program too!
When I save this syntax and reopen it, the pipe is gone...
The only way I found to get SPSS to work with the pipe is when I edited the syntax (adding the pipe) and saved it in an alternative editor (notepad++ in this case). Now, without opening the syntax, I ran it from another syntax using insert command, and it worked.
EDIT: some background info:
I have spss version 23 (+service pack 3) 64 bit.
The same things happens if I use my locale (encoding: windows-1255) or Unicode (Encoding: UTF-8). Suspecting my Hebrew keyboard I tried copying syntax from the web with same results.
Can anyone shed any light on this subject?
Turns out (according to SPSS support) that's a version specific (ver. 21) bug and was fixed in later versions.

'Missing $ inserted' error message when converting jupyter notebook to pdf with nbconvert

When attempting to convert a jupyter notebook to pdf with the following command:
jupyter nbconvert --to pdf "Search and Other Content Finding Features.ipynb"
I'm getting an error message:
! Missing $ inserted.
<inserted text>
$
l.380 ... Other Content Finding Features_10_0.png}
?
! Emergency stop.
<inserted text>
$
l.380 ... Other Content Finding Features_10_0.png}
I've found some discussion of what that is here.
However, I can't find these characters in my code. Could there be another cause?
For me it was another, although related issue: underlines. I assume that the cause is that text in cells marked as Raw Text will be passed directly to LaTeX, where it can be interpreted as LaTeX code itself. Maybe the underlines in your figure's name?
At some point, I had a raw cell with three underlines ___ which were then making the conversion break. The temporary solution was to convert the cell to markdown, instead of raw (and not run it) to appear in the pdf.
To find the error, I used the following conversion (taken from this answer):
jupyter nbconvert thenotebook.ipynb --to latex
Another error, related, was caused by a link containing underlines:
[text](https://en.wikipedia.org/wiki/Python_(programming_language))
This was also in a Raw Text cell, which I converted to markdown to generate the pdf. The format (colors, links) are different, though.
Last note: My file's name also contains empty spaces, but that wasn't an issue at all!
A very common gotcha here might be the following:
Leading or trailing spaces are not allowed in the pandoc extension tex_math_dollars, which is used by nbconvert.
This means, that this won't work:
$ \epsilon \gt 0 $
And we see the error message:
! Missing $ inserted.
<inserted text>
$
l.364 \$ \epsilon
\gt 0 \$
?
! Emergency stop.
<inserted text>
$
l.364 \$ \epsilon
\gt 0 \$
No pages of output.
Transcript written on notebook.log.
The correct formula without spaces works fine:
$\epsilon \gt 0$
This seems to be a bug in Jupyter nbconvert.
The pandoc documentation suggests that for pandoc this is by design to allow to use dollar symbols without escape sequence:
Anything between two $ characters will be treated as TeX math. The
opening $ must have a non-space character immediately to its right,
while the closing $ must have a non-space character immediately to its
left, and must not be followed immediately by a digit. Thus, $20,000
and $30,000 won’t parse as math. If for some reason you need to
enclose text in literal $ characters, backslash-escape them and they
won’t be treated as math delimiters.
The problem in this case seems to have been caused by my notebook's filename. I don't fully understand what caused the problem, but the error message above includes a reference to some text:
... Other Content Finding Features_10_0.png}.
That text includes _ which can cause this error. I think what happens is that somewhere in the conversion script, if there are spaces in the filename, a file is generated with underscores as shown, and that then triggers the error. (This seems a little bit like a bug to me, or at least a weakness).
The fix that worked for me was simply to change the jupyter notebook's filename not to include any spaces. Then the conversion ran without a hitch.
For me it's caused by significant difference between LaTeX and MathJax. For example cases environment can be rendered outside math mode with MathJax, which is the default choice of jupyter notebook. However, it causes an error stating "missing $ insert" in LaTeX. The error message disappeared after correcting syntax in Markdown cells.

Kapacitor: Getting error while defining tick file

I'm on my very first script with kapacitor. I've written a tick file. Following is the script.
stream
.from().measurement('cpu')
.where("cpu" == 'cpu-total')
.alert()
.info(lamda:TRUE)
.log('/tmp/cpu.log')
I'm defining tick file to kapacitor using following command
kapacitor define highcpu -type stream -dbrp telegraf.default -tick cpu.tick
Getting Following error
invalid TICKscript: parser: unexpected unknown state, last char: ':' line 5 char 14 in "info(lamda:TRUE)". expected: ")"
I'm not getting exactly going wrong. I'm sure there is nothing wrong with config and telegraf and influxdb.
Kapacitor version 1.3.1
OS: Fedora 22
Missing 'b' in lamda.
Should be: lambda.
Q: I'm not getting exactly going wrong.
A: Short answer, syntax error.
Unfortunately the parser for Kapacitor's TICK script is not that mature yet and you really can't blame them for it. This project is still a baby, hence these such of errors only appear during runtime.
The problem is with your lambda expression .info(lamda:TRUE). You need to tell the expression which field or tag to lookup its value.
A typical lambda expression looks like
info(lambda: if ("sum" >= 45000, '1', '0'))
info(lambda: "isPeakHour" == 'true')
Something to note here is that, there is no True or False in Kapacitor yet. 1 or 0 is typically used to represent boolean.
You might also want to take note of single quote and double quotes in TICK script.
Single quotes are string literals
Double quotes are references to a field or tag. Double quotes are
only used in lambda expressions.

why is this error with bad utf8 character is caused while creating a document in couchdb?

Creating document in couchdb is generating the following error,
12> ADoc.
[{<<"Adress">>,<<"Hjalmar Brantingsgatan 7 C">>},
{<<"District">>,<<"Brämaregården">>},
{<<"Rent">>,3964},
{<<"Rooms">>,2},
{<<"Area">>,0}]
13> IDoc.
[{<<"Adress">>,<<"Segeparksgatan 2A">>},
{<<"District">>,<<"Kirseberg">>},
{<<"Rent">>,9701},
{<<"Rooms">>,3},
{<<"Area">>,83}]
14> erlang_couchdb:create_document({"127.0.0.1", 5984}, "proto_v1", IDoc).
{json,{struct,[{<<"ok">>,true},
{<<"id">>,<<"c6d96b5f923f50bfb9263638d4167b1e">>},
{<<"rev">>,<<"1-0d17a3416d50129328f632fd5cfa1d90">>}]}}
15> erlang_couchdb:create_document({"127.0.0.1", 5984}, "proto_v1", ADoc).
** exception exit: {ucs,{bad_utf8_character_code}}
in function xmerl_ucs:from_utf8/1 (xmerl_ucs.erl, line 185)
in call from mochijson2:json_encode_string/2 (/Users/admin/AlphaGroup/src/mochijson2.erl, line 200)
in call from mochijson2:'-json_encode_proplist/2-fun-0-'/3 (/Users/admin/AlphaGroup/src/mochijson2.erl, line 181)
in call from lists:foldl/3 (lists.erl, line 1197)
in call from mochijson2:json_encode_proplist/2 (/Users/admin/AlphaGroup/src/mochijson2.erl, line 184)
in call from erlang_couchdb:create_document/3 (/Users/admin/AlphaGroup/src/erlang_couchdb.erl, line 256)
Above of two documents one can be created in couchdb with no problem (IDoc).
can any one help me to figure out the reason it is caused?
I think that is problem is in the <<"Brämaregården">>. It is necessary to convert the unicode to binary firstly. Example is in the following links.
unicode discussion. The core function is in unicode
Entering non-ASCII characters in Erlang code is fiddly, not the least because it works differently in the shell than in compiled Erlang code.
Try inputting the binary explicitly as UTF-8:
<<"Br", 16#c3, 16#a4, "mareg", 16#c3, 16#a5, "rden">>
That is, "ä" is represented by the bytes C3 A4 in UTF-8, and "å" by C3 A5. There are many ways to find those codes; a quick search turned up this table.
Normally you'd get the input from somewhere outside your code, e.g. reading from a file, typed into a web form etc, and then you wouldn't have this problem.

Strip Newline Character from command line output in Ant

I am writing an ant build script that does a sshexec and returns the output of the command ran into the outputproperty attribute.
The value of the outputproperty has a newline character on the end of them. Anyway I can strip that newline character from the output?
Regards,
Stephen
I managed to find the answer: The newline character represented by &#10 can be used when using the <equals> command.
Regards,
Steve

Resources