using ACCEPT command examples - sqlplus

I'm trying to use the ACCEPT command to accept input from the user.
I want to prompt the user to ask them if they want to see the movies in category comedy.
I don't know how to start

Related

How to determine which question was prompted to the user with interactive messages?

I tried running one of the demos using slacks apis, specifically for interactive messages.
I want to do the following:
ask the user question 1
ask the user question 2
ask the user question 3
What I don't understand is how do I know when the user is responding to a particular question?
Say in my database I have a questions table, where I store question #1, #2 and #3 etc.
When I get a response from a user, depending on the question_id I will then trigger the next question.
How do I know exactly which question the interactive message originated from? is there a way for me to get the question_id in the payload?
The standard approach to determine which of your interactive messages the user answered is to use callback_id. You can specify it for each each attachment containing an interactive message (a set of buttons, a menu, etc.) and it will be included in the response request to your app.
Here is what the documentation says about the callback_id:
The provided string will act as a unique identifier for the collection
of buttons within the attachment. It will be sent back to your message
button action URL with each invoked action. This field is required
when the attachment contains message buttons. It is key to identifying
the interaction you're working with.
If you have multiple buttons each will have its own name, which you can use to identify which button was clicked (in combination with the callback_id).
If you need to store more data you can use this hack. With that you could store your question_id directly in the value property of a button (e.g. as JSON string).

Bot that DM's chosen keywords to chosen users

What I'm looking to do is to create a bot that will be in a private channel only accessible to the admins. All users will have keywords that they have chosen prior and will get notified about. Lets say user 'x', has chosen "brown" as a keyword, when a comment comes into the private channel containing the keyword "brown", I want the bot to send that message, copy and pasted, directly to the user 'x' that chose that keyword. So basically I would like to know how to make a bot they has a keyword feature that copies that exact message and dm's that user that chose that keyword.
Is this possible, if so how would I go about it?
Thanks
Most of the bots i have made, i have used python.
Selenium web-driver is fairly easy to use if you intend on scraping the data from HTML pages.
In any case, you could use flask and mysql.connector to create the user interface and login for control of the bot.
If there are any other things you want it to do, i'm sure there's a library out there to do it, or you could just launch some kind of macro or script on the server.
Be very careful of permissions and whatnot if you intend on allowing remote control of other scripts and data on the server though.

How to run a command when clicking submit button (lua)?

i want to use lua to generate cgi-webpages with uhttpd. What's the correct way to execute a shell command when a button (submit form), or a link is clicked?
Thanks
If you are asking for the specifics of what form the HTML would take and the server side scripts in order to do what you want, then your question is way too broad. If you're just wondering about the Lua side of running shell command:
The HTTP GET (link click) or POST (form) would cause one of your Lua functions to get called, wherein you would call os.execute('your-command'). However, due to the obvious security risk associated with calling os.execute, some environments that embed Lua disable certain calls. I don't know anything about the Lua modules allowed by uhttpd. With some luck, it supports the call, and it's up to you to make the proper checks if you want to use it.

Twitter api - trigger on new post?

I have never worked with the twitter api, so I have no idea if this is possible. What I want to do is to trigger a url everytime something new happens on a users timeline (?). Is this possible, and if so, how do I do it?
Yes, but it takes a bit of work. You need to use the twitter streaming API, specifically the follow option.
From twitter:
Example: Create a file called ‘following’ that contains, exactly and
excluding the quotation marks: “follow=12,13,15,16,20,87” then
execute:
curl -d #following https://stream.twitter.com/1/statuses/filter.json
-uAnyTwitterUser:Password.
Basically you pass a list of user ids you want to follow, open a long-lived connection, and twitter sends back to you anything that the user posts publicly. You can monitor this connection and do things when a user posts something.
You have another option, called a User Stream , which gets you way more information about when a user does anything, but it requires the user's approval, and a much more complex authentication process via oAuth. So I would only use that if you need it.
How you're going to be keeping a persistant connection open to twitter is something very much dependent on your programming language and software. In Python, I really like tweepy, but even for python there are several different libraries, or you can just use curl or pycurl and do it yourself like in the example above.

Can an email be printed as soon as it enters the Inbox?

We are working on an online food ordering application. When the user orders something from any restaurant, an email is sent to the restaurant's email address mentioning the order details. However, our client wants that an order print out should be generated automatically as soon as a new order is received.
Is it feasible using ROR? If not, any alternate solution to the problem?
When my group wrote something like this we went a little lower tech, and had the system generate a fax and send it to a fax machine at the restaurant. Of course, that's mainly because this was a system working across many restaurants, with disparate IT infrastructures, and the one thing they had in common was each had a fax machine.
I would figure this could be done in 1 of two ways:
1- Outlook event-- Outlook has the ability to set up 'rules', one of which I think allows printing.
2- Create a script that runs every few minutes, checks the email (either through IMAP, or POP, depending on the account), and prints all of them out.
See this: http://ruby.about.com/od/tasks/a/pop3.htm for info on how to check POP3 mail with ruby on rails.
For printing, the links mentioned here seem useful: http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/504a616bf3e28057/ff6cb91462dfe961?pli=1
Ensure that you have 'from' or 'subject' filters setup, otherwise there will be a lot of spam printing.
You can use software to print your order automatically when email is received, it supports also print attachment like pdf, word, etc...
It is used by a lot of restaurant to print online order:
http://www.automatic-email-manager.com/

Resources