NodeJs and Google Colab - jupyter

I need to pass an array/or parameters from NodeJS to a notebook of Colab or Notebook of Jupiter.
How I can do that?
There is possible some solution?
Thank you!

run nodejs as webserver (easiest modules http or expressjs ) and publish your arrays/parameters as json (JSON.encode). If you dont have server, you can use whatsmyip services to find your place ip address, and adjusting your router (modem) to point ports to your computer.
in the collab you can use !wget http://myip:8080/myarrays -O my.json to save or urllib.request.urlretrieve to retrive.
run nodejs in the colab and webserver/socket/file implementations works.

Related

How do you configure simple-subscriptions to run using Postgraphile CLI?

I would like to add subscriptions into a react project I have which currently references graphql using the port 5000 endpoint created by running postgraphile. I start this using the command line startup of globally installed (via npm -g postgraphile) postgraphile. This works fine.
Via the documentation (https://www.graphile.org/postgraphile/subscriptions/) I see that I should be able to enable subscriptions via the CLI:-
https://www.graphile.org/postgraphile/subscriptions/#enabling-with-the-cli-1
However when I run this I get the error:-
"Error: Cannot find module '--simple-subscriptions'"
I'm not sure if it's something to do with pg-pubsub. As I installed postgraphile globally, I did the same with pg-pubsub. Therefore rather than:-
postgraphile --plugins #graphile/pg-pubsub --subscriptions --simple-subscriptions etc
I have:-
postgraphile --plugins pg-pubsub --subscriptions --simple-subscriptions etc
However I know it picks up the plugin ok as running it with "-append-plugins MySubscriptionPlugin.js" rather than simple-subscriptions starts the server with "(subscriptions enabled)" listed.
Has anyone managed to get simple subscriptions running via CLI?

How do I include "ibmiot" input node to my local installation of Node-RED

I want to include the "ibmiot" Input node into my local installation of Node-RED ?
Can I do it ? and if so - how ?
The Node-RED flow editor that shows up when I start the Bluemix IoT Starter, shows the node that exactly - fits into what I want to do.
It has the API Keys, device Type, ID and so on as seen below. I'm trying to add this to my local install of Node-RED.
Any help is appreciated.
Below - I want to add the same node ( or import ) into my Laptop where I have the Node-RED installed.
The iotapp nodes are provided by the node-red-contrib-scx-ibmiotapp module - http://flows.nodered.org/node/node-red-contrib-scx-ibmiotapp

Topology REST API of OpenDayLight not working

Guys am newbie to SDN and Open Day Light . Currently am exploring possibilities with REST api exposed by ODL . I have created a topology with 3 host and 1 switch as discussed in the link http://sdnhub.org/tutorials/opendaylight/ .
Now when i see the topology info of the default container via REST api like <>
http://localhost:8080/controller/nb/v2/topology/default
is see just this tag in the page and nothing other than that .
What am i doing wrong here ? Am i missing something ?
Thanks in advance
Have you made sure that your remote controller is up and running?
You could also run the mininet command by providing the remote controller's ip address and port no at which it is listening.
Ex: sudo mn --topo single,3 --mac --switch ovsk --controller remote,ip=x.x.x.x,port=6633

Cloud9 bottle Web Server, accessed externally

I create a Web Server in python using bottle library. Its works fine and run in https://c9.io. I want access this web service externally.
I´m using host=os.environ['IP'] and port=os.environ['PORT'] to capture the port and ip environment variable.
How can I do it?
Another thing you can do is to replace your host as 0.0.0.0 instead of localhost. This will redirect you to your cloud9's localhost. For example, I'm running my app as:
bottle.run(host='0.0.0.0', port=8082)
You can access the server from a new tab after running your server.
Currently I am facing with the same problem and my solution was to start the app like this:
python myapp.py $IP $PORT
And inside the main module used entrypont2 to map those arguments to variable and use it for run bottle:
from bottle import run
from entrypoint2 import entrypoint
#...
#entrypoint
def main(ip, port):
run(server='gevent', host=ip, port=port, debug=True)
Then I can reach it from web browser using url like this:
http://<workspace>.<user>.c9.io/

ElasticSearch with Play 2 configuration

I am trying to use the ElasticSearch module (https://github.com/cleverage/play2-elasticsearch) with my Play 2 application. In the readme, it says I should add the following to my application.conf:
## define local mode or not
elasticsearch.local=false
## list clients
elasticsearch.client="192.168.0.46:9300"
# ex : elasticsearch.client="192.168.0.46:9300,192.168.0.47:9300"
What is local mode? What is my client URL supposed to be? I can not find any information on what these options should be. With my current options, I get a NoNodeAvailableException.
Some people suggest:
elasticsearch.local=false elasticsearch.client=mynode1:9200,mynode2:9200
But what is mynode1 and mynode2? It doesn't work with my application. Can anyone help? Thanks
What is local mode?
If elaticsearch.local=true, a elasticsearch node is started in your application ( embedded )
What is my client URL supposed to be?
It's your host:port, but the port is the tcp transport define on your elasticsearch node.
By default, the port start on 9300 ( http://www.elasticsearch.org/guide/reference/modules/transport.html )
I can not find any information on what these options should be. With my current options, I get a NoNodeAvailableException.
I think you have a problem on port number.
mynode1 and mynode2 are elasticsearch nodes.
Do you have any Elasticsearch node running?
On which IP address?
Can you try to connect on these nodes using curl, for example:
curl localhost:9200
Or
curl YOURIPADDRESS:9200
If one of this is successful, then configure your play app using YOURIPADDRESS:9300 as Nicolas Boire wrote before.
If no one is successful, check that you have installed Elasticsearch and launched it before.
HTH
I've just had the same problem, be sure that you respect the version requirements written in the table : https://github.com/cleverage/play2-elasticsearch
At the beginning, I set up the latest version of the plugin 0.8.1 but my ElasticSearch version was 1.0.2.
By starting ES with version 0.9.13, it worked.