小编osu*_*lad的帖子

无法运行 Kotlin 临时文件

在新安装的 IntelliJ IDEA 中,我创建了一个新的 Kotlin 临时文件并尝试运行它,但它给了我一个错误:

add kotlin script runtime jar to classpath
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

intellij-idea kotlin

11
推荐指数
2
解决办法
9791
查看次数

如何在 Maven 中关闭 findbugs“冗余空检查”?

我找不到报告“冗余空检查”(RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE)的检测器的名称,有人知道它是什么吗?谷歌搜索只给了我大量的项目报告......

@NotNull自从我使用 JetBrains注释工具(它在字节码中插入空检查)以来,我遇到了很多错误。

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>findbugs-maven-plugin</artifactId>
  <version>2.5.2</version>
  <configuration>
    <omitVisitors>???WhatIsTheDetectorsName???</omitVisitors>
  </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

提前致谢

xml findbugs maven

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

MongoError $regex 必须是一个字符串

问题是,我的控制台出现错误:

{ [MongoError: $regex has to be a string]
  name: 'MongoError',
  message: '$regex has to be a string',
  waitedMS: 0,
  ok: 0,
  errmsg: '$regex has to be a string',
  code: 2 }
Run Code Online (Sandbox Code Playgroud)

基本上,我使用 Ajax 从我的 MongoDB 中获取数据,我在其中搜索用户。没有 Ajax,我的搜索功能可以正常工作,但我想搜索用户而不需要刷新网页,只需填写我的 HTML。这是我的所有代码:

服务器代码:

app.post("/searchresult", function(req, res){
    var thename = req.body.thename;
    LoginUser.find({
        $or: [

            {"firstname": {$regex: thename, $options: 'i'}},
            {"lastname": {$regex: thename, $options: 'i'}}
        ]
    }, function(err, searchedUser){
        if(err){
            console.log(err);
            res.redirect("back");
        } else {
            res.render("searchprofile", {foundUser: searchedUser});
        }
    });
});
Run Code Online (Sandbox Code Playgroud)

HTML代码:

<form class="form-inline" id="searchform" …
Run Code Online (Sandbox Code Playgroud)

html javascript ajax mongodb node.js

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

如何将nodejs和npm可执行文件上传到artifactory

我们有一个公司代理,阻止我使用maven-frontend-plugin.

问题是,要获取npm和bower依赖项,我们使用内部Artifactory,因此我们不应该为此设置任何代理设置.但实际的可执行文件是直接获取的,因此要获取它们我们需要代理.并且前端插件似乎不支持特定域的例外.

那么有一种简单的方法可以将npm和nodejs可执行文件上传到我们的内部工件中,以便我们可以完全跳过代理吗?或者另一种解决方法?

编辑

我在这里添加解决方案是为了方便,因为我需要修改下面批准的答案.

在Artifactory中设置两个远程存储库,一个设置为nodejs(https://nodejs.org/dist/),另一个设置为npm(https://registry.npmjs.org/npm/-/).

编辑你的maven-frontend-plugin配置:

<execution>
    <!-- optional: you don't really need execution ids,
    but it looks nice in your build log. -->
    <id>install node and npm</id>
    <goals>
        <goal>install-node-and-npm</goal>
    </goals>
    <!-- optional: default phase is "generate-resources" -->
    <phase>generate-resources</phase>
    <configuration>
        <nodeVersion>v0.12.1</nodeVersion>
        <npmVersion>2.14.1</npmVersion>
        <!-- use the URL for the repository you created in step 1 -->
        <nodeDownloadRoot>https://artifactory.my company.com/artifactory/nodejs.dist/</nodeDownloadRoot>
        <npmDownloadRoot>https://artifactory.my company.com/artifactory/npm.dist/</npmDownloadRoot>
    </configuration>
</execution>
Run Code Online (Sandbox Code Playgroud)

有可能只使用nodejs repo(但是npm仅适用于版本1.4.9)将npmDownloadRoot更改为:

<npmDownloadRoot>https://artifactory.my company.com/artifactory/nodejs.dist/npm/</npmDownloadRoot>

并且不要忘记从maven中删除代理设置 settings.xml

artifactory maven node.js npm

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

JSSE 中是否有 DTLS 实现

我想用 Java 实现 DTLS 1.0 客户端,经过一番谷歌搜索后,我发现JSSERefGuide说了以下内容:

JSSE API 能够支持 SSL 版本 2.0 和 3.0 以及 TLS 版本 1.0。这些安全协议封装了普通的双向流套接字,JSSE API 添加了对身份验证、加密和完整性保护的透明支持。JDK 附带的 JSSE 实现支持 SSL 3.0、TLS(1.0、1.1 和 1.2)和 DTLS(版本 1.0 和 1.2)。它不实现 SSL 2.0。

所以我想我可以用纯Java实现它而不使用任何库(例如BouncyCastle)

但是当我尝试运行(以及其他一些,如 DTLSv1.2、DTLSv1...)时:

final SSLContext sslContext = SSLContext.getInstance("DTLSv1.0", "SunJSSE");
Run Code Online (Sandbox Code Playgroud)

它抛出:

Exception in thread "main" java.security.NoSuchAlgorithmException: no such algorithm: DTLSv1.0 for provider SunJSSE
at sun.security.jca.GetInstance.getService(GetInstance.java:87)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:206)
at javax.net.ssl.SSLContext.getInstance(SSLContext.java:199)
Run Code Online (Sandbox Code Playgroud)

例如以下工作:

final SSLContext sslContext = SSLContext.getInstance("TLSv1.2", "SunJSSE");
Run Code Online (Sandbox Code Playgroud)

列出所有安全提供商,我根本没有发现任何 DTLS 内容。

那么实际上有 DTLS 实现吗?如果是的话你应该如何使用它?

java udp jsse dtls

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

标签 统计

maven ×2

node.js ×2

ajax ×1

artifactory ×1

dtls ×1

findbugs ×1

html ×1

intellij-idea ×1

java ×1

javascript ×1

jsse ×1

kotlin ×1

mongodb ×1

npm ×1

udp ×1

xml ×1