function updateServerList() {
var i;
for (i=0; i < servers.length; i++) {
var server = servers[i];
var ip = server['serverIp']
var html = constructServer(i);
var divId = '#server' + ip.replace(new RegExp("\\.", "mg"), "-");
var visible = $(divId).find(".server_body").is(":visible");
var div = $(divId);
div.html(html);
// Set div class.
var prevState = div.attr('class').substring(7)
if (prevState != server['state']) {
if (server['state'] == 'ok') {
console.debug(server);
div.slideUp('fast', function(server) {
$(this).removeClass();
$(this).addClass('server_ok');
var id = ipToId[server['serverIp']];
console.debug(id);
if (id == 0) {
adjacentIp = servers[1]['serverIp'];
adjacentDivId …Run Code Online (Sandbox Code Playgroud) 我有一个看起来像这样的流(除了更多东西):
<ret:EditUse>Broadcast</ret:EditUse>
<EditUse>Movie</EditUse>
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用sed清理它的XML:
sed "s_</?(ret:)?EditUse>__"
Run Code Online (Sandbox Code Playgroud)
我已经使用RegexPal测试了正则表达式,但它似乎不适用于sed.关于什么是错的任何想法?
出于以下情况,这是重用section矢量的首选方式?
Iterator<Vector> outputIter = parsedOutput.iterator();
while(outputIter.hasNext()) {
Vector section = outputIter.next();
}
Run Code Online (Sandbox Code Playgroud)
要么
Vector section = null;
while(outputIter.hasNext()) {
section = outputIter.next();
}
Run Code Online (Sandbox Code Playgroud) 我的问题是,getInputStream()当我在发布到服务器后尝试打开流时挂起.用python编写的服务器给出了一条错误消息,让我相信它无法正确解析我的查询字符串.请帮我诊断一下这个问题.
我使用以下代码发布到Web服务器:
String boundarySolo = "--158211729626281";
String boundary = boundarySolo + "\r\n";
String contentHeader = "Content-Disposition: form-data; name=\"";
URL requestUrl;
URLConnection connection;
String queryString = new String();
try{
requestUrl = new URL(config.getServerUrl());
connection = requestUrl.openConnection();
connection.setReadTimeout(1000);
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundarySolo);
Run Code Online (Sandbox Code Playgroud)
...
outStream = new DataOutputStream(connection.getOutputStream());
System.out.println("Writing bytes...");
outStream.writeUTF(queryString);
System.out.println("Bytes written");
outStream.flush();
System.out.println("Buffer flushed.");
outStream.close();
System.out.println("Stream closed.");
try{
inStream = new DataInputStream(connection.getInputStream());
String buffer;
System.out.println("Entering the loop.");
while((buffer = inStream.readLine())!= null)
System.out.println(buffer);
System.out.println("Leaving the loop.");
} …Run Code Online (Sandbox Code Playgroud) 我正在尝试在java中调试Null Pointer Exception,但堆栈跟踪无益.它不能指向任何特别的东西:
[exec] Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
[exec] at core.InputPanel.<init>(Unknown Source)
[exec] at core.Main.<init>(Unknown Source)
Run Code Online (Sandbox Code Playgroud)
我怎样才能缩小这个空指针的位置?