People,
I just read some more of the comments on the "Are we dying?" thread and I realised I, too, am happy with a ML environment and low volume means it is easier to make sure I don't miss interesting stuff when I am scanning Subjects! Anyway, I thought of another Q that people might have good suggestions / advice about:
I have a Java chatbot on my server and this Ruby script to chat with it:
#!/usr/bin/ruby
require 'socket'
require 'json'
session = "SESSION_philip_rhoades_"
session = session + `echo $LOGNAME`.chomp
session = session + "@pricom.com.au"
session_init = "@" + session
host = "localhost"
dfname = nil
if dfname == nil
dfname = 'Unknown Unknown'
end
dname = dfname.split[0]
while true
print "> "
input = gets.chomp
if (input == "quit") then
break
end
xmit = {
:commands => {
:users_name => "Philip",
:users_fullname => "Philip Rhoades",
:name => "Phil"
},
:topic_slug => "phirhodev",
:session_id => session_init,
:message => input
}
# Send it and get the client response
s = TCPSocket.open(host, 9192)
s.puts xmit.to_json
while true
response = s.gets.chomp
if response == "@@END_OF_REPLY"
break
end
puts response
end
s.close
end
This works fine for myself in an xterm but I also want be able to plug this functionality into a Rails web page on various Rails sites - what is the best way of dealing with this? - a gem? What I would like is a setup that will work in a script (like above) but will also work in a Rails environment.
Thanks!
Phil.