小编Vic*_*nko的帖子

如何在android NDK中构建子模块

我在NDK中成功构建了HelloWorld示例.

我想建立库re-0.4.2,rim和baresip.

项目结构如图所示

在此输入图像描述

如何构建上面的lib?

提前致谢.

android-ndk baresip

5
推荐指数
1
解决办法
1109
查看次数

如何在Tornado应用程序中检测长阻塞功能

我有一个Tornado应用程序,有时会有人添加一个阻止不适当时间的代码.

如何检测这些函数,甚至可以记录哪个处理程序/协同程序方法阻塞的时间比50毫秒长?

我在看_make_coroutine_wrapper()tornado.gen,看不到的方式,来削减除了修改源-这是确定的一次性调试,但有没有更好的办法?

python profiling tornado

5
推荐指数
1
解决办法
1471
查看次数

在java/rome中读取RSS提要:无法访问org.jdom.Document

我试图在java中阅读RSS feed我正在使用ROME来读取feed,但是获取错误无法访问未找到org.jdom.Document的org.jdom.Document类文件SyndFeed feed = new SyndFeedInput().build(reader ); 1错误

我已将jdom添加到lib但仍然收到错误.请指导我如何解决它.我的代码如下

import java.net.URL;
import java.util.Iterator;

import com.sun.syndication.feed.synd.SyndEntry;
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.SyndFeedInput;
import com.sun.syndication.io.XmlReader;

public class Reader {

  public static void main(String[] args) throws Exception {

    URL url  = new URL("http://viralpatel.net/blogs/feed");
    XmlReader reader = null;

    try {
      reader = new XmlReader(url);
      SyndFeed feed = new SyndFeedInput().build(reader);
      System.out.println("Feed Title: "+ feed.getAuthor());

      for (Iterator i = feed.getEntries().iterator(); i.hasNext();) {
        SyndEntry entry = (SyndEntry) i.next();
        System.out.println(entry.getTitle());
      }
    } finally {
      if (reader != null)
        reader.close();
    } …
Run Code Online (Sandbox Code Playgroud)

java rss rome

4
推荐指数
1
解决办法
1万
查看次数

Grails hasMany:查找具有符合条件的子项的所有主记录

我有这个Grails的2.0.3项目,其中有两个型号DomainADomainB无一不是由相互关联的many-to-many关系,其中DomainB的一个孩子DomainA.

class DomainA {
  // properties
  static hasMany = [domains: DomainB]
}

class DomainB {
  // properties
  static hasMany = [domains: DomainA]
  static belongsTo = [DomainA]
}
Run Code Online (Sandbox Code Playgroud)

鉴于这种设计,我想查询所有DomainB其中存在DomainA以下查询集的实例DomainA.

def domainsList = DomainA.createCriteria().list() {
   // other criterions for the other properties
}
DomainB.createCriteria().list() {
   inList("domains", domainsList)
   // other criterions for the other properties
}
Run Code Online (Sandbox Code Playgroud)

执行上面的代码时,会出现错误提示,ERROR util.JDBCExceptionReporter - Parameter #1 has not been …

grails hibernate hibernate-criteria grails-domain-class

3
推荐指数
1
解决办法
8055
查看次数

带有多个带空格的参数的Java ProcessBuilder

我知道有很多关于从java执行进程的问题.但是我无法使用提供的答案来解决我的问题.我正在尝试从java应用程序创建postgresql数据库备份.我使用以下代码

        //ProcessBuilder probuilder = new ProcessBuilder(new String[]{"cmd","/c","D:/PostgreSQL 8.2/bin/pg_dump.exe","-U","usr","-i","-h","localhost","-p","5432","-F","c","-b","-f","D:/backup test/backups/test_27-1-2013_210.backup", "test"});
        //ProcessBuilder probuilder = new ProcessBuilder(new String[]{"cmd","/c","D:\\PostgreSQL 8.2\\bin\\pg_dump.exe","-U","usr","-i","-h","localhost","-p","5432","-F","c","-b","-f","D:\\backup test\\backups\\test_27-1-2013_210.backup", "test"});
        ProcessBuilder probuilder = new ProcessBuilder(new String[]{"cmd","/c","\"D:\\PostgreSQL 8.2\\bin\\pg_dump.exe\"","-U","usr","-i","-h","localhost","-p","5432","-F","c","-b","-f","\"D:\\backup test\\backups\\test_27-1-2013_210.backup\"", "test"});
        Map<String, String> env = probuilder.environment();
        env.put("PGPASSWORD", "mypass");

        final Process process = probuilder.start();
Run Code Online (Sandbox Code Playgroud)

执行上面的代码后,我得到以下错误: D:\PostgreSQL' is not recognized as an internal or external command, operable program or batch file.

仅当备份文件的路径包含空格时才会出现问题,否则将创建备份.我试图在文件路径中使用斜杠和反斜杠,我引用文件路径,但每次都得到相同的错误.可以从命令提示符执行命令.

我做错了什么.ProcessBuilder中有关空格的参数数量是否有一些限制.谢谢

java parameters cmd space processbuilder

3
推荐指数
1
解决办法
6896
查看次数

如何在makefile中仅在特定目标上使用.NOTPARALLEL?

我在Makefile中有5个标签:

all: label1 label2 label3 label4 last_label
Run Code Online (Sandbox Code Playgroud)

我想last_label最后完成,我想用make -j.如果我使用.NOTPARALLEL,它将使所有这些NOTPARALLEL,任何关于如何做到这一点的建议?

linux makefile

3
推荐指数
2
解决办法
6699
查看次数

如何为移动的 Vec&lt;&gt; 参数调用 Vec&lt;&gt;::append()?

我正在编写一个简单的构建器。我想有一个建设者方法消耗self,同时也消耗Vec<Node>并追加到一个Vec<Node>self已经拥有。

我有这个方法:

pub fn with_nodes(mut self, mut nodes: Vec<Node>) -> Graph {
    self.nodes.append(&nodes);
    self
}
Run Code Online (Sandbox Code Playgroud)

nodes是一个非引用,因为我想使用它,这是mut因为Vec<>::append()它的参数发生了变异。

问题是,我得到:

46 |             self.nodes.append(&nodes);
   |                               ^^^^^^ types differ in mutability
   |
   = note: expected mutable reference `&mut Vec<Node>`
                      found reference `&Vec<Node>`
Run Code Online (Sandbox Code Playgroud)

为什么它nodes是不可变的,因为它被明确标记mut?我还能如何使参数成为局部可变的Vec

move rust

3
推荐指数
1
解决办法
81
查看次数

"网络编程"示例中的代码如何工作?

我正在阅读Beej的" 网络编程指南 ".

在他的一个介绍示例中,他谈到了获取主机名的IP地址(例如google.com或yahoo.com).这是代码.

/*
** showip.c -- show IP addresses for a host given on the command line
*/

#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <arpa/inet.h>

int main(int argc, char *argv[])
{
    struct addrinfo hints, *res, *p;
    int status;
    char ipstr[INET6_ADDRSTRLEN];

    if (argc != 2) {
        fprintf(stderr,"usage: showip hostname\n");
        return 1;
    }

    memset(&hints, 0, sizeof hints);
    hints.ai_family = AF_UNSPEC; // AF_INET or AF_INET6 to force version
    hints.ai_socktype = SOCK_STREAM;

    if ((status = getaddrinfo(argv[1], NULL, …
Run Code Online (Sandbox Code Playgroud)

c sockets network-programming

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

如何在grails中显示html?

我有一个域类,其中包含一个包含HTML代码的字符串变量.我想在myxml.gsp上显示此代码.

为此我写了以下代码:

Learn.groovy

public class Learn {

    String content = ("<html><head><title>Learning Grails</title>
       <body>Grails is fun</body></html>");

}
Run Code Online (Sandbox Code Playgroud)

myxml.gsp

<html>
  <head>
    <title>Xml Output</title>
  </head>
  <body>
     <p>${learn.content}<p> 
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

然而,它无法获取"内容"的值,得到错误:"Cannot get property 'content' on null object".我做错了什么?有没有更好的方法来实现这一目标?

html grails gsp

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