小编dpa*_*shu的帖子

Java屏幕共享程序

我想创建一个多客户端服务器程序,其中服务器有单独的窗口来显示所有客户端屏幕,以监控他们的计算机上发生了什么.我该怎么办?

我想知道如何在服务器上显示我正在使用GUI界面的屏幕.

java windows tcp client-server

0
推荐指数
1
解决办法
725
查看次数

字符串连接OutOfMemoryError

我正在摆弄Java.lang.String并在它们上使用'+'运算符.我很想知道为什么获得以下输出:

使用下面的代码,我可以获得数千次迭代,并且不会抛出任何内存异常:

public static void main(String[] args) {
        String str = "hello";
        int count = 1;
        while (true) {
            System.out.println(count++);
            str = str + "newString";
        }
    }
Run Code Online (Sandbox Code Playgroud)

但是,当我将'str'添加到自身时,我在20-30次迭代后得到OutOfMemoryError异常:

public static void main(String[] args) {
        String str = "hello";
        int count = 1;
        while (true) {
            System.out.println(count++);
            str = str + "newString" +str;
        }
    }
Run Code Online (Sandbox Code Playgroud)

我在32位操作系统上使用eclipse而没有额外的args,如Xms或Xmx

java memory-leaks memory-management

0
推荐指数
1
解决办法
176
查看次数

使用PHP的AJAX请求

我想点击一个按钮发出一个AJAX请求,但是我无法在后端触发它.

index.php:

<html>
    <head>
        <script type="text/javascript">
            var req = new XMLHttpRequest();
            function send1()
            {
                req.open("GET", "process.php?q=hello", true);
                req.send();         
                alert(req.responseText);      
            }
        </script>
    </head>    

    <button onclick=send1()>send</button>

</html>
Run Code Online (Sandbox Code Playgroud)

process.php:

<?php
$new= $_GET['q'];
echo $new;
?>
Run Code Online (Sandbox Code Playgroud)

这应该让我在警告框中"问好"为什么不呢?

javascript php ajax

-1
推荐指数
1
解决办法
75
查看次数