小编kon*_*nze的帖子

Font.createFont(..)设置颜色和大小(java.awt.Font)

我想使用TTF文件创建一个新的Font对象.创建一个Font对象非常简单,但我不知道如何设置颜色和大小,因为我找不到它的方法?

InputStream is = new FileInputStream("helvetica.ttf");
Font helvetica = Font.createFont(Font.TRUETYPE_FONT, is);
Run Code Online (Sandbox Code Playgroud)

java fonts awt

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

@WebServlet annotation web.xml welcome-file

我想设置我的JSP/JavaBeans项目的welcome-file.我有一个名为'Controller.java'的servlet,带有以下@WebServlet注释:

@WebServlet(name="Controller", urlPatterns={"/login", "/show_dbs"})
Run Code Online (Sandbox Code Playgroud)

我有一个web.xml文件,其中包含以下内容:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
         http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">

    <welcome-file-list>
        <welcome-file>Controller</welcome-file>
    </welcome-file-list>
</web-app>
Run Code Online (Sandbox Code Playgroud)

几乎所有的事情进展顺利,我可以打开http://localhost:8080/PROJECT/loginhttp://localhost:8080/PROJECT/show_dbs我往Controller.java.但是当我打开时,http://localhost:8080/PROJECT/我收到404错误.

我正在使用带有"动态Web项目"的Eclipse,Controller.java文件位于/ src(默认包)下,web.xml文件位于/ WebContent/WEB-INF下.

我希望你有一个小费.

java jsp web.xml servlets deployment-descriptor

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

JSON时间偏移(Trello)

我想通过Trello API创建Trello卡.我能够创建一张卡片:

curl -X POST 'https://api.trello.com/1/lists/{LIST_ID}/cards?name=TEST9&due=2014-05-08T08:00:00&key={APP_KEY}&token={TOKEN}'
Run Code Online (Sandbox Code Playgroud)

但是,我无法确定截止日期的时间偏差:

2014-05-08T08:00:00.{OFFSET}
Run Code Online (Sandbox Code Playgroud)

我的时区是CET(欧洲/柏林),如何通过时间偏移告诉Trello?

json trello

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

了解Caffe卷积层

我在Ubuntu下成功编译了Caffe,并开始研究如何定义和训练自己的网络。但是,我很难理解卷积层如何产生其输出。例如,LeNet MNIST教程(tutoriallenet.prototxt)的第二个卷积层(conv2 )具有20个输入图像和50个输出图像:

layer {
  name: "conv2"
  type: "Convolution"
  bottom: "pool1"
  top: "conv2"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  convolution_param {
    num_output: 50
    kernel_size: 5
    stride: 1
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

如何O_0, ..., O_49计算输出图像?我的直觉是,它的工作方式如下(I_i输入图像,K_j内核,B_k偏差,*卷积运算符):

O_0 = I_0 * K_0 + ... + I_19 * K_19 + B_0
O_1 = I_0 * K_20 + ... …
Run Code Online (Sandbox Code Playgroud)

convolution deep-learning caffe

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

并行执行比顺序执行快的示例

我正在寻找一个例子,其中并行执行比顺序执行更快(在C++中).我尝试了一些东西:

快速排序分类数组,

计算1000000个素数,

NxN矩阵求逆

但顺序执行总是更快.正如您所看到的,我使用两个相同的线程来执行代码threadWrapper(int threadNo)

#include <iostream>                                                             
#include <ctime>                                                                
#include <thread>                                                               

using namespace std;

void threadWrapper(int threadNo) {                                              

  clock_t start = clock();                                                    

  cout << "thread " << threadNo << ": started" << endl;                       

  // do something crazy                                                                        

  clock_t ends = clock();                                                     

  cout << "thread " << threadNo << ": has finished, elapsed time " << (double)(ends-start)
}

int main() {                                                                       

  cout << "SEQUENTIALLY:" << endl;                                               

  clock_t seq_start = clock();                                                   

  threadWrapper(1);                                                              
  threadWrapper(2);                                                              

  clock_t seq_ends = clock();                                                    

  cout << "sequentially: …
Run Code Online (Sandbox Code Playgroud)

c++ multithreading

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