我在nginx后面使用gunicorn/django(使用django-rest-framework)运行应用程序,并且在使用时使用其余框架的url返回有一点问题hyperlinkedmodelserializer.他们总是返回类似于http://127.0.0.1/我的主机名的东西.
你能帮帮忙吗?
我正在努力使工作成为一段代码来读取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)
我有这些罐子:
看起来它应该对我有用(我也尝试过更新的poi libs - 同样的错误).
有任何想法吗 ?
我一直认为我们应该在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)