How can I fix Xpath in Importjson function? - arrays

I want to get list algo from JSON response. In google sheet I am using this command:
IMPORTJSON("http://miningpoolhub.com/index.php?page=api&action=getminingandprofitsstatistics", "return/algo")
But I got the message "Nod not available" I think I have done something wrong with the Xpath command. How can I fix it?

How about this? I thought that / is required to be added to the top of path.
=IMPORTJSON("http://miningpoolhub.com/index.php?page=api&action=getminingandprofitsstatistics", "/return/algo")
If this was not useful for you, I'm sorry.

Related

Dynamic URL and Sheet using =Importange

I'm trying to make a =ImportRange with a dynamic URL and Sheet, but I'm doing something wrong.
https://i.stack.imgur.com/QQRDK.png
I've also tryed with ""=Q24"A3:A3") where Q24 = August-September !, but that also give an error.
I want to do the same thing with the URL, but I also get an error when I try to do that.
Is it possible and if, which command do i need to use.
I hope someone could help me.
Br
Anders
use:
=IMPORTRANGE("1HeGmCh3fFgHAfJSIsCIFkFi48PWpXR0iZdBcv4HhSWw"; Q24&"!A3")

Extract components of a nested Array/STRUCT JSON string field in BigQuery

I have a String field in JSON format that I am trying to extract the stripe decline code from. An example of the field is below:
{"errors":[{"message":"Your card has insufficient funds.","type":"payment","code":"card_declined","decline_code":"insufficient_funds","gateway":"stripe","stripe":{"type":"card_error","code":"card_declined","decline_code":"insufficient_funds","message":"Your card has insufficient funds.","charge":"ch_3JodUAHkqql8g8ta1ADf5fBf"}}]}
I have tried various combinations of UNNEST but continue to get an error message. I think that the issue is related to the fact the field is a combination of various STRUCTS/Arrays but had no luck extracting what I need. Any help would be greatly appreciated!
I think I found a solution. A little hacky, but I did the following in a CTE;
REPLACE(REPLACE(JSON_EXTRACT(error_message, '$.errors'),"[",""),"]","") as struct_1
And then took another JSON_EXTRACT of this;
JSON_EXTRACT(struct_1,'$.stripe.decline_code')
Consider below approach - non hacky one :o)
select json_extract_scalar(error, '$.stripe.decline_code') as decline_code
from your_table,
unnest(json_extract_array(error_message, '$.errors')) error
if applied to sample data in your question - the output is

Where can I find the simple information of the format for uploading questions?

Situation:
I want to train and simple configure the retrieve and rank service.
I just uploaded some PDFs and now I want to upload some questions.
In the documentation I do not find a simple information how the csv file must be structured and which are the must fields and which are not must files.
Something like: "[YOUR QUESTION (MUST)]",[DOCUMENT ID (MUST)], [RANKING (OPTIONAL)]
The document ID you will find in xyz in section xyz.
Inside the help I can not find such kind of help.
https://www.ibm.com/watson/developercloud/doc/retrieve-rank/training_data.shtml#script
Impact:
There is no chance to get a "real" documentation of the configuration outside the tutorial.
Possible Solution:
Provide additional documenation.
Maybe I was not able to find it and someone can guide me to the right place?
Ok, I found the solution for me, by try and error. Following steps do work for me:
1) You need a plain text file and the ending should be *.txt
2) Inside the file you have to write your questions like this:
What is the best place to be?
Why should I travel to the USA?
-> Don't do it like
"What is the best place to be?"
For me the help was missleading, because saying something about CSV files.
You can take a look also in the comment of #dalelane he is right, and highlight the entry text for the upload of the file.

How to get more info about a specific attribute?

I guess this is a stupid question, so I apologize in advance but I couldn't find the answer anywhere and I guess I didn't even really know how to search for an answer.
How do I find out more about an attribute (not even sure if that's the right word)? For example, if I do:
listAttr bifrostShape1
then I get a long list of ... attributes? .. one of them is called "particleChannel". I want to know more about "particleChannel" so I tried:
listAttr "bifrostShape1.particleChannel"
got nothing basically - returned: "particleChannel" , so I tried:
getAttr "bifrostShape1.particleChannel"
and I got result: "position"...
this is actually what I think I'm looking for and I want to know more about this, what is this "position"?
searching for "particleChannel" in the reference and online gave me nothing, and trying "listAttr and getAttr of "bifrostShape1.particleChannel.position" gave me an error..
What I'm actually trying to achieve is to get attributes of the particles in a bifrost liquid... but my question is actually: How do I find out more about something when I stumble over it like this? What is the way to find out more about a command or attribute?
This is my favorite way to learn so I really hope that there's a good way to do it in maya.
See this: attributeQuery
You can do a lot of queries about an attribute, see docs in the link.

Asterisk library libgami

I am trying to use libgami in order to retrieve differentes events from Asterisk AMI. However I do not know how to parse the response that is return with this library. As the code coments say:
Returns: #GSList of status information (stored as #GHashTable) on
success, %NULL on failure
How can I get the peers out of that list? Has anyone dealt with this before?
Thanks!
Read this
http://www.voip-info.org/wiki/view/asterisk+manager+events
to see how it looks.
After that just got hash element with name as described accordinly to your event.

Resources