Jump to content

Onetoomanysodas

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Onetoomanysodas's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Let's say I have the following: $cmd = "java helloWorld"; $spec = array(0=>array('pipe','r'), 1=>array('pipe','w'), 2=>array('error-output.txt','a')); $prc = proc_open($cmd, $spec, $pipe, getcwd()); if(is_resource($prc)) { ob_start(); while(!feof($pipe[1])) { usleep(1000); $out = fread($pipe[1], 128); if(strlen($out)==0) { break; } else if($out == "\r\n") { echo "\r\n"; ob_flush(); flush(); break; } echo $out; ob_flush(); flush(); } } and helloWorld.class was compiled from a source that looks like this: public class helloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } } Running on Windows XP, the proc_open function will use cmd.exe to execute the command. $pipe[1] is STDOUT and the while loop will break when the newline sequence is printed. This works because java's System.out.println function prints the string "Hello, World!" and then outputs "\r\n". However, If it weren't for this delimiter, fread would hang because it never finds an EOF character. I have tried using stream_set_timeout on $pipe[1] but it does not make a difference. Why can't I make the stream timeout or prevent the reading from continuing after there is nothing left to buffer in STDOUT?
  2. It's not loading into the object holder. The script does just what it should and streams the class. I am even mimicking all the other headers apache usually generates for a java file and the object is still failing to load
  3. Yes thankyou but I know what my headers are doing. It's actually better to use: `Content-Type: application/octet-stream` for better compatibility with the applet object in the DOM but for some reason it's still not loading it and I was just wondering if anyone knows this issue?
  4. I am trying to have a script forward a java class to the client but the applet is failing to load. The file acts as it should when I navigate to the script with these headers: header('Content-type: class/java'); header('Content-disposition: attachment; filename="applet.class"'); header('Content-length: ' . filesize($path)); print($file); The problem is that the applet object is failing from the html document so it must be an issue with lack of proper headers. I need to convince firefox that the request being returned is an actual class file.
  5. I need a function to be able to set a delayed event (setTimeout) to run itself within a class which means it has to be passed as a string, making arguments.callee useless. Is there any way to get the object's name like "test" in my example below from within the class or will I just have to pass the name in an argument? Does anyone know an efficient way of implementing window's globally stored variables to get an object's name as a string? var test = new MyClass(); test.start(); function MyClass() { this.start = function() { this.action(); } this.action = function() { // method body if(recurse == true) setTimeout(test_object_name+".action()", 5); } }
  6. For remote desktop control
  7. This is more of a Windows related issue. How could I get my script to switch the current window on the host machine to a program that is already running? The only thing I could think of would be to execute an external program to switch the window for me, passing the process ID as a parameter. There has got to be a better way to do this.
  8. How could I allow Apache to accept a request for an image file (png) but have php analyze a script by that name in a certain directory? Client request => xx.com/test.png PHP Script name: test.png Apache executes php.exe on test.png test.png => Returns image headers and outputs png data Thanks!
  9. I am developing some AJAX apps and I need to close the socket connection with the client so the browser will execute the server response without waiting for the script to complete it's execution. Here's what I want: <?php $bar = $_POST['foo']; echo "alert('You said '".$bar."')"; // close connection with client so browser evaluates server response someFunctionThatTakesALongTime(); ?> Any help would be most appreciated.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.