我试图在arch linux mini计算机(cubox)上安装mean.io堆栈.所以我安装了nodejs和mongodb软件包.
我用Git检索堆栈,进行了npm安装(没关系)但是接着:
输入'grunt'后我收到此错误:
[nodemon] v1.2.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node --debug server.js`
debugger listening on port 5858
{ [Error: Cannot find module '../build/Release/bson'] code: 'MODULE_NOT_FOUND' }
js-bson: Failed to load c++ bson extension, using pure JS version
fs.js:439
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT, no such file or directory '/projects/mean/bower_components/jquery/dist/jquery.min.map'
at Object.fs.openSync (fs.js:439:18)
at Object.fs.readFileSync (fs.js:290:15)
at module.exports (/projects/mean/node_modules/meanio/lib/bootstrap.js:31:27)
at /projects/mean/node_modules/meanio/lib/mean.js:20:27
at Config.onPackageRead (/projects/mean/node_modules/meanio/lib/config.js:101:25)
at Promise.<anonymous> (/projects/mean/node_modules/mongoose/node_modules/mpromise/lib/promise.js:177:8)
at …Run Code Online (Sandbox Code Playgroud) 这个问题可能看起来很愚蠢,但对我来说,循环引用是例如对象 A 引用对象 B 而对象 B 引用对象 A。
我正在使用一个 android 应用程序与一个带有 objectify DB 的 GAE 服务器进行通信。
我的模型很简单,但出现错误:
org.codehaus.jackson.map.JsonMappingException: Direct self-reference leading to cycle (through reference chain: java.util.ArrayList[0]->com.my.model.MyMessage["senderKey"]->com.googlecode.objectify.Key["root"])
Run Code Online (Sandbox Code Playgroud)
这是我的模型:MyMessage 指的是 MyUser(MyUser DOESNT 指的是 MyMessage...
这是代码:
public class MyMessage implements Serializable {
private static final long serialVersionUID = -1075184303389185795L;
@Id
private Long id;
@Unindexed
private String sendMessage;
@Unindexed
private String answerMessage;
private MessageStatus status = MessageStatus.FREE;
@Parent
Key<MyUser> senderKey;
Key<MyUser> answererKey;
@SuppressWarnings("unused")
private MyMessage() {
}
public MyMessage(MyUser user, String message) { …Run Code Online (Sandbox Code Playgroud) 我在 nexus 中为 apache 库创建了一个新闻代理 maven 2:

然后我改变了我的 pom.xml 如下:
<repositories>
<repository>
<id>maven-public</id>
<url>http://nexus.unc.nc/repository/maven-public/</url>
</repository>
<repository>
<id>maven-releases</id>
<url>http://nexus.unc.nc/repository/maven-releases/</url>
</repository>
<repository>
<id>maven-apache</id>
<url>http://nexus.unc.nc/repository/maven-apache/</url>
</repository>
</repositories>
Run Code Online (Sandbox Code Playgroud)
但它仍然从互联网下载 apache lib:
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ importparcoursup ---
Downloading from central: https://repo.maven.apache.org/maven2/junit/junit/3.8.1/junit-3.8.1.pom
Downloaded from central: https://repo.maven.apache.org/maven2/junit/junit/3.8.1/junit-3.8.1.pom (998 B at 2.0 kB/s)
Run Code Online (Sandbox Code Playgroud)
而其他库是从关系中获取的:
Downloading from maven-public: http://nexus.unc.nc/repository/maven-public/org/springframework/boot/spring-boot-starter-mail/2.0.6.RELEASE/spring-boot-starter-mail-2.0.6.RELEASE.pom
Run Code Online (Sandbox Code Playgroud)
有人可以在这里帮助我吗?
在我的 gitlab-ci.yml 中,我有一个命令可以通过 curl 帖子在 gitlab 中创建一个版本
# create release
- >-
curl --request POST -H 'PRIVATE-TOKEN: ${GITLABAPI_TOKEN}' -H 'Content-Type: application/json' --data "{\"description\": \"`git log $(git describe --tags --abbrev=0)..HEAD --oneline`\"}" https://gitlab.unc.nc/api/v4/projects/${APP_GITLAB_NUMBER}/repository/tags/${CI_COMMIT_TAG}/release
Run Code Online (Sandbox Code Playgroud)
这个请求得到一个“401 未授权”,因为我怀疑 -H 'PRIVATE-TOKEN: ${GITLABAPI_TOKEN}' 没有被变量值替换。同: ${GITLABAPI_TOKEN} $GITLABAPI_TOKEN "${GITLABAPI_TOKEN}"
如果我像这样显示值,则该值没问题:
ssh root@devsb01 "echo $GITLABAPI_TOKEN"
Run Code Online (Sandbox Code Playgroud)
如果我直接使用密码值启动帖子,它会起作用:
- >-
curl --request POST -H 'PRIVATE-TOKEN: xkwMyRealPwdùwsx' -H 'Content-Type: application/json' --data "{\"description\": \"`git log $(git describe --tags --abbrev=0)..HEAD --oneline`\"}" https://gitlab.unc.nc/api/v4/projects/${APP_GITLAB_NUMBER}/repository/tags/${CI_COMMIT_TAG}/release
Run Code Online (Sandbox Code Playgroud)
我想我需要在命令中添加一些东西,以便它替换它......但我不知道如何......
PS:注意url变量:${APP_GITLAB_NUMBER}和${CI_COMMIT_TAG}被正确替换
无法弄清楚如何在 java 8(没有日历)中执行这个简单的方法:
import java.time.Duration;
import java.util.Date;
[...]
/**
* true if date + duration is before now()
* @param date
* @param d
* @return
*/
public static boolean isDateExpired (Date date, Duration d) {
// how to do ?
}
Run Code Online (Sandbox Code Playgroud) 我按照此gitlab文档(非常差的文档)设置代码质量步骤:https ://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html
现在,执行代码质量步骤,我得到了报告(完美)。
但是,似乎它并没有太多检查,下面是一个示例:
:["Complexity"],"check_name":"method_count","content":{"body":""},"description":"`Admis` has 78 methods (exceeds 20 allowed). Consider refactoring.","fingerprint":"3a31032b9aff6d8b119f276d03a3c391","location":{"path":"src/main/java/nc/unc/importparcoursup/dao/admisDAO/Admis.java","lines":{"begin":14,"end":457}},"other_locations":[],"remediation_points":7000000,"severity":"major","type":"issue","engine_name":"structure"},{
:["Complexity"],"check_name":"file_lines","content":{"body":""},"description":"File `Candidat.java` has 945 lines of code (exceeds 250 allowed). Consider refactoring.","fingerprint":"4f570943e9f89fac8caa554c7e78f993","location":{"path":"src/main/java/nc/unc/importparcoursup/dao/candidatDAO/Candidat.java","lines":{"begin":1,"end":1184}},"other_locations":[],"remediation_points":11208000,"severity":"major","type":"issue","engine_name":"structure"},{
:["Complexity"],"check_name":"method_count","content":{"body":""},"description":"`Candidat` has 232 methods (exceeds 20 allowed). Consider refactoring.","fingerprint":"4dbebf004d9f5f3a1fabf03c43699c01","location":{"path":"src/main/java/nc/unc/importparcoursup/dao/candidatDAO/Candidat.java","lines":{"begin":14,"end":1184}},"other_locations":[],"remediation_points":22400000,"severity":"major","type":"issue","engine_name":"structure"},{
:["Bug Risk"],"check_name":"TODO","description":"TODO found","location":{"lines":{"begin":28,"end":28},"path":"src/main/java/nc/unc/importparcoursup/view/components/CheckComponentAdmis.java"},"type":"issue","engine_name":"fixme","fingerprint":"d8d52d96fc27f9b0a1f9879e7d133345","severity":"minor"}]
Run Code Online (Sandbox Code Playgroud)
我知道还有很多其他问题。如果将代码放到sonarcube中,我会发现更多的问题)
我的项目来源:https : //gitlab.com/tyvain/parcoursup
我的 conf(工作):
jdbc-url: jdbc:h2:mem:myDb;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS MYSCHEMA_1
Run Code Online (Sandbox Code Playgroud)
我需要初始化多个架构,但找不到语法。到目前为止,我尝试过:
jdbc-url: jdbc:h2:mem:myDb;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS MYSCHEMA_1, MYSCHEMA_2
jdbc-url: jdbc:h2:mem:myDb;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS MYSCHEMA_1;CREATE SCHEMA IF NOT EXISTS MYSCHEMA_2
jdbc-url: jdbc:h2:mem:myDb;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS MYSCHEMA_1;INIT=CREATE SCHEMA IF NOT EXISTS MYSCHEMA_2
Run Code Online (Sandbox Code Playgroud) 我有这个功能:
/**
* @return From november to december -> current year +1 else current year
*/
public static int getCurrentScolYear () {
int month = Calendar.getInstance().get(Calendar.MONTH);
if ( month == NOVEMBER || month == DECEMBER) {
return Calendar.getInstance().get(Calendar.YEAR) +1;
}
return Calendar.getInstance().get(Calendar.YEAR);
}
Run Code Online (Sandbox Code Playgroud)
这用于计算 scolar 年(从 11 月开始)。
我想通过更改“当前时间”在 Junit 测试中对此进行测试。所以我可以测试不同日期的结果。
我找到了这个线程,但它似乎过于复杂:java: how to mock Calendar.getInstance()?
有没有一个简单的解决方案来测试这个?
我正在尝试处理编码问题(我想将字符串中的特殊字符转换为正确的UTF-8字符...):
当我执行这个简单的代码时:
System.out.println(new String("é".getBytes("UTF-8"), "UTF-8"));
Run Code Online (Sandbox Code Playgroud)
在控制台我期待:'é'但是我明白了
é
Run Code Online (Sandbox Code Playgroud) 我尝试显示以 blob 形式存储在表中的图像。
所以我需要将 byte[] 转换为 Vaadin Image 类(我猜这是显示它的最佳方式?)。
我尝试这个解决方案(4岁):
https://vaadin.com/forum/thread/10271496/byte-array-to-vaadin-image
它不工作:
new StreamResource.StreamSource() { -> Cannot resolve symbol 'StreamSource'
Run Code Online (Sandbox Code Playgroud)
我怎样才能在 Vaadin 13 中做到这一点?
它正在使用 java 8,但我更改为 java 10(我关注了这篇文章:无法使用 Maven 编译简单的 Java 10 项目)
我收到此错误:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:47 min
[INFO] Finished at: 2018-09-26T20:15:28Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project importparcoursup: Fatal error compiling: invalid flag: --release -> [Help 1]
[ERROR]
Run Code Online (Sandbox Code Playgroud)
gitlab-ci.yml
image: maven:latest
stages:
- build
build:
stage: build
script:
- mvn install:install-file -Dfile=lib/ojdbc8.jar -DgroupId=com.oracle -DartifactId=ojdbc8 -Dversion=12.2.0.1 -Dpackaging=jar compile
Run Code Online (Sandbox Code Playgroud)
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>nc.unc</groupId>
<artifactId>importparcoursup</artifactId> …Run Code Online (Sandbox Code Playgroud) 我想根据条件为网格线着色。我试试这个:
爪哇:
gridEtudiant.setClassNameGenerator(t -> {
if (t.getEtud_numero().startsWith("2")) {
return "error_row";
}
return "";
});
Run Code Online (Sandbox Code Playgroud)
css:
td.error_row {
background-color: red;
}
Run Code Online (Sandbox Code Playgroud)
HTML
<td id="vaadin-grid-cell-1" tabindex="0" role="gridcell" part="cell body-cell" first-column="" reorder-status="undefined" aria-selected="false" class="error_row" style="width: 100px; flex-grow: 1; order: 10000000;"><slot name="vaadin-grid-cell-content-1"></slot></td>
Run Code Online (Sandbox Code Playgroud)
我们可以看到 'class="error_row"' 但它不是红色的。
Vaadin 版本是 13.0.1