新的ES 6(Harmony)引入了新的Set对象.Set使用的身份算法类似于===运算符,因此不太适合比较对象:
var set = new Set();
set.add({a:1});
set.add({a:1});
console.log([...set.values()]); // Array [ Object, Object ]
Run Code Online (Sandbox Code Playgroud)
如何自定义Set对象的相等性以进行深层对象比较?有没有像Java这样的东西equals(Object)?
从版本42开始,Firefox默认拒绝安装未签名的附加组件.如何禁用此验证?
如何指示jshell在脚本结尾处终止,类似于其他语言的解释器,例如python3或node?
遵循命令
./jshell -q /tmp/shell.java
Run Code Online (Sandbox Code Playgroud)
用脚本 /tmp/shell.java
System.out.println("Hello world");
Run Code Online (Sandbox Code Playgroud)
版画
Hello world
jshell>
Run Code Online (Sandbox Code Playgroud)
并等待进一步的命令.我希望它立即停止在文件的末尾.
我正在寻找比System.exit(0);脚本末尾更优雅的东西.
是否有可能在Flow中强制转换变量?
type StringOrNumber = string | number
const foo: StringOrNumber = 'hello'
// I look for something like `const bar:string = (string) foo`
const bar: string = foo // fails
const bar: string = (foo: string) // also fails
Run Code Online (Sandbox Code Playgroud) 在开发maven插件时,构建打印错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.3:descriptor (default-descriptor) on project default-method-demo: Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.3:descriptor failed: syntax error @[8,1] in file:/full/path/to/project/default-method/src/main/java/org/example/Iface.java -> [Help 1]
Run Code Online (Sandbox Code Playgroud)
即使该文件Iface.java是可编译的.
Iface.java:
package org.example;
public interface Iface {
default String getString() {
return "string";
}
}
Run Code Online (Sandbox Code Playgroud)
从 pom.xml
<packaging>maven-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
Run Code Online (Sandbox Code Playgroud)
是什么原因造成的?怎么修好?
有没有办法如何在所有新标签上启用开发工具?我想打开devtools以便能够舒适地调试弹出窗口.
我想为可能Vagrant VM启用密码ssh身份验证(并启用基于密钥的身份验证).怎么设置?
Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.box = "fedora/26-cloud-base"
config.vm.box_version = "20170705"
config.ssh.username = 'vagrant'
config.ssh.password = 'a'
config.ssh.keys_only = false
end
Run Code Online (Sandbox Code Playgroud)
$ sudo vagrant ssh-config
Host default
HostName 192.168.121.166
User vagrant
Port 22
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /home/jakub/src/kubernetes-vms/kubernetes/.vagrant/machines/default/libvirt/private_key
LogLevel FATAL
Run Code Online (Sandbox Code Playgroud)
a此设置不接受密码.
我想可能是PasswordAuthentication no在输出中vagrant ssh-config.如何打开该选项?
当我尝试在Typescript中导入node.js模块时,如下所示:
import co = require('co');
import co from 'co';
Run Code Online (Sandbox Code Playgroud)
如果没有提供类型定义,两行都报告相同的错误:
error TS2307: Cannot find module 'co'.
Run Code Online (Sandbox Code Playgroud)
如何正确导入?
我在mastertheboss.com上试过教程:
./jboss-cli.shmodule add --name=org.postgres --resources=/tmp/postgresql-9.3-1101.jdbc41.jar --dependencies=javax.api,javax.transaction.api/subsystem=datasources/jdbc-driver=postgres:add(driver-name="postgres",driver-module-name="org.postgres",driver-class-name=org.postgresql.Driver)data-source add --jndi-name=java:/PostGreDS --name=PostgrePool --connection-url=jdbc:postgresql://localhost/postgres --driver-name=postgres --user-name=postgres --password=postgres本教程适用于WildFly 8.2,但它不适用于WildFly 9.0.第3步失败并显示错误消息:
{
"outcome" => "failed",
"failure-description" => "WFLYJCA0041: Failed to load module for driver [org.portgres]",
"rolled-back" => true
}
Run Code Online (Sandbox Code Playgroud)
如何将Postgres数据源添加到WildFly 9.0?
firefox ×3
java ×2
javascript ×2
add-on ×1
casting ×1
datasource ×1
firebug ×1
flowtype ×1
java-8 ×1
java-9 ×1
jdbc ×1
jshell ×1
logging ×1
maven ×1
maven-plugin ×1
node.js ×1
passwords ×1
postgresql ×1
set ×1
signing ×1
ssh ×1
typescript ×1
vagrant ×1
wildfly ×1