我正在尝试使用Angular 1.5.0-beta.0我安装的npm.
根据一些指南 - 我们现在可以创建一个使用module.component而不是旧时尚的组件module.directive.
这是组件代码:
export default angular.module('app.components.header', [])
.component('dashboardHeader', {
controller: 'HeaderCtrl as headerCtrl',
template: `This is test.`
})
;
Run Code Online (Sandbox Code Playgroud)
我的HTML是:
<body>
<dashboard-header></dashboard-header>
<div ui-view="content">
</body>
Run Code Online (Sandbox Code Playgroud)
我越来越:
angular.module(...).component is not a function
Run Code Online (Sandbox Code Playgroud)
可能是什么问题呢?
我正在使用Travis-CI构建我的Go项目,到目前为止,我使用gimmetravis go环境的组合脚本来交叉编译项目.
我切换到支持GOOS和GOARCH环境变量的Go 1.5 交叉编译器,而不需要其他编译器或脚本.
我的问题是我正在使用Bintray部署,我的环境变量在部署阶段没有公开.
language: go
go:
- 1.5
env:
matrix:
- GOOS=windows GOARCH=amd64
- GOOS=linux GOARCH=amd64
- GOOS=linux GOARCH=386
- GOOS=darwin GOARCH=amd64
before_script:
- go get -d -v ./...
script:
- go build -v ./...
before_deploy:
- chmod +x ./prepare_bintray_deployment.sh
- "./prepare_bintray_deployment.sh"
deploy:
file: bintray_descriptors/${GOOS}_${GOARCH}.json
provider: bintray
Run Code Online (Sandbox Code Playgroud)
需要注意的是这种变化之前,我用的是GIMME_OS和GIMME_ARCH环境变量和它工作得很好,这让我相信,特拉维斯不支持这一点.
可能是什么问题呢?
我最近尝试将我的 Jersey 应用程序从在 Glassfish 4.1 上运行转移到在 Tomcat 8 上运行。
应用在tomcat上部署成功:
2015 年 8 月 3 日 18:42:07.982 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Web 应用程序存档部署 /Users/shikloshi/Installed/apache-tomcat-8.0.24/webapps /lit-2.war 已在 1,763 毫秒内完成
但是当向服务器创建请求时,它会导致此堆栈跟踪:
java.lang.NoSuchMethodError: org.glassfish.hk2.utilities.reflection.ReflectionHelper.getFirstTypeArgument(Ljava/lang/reflect/Type;)Ljava/lang/reflect/Type;
org.jvnet.hk2.internal.Utilities.getInjectionResolverType(Utilities.java:497)
org.jvnet.hk2.internal.ServiceLocatorImpl.checkConfiguration(ServiceLocatorImpl.java:1589)
org.jvnet.hk2.internal.ServiceLocatorImpl.addConfiguration(ServiceLocatorImpl.java:1964)
org.jvnet.hk2.internal.DynamicConfigurationImpl.commit(DynamicConfigurationImpl.java:245)
org.jvnet.hk2.external.generator.ServiceLocatorGeneratorImpl.initialize(ServiceLocatorGeneratorImpl.java:88)
org.jvnet.hk2.external.generator.ServiceLocatorGeneratorImpl.create(ServiceLocatorGeneratorImpl.java:98)
org.glassfish.hk2.internal.ServiceLocatorFactoryImpl.internalCreate(ServiceLocatorFactoryImpl.java:270)
org.glassfish.hk2.internal.ServiceLocatorFactoryImpl.create(ServiceLocatorFactoryImpl.java:230)
org.glassfish.jersey.internal.inject.Injections._createLocator(Injections.java:138)
org.glassfish.jersey.internal.inject.Injections.createLocator(Injections.java:123)
org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:308)
org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:336)
org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:170)
org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:358)
javax.servlet.GenericServlet.init(GenericServlet.java:158)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1527)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1484)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745)
我的 web.xml 看起来像这样:
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" version="2.5"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>lit-servlet</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.lit.providers.application.LitApplication</param-value>
</init-param> …Run Code Online (Sandbox Code Playgroud) 我正在使用go 1.5,我正在像这里指定的那样进行交叉编译.
问题是,在编译项目时,它将覆盖最后一次编译创建的二进制文件.而且 - 我永远不会知道我正在运行的可执行文件被编译到哪个OS/ARCH(在任何情况下都不是windows).
有没有办法在编译命令重命名文件?
我正在做一些工作,Elasticsearch查询返回一个Source对象,它的类型是*json.RawMessage。
我只想将它打印到屏幕上而不为它创建结构模型并执行明显的json.Marshal.
是否有使用 *json.RawMessage 类型并将其打印到屏幕的打印功能?
代码示例:
for _, hit := range serachResult.Hits.Hits {
fmt.Println(hit.Source, "\n")
}
Run Code Online (Sandbox Code Playgroud)
此代码运行将导致无法读取的字节数组,显然无法string仅从原始消息构建一个。
我正在尝试在我的ES6项目中使用JSDoc,我正在返回一个Map:
/**
* Some documentation..
*
* @returns {undefined} <- This should be replaced
*/
function returningMap() {
const someMap = new Map();
someMap.set("key", {a, b, c});
return someMap;
}
Run Code Online (Sandbox Code Playgroud)
我该如何记录@returns?
没有很好的答案在这里.
我正在运行非常简单的 Spring Boot 应用程序:
\n@SpringBootApplication\npublic class Application {\n\n public static void main(String[] args) {\n SpringApplication.run(Application.class, args);\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n我有一个简单的过滤器:
\n@Component\npublic class MyFilter implements Filter {\n\n @Override\n public void init(FilterConfig filterConfig) throws ServletException {\n // This is getting called ! \n }\n\n @Override\n public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {\n // some logic\n filterChain.doFilter(request, response);\n }\n\n @Override\n public void destroy() {\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n我有一个返回索引页的控制器:
\n@Controller\npublic class HomeController {\n\n @RequestMapping("/")\n public String index() {\n …Run Code Online (Sandbox Code Playgroud) 我试图在onClick事件发生后清除我的输入字段。
我正在使用react-bootstrap库,虽然有getValue()方法,但没有setValue(value)方法。
我偶然发现了这个讨论。
为了在提交后简单地清理表单,我不完全理解他们的建议。
毕竟,如果我使用简单的 HTML<input>而不是react-bootstrap我可以通过元素获取节点ref并将其值设置为空字符串或其他东西。
什么被认为是清理 react-bootstrap<Input />元素的反应方式?
一个小而有趣的问题(对我来说):
我正在尝试从我编写的小型服务器(nodejs + express)创建 docker 映像。我的服务器代码是:
var express = require('express');
var Inflector = require('inflected');
var colors = require('colors');
var app = express();
app.get('/hello/:name', function(req, res, next){
var name = Inflector.titleize(req.params.name);
console.log("Saying hello to " + name.yellow);
res.send('Hello ' + name);
});
var port = 9090;
app.listen(port, function(){
console.log(('App is running on port ' + port).inverse);
});
Run Code Online (Sandbox Code Playgroud)
我正在用这个 Dockerfile 创建我的图像:
FROM centos:centos6
RUN rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
RUN yum install -y npm
COPY . /src
RUN cd /src; npm install
EXPOSE 9090 …Run Code Online (Sandbox Code Playgroud) 我使用java 8,并tomcat 7与maven 3.3.9使用Maven Tomcat插件:
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>8085</port>
</configuration>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
有一段时间,一切都很好,tomcat7:run-war工作得很好.
现在我没有明显的理由得到这个错误:
[INFO] --- tomcat7-maven-plugin:2.2:run-war (default-cli) @ tomcat-example ---
[INFO] Running war on http://localhost:8085/tomcat-example
[INFO] Using existing Tomcat server configuration at /Users/shikloshi/java_workspace/webapp-examples/tomcat-example/target/tomcat
[INFO] create webapp with contextPath: /tomcat-example
Jul 04, 2016 2:30:45 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8085"]
Jul 04, 2016 2:30:45 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Jul 04, 2016 2:30:45 PM …Run Code Online (Sandbox Code Playgroud)