GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 07-May-2008, 20:32
Zorachus's Avatar
Zorachus Zorachus is offline
Junior Member
 
Join Date: Jul 2005
Posts: 58
Zorachus will become famous soon enough

Running interactive console programs through the browser


I remember this place being very helpful a few years ago, so this is the first place I thought of when I ran into this problem.

I'm doing independent study this semester (actually a third one-month semester; my university is a bit weird). The professor that I'm working with requires exactly what I've stated in the title. I know it's possible; I've seen AJAX terminal emulators, but I don't need something that complex. I'm pretty fluent in PHP, javascript, and the AJAX technique, but I'm really unsure where to start here. I know that, short of writing a terminal emulator, I need to find some way to redirect I/O to the browser, but I don't think piping is the answer.

Perhaps the best example of this I can think of is here. They sort of trick the browser into thinking that the page never fully loads, which allows instantaneous response to commands via AJAX.

I know that this is complex, but I would appreciate even a nudge in the right direction. It doesn't matter if this is done "right" or "well." My professor requires a quick-and-dirty solution, if you will.

Thanks in advance.
__________________
Pursue everything!

P.S. This is what you would get at some point in the alphabet with the removal of the Q and R.
  #2  
Old 21-May-2008, 22:41
JustinFox JustinFox is offline
Junior Member
 
Join Date: Mar 2008
Posts: 59
JustinFox will become famous soon enough

Re: Running interactive console programs through the browser


I would just have two ajax function, one for sending messages and one for requesting existing messages.

so when you send your message, you'll immediately change the innerHTML of your display to :

document.getElementById("ChatWindow").innerHTML += "<br/>"+<font>document.getElementById("userInput").valu e+"</font>";

then have the AJAXSENDMESSAGE function that sends your message to the server and stores it in a database along with your client name (which can be assigned by an ajax function that overrides the body onload().).

so you could have a send message table, along with a unique id, and then a received message table along with a unique Id.

Then you could just say

ok, if this is an incoming message, insert it into the sendmessage table along with the message and client name.

now it is time to see if any of the sendmessages in the sendmessages have not been recieved by this client.

if so, write the response of the messages (in html) and store the messages along with the client name in the table messagesrecieved so that next time you send a message, you won't get messages that you already recieved.

and if I were you, I would have a timed AJAX function that constantly requests fromt that php (or any other server sided script page) to see if any new messages have came in.

checking when you send is just extra, and probably you can do with out.

This is the way I would do it "quick and dirty".

Justin Fox
 
 

Recent GIDBlogOnce again, no time for hobbies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
win32 CreateProcess(), STARTUPINFO not working well for 98 console Howard_L C Programming Language 0 10-Aug-2007 00:33
running my programs EXE from VB will not "printf" to screen sharikon C++ Forum 3 18-Dec-2006 08:29
need help with a console menu system BullBuchanan C++ Forum 6 20-Aug-2006 15:46
win32 file opening and running other programs Tomb332 C++ Forum 1 17-Aug-2006 09:53
Running several Programs at the same time expi12 C Programming Language 2 02-Jan-2006 01:30

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 02:18.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.