小编Paw*_*ela的帖子

带有nginx的Django REST框架绝对URL总是返回127.0.0.1

我在nginx后面使用gunicorn/django(使用django-rest-framework)运行应用程序,并且在使用时使用其余框架的url返回有一点问题hyperlinkedmodelserializer.他们总是返回类似于http://127.0.0.1/我的主机名的东西.

你能帮帮忙吗?

python django rest nginx

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

java.lang.NoSuchMethodError:org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl.getTrList()使用Apache POI库时的Ljava/util/List

我正在努力使工作成为一段代码来读取docx文件,但由于一些奇怪的原因它失败了.

它失败了:

XWPFDocument document = new XWPFDocument(new FileInputStream(filepath));
Run Code Online (Sandbox Code Playgroud)

堆栈跟踪:

Exception in thread "main" java.lang.NoSuchMethodError: org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl.getTrList()Ljava/util/List;
    at org.apache.poi.xwpf.usermodel.XWPFTable.<init>(XWPFTable.java:106)
    at org.apache.poi.xwpf.usermodel.XWPFDocument.onDocumentRead(XWPFDocument.java:151)
    at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:159)
    at org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:124)
    at helper.JavaHelper.readTableDataFull(JavaHelper.java:84)
    at helper.JavaHelper.main(JavaHelper.java:138)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Run Code Online (Sandbox Code Playgroud)

我有这些罐子:

  • dom4j的-1.6.1.jar
  • XMLBeans的-2.3.0.jar
  • POI-3.9-20121203.jar
  • POI暂存器,3.9-20121203.jar
  • POI-OOXML-3.9-20121203.jar
  • OOXML-模式-1.0.jar

看起来它应该对我有用(我也尝试过更新的poi libs - 同样的错误).

有任何想法吗 ?

java apache-poi

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

Array/Vector作为方法参数

我一直认为我们应该在Java中使用Vector,并且没有性能问题,这当然是正确的.我正在编写一种计算MSE(均方误差)的方法,并注意到它非常慢 - 我基本上是传递了值的向量.当我切换到Array时,速度提高了10倍,但我不明白为什么.

我写了一个简单的测试:

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

    Vector <Integer> testV = new Vector<Integer>();
    Integer[] testA = new Integer[1000000];
    for(int i=0;i<1000000;i++){
        testV.add(i);
        testA[i]=i;
    }

    Long startTime = System.currentTimeMillis();
    for(int i=0;i<500;i++){
        double testVal = testArray(testA, 0, 1000000);
    }
    System.out.println(String.format("Array total time %s ",System.currentTimeMillis() - startTime));

    startTime = System.currentTimeMillis();
    for(int i=0;i<500;i++){
        double testVal = testVector(testV, 0, 1000000);
    }
    System.out.println(String.format("Vector total time %s ",System.currentTimeMillis() - startTime));

}
Run Code Online (Sandbox Code Playgroud)

其中调用以下方法:

public static double testVector(Vector<Integer> data, int start, int stop){
    double toto …
Run Code Online (Sandbox Code Playgroud)

java performance vector

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

标签 统计

java ×2

apache-poi ×1

django ×1

nginx ×1

performance ×1

python ×1

rest ×1

vector ×1