小编fen*_*sss的帖子

在java中使用invokeAll()和Future的ExecutorService

手头有以下代码:

    ExecutorService executor = Executors.newFixedThreadPool(10);
    Collection collection = new ArrayList();
    for (int n=1; n<100; n++)
        collection.add(new MyThread(n));

    try {
        List<Future<Boolean>> futures = executor.invokeAll(collection);

        for(Future<Boolean> future : futures){
            future.get();
            if (future.isDone()) {
                System.out.println("true");
            }
            else
                System.out.println("false");
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
Run Code Online (Sandbox Code Playgroud)

如果以上是正确的?
如果一切future.isDone()都是真的,那么所有的线程都已经完成了吗?
我怎样才能制作旗帜,以确保所有这些都完成了?

java

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

如何在Oracle sql中获取最接近的日期

例如,我有2个时间表:T1

id time
1 18:12:02
2 18:46:57
3 17:49:44
4 12:19:24
5 11:00:01
6 17:12:45
Run Code Online (Sandbox Code Playgroud)

和T2

id time
1 18:13:02
2 17:46:57
Run Code Online (Sandbox Code Playgroud)

我需要从T1获得与T2时间最接近的时间.这些表之间没有关系.它应该是这样的:

select T1.calldatetime
from T1, T2 
where T1.calldatetime between 
T2.calldatetime-(
    select MIN(ABS(T2.calldatetime-T1.calldatetime))
    from T2, T1)
and
T2.calldatetime+(
    select MIN(ABS(T2.calldatetime-T1.calldatetime))
    from T2, T1)
Run Code Online (Sandbox Code Playgroud)

但我无法得到它.有什么建议?

sql oracle date-arithmetic

9
推荐指数
2
解决办法
2万
查看次数

java Web应用程序中的Servlet示例

我是java web应用程序开发的新手,你能告诉我,我做错了什么:我使用maven生成了web应用程序:

mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=webapp -DarchetypeArtifactId=maven-archetype-webapp
Run Code Online (Sandbox Code Playgroud)

我把HelloWorld.java放在src.main.resources文件夹中,这里是代码:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class HelloWorld extends HttpServlet{ 
  public void doGet(HttpServletRequest request, 
  HttpServletResponse response)
  throws ServletException,IOException{
  response.setContentType("text/html");
  PrintWriter pw = response.getWriter();
  pw.println("<html>");
  pw.println("<head><title>Hello World</title></title>");
  pw.println("<body>");
  pw.println("<h1>Hello World</h1>");
  pw.println("</body></html>");
  }
}
Run Code Online (Sandbox Code Playgroud)

来自src.main.webapp.WEB-INF的我的web.xml如下所示:

!DOCTYPE web-app PUBLIC
          "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
          "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
    <display-name>Archetype Created Web Application</display-name>
    <servlet>
        <servlet-name>Hello</servlet-name>
        <servlet-class>HelloWorld</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>Hello</servlet-name>
        <url-pattern>/HelloWorld</url-pattern>
    </servlet-mapping>
</web-app>
Run Code Online (Sandbox Code Playgroud)

这是我的pom.xml:

project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion> …
Run Code Online (Sandbox Code Playgroud)

java tomcat maven

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

OpenCV的SiftDescriptorExtractor如何转换描述符值?

我对SiftDescriptorExtractor工作的最后一部分有疑问,

我正在做以下事情:

    SiftDescriptorExtractor extractor;
    Mat descriptors_object;
    extractor.compute( img_object, keypoints_object, descriptors_object );
Run Code Online (Sandbox Code Playgroud)

现在我想检查一下descriptors_object Mat对象的元素:

std::cout<< descriptors_object.row(1) << std::endl;
Run Code Online (Sandbox Code Playgroud)

输出看起来像:

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 0, 0, 0, 32, 15, 0, 0, 0, 0, 0, 0, 73, 33, 11, 0, 0, 0, 0, 0, 0, 5, 114, 1, 0, 0, 0, 0, 51, 154, 20, 0, 0, 0, 0, 0, 154, 154, 1, 2, 1, 0, 0, 0, …
Run Code Online (Sandbox Code Playgroud)

c++ opencv sift feature-descriptor

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

按钮在Web浏览器中单击

我已经创建了Web浏览器,现在我想通过单击表单上的button1单击Web上的按钮.

private void button1_Click(object sender, EventArgs e)
{
    webBrowser1.Document.GetElementById("search").SetAttribute("value", IP.Text);
    webBrowser1.Document.GetElementById("").InvokeMember("click");
}
Run Code Online (Sandbox Code Playgroud)

但我无法从此字符串中获取按钮ID

<input type="submit" value="?" class="button">
Run Code Online (Sandbox Code Playgroud)

有没有办法解决这个问题?

html c# browser

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

svg 字体无法在 Chrome 中使用 @font-face 加载到网页上

svg 字体有问题。

这是我的index.html

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
    </head>
    <body>

    <img src="sign.svg"></img>

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

这是我的 svg 文件

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
     viewBox="0 47.2 110 20.6" enable-background="new 0 47.2 110 20.6" xml:space="preserve">
<defs>
    <style type="text/css">
        @font-face {
          font-family: 'Indie Flower';
          font-style: normal;
          font-weight: 400;
          src: url('http://fonts.gstatic.com/s/indieflower/v7/10JVD_humAd5zP2yrFqw6qRDOzjiPcYnFooOUGCOsRk.woff') format('woff');
        } …
Run Code Online (Sandbox Code Playgroud)

html css fonts svg

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

标签 统计

html ×2

java ×2

browser ×1

c# ×1

c++ ×1

css ×1

date-arithmetic ×1

feature-descriptor ×1

fonts ×1

maven ×1

opencv ×1

oracle ×1

sift ×1

sql ×1

svg ×1

tomcat ×1