我的package.json文件有问题.
它应该工作正常,因为我在其他项目中使用大多数节点模块,但我有package.json以下内容:
"dependencies": {
"@angular/common": "^2.0.0-rc.1",
"@angular/compiler": "^2.0.0-rc.1",
"@angular/core": "^2.0.0-rc.1",
"@angular/platform-browser": "^2.0.0-rc.1",
"@angular/platform-browser-dynamic": "^2.0.0-rc.1",
"@angular/router": "^2.0.0-rc.1",
"angular2-in-memory-web-api": "0.0.7",
"bootstrap": "^3.3.6",
"es6-shim": "^0.35.0",
"reflect-metadata": "^0.1.3",
"rxjs": "^5.0.0-beta.6",
"systemjs": "^0.19.27",
"zone.js": "^0.6.12"
},
"devDependencies": {
"body-parser": "^1.15.1",
"express": "^4.13.4",
"jsonwebtoken": "^6.2.0",
"mongoose": "^4.4.15"
}
Run Code Online (Sandbox Code Playgroud)
并且它们都应该运行良好,因为所有依赖关系都存在,因为角度现在在rc.4中,而rxjs在5.0.0-beta.10上.
但我得到3个未满足的依赖
npm install
'rxjs@5.0.0-beta.10'
'rxjs@5.0.0-beta.6'
'@angular/core@2.0.0-rc.1'
Run Code Online (Sandbox Code Playgroud)
我也得到了这些警告:
npm WARN @angular/core@2.0.0-rc.4 requires a peer of rxjs@5.0.0-beta.6 but none was installed.
npm WARN @angular/http@2.0.0-rc.1 requires a peer of rxjs@5.0.0-beta.6 but none was installed.
npm WARN …Run Code Online (Sandbox Code Playgroud) 我正在将我的项目从Java 8迁移到Java 9.我的项目是mavenised.现在,为了迁移到Java 9,我计划创建一个单独的模块目录,其中模块的所有必需依赖项都将用于此目录.
为了通过maven这样做,我知道的唯一方法是使用maven的复制插件来复制模块目录中所有必需的依赖项.因此,在为模块运行maven安装后,依赖的jar将被复制到repository文件夹(默认情况下),并且还会复制到此模块目录文件夹中.
因此,将会有一个jar副本以及pom.xml中的硬编码,用于复制模块目录中的特定依赖项.
这种方法似乎并不干净,是否有任何出路是自动maven可以读取我的module-info.java文件并复制所需的依赖项不在类路径中但在指定的目录中
这是我的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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.aa.bb</groupId>
<artifactId>cc</artifactId>
<version>0.0.1</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>dd</artifactId>
<name>dd</name>
<groupId>com.aa.cc</groupId>
<version>1.0.0</version>
<properties>
<maven.compiler.source>10</maven.compiler.source>
<maven.compiler.target>10</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.11</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<release>10</release>
<compilerArgs>
<arg>--module-path</arg>
<arg>./moduledir</arg>
</compilerArgs>
</configuration>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>6.2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
module-info.java
module com.some_module_name {
requires …Run Code Online (Sandbox Code Playgroud) 我正在为移动应用程序(目前正在Play 2.1.1上运行)的后端工作。作为处理某些请求的一部分,我们发送推送通知。发送推送通知的下游请求应该完全异步,并与移动客户端的原始请求响应分离。
我希望Http.Context.current()在发送下游请求时能够访问,以便访问我们在请求标头中传递的某些跟踪信息。
PushNotificationRunnable sendNotificationTask = new ...
Akka.system().scheduler().scheduleOnce(Duration.apply(0, TimeUnit.MICROSECONDS),
sendNotificationTask, Akka.system().dispatcher());
Run Code Online (Sandbox Code Playgroud)
探索play.libs.Akka帮助程序将我带到将来的方法,该方法采用可调用的方法并返回Promise。这个承诺使我可以链接更多代码。在这里Callback,由于在Play的class中设置了代码,我已经链接了一个可以访问Http.Context.current()的PromiseActor。这使我可以在任务完成时记录一行,包括跟踪ID,但是在任务执行期间我的日志行仍然无法访问跟踪信息。
PushNotificationCallable sendNotificationTask = new ...
Akka.future(sendNotificationTask).onRedeem(new F.Callback<Void>() {
@Override
public void invoke(Void aVoid) throws Throwable {
Logger.info("Completed sendNotificationTask from the service");
}
});
Run Code Online (Sandbox Code Playgroud)
这是一些简短的应用程序日志,以显示我当前所在的位置以及缺少的内容,第5列中的跟踪ID:
2013-07-26 11:31:06,885 DEBUG play-akka.actor.default-dispatcher-10 -2454018518484259555 [application] : Processing request for mobile app
2013-07-26 11:31:06,907 DEBUG play-akka.actor.default-dispatcher-10 -2454018518484259555 [application] : About to schedule push notification …Run Code Online (Sandbox Code Playgroud) 苏普,
我正在尝试在 Play2.4 Scala 中为我的项目设置环境变量。我已经在 Intellij 的运行配置中设置了变量。
令人烦恼的是 Scala 似乎没有看到这些。
我不断收到未为我使用环境变量的键指定的配置错误。
当我启动应用程序时,这些显示在控制台中:
"C:\Program Files\Java\jdk1.8.0_25\bin\java" -Dfile.encoding=UTF8 -DMAIL_PORT=587 -DDB_URI=mongodb://uri -Djline.terminal=none -Dsbt.log.noformat=true -Dsbt.global.base=C:\Users\Haito\AppData\Local\Temp\sbt-global-plugin7stub -Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M -classpath C:\Users\Haito\.IntelliJIdea14\config\plugins\Scala\launcher\sbt-launch.jar xsbt.boot.Boot "project root" ~run
Run Code Online (Sandbox Code Playgroud)
以及配置文件:
mongodb.uri = ${?DB_URI}
play.mailer {
host=${?MAIL_HOST}
port=${?MAIL_PORT}
ssl=false
tls=true
user=${?MAIL_USERNAME}
password=${?MAIL_PASSWD}
debug=false
mock=false
}
Run Code Online (Sandbox Code Playgroud)
我不断收到这些:
Missing configuration key 'mongodb.db'!
Run Code Online (Sandbox Code Playgroud)
当然我的问题不是我的 mongo 驱动程序。我的问题是配置没有提供环境变量。Mailer 也使用环境变量进行配置。当我粘贴除 之外的实际 URI 时,${?DB_URI}它会起作用。
建造:
resolvers += "scalaz-bintray" at "http://dl.bintray.com/scalaz/releases"
resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
libraryDependencies ++= Seq(
"org.reactivemongo" %% "play2-reactivemongo" % "0.11.2.play24" …Run Code Online (Sandbox Code Playgroud) 我在AngularJS中不存在Angular 2的问题,我发送错误消息作为带有后端API调用的字符串,以防我有错误,错误状态401为例,问题现在我无法读取此消息来自Angular2的http响应消息,而我可以从AngularJS那样做:
我尝试了以下代码,没有任何帮助:
诺言:
this._http.post('/login',{email: 'email@example.com', password: '123'})
.toPromise()
.then((resp) => console.log(resp), (error) => console.log(error));
Run Code Online (Sandbox Code Playgroud)
观察到:
this._http.post('/login',{email: 'email@example.com', password: '123'})
.subscribe(response =>console.log(response), (error) => console.log(error));
Run Code Online (Sandbox Code Playgroud)
从后端我发送响应作为文本,对于OK或Unauthorized,对于OK我发回String token == UUID.randomUUID().toString();,因为错误我发回消息String error = " Invalid credentials ";,问题是console.log工作并打印文本成功(在这种情况下为令牌),但如果错误,它只是打印:Response with status: 200 for URL: null.
如果我改变代码,JSON.stringify(error)我得到这样的东西:
{"_body":{},"status":401,"ok":false,"statusText":"Unauthorized","headers":{"null":["HTTP/1.1 401 Unauthorized"],"Access-Control-Allow-Headers":["Origin"," X-Requested-With"," Content-Type"," Accept"," Referer"," User-Agent"],"Access-Control-Allow-Met
hods":["POST"," GET"," PUT"," DELETE"," OPTIONS"],"Access-Control-Allow-Origin":["*"],"Allow":["*"],"Content-Length":["36"],"Content-Type":["text/plain; charset=utf-8"],"Date":["Tue"," 23 Aug 2016 14:53:25 GMT"]},"type":2,"url":null}
Run Code Online (Sandbox Code Playgroud)
正如你所看到的,甚至在Object内部都没有提到错误测试!!
我试图将后端的错误响应更改为返回json,如下所示:
{
"message": "invalid email or password"
} …Run Code Online (Sandbox Code Playgroud) 我在我的React Native iOS项目中使用firebase ver 3.2.1.我在这里阅读了2.4.2版本的日志,有一个名为changePassword()的方法,可用于更改用户的密码.
但是当我查看Firebase ver 3.2.1的文档时,我找不到任何名为changePassword()的方法.所以我想知道,changePassword()方法是否不能再用于Firebase版本3了?
谢谢.
我试图像这样从我的本地主机获取数据:
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class SearchServiceService {
apiRoot:string = 'https://itunes.apple.com/search';
results:Object[];
loading:boolean;
constructor(private http:HttpClient) {
this.results = [];
this.loading = false;
}
search(term:string){
let promise = new Promise((resolve, reject) => {
let apiURL = `${this.apiRoot}?term=${term}&media=music&limit=20`;
this.http.get(apiURL).toPromise().then(res => {
// console.log( res.json() );
resolve();
}, function(error){
console.log('error is', error);
})
});
return promise;
}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用Chrome浏览器。为了防止出现此CORS问题,我使用此扩展名:
https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi/related?hl=en-US
但是仍然出现错误为:
Failed to load https://itunes.apple.com/search?term=Moo&media=music&limit=20: …Run Code Online (Sandbox Code Playgroud) 我使用时的问题:
<p:growl id="growl" autoUpdate="true" />
Run Code Online (Sandbox Code Playgroud)
要么
<p:messages id="messages" autoUpdate="true" />
Run Code Online (Sandbox Code Playgroud)
当我有错误消息,并且一旦我使用清除过滤器或重新过滤primefaces数据表,如:
<p:commandButton value="do somthing and re-filter" oncomplete="PF('testTable').filter()"/>
<p:commandButton value="do somthing and clear filter" oncomplete="PF('testTable').clearFilters()"/>
<p:dataTable id="table" widgetVar="testTable" value="#{myMB.data}">
</p:dataTable>
Run Code Online (Sandbox Code Playgroud)
消息被隐藏了,因为autoUpdate是真的,所以ajax调用过滤器被触发并返回没有消息所以这个调用清除消息,如果我做的话将是一个解决方案,autoUpdate="false"但我需要它所以我不想将它设置为假.
我对Playframwork弃用GlobalSettings问题有一个恼人的问题,我想把我的内容onStart移到建议的方式,但实际上我不能完成这个,文档没有意义,我不知道如何解决这个问题,我花了几天时间和天试图没有运气!
https://www.playframework.com/documentation/2.5.x/GlobalSettings
我只想运行初始数据库方法
private void initialDB() {
UserService userService = play.Play.application().injector().instanceOf(UserService.class);
if (userService.findUserByEmail("email@company.com") == null) {
String email = "email@company.com";
String password = "1234";
String fullName = "My Name";
User user = new User();
user.password = BCrypt.hashpw(password, BCrypt.gensalt());
user.full_name = fullName;
user.email = email;
user.save();
}
}
Run Code Online (Sandbox Code Playgroud)
这是java文件中的内部onStart方法Global extends GlobalSettings,我试图将其提取到外部模块但没有运气.
public class GlobalModule extends AbstractModule {
protected void configure() {
initialDB();
}
}
Run Code Online (Sandbox Code Playgroud)
我在Scala中找到了一些解决方案,不知道这在java中是怎么回事,但我没有时间去学习它,除此之外我也不喜欢它.
我在播放应用程序服务器启动时启动的调度程序有问题,但是一旦应用程序关闭,它就会命中以下代码部分:
// firstDay something like 1 = monday
private void startScheduler(final ImageService imageService,
final ActorSystem system) {
startImagesCleanupScheduler(imageService, system);
Logger.info("Schedulers started");
}
Run Code Online (Sandbox Code Playgroud)
我的问题是该Runnable块立即开始执行,而不仅仅是取消任务。
澄清代码:
以下方法启动Scheduler:
private void startImagesCleanupScheduler(ImageService imageService, ActorSystem system) {
system.scheduler().schedule(
Duration.create(0, TimeUnit.MILLISECONDS), //Initial delay
Duration.create(1, TimeUnit.DAYS), //Frequency 1 days
() -> {
int rows = imageService.cleanupInactiveImages();
Logger.info(String.format("%d inactive unused images cleaned from db", rows));
},
system.dispatcher()
);
}
Run Code Online (Sandbox Code Playgroud)
我关机时的日志记录第一行:
[info] - application - 1 inactive unused images cleaned from db
[info] - application …Run Code Online (Sandbox Code Playgroud) java ×4
angular ×3
akka ×2
ajax ×1
angular6 ×1
firebase ×1
java-10 ×1
java-9 ×1
java-platform-module-system ×1
javascript ×1
jsf-2.2 ×1
maven ×1
node.js ×1
npm ×1
primefaces ×1
react-native ×1
rest ×1
scala ×1