Parse yaws get query - erlang

This crashed
out(A) ->
io:format("~wqqq12", yaws_api:queryvar(A, "id"), yaws_api:parse_query(A)),
with this
Reason: {function_clause,
[{io,request,
["~wqqq12",{format,undefined,[{"id","F1D79543E9E6583B"}]}]},
But it's clear that "id" is present in the get query. Why can't it parse it?
edited:
And query: *.yaws?id=F1D79543E9E6583B
edited2:
sorry for misleading, but i use format for send values to browser, its intended error. I'm intersted in why second argument in format becomes "undefined".

You are calling io:format the wrong way. The correct is:
io:format(Format, ListOfParams)
Where Format is a String and ListOfParams is a list of terms to be used in your format.
Check the io:format/2 manual for more details.

Related

Using IN operator OData 4.0 "Bad Request" FetchXML Builder xrmtoolbox

By using FetchXML Builder in Xrmtoolbox I have an OData 4.0 string:
.../contacts?$filter=(searchable eq true)
or (contains(firstname, '%25firstName%25)'
or contains(lastname, '%25lastName%25')
or Microsoft.Dynamics.CRM.In(PropertyName= '_accountid_value', PropertyValues=['00000000-0000-0000-0000-000000000000','c198b30d-8d4e-eb11-a812-000d3ab5acdf','6c9caaac-a755-eb11-a812-0022489b9c9c'])
or Microsoft.Dynamics.CRM.In(PropertyName= 'contactid', PropertyValues=['00000000-0000-0000-0000-000000000000','30262317-0a83-eb11-a812-000d3ab02826']))
I have manually changed "and" to "or" in the query, so I am afraid it is just a small detail that I have missed. However, I have never used the IN operator with this tool before and am therefore worried it might be an issue with the way I use it/I have done something wrongly.
How do I know there is an issue with the string?
The image below shows the code in C# when I am trying to fetch the data. This is where I can't get through because I get "Bad request" from the HTTPClient.GetAsync method. I know that the method call is not the problem because I do this in several other places, and can therefore only assume it is the OData string. I have also got "Bad request" before and fixed it making the OData string correct.
Has anyone else had this issue or know what is wrong with the OData string that I am overlooking?
Edit:
I checked the docs linked by #PanagiotisKanavos. Unfortunately this also gives my "Bad request".
".../contacts?$filter=(searchable eq true) or (contains(firstname, '%25Mat%25)' or contains(lastname, '%25son%25') or _accountid_value in ('c198b30d-8d4e-eb11-a812-000d3ab5acdf','6c9caaac-a755-eb11-a812-0022489b9c9c') or contactid in ('30262317-0a83-eb11-a812-000d3ab02826'))"

How do I solve the "attempt to call a table value" runtime error on lua?

I'm working on a lua script to convert IO Link data into MQTT. When I debugged the script, I got following runtime error on the function client:register :
Runtime error: attempt to call a table value (global 'string')
I understood that out of the 3 parameters needed, the eventname has to be in string. Coming from Java, I tried converting it directly in the function. It looks like this:
client:register( deviceHandle, string(IOhandleOnDisconnected) , IOhandleOnDisconnected )
It still does not work though.
Does anybody have an idea how to fix this?
Greetings.
string is Lua's standard library for string manipulation. It is a Lua table which cannot be called as you did in string(IOhandleOnDisconnected)

How do I find the error details using the match function on Lua?

I'm just asking a question on finding error details from the error function.
Like I would like to find error details from example.lua:50: "then" expected near "if".
Any ways on how to do that on Lua? I'm working on something for ComputerCraft on Lua. (Minecraft Java mod)
EDIT:
I'm trying make a function that returns the error parsed out. It's supposed to return 3 variables, var1: file name, var2: line number (if none it is specified nil), var3: error text.
example.lua is the file where the error is. 50 is the line number. There is a syntax error, likely in the if condition. (I'm not familiar with ComputerCraft, so I don't know where that file might be.)

Read a list from stream using Yap-Prolog

I want to run a (python3) process from my (yap) prolog script and read its output formatted as a list of integers, e.g. [1,2,3,4,5,6].
This is what I do:
process_create(path(python3),
['my_script.py', MyParam],
[stdout(pipe(Out))]),
read(Out, OutputList),
close(Out).
However, it fails at read/2 predicate with the error:
PL_unify_term: PL_int64 not supported
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe
I am sure that I can run the process correctly because with [stdout(std)] parameter given to process_create the program outputs [1,2,3,4,5,6] as expected.
Weird thing is that when I change the process to output some constant term (as constant_term) it still gives the same PL_int64 error. Appending a dot to the process' output ([1,2,3,4,5,6].) doesn't solve the error. Using read_term/3 gives the same error. read_string/3 is undefined in YAP-Prolog.
How can I solve this problem?
After asking at the yap-users mailing list I got the solution.
Re-compiled YAP Prolog 6.2.2 with libGMP option and now it works. It may also occur in 32-bit YAP.

bad argument in call to crypto:aes_cfb_128_crypt

This is the code snippet at line 461 which is giving badarg error ,please help me solve this error guys.
ejabberd_odbc:escape(base64:encode(crypto:aes_cfb_128_encrypt(<<"abcdefghabcdefgh">>, <<"12345678abcdefgh">>, xml:element_to_binary(NewPacket)))),
Log:
bad argument in call to crypto:aes_cfb_128_crypt(<<"abcdefghabcdefgh">>, <<"12345678abcdefgh">>, <<">, true) in mod_offline:'-store_offline_msg/6-fun-2-'/2 line 225
One of the things I like about functional languages is that you generally have an easier time reproducing errors in a controlled environment. In your case, it seems like
base64:decode(XML)
is the call that's failing, so you should write
io:format("XML=~p~n", [XML]),
base64:decode(XML)
the first line will print out the contents of XML in Erlang syntax, and the second line will fail when you get to the bad input.
Once you see the string you're trying to decode, the problem will probably be obvious (it's not a string or it's not a base64 string). If it is a correctly-encoded base64 string, then you can post that problem as a StackOverflow question and get a more useful response.

Resources