PoI filter Data WireCloud - fiware

I'm using WireCloud, I'm trying to connect the output of a Map Viewer (PoI selected) to the input of a WebBrowser Widget (filter the PoI and get the URL of the image field). I saw some examples on the web doing it, but I'm not able to find the operator. Does anybody knows where can I get it?
Thanks a lot

We had custom operators for that tasks, and I've been cleaning and updating code to publish it as a new operator.
Such operator is called Value Filter, and you can find it on: https://github.com/Wirecloud/value-filter-operator
It does require a preference in dot-sepparated syntax as the path to the data you want to filter. It does receive a JSON object, extracts the path-addressed data and outputs it, so it can be instantiated in-line. In case original data is a POI, the path should be something like poi.data.something.
Best regards

Related

Jenkins API xpath like functionality for JSON

I am trying to use the jenkins API to retrieve a list of running jobs buildURLs and this works with this the query
https://jenkins.server.com/computer/api/xml?tree=computer[executors[currentExecutable[url]]]&depth=1&xpath=//url&wrapper=buildUrls
By searching for all executors on given jenkins server and then grabbing the urls and wrapping them in a xml buildUrls object
(what I actually want is a count of total running jobs but I can filter in api then get a .size of this once client side)
However the application I am uses only accepts json, although I could convert to json I am wondering if there is a way I can have this return a json object which contains just the buildUrls. Currently if I change return to json the xpath modification is removed (since its xml only)
And I instead get returned the list of all executors and their status
I think my answer lies within Tree but i cant seem to get the result I want
To return a JSON object you can modify the URL as below
http://jenkins.server.com/computer/api/json?tree=computer[executors[currentExecutable[url]]]&depth=1&pretty=true
It will not be possible to get only the build urls you need to iterate through all the executables to get the total running jobs. The reason is that build urls alone cannot give you information where it is running. Hence, unfortunately we need to iterate through each executor.
The output you will get is something like below.
Another way of doing this same thing is parsing via jobs
http://jenkins.server.com/api/json?tree=jobs[name,url,lastBuild[building,timestamp]]&pretty=true
You can check for building parameter. But here too you will not be able to filter output from url diretly in jenkins. Iteration would be required through each and every job.

How connect json file with after effects for rendering dynamic video

I wan't to learn how connect some json file with after effects for rendering dynamic videos.
Eg i have a form in some webpage:
this form included one input which people are using there their name.
And then i create some json file like that array of objects with this form.
data = [
{
name: 'John'
},
{
name: 'Mike'
}
]
and i wan't to create with these json objects for each name some video about few second there will be shown just name from json and render some mp4 video.
How to do that?
which steps following?
if it will be web form i think i'll need to connect json file dynamically too right?
so after effects will read this json file from some url ?
There are many ways to go about doing this, but a single answer on Stack Overflow probably won't give you everything you need.
Network communication can be done using the CEP framework provided by Adobe which can then execute ExtendScript code which actually does the manipulation of the layers inside the AEP project file. You can use node modules to perform the network communication, and then write ExtendScript code to pass in the JSON data to that.
While not free, you might want to explore Dataclay's Templater extension to help you accomplish what you want. It not only does what you are asking out of the box, but it has some rules-based AI to reconfigure layers both temporally and spatially. You can point Templater to a URL that response with an array of JSON objects and have it process that data. In addition to this, it has event hooks which allow you to execute any script within the Shell or with the ExtendScript engine during its versioning process.
Hope this helps!

How to make Simple-JSON variable template query in grafana?

I am trying to create a dynamic variable for a graph using a kdb+ database, which requires the Simple-JSON plug in. However, I am struggling to figure out how to write the query in the Query search bar under Variables on my Dashboard.
I have looked into the documentation found here but there is only a few mentions of the templating feature for variables in grafana, but nothing on how to do it.
https://github.com/grafana/simple-json-datasource/blob/master/README.md
You can write arbitrary text in the timeserie query, it doesn't need to be one of the hardcoded metrics that /search returns.
There is also the simpod json datasource plugin.
https://grafana.com/grafana/plugins/simpod-json-datasource
built on top of the Simple JSON Datasource. It has refactored code, additional features and active development.
One of the "additional features" is an "Additional JSON Data" tab where you can use variables. {"key": $variableValue}
It actually turns out that the adaptor for kdb+/grafana needs it's search function overloaded to be able to accept variables and return a string (or something that grafana can understand).

Accessing nedb results

The question is: how to access multiple documents returned from a nedb 'find' command.
Understanding some insight I gained using nedb in nodejs.
Regarding docs returned via nedb find and accessing key value pair:
Thought this would work: docs.current.temp_f but it doesn't.
This works: docs[0].current.temp_f does work.
Background and detail:
I'm new to JavaScript, nodejs, nedb, and have never used mongodb, but understand nedb has a similar API.
The reason for my post is: I use this site a lot, but could not find an answer to my problem. I finally figured it out myself, and am posting it here so I can return a contribution to the community.
I'm accessing Wunderground using their API. Works great. I then pushed the results into nedb using the nedb API's 'insert' command. There are multiple examples of this available, here and elsewhere.
Using the nedb API's find command, I was able to retrieve my data. I could print it out using console.log(). Again, multiple examples here and elsewhere for this.
Wunderground returns a JSON object (if requested in this format), in the form {response:{...some data}, current_observation:{...some data...temp_f...some more data}}, which can be inserted into the nedb database.
Using the nedb API 'find' command (e.g.,
db.find({},function(err,docs) {console.log(docs);} I was able to print out my data. But my desire was to just obtain a few key:value pairs, not the whole structure. I thought that something like docs.current_observation.temp_f would do the trick, but this was always 'undefined' and caused an error.
What I didn't understand, because I'm so new in this area, is that nedb is returning a "set" of data; an array of JSON objects in this case, since I was inserting JSON objects. I never saw this mentioned anywhere on the npmjs.com site for nedb. So I wanted to alert others like myself that lacked this knowledge.
Here's what ultimately worked to obtain the key:value information:
console.log("temp_f: ", docs[0].current_observation.temp_f);
where I'm accessing the array element 0.
Of course, this would probably end up in something like a for/in loop.
I would be interested in seeing any additional ideas on retrieving key:values from the result set returned, if you know of any.
//Thought this would work, but it doesn't
docs.current_observation.temp_f
//but this does, where x is a value to record
docs[x].current_observation.temp_f
Simple answer is use mongo's query language with find method to return an array of matching documents then manipulate the array of objects to get the values you need. Use for of when iterating arrays not for in. Alternatively use map, filter, forEach and reduce array methods for manipulating array data.

trouble understanding json and jquery-ui autocomplete

I'm trying to use the jquery-ui autocomplete and I'm having trouble fully understanding how to hook it up.
In an effort to see functionality, we exported a list of user names in the json format of
["Abbott, Bob",
"Adams, Jo", etc...
and it's over 8k lines. I saved this into a file called names.json. When I set up my autocomplete, I used the following:
$("#userName").autocomplete({
source: "names.json"
});
Based on the jqueryi-ui autocomplete page. It says this:
When a String is used, the Autocomplete plugin expects that string to point to a URL resource that will return JSON data.
It returns all 8k+ names instead of filtering it based on what I'm typing. I tried changing it to:
$("#userName").autocomplete({
source: "names.json?term="
});
That didn't work to filter it either.
I've tried variations on the remote JSONP datasource example, but I can't seem to get it to work.
I've tried changing my json file to the format of:
[{"value":"Abbot, Bob"},
{"value":"Adams, Jo"}, etc...
That didn't filter.
I've tried taking out the quotes around value. That didn't return anything.
I've tried changing it to the format listed in the answer for this stackoverflow question returning item.value with my second json format but that didn't filter it either.
I'm not quite sure what I'm doing wrong and I hope to understand. Thank you.
Your datasource needs to by dynamic.
jquery ui autocomplete is going to send a request to the URL you have specified with ?term=WHATEVER_THE_USER_TYPED appended. You need something on the server side that will process that request and return just the data for that term.
For instance,
$("#userName").autocomplete({
source: "names.php" // php as an example.
});
Will result in a request to:
/names.php?term=abcd
names.php would have to pull back the data that matches the search and return it.