How to connect python code and android app - python-3.x

I have a written a Python code that takes user id and movie name from the user and recommends a list or 10 movie to the user now i have also created an android app using the react native app UI and i want to take input from the user through the app process the input(user id and Movie name ) and give recommendation (a list of movies) in the app , what should I do to achieve this objective

One way would be to run your recommender under flask.
Then have your mobile app query your recommender service
and display the results.

Related

How to deploy Node CLI utility app, general question

My app in a nutshell: It is a CLI app. It does mini helper tasks. It intakes keywords into the console such as 'search' & opens a new tab with the search query, or 'definition' and pulls a definition from the dictionary and logs the results to console, 'email' opens thunderbird, etc...
I have uploaded this to Heroku, and it is a successful deployment. BUT, how do I access all of the CLI inputs (process.stdin, process.stdout) that I use when I run it on local host in windows terminal?

webchat and rasa, handling multiple users on a nodejs backend

I've setup a dockerized rasa installation to communicate to using a non dockerized react (mongo node express) frontend. I'm using the botfront webchat component as the chat component and I can send and receive messages correctly from rasa.
What I don't understand is how to make it so that different users (in the nodejs backend) can have different chats (in the rasa backend).
I've setup a custom connector for rasa and webchat using socketio which is setup to create a new sessionId at every connection event. This seems to work correctly as in the browser console I do see the following upon consecutive refresh:
connect:d01c6e80aa2647a186f087a4d1849ef9
session_confirm:d01c6e80aa2647a186f087a4d1849ef9 session_id:e50e1e9c87eb48c989d3d98022a0e8c3
connect:c6fc7aff5f0448a89ee54642561fe34c
session_confirm:c6fc7aff5f0448a89ee54642561fe34c session_id:2811d41ff0c44d398927d019b3d604f9
I assume the two session_ids being different means that the chat should appear empty, however the previous interactions are still visible.
Moreover, session_persistance is set to false in the credentials.yml file but this doesn't seem to have any influence
MySocketIO.WebchatInput:
user_message_evt: user_uttered
bot_message_evt: bot_uttered
session_persistence: false
And also in the widget itself I am setting the storage to session and not local:
<Widget
initPayload={"/get_started"}
socketUrl={"http://localhost:5005"}
socketPath={`/socket.io`}
customData={{"language": "en", 'ciccio':123}} // arbitrary custom data. Stay minimal as this will be added to the socket
params={{'storage':'session'}}
title={"Title"}
/>
I need to send the mongodb user._id of the specific user using the chat to the rasa custom actions and that is currently working through the customData, however I still cannot find out how to keep sessions of different users separate from each other.

How to run multiple apps with the same test case in appium

I need to test two apps in the same test case in Appium ( android )
for example, write test case to publish ads on app (A) and see the ad in the second app (B). Also, Can I run on emulator ? or should apply on real device?
After many research, I found the solution. the simple way to do that by define new driver with the selected app and this cause to close the first app and open new one.
Example Code
return driver
.elementById('username')
.click()
.init(Common.SelectApp(apps.AppName)) //Open new app ( the code below)
.setImplicitWaitTimeout(10000)
.elementById('username')
.click()
// Select App function:
var desired = process.env.npm_package_config_sauce ?
_.clone(require("./helpers/caps").android18) :
_.clone(require("./helpers/caps").android19);
return desired.app = App Name;
This code from appium examples (Node)

How to create linux terminal like tutorialspoint?

TutorialsPoint Java Compiler
In tutorialspoint, they have created linux terminal using term.js.
I have integrated same github library in my project, it is working fine but I am trying to understand the flow of tutorialspoint.
My assumption:
In tutroialspoint each time they are creating new user_id under root user(cg) and running terminal(nodejs server) using that user_id so every time when you reload page there will be a different user_id (run whoami in terminal), so another user can't operate other users files.
I am running nodejs server using forever.js under root user, I want to implement same type of functionality. What is correct way to do this? and if there is another way please elaborate.
I think they are creating a new user each time you visit the page and providing you a subshell of that user. It can be easily achieve by using Shell Programming techniques. Creating a new user each time thing is probably nothing more than a security measure.
So I will briefly explain the concept in 5 steps:
1 - Create a new user:
shell_exec('useradd --expiredate 2016-09-10 [username]');
http://www.computerhope.com/unix/useradd.htm
2 - Login to this newly created user account:
shell_exec('su [username]');
3 - Get user input to the PHP script using AJAX(dynamically).
4 - Execute user's command and send the output to user:
<?php
$output = shell_exec("[user's command]");
echo "<pre>$output</pre>";
?>
5 - Repeat from 3.

How to access the "foo" controller in the jhipster-sample-app?

I'm starting to learn AngularJS and as Java/Maven/Spring developer, the jhipster yeoman generator looks great.
I've cloned the jhipster-sample-app, imported it into my IDE and started it via Maven command mvn spring-boot:run. (I know that when I want to generate my own app, i can use yo jhipster)
I am able to browse the app at http://localhost:8080/ and also login as 'user' and 'admin'
How do I navigate to the Foo entity in the sample app?
I've tried http://localhost:8080/#/foo which redirects back to the homepage.
On the server side, I see the sample app has a Foo entity, repository, and resource. On the AngularJS side, I also there is a Foo controller, router, service, and view.
What am i missing?
The sample is just an example of the "default" application, the "foo" entity is not complete.
If you use the generator, here are the steps to make the "foo" entity working:
http://jhipster.github.io/creating_an_entity.html
There are basically the same steps to do on the sample application: you need to set up the database tables (in Liquibase, they are just commented), and import the JS files in your main app.
But you are right, we should generate a complete entity in the sample application (or no entity at all!), but not provide this half complete result.

Resources