com.github.eirslett:frontend-maven-plugin我的maven项目中有一个.
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>0.0.27</version>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<phase>generate-resources</phase>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>bower install</id>
<goals>
<goal>bower</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>install</arguments>
<workingDirectory>${basedir}/src/main/webapp</workingDirectory>
</configuration>
</execution>
</executions>
<configuration>
<nodeVersion>v4.2.4</nodeVersion>
<npmVersion>2.7.1</npmVersion>
<nodeDownloadRoot>https://nodejs.org/dist/</nodeDownloadRoot>
<npmDownloadRoot>https://registry.npmjs.org/npm/-/</npmDownloadRoot>
<workingDirectory>${basedir}/src/main/webapp</workingDirectory>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
现在我需要将其迁移到gradle但我无法找到如何做到的示例.成绩迁移工具仅转换依赖项,但不转换插件.有一些例子,我怎样才能使用frontend-maven-plugin的gradle?
我需要index.html根据应用程序版本在我的页面中动态添加脚本.我有一个控制器返回应用程序版本并尝试使用angularjs执行此操作:
var resourceLoader = angular.module('MyTabs', []);
resourceLoader.controller('ResourceLoaderController', ['$scope', '$http', function ($scope, $http) {
$scope.getVersion = function() {
$http.get('/version/get').then(function (response) {
$scope.version = response.data;
var link = document.createElement("link");
link.setAttribute("type", "text/css");
link.setAttribute("rel", "stylesheet");
link.setAttribute("href", '/r/' + $scope.version +'/css/app.css');
document.getElementsByTagName("head")[0].appendChild(link);
var script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("src", '/r/' + $scope.version +'/js/app.js');
document.getElementsByTagName("head")[0].appendChild(script);
});
};
$scope.getVersion();
}]);
Run Code Online (Sandbox Code Playgroud)
它工作但有角度控制器app.js,我在运行时得到一个错误AuthController,用于index.html,未定义.
在angularjs开始处理网页之前,有没有办法从服务器获取应用程序版本并包含脚本?
我试图在Ubuntu 14.04上安装VirtualBox.我从Ubuntu存储库安装了VirtualBox:
sudo apt-get install virtualbox
Run Code Online (Sandbox Code Playgroud)
然后我将我的用户添加到vboxusers:
sudo usermod -G vboxusers -a user
Run Code Online (Sandbox Code Playgroud)
我还为我的vb vsion安装了一个extrapack:
wget http://download.virtualbox.org/virtualbox/5.0.10/Oracle_VM_VirtualBox_Extension_Pack-4.3.36-105129.vbox-extpack
sudo vboxmanage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.0.10-104061.vbox-extpack
Run Code Online (Sandbox Code Playgroud)
但是当我尝试启动虚拟机时,我收到一个错误:
RTR3InitEx failed with rc=-1912 (rc=-1912)The VirtualBox kernel modules do not match this version of VirtualBox. The installation of VirtualBox was apparently not successful. Executing '/etc/init.d/vboxdrv setup'may correct this. Make sure that you do not mix the OSE version and the PUEL version of VirtualBox.
where: supR3HardenedMainInitRuntime
what: 4
VERR_VM_DRIVER_VERSION_MISMATCH (-1912) - The installed support driver doesn't match …Run Code Online (Sandbox Code Playgroud) 我在远程主机上有一个tomcat应用程序,需要通过JConsole连接它.申请以params开头:
IP=`ifconfig eth0 | grep 'inet addr:' | cut -d ':' -f2 | cut -d ' ' -f1`
-Dcom.sun.management.jmxremote
-Djava.rmi.server.hostname=$IP
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
Run Code Online (Sandbox Code Playgroud)
端口9999打开,IP值有效,我查了一下.我可以通过telnet(telnet <my_host> <my_port>)访问它.用netstat:
netstat -a | grep LISTEN
tcp 0 0 *:9999 *:* LISTEN
Run Code Online (Sandbox Code Playgroud)
但是我无法通过jconsole连接它,我总是得到同样的错误:
Connection Failed: Retry?
Run Code Online (Sandbox Code Playgroud)
但netstat -a表明连接是ESTABLISHED
我尝试了不同的地址:
<my_host>:<my_port>
service:jmx:rmi://<my_host>:<my_port>/jndi/rmi://<my_host>:<my_port>/jmxrmi
service:jmx:rmi:///jndi/rmi://<my_host>:<my_port>/jmxrmi
Run Code Online (Sandbox Code Playgroud)
我还试图添加文件.../conf/remote.users,.../remote.acl并在prorerties中写入文件-Dcom.sun.management.jmxremote.password.file,-Dcom.sun.management.jmxremote.access.file但它没有任何效果.
当我在本地计算机上部署此应用程序时,我可以连接到它 "localhost:9999"
帮助某人,可能是什么问题?
我有一个spring启动应用程序,我尝试在应用程序启动时初始化一些数据.
这是我的应用程序属性:
#Database connection
spring.datasource.url=jdbc:h2:mem:test_db
spring.datasource.username=...
spring.datasource.password=...
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.initialize=true
spring.datasource.schema=schema.sql
spring.datasource.data=schema.sql
#Hibernate configuration
#spring.jpa.hibernate.ddl-auto = none
Run Code Online (Sandbox Code Playgroud)
这是schema.sql:
CREATE TABLE IF NOT EXISTS `Person` (
`id` INTEGER PRIMARY KEY AUTO_INCREMENT,
`first_name` VARCHAR(50) NOT NULL,
`age` INTEGER NOT NULL,
PRIMARY KEY(`id`)
);
Run Code Online (Sandbox Code Playgroud)
和data.sql
INSERT INTO `Person` (
`id`,
`first_name`,
`age`
) VALUES (
1,
'John',
20
);
Run Code Online (Sandbox Code Playgroud)
但是在应用程序启动时我得到了"SQL语句中的语法错误":
19:08:45.642 6474 [main] INFO o.h.tool.hbm2ddl.SchemaExport - HHH000476: Executing import script '/import.sql'
19:08:45.643 6475 [main] ERROR o.h.tool.hbm2ddl.SchemaExport - HHH000388: Unsuccessful: CREATE TABLE Person (
19:08:45.643 …Run Code Online (Sandbox Code Playgroud) 我不明白为什么这段代码没有编译:
Object[] arr = new int[3];
Run Code Online (Sandbox Code Playgroud)
我不需要这段代码.我只想了解自动装箱在这种情况下不起作用的原因?
我在 Oracle DB 中有两个表
Person (
id
)
Bill (
id,
date,
amount,
person_id
)
Run Code Online (Sandbox Code Playgroud)
如果存在,我需要从最后一张账单中获取人和金额。我试图这样做
SELECT
p.id,
b.amount
FROM Person p
LEFT JOIN Bill b
ON b.person_id = p.id AND b.date = (SELECT MAX(date) FROM Bill WHERE person_id = 1)
WHERE p.id = 1;
Run Code Online (Sandbox Code Playgroud)
但此查询仅适用于 INNER JOIN。在 LEFT JOIN 的情况下,它会抛出ORA-01799 a column may not be outer-joined to a subquery
如何使用左连接从最后一张账单中获得金额?
我试图在嵌入式jetty容器中制作简单的servlet.这是我的码头配置:
public class Application {
public static void main(String[] args) throws Exception {
//-Dport=8188
int port = 8188;
if(System.getProperty("port") != null) {
port = Integer.valueOf(System.getProperty("port"));
}
//-Dhost="127.0.0.1"
String host = System.getProperty("host");
if(host == null || host.isEmpty()) {
host = "127.0.0.1";
}
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
InetAddress address = InetAddress.getByName(host);
InetSocketAddress socketAddress = new InetSocketAddress(address, port);
Server jettyServer = new Server(socketAddress);
jettyServer.setHandler(context);
ServletHolder jerseyServlet = context.addServlet(org.glassfish.jersey.servlet.ServletContainer.class, "/*");
jerseyServlet.setInitOrder(0);
// Initializing servlet
jerseyServlet.setInitParameter(
"jersey.config.server.provider.classnames",
Proxy.class.getCanonicalName()
);
try {
jettyServer.start();
jettyServer.join(); …Run Code Online (Sandbox Code Playgroud) 我有一个Java KeyStore(JKS),需要与BouncyCastle一起阅读。
我已BC在提供商列表顶部添加了提供商:
Security.insertProviderAt(new BouncyCastleProvider(), 1);
Run Code Online (Sandbox Code Playgroud)
如果我以这种方式创建KeyStore:
final KeyStore keystore = KeyStore.getInstance("JKS", "BC");
Run Code Online (Sandbox Code Playgroud)
我收到一个错误:
java.security.KeyStoreException:找不到JKS
如果我未指定提供程序,则将使用Sun提供程序创建KeyStore keystore.aliases()并将包含EmptyEnumeration。
正如我在本主题中看到的那样,BouncyCastle可以与JKS合作
如何通过BouncyCastle阅读JKS?
我有一个按人返回帐户计数的查询
SELECT p.id, COUNT(a.id) accounts
FROM Person p
LEFT JOIN Account a
ON a.person_id = p.id
WHERE p.id = 1
GROUP BY p.id;
Run Code Online (Sandbox Code Playgroud)
它可以找到。如果该人有两个帐户,则返回 2。但我还需要获得活跃帐户数。我尝试这样做:
SELECT p.id, COUNT(a.id) accounts, COUNT(a1.id) active_accounts
FROM Person p
LEFT JOIN Account a
ON a.person_id = p.id
LEFT JOIN Account a1
ON a1.person_id = p.id AND a1.state = '0'
WHERE p.id = 1
GROUP BY p.id;
Run Code Online (Sandbox Code Playgroud)
但此查询返回帐户 4,而不是 2。我该如何修复此查询?
java ×5
group-by ×2
left-join ×2
sql ×2
angularjs ×1
bouncycastle ×1
gradle ×1
h2 ×1
javascript ×1
jconsole ×1
jetty ×1
keystore ×1
oracle ×1
servlet-3.0 ×1
spring-boot ×1
types ×1
ubuntu-14.04 ×1
virtualbox ×1